jobSkills.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  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">岗位职业技能</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" :key="ind">
  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. let set = 0
  82. export default {
  83. data() {
  84. return {
  85. jobTitle: '亚马逊运营总监',
  86. showAddTag: false,
  87. newTagName: '',
  88. selectedOperation: [],
  89. customTags: [],
  90. operationOptions: []
  91. }
  92. },
  93. onLoad(options) {
  94. if (options && options.jobTitle) {
  95. this.jobTitle = decodeURIComponent(options.jobTitle)
  96. }
  97. if (options && options.skill) {
  98. this.selectedOperation = JSON.parse(decodeURIComponent(options.skill))
  99. }
  100. this.getData()
  101. set = options && options.set ? options.set : 0
  102. },
  103. methods: {
  104. goBack() {
  105. uni.navigateBack()
  106. },
  107. getData() {
  108. const data = {}
  109. this.$Request.getT('/app/userFirst/getPostSkill', data).then(res => {
  110. if (res.code === 0) {
  111. this.operationOptions = res.data
  112. }
  113. })
  114. },
  115. toggleOperation(item) {
  116. const index = this.selectedOperation.indexOf(item)
  117. if (index > -1) {
  118. this.selectedOperation.splice(index, 1)
  119. } else {
  120. if (this.selectedOperation.length < 8) {
  121. this.selectedOperation.push(item)
  122. } else {
  123. uni.showToast({
  124. title: '最多选择8个标签',
  125. icon: 'none'
  126. })
  127. }
  128. }
  129. },
  130. showAddTagModal() {
  131. this.showAddTag = true
  132. this.newTagName = ''
  133. },
  134. cancelAddTag() {
  135. this.showAddTag = false
  136. this.newTagName = ''
  137. },
  138. addCustomTag() {
  139. if (this.newTagName.trim()) {
  140. if (this.customTags.length < 5) {
  141. if (this.customTags.length + this.selectedOperation.length >= 8) {
  142. return uni.showToast({
  143. title: '最多选择8个标签',
  144. icon: 'none'
  145. })
  146. }
  147. this.customTags.push(this.newTagName.trim())
  148. this.showAddTag = false
  149. this.newTagName = ''
  150. } else {
  151. uni.showToast({
  152. title: '最多添加5个自定义标签',
  153. icon: 'none'
  154. })
  155. }
  156. } else {
  157. uni.showToast({
  158. title: '请输入标签名称',
  159. icon: 'none'
  160. })
  161. }
  162. },
  163. removeCustomTag(index) {
  164. this.customTags.splice(index, 1)
  165. },
  166. confirmSelection() {
  167. // 合并选择的标签和自定义标签并回传
  168. const allSelectedTags = [...this.selectedOperation, ...this.customTags]
  169. // 触发事件通知上一页面
  170. uni.$emit('skillsUpdated', {
  171. jobTitle: this.jobTitle,
  172. selectedTags: allSelectedTags, // 所有选中的标签(含系统和自定义)
  173. systemTags: this.selectedOperation, // 系统标签
  174. customTags: this.customTags, // 自定义标签
  175. set
  176. })
  177. uni.navigateBack({
  178. delta: 1
  179. })
  180. }
  181. }
  182. }
  183. </script>
  184. <style lang="scss" scoped>
  185. .job-skills {
  186. min-height: 100vh;
  187. background: #fff;
  188. display: flex;
  189. flex-direction: column;
  190. padding: 88rpx 40rpx 40rpx 40rpx;
  191. }
  192. .navbar-content {
  193. display: flex;
  194. align-items: center;
  195. justify-content: space-between;
  196. height: 88rpx;
  197. }
  198. .nav-left, .nav-right {
  199. width: 60rpx;
  200. height: 60rpx;
  201. display: flex;
  202. align-items: center;
  203. justify-content: center;
  204. }
  205. .nav-title {
  206. color: rgba(51, 51, 51, 1);
  207. font-family: DM Sans;
  208. font-size: 36rpx;
  209. font-weight: 700;
  210. line-height: 26px;
  211. letter-spacing: 0px;
  212. text-align: center;
  213. }
  214. .main-content {
  215. margin-top: 20rpx;
  216. }
  217. .job-title {
  218. color: rgba(51, 51, 51, 1);
  219. font-family: DM Sans;
  220. font-size: 52rpx;
  221. font-weight: 700;
  222. line-height: 30px;
  223. letter-spacing: 0px;
  224. text-align: left;
  225. margin-bottom: 30rpx;
  226. }
  227. .description {
  228. margin: 20rpx 0 40rpx 0;
  229. color: rgba(102, 102, 102, 1);
  230. font-family: DM Sans;
  231. font-size: 28rpx;
  232. font-weight: 400;
  233. letter-spacing: 0px;
  234. text-align: left;
  235. line-height: 1.5;
  236. }
  237. .skills-section {
  238. margin-bottom: 50rpx;
  239. }
  240. .section-title {
  241. color: rgba(34, 37, 42, 1);
  242. font-family: DM Sans;
  243. font-size: 36rpx;
  244. font-weight: 500;
  245. line-height: 24px;
  246. letter-spacing: 0px;
  247. text-align: left;
  248. margin-bottom: 24rpx;
  249. padding-left: 4rpx;
  250. }
  251. .skills-grid {
  252. display: flex;
  253. flex-wrap: wrap;
  254. gap: 20rpx;
  255. }
  256. .skill-tag {
  257. padding: 16rpx 24rpx;
  258. background: #F7F8FA;
  259. border: 1rpx solid #E5E5EA;
  260. border-radius: 16rpx;
  261. transition: all 0.2s ease;
  262. display: flex;
  263. align-items: center;
  264. justify-content: center;
  265. cursor: pointer;
  266. text {
  267. font-size: 26rpx;
  268. color: rgba(102, 102, 102, 1);
  269. font-weight: 400;
  270. text-align: center;
  271. line-height: 1.2;
  272. }
  273. &:hover {
  274. background: rgba(153, 196, 250, 0.2);
  275. border-color: rgba(1, 107, 246, 0.3);
  276. }
  277. &.active {
  278. background: rgba(1, 107, 246, 0.1);
  279. border: 1rpx solid rgba(1, 107, 246, 1);
  280. box-shadow: 0 4rpx 12rpx rgba(1, 107, 246, 0.15);
  281. text {
  282. color: rgba(1, 107, 246, 1);
  283. font-weight: 500;
  284. }
  285. }
  286. &:active {
  287. transform: scale(0.96);
  288. }
  289. }
  290. .custom-tags {
  291. display: flex;
  292. flex-wrap: wrap;
  293. gap: 20rpx;
  294. }
  295. .custom-tag {
  296. padding: 14rpx 20rpx;
  297. background: rgba(153, 196, 250, 0.4);
  298. border: 1rpx solid rgba(1, 107, 246, 1);
  299. border-radius: 16rpx;
  300. display: flex;
  301. align-items: center;
  302. gap: 10rpx;
  303. cursor: pointer;
  304. transition: all 0.2s ease;
  305. text {
  306. font-size: 24rpx;
  307. color: rgba(1, 107, 246, 1);
  308. font-weight: 400;
  309. }
  310. &:hover {
  311. background: rgba(153, 196, 250, 0.6);
  312. }
  313. &:active {
  314. transform: scale(0.96);
  315. }
  316. }
  317. .add-tag {
  318. padding: 14rpx 20rpx;
  319. background: #F7F8FA;
  320. border: 1rpx dashed #E5E5EA;
  321. border-radius: 16rpx;
  322. display: flex;
  323. align-items: center;
  324. gap: 10rpx;
  325. cursor: pointer;
  326. transition: all 0.2s ease;
  327. text {
  328. font-size: 24rpx;
  329. color: rgba(102, 102, 102, 1);
  330. font-weight: 400;
  331. }
  332. &:hover {
  333. background: #f0f0f0;
  334. border-color: #d9d9d9;
  335. }
  336. &:active {
  337. transform: scale(0.96);
  338. }
  339. }
  340. .bottom-btn-container {
  341. position: fixed;
  342. bottom: 0;
  343. left: 0;
  344. right: 0;
  345. padding: 32rpx;
  346. background: #fff;
  347. border-top: 1rpx solid #f0f0f0;
  348. z-index: 10;
  349. }
  350. .confirm-btn {
  351. width: 100%;
  352. height: 96rpx;
  353. background: linear-gradient(90deg, #007AFF 0%, #2DB0F0 100%);
  354. border-radius: 48rpx;
  355. display: flex;
  356. align-items: center;
  357. justify-content: center;
  358. box-shadow: 0 6rpx 16rpx rgba(0, 122, 255, 0.2);
  359. transition: all 0.2s ease;
  360. cursor: pointer;
  361. text {
  362. font-size: 34rpx;
  363. font-weight: 600;
  364. color: #fff;
  365. }
  366. &:active {
  367. background: linear-gradient(90deg, #0056CC 0%, #4A9FE7 100%);
  368. transform: scale(0.98);
  369. box-shadow: 0 4rpx 12rpx rgba(0, 122, 255, 0.15);
  370. }
  371. }
  372. // 添加标签弹窗样式
  373. .add-tag-popup {
  374. background: #fff;
  375. border-radius: 24rpx;
  376. padding: 48rpx 40rpx;
  377. width: 100%;
  378. .popup-title {
  379. color: rgba(34, 37, 42, 1);
  380. font-family: DM Sans;
  381. font-size: 36rpx;
  382. font-weight: 500;
  383. line-height: 24px;
  384. text-align: center;
  385. margin-bottom: 36rpx;
  386. }
  387. .popup-content {
  388. margin-bottom: 40rpx;
  389. .tag-input {
  390. width: 100%;
  391. height: 90rpx;
  392. padding: 0 24rpx;
  393. border: 1rpx solid #E5E5EA;
  394. border-radius: 16rpx;
  395. font-size: 28rpx;
  396. color: rgba(34, 37, 42, 1);
  397. background: #F7F8FA;
  398. box-sizing: border-box;
  399. }
  400. .tag-input::placeholder {
  401. color: #C9CDD4;
  402. }
  403. }
  404. .popup-buttons {
  405. display: flex;
  406. gap: 24rpx;
  407. .popup-btn {
  408. flex: 1;
  409. height: 88rpx;
  410. border-radius: 16rpx;
  411. display: flex;
  412. align-items: center;
  413. justify-content: center;
  414. font-size: 30rpx;
  415. font-weight: 500;
  416. transition: all 0.2s ease;
  417. cursor: pointer;
  418. }
  419. .cancel-btn {
  420. background: #F7F8FA;
  421. color: rgba(102, 102, 102, 1);
  422. &:active {
  423. background: #eaeaea;
  424. }
  425. }
  426. .confirm-btn {
  427. background: #007AFF;
  428. color: #fff;
  429. &:active {
  430. background: #0056CC;
  431. }
  432. }
  433. }
  434. }
  435. </style>