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

368 lines
7.6 KiB

4 months ago
2 months ago
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
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
4 months ago
4 months ago
2 months ago
4 months ago
4 months ago
4 months ago
2 months ago
1 month ago
4 months ago
1 month 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
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
4 months ago
2 months ago
2 months ago
2 months ago
2 months ago
4 months ago
2 months ago
4 months ago
2 months ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
4 months ago
2 months ago
2 months ago
4 months ago
2 months ago
4 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="item.type">
  45. <view class="title">
  46. {{ role ? item.bossTitle : 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.label">
  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. bossTitle : '您希望招工的工种',
  131. tag : [],
  132. index : 0,
  133. type : 'typeId',
  134. },
  135. {
  136. title : '您希望从事的工作性质',
  137. bossTitle : '您希望招工的工作性质',
  138. tag : [],
  139. index : 0,
  140. type : 'natureId',
  141. },
  142. {
  143. title : '您希望从事的工作地区',
  144. bossTitle : '您希望招工的工作地区',
  145. tag : [],
  146. index : 0,
  147. type : 'areaId',
  148. },
  149. ]
  150. }
  151. },
  152. computed : {
  153. dropItem(name) {
  154. return (name) => {
  155. const result = {};
  156. const find = this.result.find(item => item.name === name);
  157. if (find) {
  158. result.label = find.label;
  159. result.value = find.value;
  160. } else {
  161. result.label = this[name].label;
  162. result.value = this[name].value;
  163. }
  164. return result;
  165. }
  166. },
  167. // 获取当前下拉筛选项
  168. currentDropItem() {
  169. return this[this.activeName];
  170. },
  171. ...mapState(['jobTypeList', 'natureList', 'addressList']),
  172. },
  173. mounted() {
  174. setTimeout(this.initData, 500)
  175. },
  176. methods: {
  177. initData(){
  178. if(this.addressList.length == 0){
  179. setTimeout(this.initData, 500)
  180. }
  181. // 工种
  182. this.jobTypeList.forEach(n => {
  183. this.typeId.child.push({
  184. label: n.name,
  185. value: n.id,
  186. })
  187. })
  188. this.list[0].tag = this.typeId.child
  189. // 工作性质
  190. this.natureList.forEach(n => {
  191. this.natureId.child.push({
  192. label: n.name,
  193. value: n.id,
  194. })
  195. })
  196. this.list[1].tag = this.natureId.child
  197. // if(this.addressList[0]){
  198. // this.areaId.value = this.addressList[0].id
  199. // this.areaId.label = this.addressList[0].adress
  200. // this.defaultValue.slice(0, 1, this.addressList[0].id)
  201. // this.$forceUpdate()
  202. // }
  203. // 地址
  204. this.addressList.forEach(n => {
  205. this.areaId.child.push({
  206. label: n.adress,
  207. value: n.id,
  208. })
  209. })
  210. this.list[2].tag = this.areaId.child
  211. },
  212. clickTag(item, i){
  213. item.index = i
  214. },
  215. change(e) {},
  216. /**
  217. * 点击每个筛选项回调
  218. * @param {Object} e { name, active, type } = e
  219. */
  220. selectMenu(e) {
  221. const {
  222. name,
  223. active,
  224. type
  225. } = e;
  226. this.activeName = name;
  227. if(type == 1){
  228. this.$refs.popup.open()
  229. return
  230. }
  231. const find = this.result.find(item => item.name == this.activeName);
  232. if (find) {
  233. const findIndex = this[this.activeName]
  234. .child.findIndex(item => item.label == find.label && item
  235. .value == find.value);
  236. this[this.activeName].activeIndex = findIndex;
  237. } else {
  238. this[this.activeName].activeIndex = 0;
  239. }
  240. },
  241. /**
  242. * 点击菜单回调处理
  243. * @param {Object} item 选中项 { label,value } = e
  244. */
  245. clickItem(e) {
  246. // 下面有重新赋值,所以用let
  247. let {
  248. label,
  249. value
  250. } = e;
  251. const findIndex = this.result.findIndex(item => item.name == this.activeName);
  252. if (this.defaultValue.indexOf(value) > -1 && this[this.activeName].label) {
  253. label = this[this.activeName].label;
  254. }
  255. // 已经存在筛选项
  256. if (findIndex > -1) {
  257. this.$set(this.result, findIndex, {
  258. name: this.activeName,
  259. label,
  260. value
  261. })
  262. } else {
  263. this.result.push({
  264. name: this.activeName,
  265. label,
  266. value
  267. });
  268. }
  269. this.result = this.result.filter(item => this.defaultValue.indexOf(item.value) == -1);
  270. this.$emit('clickItem', this.result)
  271. },
  272. submit(){
  273. this.result = []
  274. this.list.forEach(n => {
  275. let t = n.tag[n.index]
  276. this.result.push({
  277. name: n.type,
  278. label : t.label,
  279. value : t.value
  280. })
  281. })
  282. this.result = this.result.filter(item => this.defaultValue.indexOf(item.value) == -1);
  283. this.$emit('clickItem', this.result)
  284. this.$refs.popup.close()
  285. },
  286. }
  287. }
  288. </script>
  289. <style scoped lang="scss">
  290. .page{
  291. .popup{
  292. width: 80vw;
  293. padding: 40rpx;
  294. .list{
  295. .item{
  296. margin-top: 20rpx;
  297. .title{
  298. font-weight: 900;
  299. font-size: 30rpx;
  300. }
  301. .tagList{
  302. display: flex;
  303. flex-wrap: wrap;
  304. padding: 10rpx 0;
  305. view{
  306. background: rgba($uni-color, 0.1);
  307. padding: 10rpx 20rpx;
  308. margin: 10rpx;
  309. border-radius: 10rpx;
  310. font-size: 26rpx;
  311. }
  312. .act{
  313. color: #fff;
  314. background: $uni-color;
  315. }
  316. }
  317. }
  318. }
  319. .btn {
  320. display: flex;
  321. justify-content: center;
  322. width: 100%;
  323. margin-top: 20rpx;
  324. .a {
  325. display: flex;
  326. justify-content: center;
  327. align-items: center;
  328. width: 90%;
  329. color: #FFF;
  330. background-color: $uni-color;
  331. border: 1px solid rgba($uni-color, 0.2);
  332. border-radius: 100rpx;
  333. font-size: 30rpx;
  334. }
  335. }
  336. }
  337. }
  338. </style>