特易招,招聘小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

327 lines
6.7 KiB

4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
4 months ago
2 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
2 months ago
4 months ago
4 months ago
  1. <template>
  2. <view class="page">
  3. <uv-drop-down ref="dropDown"
  4. sign="dropDown_1"
  5. text-active-color="#3796F8"
  6. :extra-icon="{name:'arrow-down-fill',color:'#666',size:'26rpx'}"
  7. :extra-active-icon="{name:'arrow-up-fill',color:'#3796F8',size:'26rpx'}"
  8. :defaultValue="defaultValue"
  9. :custom-style="{padding: '0 30rpx'}"
  10. @click="selectMenu">
  11. <uv-drop-down-item name="areaId" type="2"
  12. :label="dropItem('areaId').label"
  13. :value="dropItem('areaId').value">
  14. </uv-drop-down-item>
  15. <uv-drop-down-item
  16. name="typeId" type="2"
  17. :label="dropItem('typeId').label"
  18. :value="dropItem('typeId').value">
  19. </uv-drop-down-item>
  20. <uv-drop-down-item
  21. name="natureId" type="2"
  22. :label="dropItem('natureId').label"
  23. :value="dropItem('natureId').value">
  24. </uv-drop-down-item>
  25. <uv-drop-down-item
  26. name="vip_type"
  27. type="1"
  28. label='智能推荐'
  29. :value="0">
  30. </uv-drop-down-item>
  31. </uv-drop-down>
  32. <uv-drop-down-popup
  33. sign="dropDown_1"
  34. :click-overlay-on-close="true"
  35. :currentDropItem="currentDropItem"
  36. @clickItem="clickItem"
  37. @popupChange="change"></uv-drop-down-popup>
  38. <uv-popup ref="popup" :round="30"
  39. :safeAreaInsetBottom="false">
  40. <view class="popup">
  41. <view class="list">
  42. <view class="item"
  43. v-for="(item, index) in list"
  44. :key="index">
  45. <view class="title">
  46. {{ item.title }}
  47. </view>
  48. <view class="tagList">
  49. <view
  50. :class="{act : i == item.index}"
  51. @click="clickTag(item, i)"
  52. v-for="(t, i) in item.tag"
  53. :key="t">
  54. {{ t.label }}
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="btn" @click="submit">
  60. <button class="a">提交</button>
  61. </view>
  62. </view>
  63. </uv-popup>
  64. </view>
  65. </template>
  66. <script>
  67. import {
  68. mapState,
  69. } from 'vuex'
  70. export default {
  71. data() {
  72. return {
  73. // 表示value等于这些值,就属于默认值
  74. defaultValue: [0, 'all', 'all'],
  75. // 筛选结果
  76. result: [],
  77. activeName: 'areaId',
  78. areaId: {
  79. label: '全国',
  80. value: 0,
  81. activeIndex: 0,
  82. color: '#333',
  83. activeColor: '#3796F8',
  84. child: [
  85. {
  86. label: '全国',
  87. value: 0,
  88. },
  89. ]
  90. },
  91. typeId: {
  92. label: '工种',
  93. value: 'all',
  94. activeIndex: 0,
  95. color: '#333',
  96. activeColor: '#3796F8',
  97. child: [
  98. {
  99. label: '全部',
  100. value: 'all'
  101. },
  102. ]
  103. },
  104. natureId: {
  105. label: '性质',
  106. value: 'all',
  107. activeIndex: 0,
  108. color: '#333',
  109. activeColor: '#3796F8',
  110. child: [
  111. {
  112. label: '全部',
  113. value: 'all'
  114. },
  115. ]
  116. },
  117. list : [
  118. // {
  119. // title : '您目前所属的年龄段',
  120. // tag : ['18岁~35岁', '35岁~45岁', '45岁~50岁', '50岁以上'],
  121. // index : 0,
  122. // },
  123. {
  124. title : '您希望从事的工种',
  125. tag : ['电工', '焊工', '叉车', '其他'],
  126. index : 0,
  127. },
  128. {
  129. title : '您希望从事的工作性质',
  130. tag : ['全职', '临时工',],
  131. index : 0,
  132. },
  133. ]
  134. }
  135. },
  136. computed : {
  137. dropItem(name) {
  138. return (name) => {
  139. const result = {};
  140. const find = this.result.find(item => item.name === name);
  141. if (find) {
  142. result.label = find.label;
  143. result.value = find.value;
  144. } else {
  145. result.label = this[name].label;
  146. result.value = this[name].value;
  147. }
  148. return result;
  149. }
  150. },
  151. // 获取当前下拉筛选项
  152. currentDropItem() {
  153. return this[this.activeName];
  154. },
  155. ...mapState(['jobTypeList', 'natureList', 'addressList']),
  156. },
  157. mounted() {
  158. // 工种
  159. this.jobTypeList.forEach(n => {
  160. this.typeId.child.push({
  161. label: n.name,
  162. value: n.id,
  163. })
  164. })
  165. this.list[0].tag = this.typeId.child
  166. // 工作性质
  167. this.natureList.forEach(n => {
  168. this.natureId.child.push({
  169. label: n.name,
  170. value: n.id,
  171. })
  172. })
  173. this.list[1].tag = this.natureId.child
  174. // if(this.addressList[0]){
  175. // this.areaId.value = this.addressList[0].id
  176. // this.areaId.label = this.addressList[0].name
  177. // this.defaultValue[0] = this.addressList[0].id
  178. // this.$forceUpdate()
  179. // }
  180. // 地址
  181. this.addressList.forEach(n => {
  182. this.areaId.child.push({
  183. label: n.adress,
  184. value: n.id,
  185. })
  186. })
  187. },
  188. methods: {
  189. clickTag(item, i){
  190. console.log(i);
  191. item.index = i
  192. },
  193. change(e) {},
  194. /**
  195. * 点击每个筛选项回调
  196. * @param {Object} e { name, active, type } = e
  197. */
  198. selectMenu(e) {
  199. const {
  200. name,
  201. active,
  202. type
  203. } = e;
  204. this.activeName = name;
  205. if(type == 1){
  206. this.$refs.popup.open()
  207. return
  208. }
  209. const find = this.result.find(item => item.name == this.activeName);
  210. if (find) {
  211. const findIndex = this[this.activeName]
  212. .child.findIndex(item => item.label == find.label && item
  213. .value == find.value);
  214. this[this.activeName].activeIndex = findIndex;
  215. } else {
  216. this[this.activeName].activeIndex = 0;
  217. }
  218. },
  219. /**
  220. * 点击菜单回调处理
  221. * @param {Object} item 选中项 { label,value } = e
  222. */
  223. clickItem(e) {
  224. // 下面有重新赋值,所以用let
  225. let {
  226. label,
  227. value
  228. } = e;
  229. const findIndex = this.result.findIndex(item => item.name == this.activeName);
  230. if (this.defaultValue.indexOf(value) > -1 && this[this.activeName].label) {
  231. label = this[this.activeName].label;
  232. }
  233. // 已经存在筛选项
  234. if (findIndex > -1) {
  235. this.$set(this.result, findIndex, {
  236. name: this.activeName,
  237. label,
  238. value
  239. })
  240. } else {
  241. this.result.push({
  242. name: this.activeName,
  243. label,
  244. value
  245. });
  246. }
  247. this.result = this.result.filter(item => this.defaultValue.indexOf(item.value) == -1);
  248. this.$emit('clickItem', this.result)
  249. },
  250. submit(){
  251. },
  252. }
  253. }
  254. </script>
  255. <style scoped lang="scss">
  256. .page{
  257. .popup{
  258. width: 80vw;
  259. padding: 40rpx;
  260. .list{
  261. .item{
  262. margin-top: 20rpx;
  263. .title{
  264. font-weight: 900;
  265. font-size: 30rpx;
  266. }
  267. .tagList{
  268. display: flex;
  269. flex-wrap: wrap;
  270. padding: 10rpx 0;
  271. view{
  272. background: rgba($uni-color, 0.1);
  273. padding: 10rpx 20rpx;
  274. margin: 10rpx;
  275. border-radius: 10rpx;
  276. font-size: 26rpx;
  277. }
  278. .act{
  279. color: #fff;
  280. background: $uni-color;
  281. }
  282. }
  283. }
  284. }
  285. .btn {
  286. display: flex;
  287. justify-content: center;
  288. width: 100%;
  289. margin-top: 20rpx;
  290. .a {
  291. display: flex;
  292. justify-content: center;
  293. align-items: center;
  294. width: 90%;
  295. color: #FFF;
  296. background-color: $uni-color;
  297. border: 1px solid rgba($uni-color, 0.2);
  298. border-radius: 100rpx;
  299. font-size: 30rpx;
  300. }
  301. }
  302. }
  303. }
  304. </style>