jobSkills.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  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" >
  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. showAddTag: false,
  87. newTagName: '',
  88. selectedOperation: [],
  89. customTags: [],
  90. operationOptions: [
  91. ]
  92. }
  93. },
  94. onLoad(options) {
  95. if (options&&options.jobTitle) {
  96. this.jobTitle = decodeURIComponent(options.jobTitle)
  97. }
  98. if(options&&options.skill)
  99. this.selectedOperation = JSON.parse(decodeURIComponent(options.skill))
  100. this.getData()
  101. set=options&&options.set?options.set:0
  102. },
  103. methods: {
  104. goBack() {
  105. uni.navigateBack()
  106. },
  107. getData(){
  108. let data = {
  109. }
  110. this.$Request.getT('/app/userFirst/getPostSkill',data).then(res => {
  111. if(res.code==0){
  112. this.operationOptions = res.data
  113. }
  114. })
  115. },
  116. toggleOperation(item) {
  117. const index = this.selectedOperation.indexOf(item)
  118. if (index > -1) {
  119. this.selectedOperation.splice(index, 1)
  120. } else {
  121. if (this.selectedOperation.length < 8) {
  122. this.selectedOperation.push(item)
  123. } else {
  124. uni.showToast({
  125. title: '最多选择8个标签',
  126. icon: 'none'
  127. })
  128. }
  129. }
  130. },
  131. showAddTagModal() {
  132. this.showAddTag = true
  133. this.newTagName = ''
  134. },
  135. cancelAddTag() {
  136. this.showAddTag = false
  137. this.newTagName = ''
  138. },
  139. addCustomTag() {
  140. if (this.newTagName.trim()) {
  141. if (this.customTags.length < 5) {
  142. if(this.customTags.length+this.selectedOperation.length>=8)
  143. return uni.showToast({title: '最多选择8个标签',icon: 'none'})
  144. this.customTags.push(this.newTagName.trim())
  145. this.showAddTag = false
  146. this.newTagName = ''
  147. } else {
  148. uni.showToast({
  149. title: '最多添加5个自定义标签',
  150. icon: 'none'
  151. })
  152. }
  153. } else {
  154. uni.showToast({
  155. title: '请输入标签名称',
  156. icon: 'none'
  157. })
  158. }
  159. },
  160. removeCustomTag(index) {
  161. this.customTags.splice(index, 1)
  162. },
  163. confirmSelection() {
  164. // 返回选中的技能设置
  165. // 通知父页面更新技能设置
  166. uni.$emit('skillsUpdated', {
  167. jobTitle: this.jobTitle,
  168. operation: this.selectedOperation,
  169. skills: this.selectedOperation.concat(this.customTags),
  170. customTags: this.customTags,
  171. set
  172. })
  173. /* uni.showToast({
  174. title: '技能设置已保存',
  175. icon: 'success'
  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. }
  226. .description {
  227. margin: 20rpx 0;
  228. color: rgba(102, 102, 102, 1);
  229. font-family: DM Sans;
  230. font-size: 28rpx;
  231. font-weight: 400;
  232. letter-spacing: 0px;
  233. text-align: left;
  234. }
  235. .skills-section {
  236. margin-bottom: 40rpx;
  237. }
  238. .section-title {
  239. color: rgba(34, 37, 42, 1);
  240. font-family: DM Sans;
  241. font-size: 36rpx;
  242. font-weight: 400;
  243. line-height: 24px;
  244. letter-spacing: 0px;
  245. text-align: left;
  246. margin-bottom: 20rpx;
  247. }
  248. .skills-grid {
  249. display: flex;
  250. flex-wrap: wrap;
  251. gap: 12rpx;
  252. }
  253. .skill-tag {
  254. width: fit-content;//calc((100% - 72rpx) / 6)
  255. padding: 10rpx 12rpx;
  256. background: #F7F8FA;
  257. border: 1rpx solid #F7F8FA;
  258. border-radius: 12rpx;
  259. transition: all 0.3s ease;
  260. display: flex;
  261. align-items: center;
  262. justify-content: center;
  263. text {
  264. font-size: 20rpx;
  265. color: rgba(102, 102, 102, 1);
  266. font-weight: 400;
  267. text-align: center;
  268. line-height: 1.2;
  269. }
  270. &.active {
  271. background: rgba(153, 196, 250, 0.4);
  272. border: 0.5px solid rgba(1, 107, 246, 1);
  273. text {
  274. color: rgba(1, 107, 246, 1);
  275. font-weight: 400;
  276. }
  277. }
  278. &:active {
  279. transform: scale(0.95);
  280. }
  281. }
  282. .custom-tags {
  283. display: flex;
  284. flex-wrap: wrap;
  285. gap: 12rpx;
  286. }
  287. .custom-tag {
  288. padding: 8rpx 12rpx;
  289. background: rgba(153, 196, 250, 0.4);
  290. border: 0.5px solid rgba(1, 107, 246, 1);
  291. border-radius: 12rpx;
  292. display: flex;
  293. align-items: center;
  294. gap: 8rpx;
  295. text {
  296. font-size: 18rpx;
  297. color: rgba(1, 107, 246, 1);
  298. font-weight: 400;
  299. }
  300. }
  301. .add-tag {
  302. padding: 8rpx 12rpx;
  303. background: #F7F8FA;
  304. border: 1rpx solid #F7F8FA;
  305. border-radius: 12rpx;
  306. display: flex;
  307. align-items: center;
  308. gap: 8rpx;
  309. text {
  310. font-size: 18rpx;
  311. color: rgba(102, 102, 102, 1);
  312. font-weight: 400;
  313. }
  314. }
  315. .bottom-btn-container {
  316. position: fixed;
  317. bottom: 0;
  318. left: 0;
  319. right: 0;
  320. padding: 32rpx;
  321. background: #fff;
  322. border-top: 1px solid #f0f0f0;
  323. }
  324. .confirm-btn {
  325. width: 100%;
  326. height: 88rpx;
  327. background: linear-gradient(90deg, #007AFF 0%, #5AC8FA 100%);
  328. border-radius: 44rpx;
  329. display: flex;
  330. align-items: center;
  331. justify-content: center;
  332. text {
  333. font-size: 32rpx;
  334. font-weight: 600;
  335. color: #fff;
  336. }
  337. &:active {
  338. background: linear-gradient(90deg, #0056CC 0%, #4A9FE7 100%);
  339. }
  340. }
  341. // 添加标签弹窗样式
  342. .add-tag-popup {
  343. background: #fff;
  344. border-radius: 24rpx;
  345. padding: 40rpx;
  346. .popup-title {
  347. color: rgba(34, 37, 42, 1);
  348. font-family: DM Sans;
  349. font-size: 36rpx;
  350. font-weight: 500;
  351. line-height: 24px;
  352. text-align: center;
  353. margin-bottom: 30rpx;
  354. }
  355. .popup-content {
  356. margin-bottom: 30rpx;
  357. .tag-input {
  358. width: 100%;
  359. height: 80rpx;
  360. padding: 0 20rpx;
  361. border: 1rpx solid #E5E5EA;
  362. border-radius: 12rpx;
  363. font-size: 28rpx;
  364. color: rgba(34, 37, 42, 1);
  365. background: #F7F8FA;
  366. }
  367. }
  368. .popup-buttons {
  369. display: flex;
  370. gap: 20rpx;
  371. .popup-btn {
  372. flex: 1;
  373. height: 80rpx;
  374. border-radius: 12rpx;
  375. display: flex;
  376. align-items: center;
  377. justify-content: center;
  378. font-size: 28rpx;
  379. font-weight: 500;
  380. }
  381. .cancel-btn {
  382. background: #F7F8FA;
  383. color: rgba(102, 102, 102, 1);
  384. }
  385. .confirm-btn {
  386. background: #007AFF;
  387. color: #fff;
  388. }
  389. }
  390. }
  391. </style>