fix: 修复模态框显示时页面滚动问题
为多个组件添加watch监听,当模态框显示时隐藏页面滚动条,关闭时恢复 修复学校筛选条件中sid改为id的字段匹配问题 清理viewMap组件中多余的注释代码
This commit is contained in:
@@ -95,6 +95,7 @@ let watchSet = (num) => {
|
||||
const handleEscKey = e => (e.key == "Escape" && close())
|
||||
|
||||
onMounted(() => {
|
||||
document.body.style.overflow = "hidden";
|
||||
watchEffect(() => {
|
||||
show = props.show;
|
||||
list.value = props.list;
|
||||
@@ -106,6 +107,7 @@ onMounted(() => {
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
document.body.style.overflow = "unset";
|
||||
window.removeEventListener("keydown", handleEscKey);
|
||||
});
|
||||
|
||||
|
||||
@@ -48,9 +48,9 @@
|
||||
<script setup>
|
||||
import { ElLoading } from "element-plus";
|
||||
|
||||
import { ref, reactive, onMounted, getCurrentInstance, defineEmits, inject } from "vue";
|
||||
import { ref, reactive, onMounted, getCurrentInstance, defineEmits, inject, watch } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import store from "../../store/index"
|
||||
import store from "../../store/index";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const router = useRouter();
|
||||
@@ -61,6 +61,11 @@ let identityList = ref([]);
|
||||
|
||||
let popType = ref(""); // choice agent: 确认是否是中介(有个人房源) affirmAgent: 确认是否是中介(有中介房源)
|
||||
|
||||
watch(popType, (newValue) => {
|
||||
if (newValue) document.body.style.overflow = "hidden";
|
||||
else document.body.style.overflow = "unset";
|
||||
});
|
||||
|
||||
let agent = ref([`中介账号发布的房源信息,均展示在“<span style="color: #000; font-weight:650;">中介房源</span>”频道中,即不能发布“<span style="color: #000; font-weight:650;">个人房源</span>”、“<span style="color: #000; font-weight:650;">求房源</span>”;如您已上架个人房源或求房源信息,在你确认中介身份后,将会自动下架`]);
|
||||
|
||||
let affirmAgent = ref([`个人账号只能发布“<span style="color: #000; font-weight:650;">个人房源</span>”、“<span style="color: #000; font-weight:650;">求房源</span>”,在您确认不是中介身份后,将会自动下架您的中介房源;`, `中介账号只能发布“<span style="color: #000; font-weight:650;">中介房源</span>”,如您已上架个人房源或求房源信息,在你确认中介身份后,将会自动下架;`]);
|
||||
@@ -78,7 +83,7 @@ let loading = ref(null); // 加载
|
||||
// 点击按钮
|
||||
const ClickBtn = () => {
|
||||
if (store.state.realname == 0 && store.state.userInfoWin?.uin > 0) {
|
||||
store.commit('openAttest')
|
||||
store.commit("openAttest");
|
||||
return;
|
||||
}
|
||||
if (identityList.value.length == 0) init();
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
<template>
|
||||
<div class="flexcenter" :class="{ 'pop-mask': show }">
|
||||
<div class="" :class="{ 'pop': show }">
|
||||
<!-- <div class="close flexcenter" > -->
|
||||
<img class=" close icon" @click="showPop" src="@/assets/img/publicImage/white-cross.svg">
|
||||
<!-- </div> -->
|
||||
<div id="container">
|
||||
<div class="location-bj flexcenter" @click="showPop" v-if="!show">
|
||||
<div class="location-site flexacenter" v-if="props['name']">
|
||||
@@ -18,7 +16,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, defineProps, defineExpose } from 'vue';
|
||||
import { ref, defineProps, defineExpose, watch } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
latlng: Object,
|
||||
@@ -60,6 +58,11 @@ loadScript(`https://map.qq.com/api/gljs?v=1.exp&key=${key.value}&callback=initMa
|
||||
|
||||
let show = ref(false) // 弹窗状态
|
||||
|
||||
watch(show, (newValue) => {
|
||||
if (newValue) document.body.style.overflow = "hidden";
|
||||
else document.body.style.overflow = "unset";
|
||||
});
|
||||
|
||||
const showPop = () => {
|
||||
show.value = !show.value
|
||||
// if (!show.value) return
|
||||
|
||||
@@ -1520,6 +1520,11 @@ const getLikeList = () => {
|
||||
|
||||
let isSelectSchool = ref(false); // 选择学校状态
|
||||
|
||||
watch(isSelectSchool, (newValue) => {
|
||||
if (newValue) document.body.style.overflow = "hidden";
|
||||
else document.body.style.overflow = "unset";
|
||||
});
|
||||
|
||||
let distancePitch = ref({});
|
||||
|
||||
let distanceList = ref([]);
|
||||
@@ -1633,6 +1638,11 @@ let returnSum = ref(0);
|
||||
let remarkList = ref([]);
|
||||
let remarkTypeid = ref(0); // 0 全部 1 考察 2 回访
|
||||
|
||||
watch(isInspectPop, (newValue) => {
|
||||
if (newValue) document.body.style.overflow = "hidden";
|
||||
else document.body.style.overflow = "unset";
|
||||
});
|
||||
|
||||
const getComment = () => {
|
||||
proxy
|
||||
.$post("https://api.gter.net/v1/apartment/comment", { token })
|
||||
|
||||
@@ -897,6 +897,11 @@ let clone = (text) => {
|
||||
//显示联系方式
|
||||
let showConcat = ref(false);
|
||||
|
||||
watch(showConcat, (newValue) => {
|
||||
if (newValue) document.body.style.overflow = "hidden";
|
||||
else document.body.style.overflow = "unset";
|
||||
});
|
||||
|
||||
//数据包
|
||||
let indexData = reactive({});
|
||||
//房源详情
|
||||
|
||||
@@ -314,7 +314,7 @@
|
||||
<el-popover v-model:visible="areaPopState" placement="bottom" :width="640" :show-arrow="false" trigger="click" popper-style="padding:0; border-radius:16px !important;" :disabled="verified == 1">
|
||||
<template #reference>
|
||||
<div ref="location" class="modeOne-item flexacenter" :class="{ disabled: verified == 1 }" style="width: 640px">
|
||||
<div class="modeOne-text flexacenter" v-if="info['location'] && info['location'] !== '0'">
|
||||
<div class="modeOne-text flexacenter" v-if="info['location'] && info['location'] !== '0'">
|
||||
{{ locationData[Math.floor(info.location)]?.name }}
|
||||
<img class="form-arrows form-arrows-disabled" src="@/assets/img/edit/thin-arrow-disabled.svg" />
|
||||
{{ locationData[Math.floor(info.location)]?.data[info.location] }}
|
||||
@@ -814,6 +814,12 @@ export default {
|
||||
pageTopBar,
|
||||
userBox,
|
||||
},
|
||||
watch: {
|
||||
targetAreaState(newVal) {
|
||||
if (newVal) document.body.style.overflow = "hidden";
|
||||
else document.body.style.overflow = "unset";
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
require(url) {
|
||||
return require(url);
|
||||
@@ -934,7 +940,7 @@ export default {
|
||||
if (info["floor"]) info["floor"] = Number(info["floor"]);
|
||||
if (info["rentalduration"]) info["rentalduration"] = Number(info["rentalduration"]);
|
||||
}
|
||||
|
||||
|
||||
this.fieldinfo = fieldinfo;
|
||||
this.typeData = typeData;
|
||||
this.locationData = locationData;
|
||||
@@ -954,7 +960,6 @@ export default {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.info = info;
|
||||
this.verified = data.verified;
|
||||
@@ -1206,7 +1211,7 @@ export default {
|
||||
// 提交
|
||||
submit(status = 0) {
|
||||
if (status == 1 && this.$store.state.realname == 0 && this.$store.state.userInfoWin?.uin > 0) this.$store.commit("openAttest");
|
||||
|
||||
|
||||
let info = { ...this.info };
|
||||
|
||||
if (info["images"] && info["images"].length > 1 && !info["aid"]) {
|
||||
|
||||
@@ -91,8 +91,8 @@ onMounted(() => {
|
||||
value = JSON.parse(value);
|
||||
// 判断 学校id是否在筛选
|
||||
if (value["school"]) {
|
||||
const schoolList = store.state.schoolList || [];
|
||||
const isExist = schoolList.some((item) => item.sid == value["school"]);
|
||||
const schoolList = store.state.schoolList || [];
|
||||
const isExist = schoolList.some((item) => item.id == value["school"]);
|
||||
if (!isExist) value["school"] = 0;
|
||||
}
|
||||
pitchValue.value = value;
|
||||
|
||||
Reference in New Issue
Block a user