jobSkills.vue 11 KB

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