|
|
@@ -3,34 +3,11 @@
|
|
|
<navBar title="筛选" color="#000" />
|
|
|
<!-- 列表 -->
|
|
|
<view class="list flex justify-between">
|
|
|
- <!-- 左侧分类 -->
|
|
|
- <!-- <view class="list-l">
|
|
|
- <scroll-view scroll-y="true" style="width: 100%;height: 100%;padding-bottom: 20rpx;">
|
|
|
- <block v-if="type">
|
|
|
- <view class="list-l-item flex align-center " v-if="index!=3" @click="change_click_index(index)"
|
|
|
- :class="current==index?'active':''" v-for="(item,index) in list" :key="index">
|
|
|
- {{item.name}}
|
|
|
- </view>
|
|
|
- </block>
|
|
|
- <block v-else>
|
|
|
- <view class="list-l-item flex align-center " @click="change_click_index(index)"
|
|
|
- :class="current==index?'active':''" v-for="(item,index) in list" :key="index">
|
|
|
- {{item.name}}
|
|
|
- </view>
|
|
|
- </block>
|
|
|
-
|
|
|
- </scroll-view>
|
|
|
-
|
|
|
- </view> -->
|
|
|
<!-- 右侧列表 -->
|
|
|
<view class="list-r">
|
|
|
<scroll-view
|
|
|
scroll-y="true"
|
|
|
- @scroll="
|
|
|
- (e) => {
|
|
|
- scrolls(e);
|
|
|
- }
|
|
|
- "
|
|
|
+ @scroll="scrolls"
|
|
|
scroll-with-animation="true"
|
|
|
:scroll-into-view="'bottomView' + current"
|
|
|
style="width: 100%; height: 100%; padding-bottom: 20rpx"
|
|
|
@@ -198,14 +175,13 @@ export default {
|
|
|
});
|
|
|
|
|
|
if (this.isBrowse) {
|
|
|
- //把选中的条件存到本地然后返回首页进行筛选
|
|
|
uni.setStorageSync("browse", arr);
|
|
|
} else if (this.isCompyBrowse) {
|
|
|
uni.setStorageSync("isCompyBrowse", arr);
|
|
|
} else if (this.isCompyHistory) {
|
|
|
uni.setStorageSync("isCompyHistory", arr);
|
|
|
} else {
|
|
|
- uni.setStorageSync("filter", arr); //把选中的条件存到本地然后返回首页进行筛选
|
|
|
+ uni.setStorageSync("filter", arr);
|
|
|
}
|
|
|
uni.$emit('updateRecord')
|
|
|
uni.navigateBack();
|
|
|
@@ -216,25 +192,27 @@ export default {
|
|
|
* @param {Object} info 内层对象
|
|
|
* @param {Object} ind 内层下标
|
|
|
* 选择右侧的筛选
|
|
|
- * 薪资单选,其余可以多选
|
|
|
+ * 学历、薪资、经验单选,其余可以多选
|
|
|
*/
|
|
|
selectHyList(index, name, info, ind) {
|
|
|
- //选中
|
|
|
- if (name == "薪资范围(单选)") {
|
|
|
- // 薪资单选
|
|
|
- this.list[1].list.map((item, index) => {
|
|
|
+ // 定义需要单选的类型
|
|
|
+ const singleSelectTypes = ['学历要求', '薪资范围(单选)', '经验要求'];
|
|
|
+
|
|
|
+ if (singleSelectTypes.includes(name)) {
|
|
|
+ // 单选逻辑:先取消当前分类下所有选项的选中状态,再选中当前点击的选项
|
|
|
+ this.list[index].list.forEach(item => {
|
|
|
item.select = false;
|
|
|
- info.select = true;
|
|
|
});
|
|
|
+ info.select = true;
|
|
|
} else {
|
|
|
- //其余多选
|
|
|
+ // 其余多选逻辑保持不变
|
|
|
if (info.value == "不限") {
|
|
|
- this.list[index].list.map((item, index) => {
|
|
|
+ this.list[index].list.forEach(item => {
|
|
|
item.select = false;
|
|
|
- info.select = true;
|
|
|
});
|
|
|
+ info.select = true;
|
|
|
} else {
|
|
|
- this.list[index].list.map((item, ind) => {
|
|
|
+ this.list[index].list.forEach(item => {
|
|
|
if (item.value == "不限") {
|
|
|
item.select = false;
|
|
|
}
|
|
|
@@ -250,7 +228,7 @@ export default {
|
|
|
*/
|
|
|
change_click_index(index) {
|
|
|
this.current = index;
|
|
|
- //解决最后一个 ***来回*** 问题 (由于点击左侧导航,右侧锚点位置信息变化,此时滚动事件也随之滚动。)
|
|
|
+ //解决最后一个 ***来回*** 问题
|
|
|
uni.setStorageSync("resolve", "last");
|
|
|
setTimeout(() => {
|
|
|
uni.removeStorageSync("resolve");
|
|
|
@@ -266,8 +244,7 @@ export default {
|
|
|
* 获取节点信息
|
|
|
*/
|
|
|
get_node_details(options) {
|
|
|
- const query = uni.createSelectorQuery().in(this); //获得实例
|
|
|
- //获取多个节点方式
|
|
|
+ const query = uni.createSelectorQuery().in(this);
|
|
|
query
|
|
|
.selectAll(".list-r-item")
|
|
|
.boundingClientRect((data) => {
|
|
|
@@ -283,7 +260,6 @@ export default {
|
|
|
* 设置滚动的位置
|
|
|
*/
|
|
|
async_detail_msg(options) {
|
|
|
- //options 为滚动信息。 options.detail.scrollTop 值为相对于scroll-view。
|
|
|
let top_page = options.detail.scrollTop + this.top_list[0];
|
|
|
for (let i = 0; i < this.top_list.length; i++) {
|
|
|
let node1 = this.top_list[i];
|
|
|
@@ -316,8 +292,6 @@ export default {
|
|
|
name: "学历要求",
|
|
|
list: [...list, ...res.data],
|
|
|
};
|
|
|
- console.log(obj, "学历");
|
|
|
-
|
|
|
this.getMoney(obj);
|
|
|
}
|
|
|
});
|
|
|
@@ -424,80 +398,33 @@ export default {
|
|
|
});
|
|
|
|
|
|
this.list = arr;
|
|
|
- if (uni.getStorageSync("filter")) {
|
|
|
- let filter = uni.getStorageSync("filter");
|
|
|
- let arrs = [];
|
|
|
- filter.map((item) => {
|
|
|
- item.list.map((ite) => {
|
|
|
- arrs.push(ite.value);
|
|
|
- });
|
|
|
- });
|
|
|
+ // 从缓存加载选中状态
|
|
|
+ const storageKeys = [
|
|
|
+ {key: 'filter', condition: !this.isBrowse && !this.isCompyBrowse && !this.isCompyHistory},
|
|
|
+ {key: 'browse', condition: this.isBrowse},
|
|
|
+ {key: 'isCompyBrowse', condition: this.isCompyBrowse},
|
|
|
+ {key: 'isCompyHistory', condition: this.isCompyHistory}
|
|
|
+ ];
|
|
|
|
|
|
- console.log(this.list, "list");
|
|
|
- console.log(arrs, "list");
|
|
|
- this.list.map((item, index) => {
|
|
|
- item.list.map((ite, ind) => {
|
|
|
- arrs.map((it, ins) => {
|
|
|
- if (ite.value == it) {
|
|
|
- ite.select = true;
|
|
|
- }
|
|
|
+ for (const {key, condition} of storageKeys) {
|
|
|
+ if (condition && uni.getStorageSync(key)) {
|
|
|
+ const storedData = uni.getStorageSync(key);
|
|
|
+ const selectedValues = [];
|
|
|
+ storedData.forEach(item => {
|
|
|
+ item.list.forEach(ite => {
|
|
|
+ selectedValues.push(ite.value);
|
|
|
});
|
|
|
});
|
|
|
- });
|
|
|
- }
|
|
|
- if (uni.getStorageSync("browse")) {
|
|
|
- let browse = uni.getStorageSync("browse");
|
|
|
- let arrs = [];
|
|
|
- browse.map((item) => {
|
|
|
- item.list.map((ite) => {
|
|
|
- arrs.push(ite.value);
|
|
|
- });
|
|
|
- });
|
|
|
- this.list.map((item, index) => {
|
|
|
- item.list.map((ite, ind) => {
|
|
|
- arrs.map((it, ins) => {
|
|
|
- if (ite.value == it) {
|
|
|
+
|
|
|
+ this.list.forEach(item => {
|
|
|
+ item.list.forEach(ite => {
|
|
|
+ if (selectedValues.includes(ite.value)) {
|
|
|
ite.select = true;
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
- });
|
|
|
- }
|
|
|
- if (uni.getStorageSync("isCompyBrowse")) {
|
|
|
- let isCompyBrowse = uni.getStorageSync("isCompyBrowse");
|
|
|
- let arrs = [];
|
|
|
- isCompyBrowse.map((item) => {
|
|
|
- item.list.map((ite) => {
|
|
|
- arrs.push(ite.value);
|
|
|
- });
|
|
|
- });
|
|
|
- this.list.map((item, index) => {
|
|
|
- item.list.map((ite, ind) => {
|
|
|
- arrs.map((it, ins) => {
|
|
|
- if (ite.value == it) {
|
|
|
- ite.select = true;
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
- if (uni.getStorageSync("isCompyHistory")) {
|
|
|
- let isCompyHistory = uni.getStorageSync("isCompyHistory");
|
|
|
- let arrs = [];
|
|
|
- isCompyHistory.map((item) => {
|
|
|
- item.list.map((ite) => {
|
|
|
- arrs.push(ite.value);
|
|
|
- });
|
|
|
- });
|
|
|
- this.list.map((item, index) => {
|
|
|
- item.list.map((ite, ind) => {
|
|
|
- arrs.map((it, ins) => {
|
|
|
- if (ite.value == it) {
|
|
|
- ite.select = true;
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- });
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -507,6 +434,7 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
+/* 样式保持不变 */
|
|
|
page {
|
|
|
background-color: #ffffff;
|
|
|
}
|
|
|
@@ -616,4 +544,4 @@ page {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|