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

@@ -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 }}个房型