refactor: 移除调试日志并优化代码结构

移除多个组件中的调试日志语句,优化代码结构以提高可读性和维护性。同时调整了部分样式和逻辑,确保功能一致性和用户体验。
This commit is contained in:
DESKTOP-RQ919RC\Pc
2025-05-22 18:58:39 +08:00
parent 4f3989f756
commit fbb9e5a76c
12 changed files with 512 additions and 412 deletions

View File

@@ -3,18 +3,18 @@
<login></login>
</template>
<script setup>
import login from "@/components/public/login.vue"
import store from "@/store"
import { onMounted, watch, watchEffect } from "vue"
import { useRoute } from "vue-router"
import api from "./utils/api"
let socketTask = null
import login from "@/components/public/login.vue";
import store from "@/store";
import { onMounted, watch, watchEffect } from "vue";
import { useRoute } from "vue-router";
import api from "./utils/api";
let socketTask = null;
onMounted(() => {
// useSocket()
document.addEventListener("visibilitychange", () => {
if (document.visibilityState === "visible" && socketTask?.readyState != 1) useSocket()
})
if (document.visibilityState === "visible" && socketTask?.readyState != 1) useSocket();
});
// 创建cnzz统计js //v1.cnzz.com/z_stat.php?id=1281224882&amp;web_id=1281224882
// const script = document.createElement("script")
@@ -22,31 +22,31 @@ onMounted(() => {
// script.language = "JavaScript"
// document.body.appendChild(script)
getBannerData()
})
getBannerData();
});
const route = useRoute()
const route = useRoute();
watch(route, (newValue, oldValue) => {
if (window._czc) {
let location = window.location
let contentUrl = location.pathname + location.hash
let refererUrl = "/"
let location = window.location;
let contentUrl = location.pathname + location.hash;
let refererUrl = "/";
window._czc.push(["_trackPageview", contentUrl, refererUrl])
window._czc.push(["_setAutoPageview", false])
window._czc.push(["_trackPageview", contentUrl, refererUrl]);
window._czc.push(["_setAutoPageview", false]);
}
if (window._hmt) {
if (newValue["path"]) window._hmt.push(["_trackPageview", newValue["fullPath"]])
if (newValue["path"]) window._hmt.push(["_trackPageview", newValue["fullPath"]]);
}
})
});
const useSocketInterval = 50000 // Socket的时间间隔
const useSocketInterval = 50000; // Socket的时间间隔
const useSocket = () => {
let token = getMiucmsSessionCookie() || ""
socketTask = new WebSocket(`wss://app.gter.net/socket?token=${token}`)
let token = getMiucmsSessionCookie() || "";
socketTask = new WebSocket(`wss://app.gter.net/socket?token=${token}`);
socketTask.onopen = () => {
let user = store.state.user || {}
let user = store.state.user || {};
if (user && token) {
socketTask.send(
JSON.stringify({
@@ -56,46 +56,46 @@ const useSocket = () => {
uid: user.uid || 0,
},
})
)
);
}
setTimeout(() => timedTransmission(), useSocketInterval)
}
setTimeout(() => timedTransmission(), useSocketInterval);
};
socketTask.onclose = () => {
// timedTransmissionState = false
console.log("socket关闭了", new Date())
}
}
console.log("socket关闭了", new Date());
};
};
// let timedTransmissionState = false // 定时器启动状态
// 定时发送
const timedTransmission = () => {
// if (socketTask.readyState != 1 || timedTransmissionState) return
if (socketTask.readyState != 1) return
if (socketTask.readyState != 1) return;
// timedTransmissionState = true
socketTask.send(JSON.stringify({ type: "ping" }))
setTimeout(() => timedTransmission(), useSocketInterval)
}
socketTask.send(JSON.stringify({ type: "ping" }));
setTimeout(() => timedTransmission(), useSocketInterval);
};
const getMiucmsSessionCookie = () => {
let cookies = document.cookie.split(";")
let cookies = document.cookie.split(";");
for (let i = 0; i < cookies.length; i++) {
let cookie = cookies[i].split("=")
let cookie = cookies[i].split("=");
if (cookie[0].trim() === "miucms_session") {
return cookie[1]
return cookie[1];
}
}
return null
}
return null;
};
// 获取轮播图的 数据
const getBannerData = () => {
api.banner().then(res => {
api.banner().then((res) => {
if (res.code === 200) {
// bannerData
store.state.bannerData = res.data
store.state.bannerData = res.data;
}
})
}
});
};
</script>
<style lang="less">
header.page-header {
@@ -137,7 +137,6 @@ img {
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
}
.shadow {
@@ -180,7 +179,7 @@ img {
.box-min-1200-src {
min-width: 1200px;
overflow-x: scroll;
overflow-x: auto;
}
/* // 全局css 加上以下代码,可以隐藏上下箭头 */

View File

@@ -439,6 +439,13 @@
.content .details-box {
justify-content: space-between;
align-items: flex-start;
position: relative;
}
.content .details-box .details-left {
transition: bottom 0.5s;
}
.content .details-box .details-left.fixed {
position: fixed;
}
.content .details-box .details-left .special-offer {
width: 876px;
@@ -956,7 +963,6 @@
line-height: 24px;
font-size: 13px;
padding: 30px;
margin-bottom: 100px;
}
.content .details-box .details-left .details-item.hint-box .hint-item {
min-height: 24px;

View File

@@ -576,8 +576,15 @@
.details-box {
justify-content: space-between;
align-items: flex-start;
position: relative;
.details-left {
&.fixed {
position: fixed;
}
transition: bottom 0.5s;
.special-offer {
width: 876px;
position: relative;
@@ -1392,7 +1399,7 @@
line-height: 24px;
font-size: 13px;
padding: 30px;
margin-bottom: 100px;
// margin-bottom: 100px;
.hint-item {
min-height: 24px;

View File

@@ -32,11 +32,14 @@
</template>
<script setup>
import { defineProps } from "vue"
import { useRouter } from "vue-router";
const props = defineProps({
item: Object,
});
let router = useRouter();
const gobrand = (item) => router.push(`/apartmentDetail?uniqid=${item.uniqid}`);
</script>
@@ -47,9 +50,12 @@ const gobrand = (item) => router.push(`/apartmentDetail?uniqid=${item.uniqid}`);
border-radius: 17px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.117647058823529);
padding: 8px 0;
margin-bottom: 20px;
cursor: pointer;
&:not(:last-of-type) {
margin-bottom: 20px;
}
&:hover {
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.25686275);
}

View File

@@ -267,7 +267,6 @@ let pitchValue = ref({
watchEffect(() => {
// nearSchoolList = store.state.apartment.school || []
console.log('store.state.schoolList',store.state.schoolList);
nearSchoolList = store.state.schoolList || [];
roomTypeList = store.state.apartment.roomtype || [];
roomTypeKey = store.state.roomTypeKey || {};

View File

@@ -1,6 +1,6 @@
<template>
<!-- <div class="top-bg-img-box pos-r" :style="{ 'height': bannerLists.data.length ? '530px' : '260px' }"> -->
<div class="top-bg-img-box pos-r" :style="{ 'height': bannerLists.data.length ? '470px' : '260px' }">
<div class="top-bg-img-box pos-r" :style="{ height: bannerLists.data.length ? '450px' : '260px' }">
<img src="../../assets/homeImage/indexBg.jpg" class="bg-img" alt="" v-if="bannerLists.data.length" />
<img src="../../assets//img/edit/bj-img1920.png" class="bg-img" alt="" v-if="!bannerLists.data.length" />
<div class="info-box">
@@ -19,9 +19,7 @@
<div class="user-out-box">
<div class="box-bg dis-f jus-x">
<div class="top-box"></div>
<a :href="quitUrl" style="color: #fff;">
退出
</a>
<a :href="quitUrl" style="color: #fff"> 退出 </a>
</div>
</div>
</div>
@@ -31,18 +29,18 @@
</div>
</div>
</div>
<div class="dis-f jus-x al-item body-maxWidth" style="margin: auto;">
<div class="dis-f jus-x al-item body-maxWidth" style="margin: auto">
<div class="logo-box dis-f al-item body-maxWidth">
<img src="../../assets/homeImage/logo.png" class="logo-img" alt="" @click="goIndex()" />
<img src="../../assets/homeImage/logoText.png" class="logo-text-img" alt="" @click="goIndex()" />
</div>
</div>
<!-- <div class="dis-f jus-x al-item" style="margin-top:20px;" v-if="bannerLists.data.length"> -->
<div class="dis-f jus-x al-item" v-if="bannerLists.data.length">
<div class="dis-f jus-x al-item" v-if="bannerLists.data.length" style="margin-top: 37px">
<div class="body-maxWidth">
<el-carousel :interval="5000" arrow="always" height="330" style="height: 330px;" @change="carouselChange">
<el-carousel :interval="5000" arrow="always" style="height: 236px" @change="carouselChange">
<el-carousel-item v-for="(item, i) in bannerLists.data" :key="item.feedId">
<div style="width: 100%; height: 100%;" class="dis-f jus-x al-item">
<div style="width: 100%; height: 100%" class="dis-f jus-x al-item">
<img v-if="i >= carouselIndex - 1 && i <= carouselIndex + 1" class="carousel-img" :src="item.imageurl" alt="" :title="item.title" @click="openInfo(item)" />
</div>
</el-carousel-item>
@@ -50,10 +48,10 @@
</div>
</div>
<div class="btm-seach-btn-box dis-f al-item jus-x" v-if="pageTopBarShow">
<div class="body-maxWidth dis-f" style="height: 40px;">
<div class="body-maxWidth dis-f" style="height: 40px">
<div class="tab-btn dis-f al-item jus-x" :class="{ 'tab-btn-click': item.path === tabBtnType }" v-for="(item, i) in seachTab.data" :key="i" @click="changeTabBtnType(item)">
<el-badge v-if="item['path'] == '/user' && user.data['messagenum'] != 0" :value="user.data['messagenum']">
<div style="padding: 0 10px;">{{ item.name }}</div>
<div style="padding: 0 10px">{{ item.name }}</div>
</el-badge>
<div v-else>{{ item.name }}</div>
</div>
@@ -64,112 +62,114 @@
</template>
<script setup>
import store from "../../store/index"
import { useRoute, useRouter } from "vue-router"
import { reactive, watchEffect, ref, defineProps } from "vue"
import { goTologin } from "@/utils/util.js"
import store from "../../store/index";
import { useRoute, useRouter } from "vue-router";
import { reactive, watchEffect, ref, defineProps } from "vue";
import { goTologin } from "@/utils/util.js";
const props = defineProps({
bannerList: {
type: Array,
default: function () {
return []
return [];
},
},
})
});
//退出登录
let url = location.href
let quitUrl = ref(`https://passport.gter.net/login/quit?referer=${url}`)
let url = location.href;
let quitUrl = ref(`https://passport.gter.net/login/quit?referer=${url}`);
//个人信息
let user = reactive({ data: {} })
let user = reactive({ data: {} });
//组件数据
let topTab = reactive({ data: [] })
let seachTab = reactive({ data: [] })
let bannerLists = reactive({ data: [] })
let topTab = reactive({ data: [] });
let seachTab = reactive({ data: [] });
let bannerLists = reactive({ data: [] });
watchEffect(() => {
user.data = store.state.user
user.data = store.state.user;
// bannerLists.data = props.bannerList
if (!store.state.indexData.menu) return
store.state.indexData.menu.map(res => {
if (!store.state.indexData.menu) return;
store.state.indexData.menu.map((res) => {
if (res.name === "首页") {
res.path = "/"
res.path = "/";
} else if (res.name === "个人房源") {
res.path = "/personHousing"
res.path = "/personHousing";
} else if (res.name === "中介房源") {
res.path = "/intermediaryHousing"
res.path = "/intermediaryHousing";
} else if (res.name === "品牌公寓") {
res.path = "/apartment"
res.path = "/apartment";
} else if (res.name === "求房源") {
res.path = "/needHousing"
res.path = "/needHousing";
} else if (res.name === "我的") {
res.path = "/user"
res.path = "/user";
}
})
seachTab.data = store.state.indexData.menu
topTab.data = store.state.indexData.nav
})
});
seachTab.data = store.state.indexData.menu;
topTab.data = store.state.indexData.nav;
});
//顶部导航跳转
let topTabNum = ref("fang")
let topTabNum = ref("fang");
let topTabSelect = (type, item) => {
// topTabNum.value=type
window.open(item.url)
}
window.open(item.url);
};
//页面跳转
const router = useRouter()
let tabBtnType = ref("/")
const router = useRouter();
let tabBtnType = ref("/");
let pageTopBarShow = router.currentRoute.value.meta.topBarShow
let changeTabBtnType = item => {
let pageTopBarShow = router.currentRoute.value.meta.topBarShow;
let changeTabBtnType = (item) => {
// 判断点击进入 user 时是否已经登录
if (item["path"] == "/user" && (user.data["uid"] == 0 || user.data["uin"] == 0)) {
loginBtn("login")
return
loginBtn("login");
return;
}
tabBtnType.value = item.path
router.push({
path: item.path,
})
}
tabBtnType.value = item.path;
// router.push({
// path: item.path,
// })
let openInfo = data => {
window.open(data.url)
}
router.push(item.path);
};
let openInfo = (data) => {
window.open(data.url);
};
//监听路由
const route = useRoute()
let routePath = ref("")
routePath.value = route.meta.path
tabBtnType.value = route.meta.path
const route = useRoute();
let routePath = ref("");
routePath.value = route.meta.path;
tabBtnType.value = route.meta.path;
// 点击登录注册 type login 登录 register注册
const loginBtn = type => {
const loginBtn = (type) => {
if (type == "login") {
store.state.showloginmodal = true
return
store.state.showloginmodal = true;
return;
}
goTologin()
}
goTologin();
};
// 跳转首页
const goIndex = () => router.push("/")
const goIndex = () => router.push("/");
watchEffect(() => {
if (routePath.value == "/needHousing") bannerLists.data = store.state.bannerData.needHousing || []
else if (routePath.value == "/intermediaryHousing") bannerLists.data = store.state.bannerData.intermediaryHousing || []
else if (routePath.value == "/personHousing") bannerLists.data = store.state.bannerData.personHousing || []
else if (routePath.value == "/apartment") bannerLists.data = store.state.bannerData.apartment || []
else if (routePath.value == "/") bannerLists.data = store.state.bannerData.home || []
})
if (routePath.value == "/needHousing") bannerLists.data = store.state.bannerData.needHousing || [];
else if (routePath.value == "/intermediaryHousing") bannerLists.data = store.state.bannerData.intermediaryHousing || [];
else if (routePath.value == "/personHousing") bannerLists.data = store.state.bannerData.personHousing || [];
else if (routePath.value == "/apartment") bannerLists.data = store.state.bannerData.apartment || [];
else if (routePath.value == "/") bannerLists.data = store.state.bannerData.home || [];
});
let carouselIndex = ref(0) // 轮播图的索引
let carouselIndex = ref(0); // 轮播图的索引
const carouselChange = value => {
carouselIndex.value = value
}
const carouselChange = (value) => {
carouselIndex.value = value;
};
</script>
<style lang="less" scoped>
.pos-r {
@@ -320,8 +320,9 @@ const carouselChange = value => {
.carousel-img {
margin: 0 auto;
width: 660px;
height: 280px;
// width: 660px;
// height: 280px;
height: 200px;
border-radius: 15px;
cursor: pointer;
}
@@ -405,6 +406,10 @@ const carouselChange = value => {
text-align: left;
}
/deep/ .el-carousel__container {
height: 200px;
}
.dropdown {
background: #000;
}

View File

@@ -71,7 +71,7 @@
<div class="collect-type flexacenter">
<div class="collect flexacenter flex1">
<img class="flame-icon" src="@/assets/img/publicImage/flame-icon.png" />
近15天{{ item.collectnum }}收藏
近15天{{ item.collectnum }}感兴趣
</div>
<div class="house-type flexacenter">
{{ item.roomnum || 0 }}个房型

View File

@@ -2,7 +2,7 @@
<page-top-bar></page-top-bar>
<div class="content wid1200">
<div class="header">
<div class="header" ref="headerRef">
<div class="top flexflex">
<div class="brand-abstract flexflex">
<div class="flexacenter" style="height: min-content">
@@ -92,7 +92,7 @@
</div>
</div>
<div class="figure flexacenter">
<div class="figure flexacenter" v-if="distancePitch?.alias">
距离
<div class="school">{{ distancePitch.alias }}</div>
{{ distancePitch.distance }}km
@@ -100,7 +100,7 @@
</div>
<div class="vehicle flexflex">
<div class="item flexacenter" v-for="(item, index) in distancePitch.obj" :key="index">
<div class="item flexacenter" v-for="(item, index) in distancePitch?.obj" :key="index">
<img v-if="index == 'walking'" class="icon" src="@/assets/img/apartmentDetail/walk-icon.png" />
<img v-if="index == 'driving'" class="icon" src="@/assets/img/apartmentDetail/taxi-icon.png" />
<img v-if="index == 'transit'" class="icon" src="@/assets/img/apartmentDetail/subway-icon.png" />
@@ -122,7 +122,7 @@
</div>
</div>
<div class="operate-box-bj flexcenter">
<div class="operate-box-bj flexcenter" v-if="isOperateShow">
<div class="operate-box flexacenter" aria-label="详情的导航栏">
<div class="nav-box flexacenter">
<div class="nav-item flexcenter" :class="{ pitch: navTab == item.value }" :aria-label="`${item['name']}-按钮`" v-for="(item, index) in navList" :key="index" @click="handleClickNav(item.value)">{{ item["value"] == "roomEle" ? `${item["name"]} ${roomList.length}` : item["name"] }}</div>
@@ -142,107 +142,108 @@
</div>
</div>
</div>
<div class="details-box flexflex">
<div class="details-left flex1" ref="detailsLeft">
<div class="special-offer" v-if="info.promotionalactivities" ref="specialEle">
<img class="special-bj" src="@/assets/img/publicImage/special-bj.svg" />
<img class="head" src="@/assets/img/publicImage/special-title.png" />
<img class="gift" src="@/assets/img/publicImage/special-gift.png" />
<img class="star1" src="@/assets/img/publicImage/special-star-1.png" />
<img class="star2" src="@/assets/img/publicImage/special-star-2.png" />
<img class="star3" src="@/assets/img/publicImage/special-star-3.png" />
<img class="fireworks" src="@/assets/img/publicImage/special-fireworks.png" />
<div class="board">
<div class="gray">
<p class="text" user-select>{{ info.promotionalactivities }}</p>
</div>
</div>
<img class="bottom-white" src="@/assets/img/publicImage/special-bottom-white.svg" />
<img class="bottom-orange" src="@/assets/img/publicImage/special-bottom-orange.svg" />
</div>
<div class="remark" ref="inspectEle" v-if="spotSum > 0" @click="openInspectPop">
<div class="head flexacenter">
<div class="text">寄托实地考察</div>
<div class="more flexacenter">
{{ spotSum }}
<img class="icon" src="@/assets/img/publicImage/arrow-black-down.svg" />
</div>
</div>
<div class="inspect flexacenter">
<div class="left flex1">
<div class="info flexacenter">
<img class="avatar" :src="spotObj.avatar" />
<div class="username">{{ spotObj.nickname }}</div>
<img class="label" :src="spotObj.groupimage" />
<div class="details-box flexflex" ref="detailsBox">
<div class="flex1">
<div class="details-left flex1" :class="{ fixed: isFixed }" :style="{ bottom: FixedBottom + 'px' }" ref="detailsLeft">
<div class="special-offer" v-if="info.promotionalactivities" ref="specialEle">
<img class="special-bj" src="@/assets/img/publicImage/special-bj.svg" />
<img class="head" src="@/assets/img/publicImage/special-title.png" />
<img class="gift" src="@/assets/img/publicImage/special-gift.png" />
<img class="star1" src="@/assets/img/publicImage/special-star-1.png" />
<img class="star2" src="@/assets/img/publicImage/special-star-2.png" />
<img class="star3" src="@/assets/img/publicImage/special-star-3.png" />
<img class="fireworks" src="@/assets/img/publicImage/special-fireworks.png" />
<div class="board">
<div class="gray">
<p class="text" user-select>{{ info.promotionalactivities }}</p>
</div>
<div class="explain two-line-text">{{ spotObj.content }}</div>
</div>
<img class="inspect-img" :src="spotObj.sources[0].thumbnail" />
</div>
</div>
<div class="remark" ref="followEle" v-if="returnSum > 0" @click="openInspectPop">
<div class="head flexacenter">
<div class="text">寄托回访</div>
<div class="more flexacenter">
{{ returnSum }}
<img class="icon" src="@/assets/img/publicImage/arrow-black-down.svg" />
</div>
<img class="bottom-white" src="@/assets/img/publicImage/special-bottom-white.svg" />
<img class="bottom-orange" src="@/assets/img/publicImage/special-bottom-orange.svg" />
</div>
<div class="return-visit flexacenter" scroll-x>
<template v-for="(item, index) in remarkList" :key="index">
<div class="item flex1" v-if="item.typeid == 2">
<div class="remark" ref="inspectEle" v-if="spotSum > 0" @click="openInspectPop">
<div class="head flexacenter">
<div class="text">寄托实地考察</div>
<div class="more flexacenter">
{{ spotSum }}
<img class="icon" src="@/assets/img/publicImage/arrow-black-down.svg" />
</div>
</div>
<div class="inspect flexacenter">
<div class="left flex1">
<div class="info flexacenter">
<img class="avatar" :src="item.avatar" />
<div class="username">{{ item.nickname }}</div>
<div class="label flexacenter">已入住</div>
<img class="avatar" :src="spotObj.avatar" />
<div class="username">{{ spotObj.nickname }}</div>
<img class="label" :src="spotObj.groupimage" />
</div>
<div class="explain two-line-text">{{ item.content }}</div>
<div class="explain two-line-text">{{ spotObj.content }}</div>
</div>
</template>
</div>
</div>
<!-- 房间类型 -->
<div class="type-box" v-if="roomList.length !== 0" ref="roomEle">
<div class="item flexacenter" v-for="(item, index) in roomList" :key="index">
<div class="media" v-if="item.thumbnail" @click="cloaseImageShow([...item['videos'], ...item['images']], 0, `media${index}`)">
<img class="icon" :src="item.thumbnail" />
<img v-if="item.isVideo" class="play" src="@/assets/img/publicImage/video-icon.svg" />
</div>
<div class="info flex1">
<div class="name">{{ item.name }}</div>
<div class="tags flexflex">
<div class="tags-item green" v-if="item.allowance">剩余{{ item.allowance }}</div>
<div class="tags-item" v-for="(item, index) in item.tags" key="index">{{ item }}</div>
</div>
<div class="price flexflex">
<div class="unit">HK$</div>
<div class="number">{{ item.discountprice || item.price }}</div>
<div class="month">/</div>
<div class="original" v-if="item.discountprice">HK$ {{ item.price }}/</div>
</div>
</div>
<div class="btn flexacenter">
<div v-if="item.iscollection" class="collect flexcenter red" @click="roomCollect(item.id, index)">
<img class="icon" src="@/assets/img/apartmentDetail/collect-red.svg" />
已收藏
</div>
<div v-else class="collect flexcenter" @click="roomCollect(item.id, index)">
<img class="icon" src="@/assets/img/apartmentDetail/collect-hollow-black.svg" />
收藏
</div>
<div v-if="item.status == 1" class="consult flexcenter" @click="modificationContact">
<img class="icon" src="@/assets/img/apartmentDetail/consult-icon.png" />
咨询
</div>
<div v-else class="full-rent flexcenter">已租满</div>
<img class="inspect-img" :src="spotObj.sources[0].thumbnail" />
</div>
</div>
<!-- <div class="type-item flexacenter" v-for="(item, index) in roomList" :key="index">
<div class="remark" ref="followEle" v-if="returnSum > 0" @click="openInspectPop">
<div class="head flexacenter">
<div class="text">寄托回访</div>
<div class="more flexacenter">
{{ returnSum }}
<img class="icon" src="@/assets/img/publicImage/arrow-black-down.svg" />
</div>
</div>
<div class="return-visit flexacenter" scroll-x>
<template v-for="(item, index) in remarkList" :key="index">
<div class="item flex1" v-if="item.typeid == 2">
<div class="info flexacenter">
<img class="avatar" :src="item.avatar" />
<div class="username">{{ item.nickname }}</div>
<div class="label flexacenter">已入住</div>
</div>
<div class="explain two-line-text">{{ item.content }}</div>
</div>
</template>
</div>
</div>
<!-- 房间类型 -->
<div class="type-box" v-if="roomList.length !== 0" ref="roomEle">
<div class="item flexacenter" v-for="(item, index) in roomList" :key="index">
<div class="media" v-if="item.thumbnail" @click="cloaseImageShow([...item['videos'], ...item['images']], 0, `media${index}`)">
<img class="icon" :src="item.thumbnail" />
<img v-if="item.isVideo" class="play" src="@/assets/img/publicImage/video-icon.svg" />
</div>
<div class="info flex1">
<div class="name">{{ item.name }}</div>
<div class="tags flexflex">
<div class="tags-item green" v-if="item.allowance">剩余{{ item.allowance }}</div>
<div class="tags-item" v-for="(item, index) in item.tags" key="index">{{ item }}</div>
</div>
<div class="price flexflex">
<div class="unit">HK$</div>
<div class="number">{{ item.discountprice || item.price }}</div>
<div class="month">/</div>
<div class="original" v-if="item.discountprice">HK$ {{ item.price }}/</div>
</div>
</div>
<div class="btn flexacenter">
<div v-if="item.iscollection" class="collect flexcenter red" @click="roomCollect(item.id, index)">
<img class="icon" src="@/assets/img/apartmentDetail/collect-red.svg" />
已收藏
</div>
<div v-else class="collect flexcenter" @click="roomCollect(item.id, index)">
<img class="icon" src="@/assets/img/apartmentDetail/collect-hollow-black.svg" />
收藏
</div>
<div v-if="item.status == 1" class="consult flexcenter" @click="modificationContact">
<img class="icon" src="@/assets/img/apartmentDetail/consult-icon.png" />
咨询
</div>
<div v-else class="full-rent flexcenter">已租满</div>
</div>
</div>
<!-- <div class="type-item flexacenter" v-for="(item, index) in roomList" :key="index">
<div class="type-left flex1">
<div class="type-name">{{ item["name"] }}</div>
<div class="type-tags flexacenter" v-if="item.allowance || item.tags.length != 0">
@@ -285,27 +286,27 @@
<div class="full-occupancy flexcenter" v-else>已租满</div>
</div>
</div> -->
</div>
<!-- 费用说明 -->
<div class="details-item cost" v-if="costList.length > 0" ref="costEle">
<div class="details-header flexacenter">
<img class="icon" src="@/assets/img/apartmentDetail/cost-icon.png" />
费用说明
</div>
<div class="cost-box">
<div class="item" v-for="(item, index) in costList" :key="index">
<div class="head flexacenter">
<img class="icon" :src="require('@/assets/img/apartmentDetail/' + item.img)" />
{{ item.name }}
<!-- 费用说明 -->
<div class="details-item cost" v-if="costList.length > 0" ref="costEle">
<div class="details-header flexacenter">
<img class="icon" src="@/assets/img/apartmentDetail/cost-icon.png" />
费用说明
</div>
<div class="cost-box">
<div class="item" v-for="(item, index) in costList" :key="index">
<div class="head flexacenter">
<img class="icon" :src="require('@/assets/img/apartmentDetail/' + item.img)" />
{{ item.name }}
</div>
<div class="explain">{{ item.text }}</div>
</div>
<div class="explain">{{ item.text }}</div>
</div>
</div>
</div>
<!-- 优惠活动 -->
<!-- <div class="details-item special-offer" v-if="info['promotionalactivities']" ref="specialEle">
<!-- 优惠活动 -->
<!-- <div class="details-item special-offer" v-if="info['promotionalactivities']" ref="specialEle">
<div class="details-header flexacenter">
<img class="icon" src="@/assets/img/apartmentDetail/special-offer.svg" />
优惠活动
@@ -313,166 +314,166 @@
<div class="text" v-html="info['promotionalactivities']"></div>
</div> -->
<!-- 地址 -->
<div class="details-item location" v-if="info.address" ref="addressEle">
<div class="details-header flexacenter">
<img class="icon" src="@/assets/img/apartmentDetail/bus-icon.svg" />
{{ info.location || "交通" }}
</div>
<view-map ref="viewMapRef" :latlng="{ latitude: info['coordinate'][0], longitude: info['coordinate'][1] }" :name="info['address']"></view-map>
<!-- 地址 -->
<div class="details-item location" v-if="info.address" ref="addressEle">
<div class="details-header flexacenter">
<img class="icon" src="@/assets/img/apartmentDetail/bus-icon.svg" />
{{ info.location || "交通" }}
</div>
<view-map ref="viewMapRef" :latlng="{ latitude: info['coordinate'][0], longitude: info['coordinate'][1] }" :name="info['address']"></view-map>
<template v-if="false">
<el-popover :width="814" trigger="click" popper-style="padding: 0" :show-arrow="false" v-model:visible="showDistance">
<template #reference>
<div class="annex-school-box flexacenter">
<div class="annex-left flex1 flexacenter">
<div class="annex-school-item flexflex flex1" @click="selectIndex()" v-if="specialSchoolDistance">
<div class="distance-item-value special flexacenter">
<div class="mileage">{{ specialSchoolDistance.distanceText }}</div>
<img v-if="specialSchoolDistance.toolText == '步行'" class="tool-icon" src="@/assets/img/detail/walk-icon.png" />
<img v-else class="tool-icon" src="@/assets/img/detail/subway-icon.png" />
<div class="tool-time">{{ specialSchoolDistance?.durationText }}</div>
</div>
<div class="flexcenter">
<img src="@/assets/img/detail/markIcon.svg" class="marker-icon" alt="" />
</div>
<div class="alias-text flexcenter">{{ specialSchoolDistance.alias || "都大" }}</div>
</div>
<div class="annex-school-item flexflex flex1" v-for="(item, index) in annexSchoolOmit" :key="index" @click="selectIndex(item.id)">
<div class="distance-item-value flexacenter">
<div class="mileage">{{ item.distanceText || "2.0km" }}</div>
<img v-if="!item.list[0].publictransport" class="tool-icon" src="@/assets/img/detail/walk-icon.png" />
<img v-else class="tool-icon" src="@/assets/img/detail/subway-icon.png" />
<div class="tool-time">{{ item.list[0]?.publictransport?.durationText2 || item.list[0]?.durationText2 || "41min" }}</div>
</div>
<div class="flexcenter">
<img src="@/assets/img/detail/markIcon.svg" class="marker-icon" alt="" />
</div>
<div class="alias-text flexcenter">{{ item.alias || "都大" }}</div>
</div>
<div class="line-img"></div>
</div>
<div class="annex-btn flexcenter">
<img class="annex-btn-bj" src="@/assets/img/detail/infoBtnBg.svg" />
更多
<img class="annex-btn-icon" src="@/assets/img/detail/arrowIcon.svg" />
</div>
</div>
</template>
<div class="distance-info-box pos-r" :style="{ height: `${50 * annexSchoolList.length + 70}px` }">
<div class="title-box dis-f al-item jus-x">
房源
<img class="distance-arrow" src="@/assets/img/detail/arrow-circle-blue.svg" />
院校
<img src="../assets/img/detail/close.png" class="close-icon" @click="showDistance = false" alt="" />
</div>
<div class="distance-info-data dis-f">
<div class="distance-info-left">
<div class="distance-info-left-item flexcenter" :class="{ pitch: index == academyPitchIndex }" v-for="(item, index) in annexSchoolList" :key="index" @click="selectAcademyIndex(index)">{{ item.alias }}</div>
</div>
<el-scrollbar ref="elscrollbarRef" :style="{ height: 50 * annexSchoolList.length + 'px' }">
<div class="distance-info-right flex1">
<div class="distance-header-box flexacenter">
<div class="flexacenter">
<div class="distance-header-icon flexcenter">
<img src="@/assets/img/detail/home.png" alt="" class="distance-header-img" />
</div>
{{ targetAcademyPitch.school }}
<template v-if="false">
<el-popover :width="814" trigger="click" popper-style="padding: 0" :show-arrow="false" v-model:visible="showDistance">
<template #reference>
<div class="annex-school-box flexacenter">
<div class="annex-left flex1 flexacenter">
<div class="annex-school-item flexflex flex1" @click="selectIndex()" v-if="specialSchoolDistance">
<div class="distance-item-value special flexacenter">
<div class="mileage">{{ specialSchoolDistance.distanceText }}</div>
<img v-if="specialSchoolDistance.toolText == '步行'" class="tool-icon" src="@/assets/img/detail/walk-icon.png" />
<img v-else class="tool-icon" src="@/assets/img/detail/subway-icon.png" />
<div class="tool-time">{{ specialSchoolDistance?.durationText }}</div>
</div>
<div class="distance-header-hint">本数据来自高德地图仅供参考</div>
<div class="flexcenter">
<img src="@/assets/img/detail/markIcon.svg" class="marker-icon" alt="" />
</div>
<div class="alias-text flexcenter">{{ specialSchoolDistance.alias || "都大" }}</div>
</div>
<div class="academy-school-item" v-for="(item, index) in targetAcademyPitch.list" :key="index">
<div class="academy-school-item-header flexacenter">
<div class="academy-school-item-left flexacenter">
<div class="academy-school-item-name">{{ item.title }}</div>
<div class="academy-school-item-number">{{ item.distanceText || "1km" }}</div>
</div>
<div class="academy-school-item-right flexacenter">
<img v-if="item.publictransport" class="academy-school-item-icon" src="@/assets/img/detail/subway-icon.png" mode="widthFix" />
<img v-else class="academy-school-item-icon" src="@/assets/img/detail/walk-icon.png" mode="widthFix" />
<div class="academy-school-item-time">{{ item?.publictransport?.durationText || item.durationText || "1分钟" }}</div>
</div>
<img class="arrow-green" mode="widthFix" src="@/assets/img/detail/arrow-green.svg" />
<div class="annex-school-item flexflex flex1" v-for="(item, index) in annexSchoolOmit" :key="index" @click="selectIndex(item.id)">
<div class="distance-item-value flexacenter">
<div class="mileage">{{ item.distanceText || "2.0km" }}</div>
<img v-if="!item.list[0].publictransport" class="tool-icon" src="@/assets/img/detail/walk-icon.png" />
<img v-else class="tool-icon" src="@/assets/img/detail/subway-icon.png" />
<div class="tool-time">{{ item.list[0]?.publictransport?.durationText2 || item.list[0]?.durationText2 || "41min" }}</div>
</div>
<div class="academy-school-item-journey" v-if="item.publictransport">
<div class="journey-item flexacenter" v-for="(item, index) in item.publictransport.segments" :key="index">
<div class="circle"></div>
<!-- 步行 骑行 -->
<div v-if="item.type == 'walking'" class="journey-value flex1">步行{{ item.distanceText }}</div>
<!-- 地铁 -->
<div v-else-if="item.type == 'bus' && item.bustype == '地铁线路'" class="journey-value flex1 subway flexacenter">
<div class="subway-name flexcenter">{{ item.name }}</div>
<div class="flex1" style="white-space: nowrap">{{ item.via_num }}·{{ item.durationText }}</div>
<div class="flexcenter">
<img src="@/assets/img/detail/markIcon.svg" class="marker-icon" alt="" />
</div>
<div class="alias-text flexcenter">{{ item.alias || "都大" }}</div>
</div>
<div class="line-img"></div>
</div>
<div class="annex-btn flexcenter">
<img class="annex-btn-bj" src="@/assets/img/detail/infoBtnBg.svg" />
更多
<img class="annex-btn-icon" src="@/assets/img/detail/arrowIcon.svg" />
</div>
</div>
</template>
<div class="distance-info-box pos-r" :style="{ height: `${50 * annexSchoolList.length + 70}px` }">
<div class="title-box dis-f al-item jus-x">
房源
<img class="distance-arrow" src="@/assets/img/detail/arrow-circle-blue.svg" />
院校
<img src="../assets/img/detail/close.png" class="close-icon" @click="showDistance = false" alt="" />
</div>
<div class="distance-info-data dis-f">
<div class="distance-info-left">
<div class="distance-info-left-item flexcenter" :class="{ pitch: index == academyPitchIndex }" v-for="(item, index) in annexSchoolList" :key="index" @click="selectAcademyIndex(index)">{{ item.alias }}</div>
</div>
<el-scrollbar ref="elscrollbarRef" :style="{ height: 50 * annexSchoolList.length + 'px' }">
<div class="distance-info-right flex1">
<div class="distance-header-box flexacenter">
<div class="flexacenter">
<div class="distance-header-icon flexcenter">
<img src="@/assets/img/detail/home.png" alt="" class="distance-header-img" />
</div>
<!-- 公交 -->
<div v-else-if="item.type == 'bus' && item.bustype == '普通公交线路'" class="journey-value flex1 bus flexacenter">
<div class="bus-name flexcenter">{{ item.name }}</div>
<div class="flex1" style="white-space: nowrap">{{ item.via_num }}·{{ item.durationText }}</div>
{{ targetAcademyPitch.school }}
</div>
<div class="distance-header-hint">本数据来自高德地图仅供参考</div>
</div>
<div class="academy-school-item" v-for="(item, index) in targetAcademyPitch.list" :key="index">
<div class="academy-school-item-header flexacenter">
<div class="academy-school-item-left flexacenter">
<div class="academy-school-item-name">{{ item.title }}</div>
<div class="academy-school-item-number">{{ item.distanceText || "1km" }}</div>
</div>
<div class="academy-school-item-right flexacenter">
<img v-if="item.publictransport" class="academy-school-item-icon" src="@/assets/img/detail/subway-icon.png" mode="widthFix" />
<img v-else class="academy-school-item-icon" src="@/assets/img/detail/walk-icon.png" mode="widthFix" />
<div class="academy-school-item-time">{{ item?.publictransport?.durationText || item.durationText || "1分钟" }}</div>
</div>
<img class="arrow-green" mode="widthFix" src="@/assets/img/detail/arrow-green.svg" />
</div>
<div class="academy-school-item-journey" v-if="item.publictransport">
<div class="journey-item flexacenter" v-for="(item, index) in item.publictransport.segments" :key="index">
<div class="circle"></div>
<!-- 步行 骑行 -->
<div v-if="item.type == 'walking'" class="journey-value flex1">步行{{ item.distanceText }}</div>
<!-- 地铁 -->
<div v-else-if="item.type == 'bus' && item.bustype == '地铁线路'" class="journey-value flex1 subway flexacenter">
<div class="subway-name flexcenter">{{ item.name }}</div>
<div class="flex1" style="white-space: nowrap">{{ item.via_num }}·{{ item.durationText }}</div>
</div>
<!-- 公交 -->
<div v-else-if="item.type == 'bus' && item.bustype == '普通公交线路'" class="journey-value flex1 bus flexacenter">
<div class="bus-name flexcenter">{{ item.name }}</div>
<div class="flex1" style="white-space: nowrap">{{ item.via_num }}·{{ item.durationText }}</div>
</div>
</div>
</div>
</div>
</div>
</div>
</el-scrollbar>
</el-scrollbar>
</div>
</div>
</div>
</el-popover>
</template>
</el-popover>
</template>
<!-- 交通 -->
<div class="traffic-box" v-if="info['traffic']">
<!-- <div class="traffic-title item-title flexcenter">交通</div> -->
<div class="traffic-content" v-html="info['traffic']"></div>
</div>
</div>
<!-- 公寓设施 -->
<div class="details-item apartment-facilities" :class="{ hide: isHideFacilities }" v-if="facilitylist.length > 0" ref="facilitiesEle">
<div class="details-header flexacenter">
<img class="icon" src="@/assets/img/apartmentDetail/apartment-facilities.svg" />
公寓设施
<!-- 交通 -->
<div class="traffic-box" v-if="info['traffic']">
<!-- <div class="traffic-title item-title flexcenter">交通</div> -->
<div class="traffic-content" v-html="info['traffic']"></div>
</div>
</div>
<div class="facility-box">
<div class="item" v-for="(item, index) in facilitylist" :key="index">
<div class="head">{{ item.name }}{{ item.label.length }}</div>
<div class="label flexflex">
<div class="label-item flexacenter" v-for="(item, index) in item.label" :key="index">
<img class="icon" src="@/assets/img/apartmentDetail/tick-circle-baby-blue.svg" />
{{ item }}
<!-- 公寓设施 -->
<div class="details-item apartment-facilities" :class="{ hide: isHideFacilities }" v-if="facilitylist.length > 0" ref="facilitiesEle">
<div class="details-header flexacenter">
<img class="icon" src="@/assets/img/apartmentDetail/apartment-facilities.svg" />
公寓设施
</div>
<div class="facility-box">
<div class="item" v-for="(item, index) in facilitylist" :key="index">
<div class="head">{{ item.name }}{{ item.label.length }}</div>
<div class="label flexflex">
<div class="label-item flexacenter" v-for="(item, index) in item.label" :key="index">
<img class="icon" src="@/assets/img/apartmentDetail/tick-circle-baby-blue.svg" />
{{ item }}
</div>
</div>
</div>
<div class="img-box flexflex" v-if="item.images.length > 0">
<div class="img-item" v-for="(item, index) in item.images" :key="index" @click="openFacilitiesImg(item.imageurl)">
<img class="icon" :src="item.thumbnail" />
<div class="name">{{ item.name }}</div>
<div class="img-box flexflex" v-if="item.images.length > 0">
<div class="img-item" v-for="(item, index) in item.images" :key="index" @click="openFacilitiesImg(item.imageurl)">
<img class="icon" :src="item.thumbnail" />
<div class="name">{{ item.name }}</div>
</div>
</div>
</div>
</div>
<div class="bottom-btn flexcenter" v-if="isHideFacilities" @click="openFacilities">
展开全部
<img class="icon" src="@/assets/img/publicImage/arrow-black-solid.svg" />
</div>
</div>
<div class="bottom-btn flexcenter" v-if="isHideFacilities" @click="openFacilities">
展开全部
<img class="icon" src="@/assets/img/publicImage/arrow-black-solid.svg" />
</div>
</div>
<!-- 房源详情 -->
<div class="details-item details-message" :class="{ hide: isHideDetails }" v-if="info['message']" ref="messageEle">
<div class="details-header flexacenter">
<img class="icon" src="@/assets/img/apartmentDetail/listing-details.png" />
房源详情
<!-- 房源详情 -->
<div class="details-item details-message" :class="{ hide: isHideDetails }" v-if="info['message']" ref="messageEle">
<div class="details-header flexacenter">
<img class="icon" src="@/assets/img/apartmentDetail/listing-details.png" />
房源详情
</div>
<div class="text" v-html="info['message']"></div>
<div class="bottom-btn flexcenter" v-if="isHideDetails" @click="openDetails">
展开全部
<img class="icon" src="@/assets/img/publicImage/arrow-black-solid.svg" />
</div>
</div>
<div class="text" v-html="info['message']"></div>
<div class="bottom-btn flexcenter" v-if="isHideDetails" @click="openDetails">
展开全部
<img class="icon" src="@/assets/img/publicImage/arrow-black-solid.svg" />
</div>
</div>
<!-- 公寓设施 -->
<!-- <div class="details-item apartment-facilities" v-if="info['facilities']" ref="facilitiesEle">
<!-- 公寓设施 -->
<!-- <div class="details-item apartment-facilities" v-if="info['facilities']" ref="facilitiesEle">
<div class="details-header flexacenter">
<img class="icon" src="@/assets/img/apartmentDetail/apartment-facilities.svg" />
公寓设施
@@ -494,32 +495,34 @@
</div>
</div> -->
<!-- 生活 -->
<div class="details-item life" v-if="info['life']" ref="lifeEle">
<div class="details-header flexacenter">
<img class="icon" src="@/assets/img/apartmentDetail/live.png" />
生活配套
<!-- 生活 -->
<div class="details-item life" v-if="info['life']" ref="lifeEle">
<div class="details-header flexacenter">
<img class="icon" src="@/assets/img/apartmentDetail/live.png" />
生活配套
</div>
<div class="text" v-html="info['life']"></div>
</div>
<div class="text" v-html="info['life']"></div>
</div>
<!-- 品牌介绍 -->
<div class="details-item company" v-if="company" ref="companyEle">
<div class="details-header flexacenter">
<img class="icon" style="width: 20px; height: 20px" src="@/assets/img/apartmentDetail/introduce-icon.png" />
品牌介绍
<!-- 品牌介绍 -->
<div class="details-item company" v-if="company" ref="companyEle">
<div class="details-header flexacenter">
<img class="icon" style="width: 20px; height: 20px" src="@/assets/img/apartmentDetail/introduce-icon.png" />
品牌介绍
</div>
<img class="company-img flexflex" v-lazy="company['imageurl']" />
<div class="text" v-html="company['introduction']"></div>
</div>
<img class="company-img flexflex" v-lazy="company['imageurl']" />
<div class="text" v-html="company['introduction']"></div>
</div>
<div class="details-item hint-box">
<div class="hint-item">温馨提示房源信息均由公寓方/酒店提供并对其真实性合法性等负责平台不负责甄别和审核具体内容真实性和有效性等请务必仔细核实相关信息谨防上当受骗</div>
<div class="hint-item"></div>
<div class="hint-item flexacenter">公寓/酒店/中介房源推广合作请联系<a @click="copy('ad@gter.net')">ad@gter.net</a></div>
<div class="details-item hint-box">
<div class="hint-item">温馨提示房源信息均由公寓方/酒店提供并对其真实性合法性等负责平台不负责甄别和审核具体内容真实性和有效性等请务必仔细核实相关信息谨防上当受骗</div>
<div class="hint-item"></div>
<div class="hint-item flexacenter">公寓/酒店/中介房源推广合作请联系<a @click="copy('ad@gter.net')">ad@gter.net</a></div>
</div>
</div>
</div>
<div class="details-right flexacenter">
<div class="details-right flexacenter" ref="detailsRigth">
<phoneqrcode type="apartment" :qrcode="qrcode"></phoneqrcode>
<groupqrcode type="apartment"></groupqrcode>
<!-- 同品牌公寓 -->
@@ -692,7 +695,7 @@ watch(route, () => {
mediaBtnstate.value = {};
slideshowList.value = null;
detailsLeft.value = null;
// detailsLeft.value = null;
token = "";
carouselIndex.value = 0;
@@ -792,7 +795,7 @@ const facilityKeyName = {
room: "房间设施",
};
const facilityArr = ["public", "room", "service", "sport", "outdoor", "security"]; // 公寓设施 顺序
const facilityArr = ["room", "public", "service", "sport", "outdoor", "security"]; // 公寓设施 顺序
let facilitylist = ref([]);
let costList = ref([]);
@@ -1105,7 +1108,9 @@ const handleNavData = () => {
// 处理点击nav 滚动事件
const handleClickNav = (value) => {
let scrollTop = eval(value).value.offsetTop + 136;
const headerHeight = headerRef.value.getBoundingClientRect().height + 20 + 260 - 36 - 20;
let scrollTop = eval(value).value.offsetTop + headerHeight;
window.scrollTo({ top: scrollTop, behavior: "smooth" });
};
@@ -1211,6 +1216,7 @@ const slideshowItem = (index) => remarkCaruselUp.value.setActiveItem(index);
const slideshowType = (type) => slideshowItem(carouselsconfig.value[type].index);
let detailsLeft = ref(null);
let detailsRigth = ref(null);
onMounted(() => {
window.addEventListener("scroll", handleScroll);
@@ -1220,8 +1226,43 @@ onUnmounted(() => {
window.removeEventListener("scroll", handleScroll);
});
let isFixed = ref(false); // 详情左侧是否固定
let FixedBottom = ref(0); // 详情左侧固定的距离
let detailsBox = ref(null); // 详情的节点
let headerRef = ref(null); // 头部节点
let isOperateShow = ref(true); // 底部操作栏是否显示
const handleScroll = () => {
if (Math.random() > 0.3) return;
let body = document.documentElement ? document.documentElement : document.body ? document.body : document.querySelector(".element")
let offsetHeight = body.offsetHeight
const clientHeight = document.documentElement.clientHeight;
const scrollTop = document.documentElement.scrollTop;
const top = scrollTop + clientHeight;
const headerHeight = headerRef.value.getBoundingClientRect().height + 20;
const left = detailsLeft.value.getBoundingClientRect();
const rigth = detailsRigth.value.getBoundingClientRect();
const leftHeight = left.height;
const rigthHeight = rigth.height;
if (leftHeight < rigthHeight) {
// 整个左边高度到顶部的距离
const topDistance = 260 - 36 + headerHeight + leftHeight + 223;
if (top > topDistance && isFixed.value == false) {
isFixed.value = true;
FixedBottom.value = document.querySelector(".index-footer").getBoundingClientRect().height + 20
}
if (top < topDistance && isFixed.value == true) isFixed.value = false;
}
if (scrollTop + clientHeight >= offsetHeight - 200) isOperateShow.value = false;
else isOperateShow.value = true;
for (let i = 0; i < navList.value.length; i++) {
let element = navList.value[i];

View File

@@ -170,7 +170,7 @@
<span v-for="(item, i) in housingInfo['data'] && housingInfo['data'].info.sunshinearea" :key="i"><span v-show="i != 0">/</span>{{ item == 0 ? "不限" : indexData["data"] && indexData["data"]["config"] && indexData["data"]["config"]["sunshinearea"][item] }} </span>
</div>
</div>
<div class="info dis-f al-item" v-if="housingInfo['data'] && housingInfo['data'].info.acreage[0]">
<div class="info dis-f al-item" v-if="housingInfo['data'] && housingInfo['data'].info.acreage?.[0]">
<div class="title-box">
面积
</div>

View File

@@ -86,8 +86,17 @@ onMounted(() => {
// pitchValue.value = store.getters.getApartmentPitchValue
const value = localStorage.getItem("apartmentPitchValue");
if (value) pitchValue.value = JSON.parse(value);
let value = localStorage.getItem("apartmentPitchValue");
if (value) {
value = JSON.parse(value);
// 判断 学校id是否在筛选
if (value["school"]) {
const schoolList = store.state.schoolList || [];
const isExist = schoolList.some((item) => item.sid == value["school"]);
if (!isExist) value["school"] = 0;
}
pitchValue.value = value;
}
if (route.query["companyid"]) pitchValue.value["companyid"] = route.query["companyid"];
@@ -118,7 +127,7 @@ const getData = () => {
localStorage.setItem("apartmentPitchValue", JSON.stringify(pitchValue.value));
proxy
.$post("https://api.gter.net/v1/apartment/lists", { limit: 12, page, ...pitchValue.value })
.$post("https://api.gter.net/v1/apartment/lists", { limit: 1000, page, ...pitchValue.value })
.then((res) => {
if (res.code != 200) return;
let data = res.data;
@@ -133,8 +142,6 @@ const getData = () => {
requestLoading = false;
});
// console.log("pitchValue.value", pitchValue.value);
if (page == 0 && (pitchValue.value.companyid || pitchValue.value.rent_max || pitchValue.value.rent_min || pitchValue.value.roomlistings || pitchValue.value.roomtype || pitchValue.value.school || pitchValue.value.tag)) {
morePage = 1;
getMoreList();
@@ -156,8 +163,10 @@ const handleScroll = () => {
const scrollHeight = document.documentElement.scrollHeight;
const clientHeight = document.documentElement.clientHeight;
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
if (scrollTop + clientHeight >= scrollHeight - 350 && page != 0) getData();
if (scrollTop + clientHeight >= scrollHeight - 350 && page == 0) getMoreList();
if (scrollTop + clientHeight >= scrollHeight - 350) {
if (page != 0) getData();
else if (page == 0 && (pitchValue.value.companyid || pitchValue.value.rent_max || pitchValue.value.rent_min || pitchValue.value.roomlistings || pitchValue.value.roomtype || pitchValue.value.school || pitchValue.value.tag)) getMoreList();
}
};
let pitchValue = ref({
@@ -213,7 +222,7 @@ const getMoreList = () => {
let notids = [];
list.value.forEach((element) => notids.push(element.id));
proxy.$post("https://api.gter.net/v1/apartment/lists", { notids, page: morePage, limit: 12 }).then((res) => {
proxy.$post("https://api.gter.net/v1/apartment/lists", { notids, page: morePage, limit: 1000 }).then((res) => {
if (res.code != 200) return;
const data = res.data;
if (!data.data) return;
@@ -245,7 +254,7 @@ const getMoreScroll = () => {
let scrollTop = body.scrollTop;
let clientHeight = body.clientHeight;
let offsetHeight = body.offsetHeight;
if (scrollTop + clientHeight >= offsetHeight - 200 && !moreLoading.value) getMoreList();
if (scrollTop + clientHeight >= offsetHeight - 200 && !moreLoading.value && (pitchValue.value.companyid || pitchValue.value.rent_max || pitchValue.value.rent_min || pitchValue.value.roomlistings || pitchValue.value.roomtype || pitchValue.value.school || pitchValue.value.tag)) getMoreList();
};
// 处理列表的点击收藏

View File

@@ -8,7 +8,7 @@
<biserialItem v-for="(item, i) in pageList" :key="i" :item="item"></biserialItem>
</div>
<div class="body-maxWidth" v-show="seachSelectData.data && seachSelectData.data.tabType === 'apartment' && dataList.data && dataList.data.length > 0" ref="gridContainer">
<apartment-item v-for="(item, index) in listApartment" :key="index" :item="item" :masonryInstance="masonryInstance"></apartment-item>
<apartment-item v-for="(item, index) in listApartment" :key="index" :item="item" :masonryInstance="masonryInstance" @handlecollect="handlecollect"></apartment-item>
</div>
<div class="dis-f jus-x no-list-box al-item" v-show="dataList.data && dataList.data.length === 0">
<noList hintText="暂无搜索结果" hintTextTwo="建议更换搜索关键词,或放宽筛选条件"></noList>
@@ -79,7 +79,6 @@ let setInitial = () => {
//获取搜索数据
let getDataList = (data, type = true) => {
console.log("data", data);
if (!type) {
//是否继续搜索
seachSelectData.data.tabType !== "apartment" ? (pageList.value = []) : (listApartment.value = []);
@@ -186,6 +185,28 @@ onMounted(() => {
onBeforeUnmount(() => {
window.removeEventListener("scroll", downLoadMore, true);
});
// 处理列表的点击收藏
const handlecollect = (uniqid) => {
let targetIndex = 0;
let token = "";
listApartment.value.forEach((element, index) => {
if (element.uniqid == uniqid) {
targetIndex = index;
token = element.token || "";
}
});
// api.apartmentCollection({ token }).then((res) => {
proxy.$post("https://api.gter.net/v1/apartment/collection", { token }).then((res) => {
if (res.code != 200) return;
const data = res.data;
listApartment.value[targetIndex]["iscollect"] = data.status;
ElMessage.success(res.message);
});
};
</script>
<style scoped lang="less">
img {

View File

@@ -215,7 +215,7 @@ import backToTop from "@/components/public/backToTop.vue";
import authenticationInfo from "@/components/seachModule/authenticationInfo.vue";
import { redirectToExternalWebsite } from "@/utils/util.js";
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, nextTick, pushScopeId } from "vue";
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, onBeforeUnmount, nextTick, pushScopeId, onDeactivated } from "vue";
import { useRoute, useRouter } from "vue-router";
import { ElLoading, ElMessage } from "element-plus";
@@ -243,7 +243,6 @@ onMounted(() => {
});
init();
console.log("onMounted");
window.addEventListener("scroll", handleScroll);
});
@@ -341,6 +340,7 @@ const getPublishData = () => {
let favData = ref({
page: 1,
list: [],
limit: 200000,
});
// 获取收藏数据
@@ -355,7 +355,7 @@ const getFavData = () => {
// .$post("/tenement/pc/api/user/favList", {
// .$post("/tenement/pc/api/user/collectionList", {
proxy
.$post("https://app.gter.net/tenement/v2/api/user/collections", { page: favData.value["page"] })
.$post("https://app.gter.net/tenement/v2/api/user/collections", { page: favData.value["page"], limit: favData.value["limit"] })
.then((res) => {
if (res.code != 200) return;
let data = res.data;
@@ -410,7 +410,6 @@ let cancelCollection = (data) => {
if (index == -1) return;
// const list = favData.value.list || [];
console.log("list", list);
proxy
.$post(url, {
@@ -499,6 +498,8 @@ const handleDelete = (index, status) => {
// 监听滚动到底部
const handleScroll = () => {
// 判断是不是 user 页面
if (route.path.indexOf("/user") == -1) window.removeEventListener("scroll", handleScroll);
if (!user.value["uid"]) return;
const scrollHeight = document.documentElement.scrollHeight;
const clientHeight = document.documentElement.clientHeight;
@@ -512,7 +513,13 @@ const handleScroll = () => {
// 跳转公寓详情页
const goApartmentDetail = (item) => redirectToExternalWebsite(`/apartmentDetail?uniqid=${item.uniqid}`);
onUnmounted(() => window.removeEventListener("scroll", handleScroll));
onBeforeUnmount(() => {
window.removeEventListener("scroll", handleScroll);
});
onUnmounted(() => {
window.removeEventListener("scroll", handleScroll);
});
</script>
<style lang="less" scoped>