特易招,招聘小程序
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.

336 lines
6.8 KiB

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