preferenceSetting.vue 5.0 KB

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