preferenceSetting.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <view class="preference-setting">
  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">根据你的偏好设置,为你推荐更匹配的职位</view>
  17. <view class="preference-section">
  18. <view class="section-title">请选择你的从事偏好</view>
  19. <!-- 偏好标签网格 -->
  20. <view class="preference-grid">
  21. <view
  22. v-for="(item, index) in preferenceOptions"
  23. :key="index"
  24. class="preference-tag"
  25. :class="{ active: selectedPreferences.includes(item) }"
  26. @click="togglePreference(item)"
  27. >
  28. <text>{{ item }}</text>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <!-- 底部确定按钮 -->
  34. <view class="bottom-btn-container">
  35. <view class="confirm-btn" @click="confirmSelection">
  36. <text>确定</text>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. var set=0
  43. export default {
  44. data() {
  45. return {
  46. jobTitle: '亚马逊运营总监',
  47. jobId:'',
  48. selectedPreferences: ['独立站'],
  49. preferenceOptions: [
  50. '精品铺货', '独立站', '3C数码', '美妆日用', '服装配饰', '家居用品',
  51. '户外运动', '母婴用品', '食品饮料', '宠物用品', '汽车用品', '图书文具',
  52. '数码配件', '办公用品', '礼品玩具', '健康保健', '珠宝首饰', '箱包皮具',
  53. '手表眼镜', '乐器音响', '摄影摄像', '运动健身', '旅游出行', '教育培训',
  54. '金融服务', '生活服务', '其他'
  55. ]
  56. }
  57. },
  58. onLoad(options) {
  59. if (options&&options.jobTitle) {
  60. this.jobTitle = decodeURIComponent(options.jobTitle)
  61. }
  62. if (options&&options.jobId) {
  63. this.jobId = options.jobId
  64. }
  65. if(options&&options.selectedPreferences)
  66. this.selectedPreferences = JSON.parse(decodeURIComponent(options.selectedPreferences))
  67. this.getData()
  68. set=options&&options.set?options.set:0
  69. },
  70. methods: {
  71. getData(){
  72. let data = {
  73. ruleClassifyId:this.jobId
  74. }
  75. var action=this.jobId==''||this.jobId==0?'/app/userFirst/selectSkill':'/app/userFirst/getPostSkill'
  76. this.$Request.getT(action,data).then(res => {
  77. if(res.code==0){
  78. if(this.jobId==''||this.jobId==0){
  79. res.data.forEach(function(item){
  80. item.postSkillName=item.skillName
  81. })
  82. this.operationOptions =[{childrenList:res.data,postSkillName:''}]
  83. }else
  84. this.operationOptions = res.data
  85. }
  86. })
  87. },
  88. goBack() {
  89. uni.navigateBack()
  90. },
  91. togglePreference(item) {
  92. const index = this.selectedPreferences.indexOf(item)
  93. if (index > -1) {
  94. // 如果已选中,则取消选中
  95. this.selectedPreferences.splice(index, 1)
  96. } else {
  97. // 如果未选中,则添加到选中列表
  98. this.selectedPreferences.push(item)
  99. }
  100. },
  101. confirmSelection() {
  102. // 返回选中的偏好设置
  103. uni.navigateBack({
  104. delta: 1
  105. })
  106. // 通知父页面更新偏好设置
  107. uni.$emit('preferenceUpdated', {
  108. jobTitle: this.jobTitle,
  109. preferences: this.selectedPreferences,
  110. set
  111. })
  112. uni.showToast({
  113. title: '偏好设置已保存',
  114. icon: 'success'
  115. })
  116. }
  117. }
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. .preference-setting {
  122. min-height: 100vh;
  123. background: #fff;
  124. display: flex;
  125. flex-direction: column;
  126. padding: 88rpx 40rpx 40rpx 40rpx;
  127. }
  128. .navbar-content {
  129. display: flex;
  130. align-items: center;
  131. justify-content: space-between;
  132. height: 88rpx;
  133. }
  134. .nav-left, .nav-right {
  135. width: 60rpx;
  136. height: 60rpx;
  137. display: flex;
  138. align-items: center;
  139. justify-content: center;
  140. }
  141. .nav-title {
  142. color: rgba(51, 51, 51, 1);
  143. font-family: DM Sans;
  144. font-size: 36rpx;
  145. font-weight: 700;
  146. line-height: 26px;
  147. letter-spacing: 0px;
  148. text-align: center;
  149. }
  150. .main-content {
  151. margin-top:20rpx;
  152. }
  153. .job-title {
  154. color: rgba(51, 51, 51, 1);
  155. font-family: DM Sans;
  156. font-size: 52rpx;
  157. font-weight: 700;
  158. line-height: 30px;
  159. letter-spacing: 0px;
  160. text-align: left;
  161. }
  162. .description {
  163. margin:20rpx 0;
  164. color: rgba(102, 102, 102, 1);
  165. font-family: DM Sans;
  166. font-size: 28rpx;
  167. font-weight: 400;
  168. letter-spacing: 0px;
  169. text-align: left;
  170. }
  171. .preference-section {
  172. margin-bottom: 40rpx;
  173. }
  174. .section-title {
  175. color: rgba(34, 37, 42, 1);
  176. font-family: DM Sans;
  177. font-size: 36rpx;
  178. font-weight: 400;
  179. line-height: 24px;
  180. letter-spacing: 0px;
  181. text-align: left;
  182. margin-bottom: 20rpx;
  183. }
  184. .preference-grid {
  185. display: flex;
  186. flex-wrap: wrap;
  187. gap: 12rpx;
  188. }
  189. .preference-tag {
  190. width: calc((100% - 72rpx) / 7);
  191. padding: 8rpx 6rpx;
  192. background: #F7F8FA;
  193. border: 1rpx solid #F7F8FA;
  194. border-radius: 12rpx;
  195. transition: all 0.3s ease;
  196. display: flex;
  197. align-items: center;
  198. justify-content: center;
  199. text {
  200. font-size: 18rpx;
  201. color: rgba(102, 102, 102, 1);
  202. font-weight: 400;
  203. text-align: center;
  204. line-height: 1.2;
  205. }
  206. &.active {
  207. background: rgba(153, 196, 250, 0.4);
  208. border: 0.5px solid rgba(1, 107, 246, 1);
  209. text {
  210. color: rgba(1, 107, 246, 1);
  211. font-weight: 400;
  212. }
  213. }
  214. &:active {
  215. transform: scale(0.95);
  216. }
  217. }
  218. .bottom-btn-container {
  219. position: fixed;
  220. bottom: 0;
  221. left: 0;
  222. right: 0;
  223. padding: 32rpx;
  224. background: #fff;
  225. border-top: 1px solid #f0f0f0;
  226. }
  227. .confirm-btn {
  228. width: 100%;
  229. height: 88rpx;
  230. background: #007AFF;
  231. border-radius: 44rpx;
  232. display: flex;
  233. align-items: center;
  234. justify-content: center;
  235. text {
  236. font-size: 32rpx;
  237. font-weight: 600;
  238. color: #fff;
  239. }
  240. &:active {
  241. background: #0056CC;
  242. }
  243. }
  244. </style>