jobSkills.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. <template>
  2. <view class="job-skills">
  3. <!-- 自定义导航栏 -->
  4. <view class="custom-navbar">
  5. <view class="navbar-content">
  6. <view class="nav-left" @click="goBack">
  7. <u-icon name="close" color="#333" size="32"></u-icon>
  8. </view>
  9. <view class="nav-title">{{this.jobId==0||this.jobId==''?'我的':'岗位'}}职业技能</view>
  10. <view class="nav-right"></view>
  11. </view>
  12. </view>
  13. <!-- 主要内容 -->
  14. <view class="main-content">
  15. <view class="job-title">{{ jobTitle }}-职业技能</view>
  16. <view class="description">根据你的偏好设置,为你推荐更匹配的职位,最多选择8个</view>
  17. <!-- 运营方向 -->
  18. <view class="skills-section" v-for="(it, ind) in operationOptions" >
  19. <view class="section-title">{{it.postSkillName}}</view>
  20. <!-- 技能标签网格 -->
  21. <view class="skills-grid">
  22. <view
  23. v-for="(item, index) in it.childrenList"
  24. :key="index"
  25. class="skill-tag"
  26. :class="{ active: selectedOperation.includes(item.postSkillName) }"
  27. @click="toggleOperation(item.postSkillName)"
  28. >
  29. <text>{{ item.postSkillName }}</text>
  30. </view>
  31. </view>
  32. </view>
  33. <!-- 自定义标签 -->
  34. <view class="skills-section">
  35. <view class="section-title">自定义标签</view>
  36. <!-- 自定义标签区域 -->
  37. <view class="custom-tags">
  38. <view
  39. v-for="(item, index) in customTags"
  40. :key="index"
  41. class="custom-tag"
  42. @click="removeCustomTag(index)"
  43. >
  44. <text>{{ item }}</text>
  45. <u-icon name="close" color="#007AFF" size="18"></u-icon>
  46. </view>
  47. <view class="add-tag" @click="showAddTagModal">
  48. <text>添加标签</text>
  49. <u-icon name="plus" color="#333" size="18"></u-icon>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <!-- 底部确定按钮 -->
  55. <view class="bottom-btn-container">
  56. <view class="confirm-btn" @click="confirmSelection">
  57. <text>确定</text>
  58. </view>
  59. </view>
  60. <!-- 添加标签弹窗 -->
  61. <u-popup v-model="showAddTag" mode="center" border-radius="24" width="80%">
  62. <view class="add-tag-popup">
  63. <view class="popup-title">添加自定义标签</view>
  64. <view class="popup-content">
  65. <input
  66. v-model="newTagName"
  67. placeholder="请输入标签名称"
  68. class="tag-input"
  69. maxlength="10"
  70. />
  71. </view>
  72. <view class="popup-buttons">
  73. <view class="popup-btn cancel-btn" @click="cancelAddTag">取消</view>
  74. <view class="popup-btn confirm-btn" @click="addCustomTag">确定</view>
  75. </view>
  76. </view>
  77. </u-popup>
  78. </view>
  79. </template>
  80. <script>
  81. var set=0
  82. export default {
  83. data() {
  84. return {
  85. jobTitle: '亚马逊运营总监',
  86. jobId:'',
  87. showAddTag: false,
  88. newTagName: '',
  89. selectedOperation: [],
  90. customTags: [],
  91. operationOptions: [
  92. ]
  93. }
  94. },
  95. onLoad(options) {
  96. if (options&&options.jobTitle) {
  97. this.jobTitle = decodeURIComponent(options.jobTitle)
  98. }
  99. if (options&&options.jobId) {
  100. this.jobId = options.jobId
  101. }
  102. if(options&&options.skill)
  103. this.selectedOperation = JSON.parse(decodeURIComponent(options.skill))
  104. this.getData()
  105. set=options&&options.set?options.set:0
  106. },
  107. methods: {
  108. goBack() {
  109. uni.navigateBack()
  110. },
  111. getData(){
  112. let data = {
  113. ruleClassifyId:this.jobId
  114. }
  115. var action=this.jobId==''||this.jobId==0?'/app/userFirst/selectSkill':'/app/userFirst/getPostSkill'
  116. this.$Request.getT(action,data).then(res => {
  117. if(res.code==0){
  118. if(this.jobId==''||this.jobId==0){
  119. res.data.forEach(function(item){
  120. item.postSkillName=item.skillName
  121. })
  122. this.operationOptions =[{childrenList:res.data,postSkillName:''}]
  123. }else
  124. this.operationOptions = res.data
  125. }
  126. })
  127. },
  128. toggleOperation(item) {
  129. const index = this.selectedOperation.indexOf(item)
  130. if (index > -1) {
  131. this.selectedOperation.splice(index, 1)
  132. } else {
  133. if (this.selectedOperation.length < 8) {
  134. this.selectedOperation.push(item)
  135. } else {
  136. uni.showToast({
  137. title: '最多选择8个标签',
  138. icon: 'none'
  139. })
  140. }
  141. }
  142. },
  143. showAddTagModal() {
  144. this.showAddTag = true
  145. this.newTagName = ''
  146. },
  147. cancelAddTag() {
  148. this.showAddTag = false
  149. this.newTagName = ''
  150. },
  151. addCustomTag() {
  152. if (this.newTagName.trim()) {
  153. if (this.customTags.length < 5) {
  154. if(this.customTags.length+this.selectedOperation.length>=8)
  155. return uni.showToast({title: '最多选择8个标签',icon: 'none'})
  156. this.customTags.push(this.newTagName.trim())
  157. this.showAddTag = false
  158. this.newTagName = ''
  159. } else {
  160. uni.showToast({
  161. title: '最多添加5个自定义标签',
  162. icon: 'none'
  163. })
  164. }
  165. } else {
  166. uni.showToast({
  167. title: '请输入标签名称',
  168. icon: 'none'
  169. })
  170. }
  171. },
  172. removeCustomTag(index) {
  173. this.customTags.splice(index, 1)
  174. },
  175. confirmSelection() {
  176. // 返回选中的技能设置
  177. // 通知父页面更新技能设置
  178. uni.$emit('skillsUpdated', {
  179. jobTitle: this.jobTitle,
  180. operation: this.selectedOperation,
  181. skills: this.selectedOperation.concat(this.customTags),
  182. customTags: this.customTags,
  183. set
  184. })
  185. /* uni.showToast({
  186. title: '技能设置已保存',
  187. icon: 'success'
  188. }) */
  189. uni.navigateBack({
  190. delta: 1
  191. })
  192. }
  193. }
  194. }
  195. </script>
  196. <style lang="scss" scoped>
  197. .job-skills {
  198. min-height: 100vh;
  199. background: #fff;
  200. display: flex;
  201. flex-direction: column;
  202. padding: 88rpx 40rpx 40rpx 40rpx;
  203. }
  204. .navbar-content {
  205. display: flex;
  206. align-items: center;
  207. justify-content: space-between;
  208. height: 88rpx;
  209. }
  210. .nav-left, .nav-right {
  211. width: 60rpx;
  212. height: 60rpx;
  213. display: flex;
  214. align-items: center;
  215. justify-content: center;
  216. }
  217. .nav-title {
  218. color: rgba(51, 51, 51, 1);
  219. font-family: DM Sans;
  220. font-size: 36rpx;
  221. font-weight: 700;
  222. line-height: 26px;
  223. letter-spacing: 0px;
  224. text-align: center;
  225. }
  226. .main-content {
  227. margin-top: 20rpx;
  228. }
  229. .job-title {
  230. color: rgba(51, 51, 51, 1);
  231. font-family: DM Sans;
  232. font-size: 52rpx;
  233. font-weight: 700;
  234. line-height: 30px;
  235. letter-spacing: 0px;
  236. text-align: left;
  237. }
  238. .description {
  239. margin: 20rpx 0;
  240. color: rgba(102, 102, 102, 1);
  241. font-family: DM Sans;
  242. font-size: 28rpx;
  243. font-weight: 400;
  244. letter-spacing: 0px;
  245. text-align: left;
  246. }
  247. .skills-section {
  248. margin-bottom: 40rpx;
  249. }
  250. .section-title {
  251. color: rgba(34, 37, 42, 1);
  252. font-family: DM Sans;
  253. font-size: 36rpx;
  254. font-weight: 400;
  255. line-height: 24px;
  256. letter-spacing: 0px;
  257. text-align: left;
  258. margin-bottom: 20rpx;
  259. }
  260. .skills-grid {
  261. display: flex;
  262. flex-wrap: wrap;
  263. gap: 12rpx;
  264. }
  265. .skill-tag {
  266. width: fit-content;//calc((100% - 72rpx) / 6)
  267. padding: 10rpx 12rpx;
  268. background: #F7F8FA;
  269. border: 1rpx solid #F7F8FA;
  270. border-radius: 12rpx;
  271. transition: all 0.3s ease;
  272. display: flex;
  273. align-items: center;
  274. justify-content: center;
  275. text {
  276. font-size: 20rpx;
  277. color: rgba(102, 102, 102, 1);
  278. font-weight: 400;
  279. text-align: center;
  280. line-height: 1.2;
  281. }
  282. &.active {
  283. background: rgba(153, 196, 250, 0.4);
  284. border: 0.5px solid rgba(1, 107, 246, 1);
  285. text {
  286. color: rgba(1, 107, 246, 1);
  287. font-weight: 400;
  288. }
  289. }
  290. &:active {
  291. transform: scale(0.95);
  292. }
  293. }
  294. .custom-tags {
  295. display: flex;
  296. flex-wrap: wrap;
  297. gap: 12rpx;
  298. }
  299. .custom-tag {
  300. padding: 8rpx 12rpx;
  301. background: rgba(153, 196, 250, 0.4);
  302. border: 0.5px solid rgba(1, 107, 246, 1);
  303. border-radius: 12rpx;
  304. display: flex;
  305. align-items: center;
  306. gap: 8rpx;
  307. text {
  308. font-size: 18rpx;
  309. color: rgba(1, 107, 246, 1);
  310. font-weight: 400;
  311. }
  312. }
  313. .add-tag {
  314. padding: 8rpx 12rpx;
  315. background: #F7F8FA;
  316. border: 1rpx solid #F7F8FA;
  317. border-radius: 12rpx;
  318. display: flex;
  319. align-items: center;
  320. gap: 8rpx;
  321. text {
  322. font-size: 18rpx;
  323. color: rgba(102, 102, 102, 1);
  324. font-weight: 400;
  325. }
  326. }
  327. .bottom-btn-container {
  328. position: fixed;
  329. bottom: 0;
  330. left: 0;
  331. right: 0;
  332. padding: 32rpx;
  333. background: #fff;
  334. border-top: 1px solid #f0f0f0;
  335. }
  336. .confirm-btn {
  337. width: 100%;
  338. height: 88rpx;
  339. background: linear-gradient(90deg, #007AFF 0%, #5AC8FA 100%);
  340. border-radius: 44rpx;
  341. display: flex;
  342. align-items: center;
  343. justify-content: center;
  344. text {
  345. font-size: 32rpx;
  346. font-weight: 600;
  347. color: #fff;
  348. }
  349. &:active {
  350. background: linear-gradient(90deg, #0056CC 0%, #4A9FE7 100%);
  351. }
  352. }
  353. // 添加标签弹窗样式
  354. .add-tag-popup {
  355. background: #fff;
  356. border-radius: 24rpx;
  357. padding: 40rpx;
  358. .popup-title {
  359. color: rgba(34, 37, 42, 1);
  360. font-family: DM Sans;
  361. font-size: 36rpx;
  362. font-weight: 500;
  363. line-height: 24px;
  364. text-align: center;
  365. margin-bottom: 30rpx;
  366. }
  367. .popup-content {
  368. margin-bottom: 30rpx;
  369. .tag-input {
  370. width: 100%;
  371. height: 80rpx;
  372. padding: 0 20rpx;
  373. border: 1rpx solid #E5E5EA;
  374. border-radius: 12rpx;
  375. font-size: 28rpx;
  376. color: rgba(34, 37, 42, 1);
  377. background: #F7F8FA;
  378. }
  379. }
  380. .popup-buttons {
  381. display: flex;
  382. gap: 20rpx;
  383. .popup-btn {
  384. flex: 1;
  385. height: 80rpx;
  386. border-radius: 12rpx;
  387. display: flex;
  388. align-items: center;
  389. justify-content: center;
  390. font-size: 28rpx;
  391. font-weight: 500;
  392. }
  393. .cancel-btn {
  394. background: #F7F8FA;
  395. color: rgba(102, 102, 102, 1);
  396. }
  397. .confirm-btn {
  398. background: #007AFF;
  399. color: #fff;
  400. }
  401. }
  402. }
  403. </style>