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

394 lines
8.3 KiB

8 months ago
6 months ago
8 months ago
3 days ago
6 months ago
8 months ago
6 months ago
8 months ago
8 months ago
6 months ago
8 months ago
8 months ago
6 months ago
8 months ago
3 days ago
8 months ago
6 months ago
8 months ago
6 months ago
8 months ago
6 months ago
8 months ago
8 months ago
8 months ago
3 days ago
8 months ago
3 days ago
6 months ago
8 months ago
8 months ago
8 months ago
6 months ago
6 months ago
8 months ago
6 months ago
8 months ago
6 months ago
8 months ago
6 months ago
8 months ago
8 months ago
8 months ago
8 months ago
6 months ago
8 months ago
6 months ago
8 months ago
6 months ago
8 months ago
6 months ago
8 months ago
8 months ago
8 months ago
6 months ago
6 months ago
6 months ago
6 months ago
8 months ago
6 months ago
8 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
8 months ago
6 months ago
6 months ago
8 months ago
3 days ago
8 months ago
6 months ago
8 months ago
3 days ago
8 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="1"
  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. <!-- 地址选择组件 -->
  39. <AddressPicker ref="addressPicker" @confirm="onAddressConfirm" />
  40. <uv-popup ref="popup" :round="30"
  41. :safeAreaInsetBottom="false">
  42. <view class="popup">
  43. <view class="list">
  44. <view class="item"
  45. v-for="(item, index) in list"
  46. :key="item.type">
  47. <view class="title">
  48. {{ role ? item.bossTitle : item.title }}
  49. </view>
  50. <view class="tagList">
  51. <view
  52. :class="{act : i == item.index}"
  53. @click="clickTag(item, i)"
  54. v-for="(t, i) in item.tag"
  55. :key="t.label">
  56. {{ t.label }}
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="btn" @click="submit">
  62. <button class="a">提交</button>
  63. </view>
  64. </view>
  65. </uv-popup>
  66. </view>
  67. </template>
  68. <script>
  69. import {
  70. mapState,
  71. } from 'vuex'
  72. import AddressPicker from '@/components/AddressPicker.vue'
  73. export default {
  74. components: {
  75. AddressPicker
  76. },
  77. props : {
  78. sign : {
  79. default : 'dropDown_1'
  80. },
  81. },
  82. data() {
  83. return {
  84. // 表示value等于这些值,就属于默认值
  85. defaultValue: [0, 'all', 'all'],
  86. // 筛选结果
  87. result: [],
  88. activeName: 'areaId',
  89. areaId: {
  90. label: '全部',
  91. value: 0,
  92. activeIndex: 0,
  93. color: '#333',
  94. activeColor: '#3796F8',
  95. child: [
  96. {
  97. label: '全部',
  98. value: 0,
  99. },
  100. ]
  101. },
  102. typeId: {
  103. label: '工种',
  104. value: 'all',
  105. activeIndex: 0,
  106. color: '#333',
  107. activeColor: '#3796F8',
  108. child: [
  109. {
  110. label: '全部',
  111. value: 'all'
  112. },
  113. ]
  114. },
  115. natureId: {
  116. label: '性质',
  117. value: 'all',
  118. activeIndex: 0,
  119. color: '#333',
  120. activeColor: '#3796F8',
  121. child: [
  122. {
  123. label: '全部',
  124. value: 'all'
  125. },
  126. ]
  127. },
  128. list : [
  129. // {
  130. // title : '您目前所属的年龄段',
  131. // tag : ['18岁~35岁', '35岁~45岁', '45岁~50岁', '50岁以上'],
  132. // index : 0,
  133. // },
  134. {
  135. title : '您希望从事的工种',
  136. bossTitle : '您希望招工的工种',
  137. tag : [],
  138. index : 0,
  139. type : 'typeId',
  140. },
  141. {
  142. title : '您希望从事的工作性质',
  143. bossTitle : '您希望招工的工作性质',
  144. tag : [],
  145. index : 0,
  146. type : 'natureId',
  147. },
  148. {
  149. title : '您希望从事的工作地区',
  150. bossTitle : '您希望招工的工作地区',
  151. tag : [],
  152. index : 0,
  153. type : 'areaId',
  154. },
  155. ]
  156. }
  157. },
  158. computed : {
  159. dropItem(name) {
  160. return (name) => {
  161. const result = {};
  162. const find = this.result.find(item => item.name === name);
  163. if (find) {
  164. result.label = find.label;
  165. result.value = find.value;
  166. } else {
  167. result.label = this[name].label;
  168. result.value = this[name].value;
  169. }
  170. return result;
  171. }
  172. },
  173. // 获取当前下拉筛选项
  174. currentDropItem() {
  175. return this[this.activeName];
  176. },
  177. ...mapState(['jobTypeList', 'natureList', 'addressList']),
  178. },
  179. mounted() {
  180. setTimeout(this.initData, 500)
  181. },
  182. methods: {
  183. initData(){
  184. if(this.addressList.length == 0){
  185. setTimeout(this.initData, 500)
  186. }
  187. // 工种
  188. this.jobTypeList.forEach(n => {
  189. this.typeId.child.push({
  190. label: n.name,
  191. value: n.id,
  192. })
  193. })
  194. this.list[0].tag = this.typeId.child
  195. // 工作性质
  196. this.natureList.forEach(n => {
  197. this.natureId.child.push({
  198. label: n.name,
  199. value: n.id,
  200. })
  201. })
  202. this.list[1].tag = this.natureId.child
  203. // if(this.addressList[0]){
  204. // this.areaId.value = this.addressList[0].id
  205. // this.areaId.label = this.addressList[0].adress
  206. // this.defaultValue.slice(0, 1, this.addressList[0].id)
  207. // this.$forceUpdate()
  208. // }
  209. // 地址
  210. this.addressList.forEach(n => {
  211. this.areaId.child.push({
  212. label: n.adress,
  213. value: n.id,
  214. })
  215. })
  216. this.list[2].tag = this.areaId.child
  217. },
  218. clickTag(item, i){
  219. item.index = i
  220. },
  221. change(e) {},
  222. /**
  223. * 点击每个筛选项回调
  224. * @param {Object} e { name, active, type } = e
  225. */
  226. selectMenu(e) {
  227. const {
  228. name,
  229. active,
  230. type
  231. } = e;
  232. this.activeName = name;
  233. // 地址选择使用AddressPicker组件
  234. if(name === 'areaId'){
  235. this.$refs.addressPicker.open()
  236. return
  237. }
  238. // 智能推荐弹窗
  239. if(type == 1){
  240. this.$refs.popup.open()
  241. return
  242. }
  243. const find = this.result.find(item => item.name == this.activeName);
  244. if (find) {
  245. const findIndex = this[this.activeName]
  246. .child.findIndex(item => item.label == find.label && item
  247. .value == find.value);
  248. this[this.activeName].activeIndex = findIndex;
  249. } else {
  250. this[this.activeName].activeIndex = 0;
  251. }
  252. },
  253. /**
  254. * 点击菜单回调处理
  255. * @param {Object} item 选中项 { label,value } = e
  256. */
  257. clickItem(e) {
  258. // 下面有重新赋值,所以用let
  259. let {
  260. label,
  261. value
  262. } = e;
  263. const findIndex = this.result.findIndex(item => item.name == this.activeName);
  264. if (this.defaultValue.indexOf(value) > -1 && this[this.activeName].label) {
  265. label = this[this.activeName].label;
  266. }
  267. // 已经存在筛选项
  268. if (findIndex > -1) {
  269. this.$set(this.result, findIndex, {
  270. name: this.activeName,
  271. label,
  272. value
  273. })
  274. } else {
  275. this.result.push({
  276. name: this.activeName,
  277. label,
  278. value
  279. });
  280. }
  281. this.result = this.result.filter(item => this.defaultValue.indexOf(item.value) == -1);
  282. this.$emit('clickItem', this.result)
  283. },
  284. submit(){
  285. this.result = []
  286. this.list.forEach(n => {
  287. let t = n.tag[n.index]
  288. this.result.push({
  289. name: n.type,
  290. label : t.label,
  291. value : t.value
  292. })
  293. })
  294. this.result = this.result.filter(item => this.defaultValue.indexOf(item.value) == -1);
  295. this.$emit('clickItem', this.result)
  296. this.$refs.popup.close()
  297. },
  298. // 地址选择确认回调
  299. onAddressConfirm(addressResult) {
  300. // 更新areaId的状态
  301. this.areaId.label = addressResult.fullAddress
  302. this.areaId.value = addressResult.selectedAddress.selectedAddress
  303. // 调用clickItem来更新result数组并触发父组件事件
  304. this.clickItem({
  305. label: addressResult.fullAddress,
  306. value: addressResult.selectedAddress.selectedAddress
  307. })
  308. },
  309. }
  310. }
  311. </script>
  312. <style scoped lang="scss">
  313. .page{
  314. .popup{
  315. width: 80vw;
  316. padding: 40rpx;
  317. .list{
  318. .item{
  319. margin-top: 20rpx;
  320. .title{
  321. font-weight: 900;
  322. font-size: 30rpx;
  323. }
  324. .tagList{
  325. display: flex;
  326. flex-wrap: wrap;
  327. padding: 10rpx 0;
  328. view{
  329. background: rgba($uni-color, 0.1);
  330. padding: 10rpx 20rpx;
  331. margin: 10rpx;
  332. border-radius: 10rpx;
  333. font-size: 26rpx;
  334. }
  335. .act{
  336. color: #fff;
  337. background: $uni-color;
  338. }
  339. }
  340. }
  341. }
  342. .btn {
  343. display: flex;
  344. justify-content: center;
  345. width: 100%;
  346. margin-top: 20rpx;
  347. .a {
  348. display: flex;
  349. justify-content: center;
  350. align-items: center;
  351. width: 90%;
  352. color: #FFF;
  353. background-color: $uni-color;
  354. border: 1px solid rgba($uni-color, 0.2);
  355. border-radius: 100rpx;
  356. font-size: 30rpx;
  357. }
  358. }
  359. }
  360. }
  361. </style>