Files
tydata-webview-v2/src/layouts/HomeLayout.vue

160 lines
4.2 KiB
Vue
Raw Normal View History

2025-09-27 17:41:14 +08:00
<template>
<div class="home-layout min-h-screen flex flex-col">
<!-- Header -->
<div class="header">
2026-01-03 17:53:26 +08:00
<img class="logo rounded-full overflow-hidden" src="/logo.png" alt="Logo" />
2026-02-14 11:14:09 +08:00
<div class="title">天远助手</div>
2025-09-27 17:41:14 +08:00
</div>
<!-- Content Area -->
<div class="content flex flex-col flex-1">
<router-view />
</div>
<!-- Vant Tabbar -->
<van-tabbar v-model="tabbar" @change="tabChange">
2025-10-24 14:39:32 +08:00
<van-tabbar-item v-for="(item, index) in menu" :key="index" :name="item.name" :icon="item.icon">{{
item.title }}
2025-09-27 17:41:14 +08:00
</van-tabbar-item>
</van-tabbar>
<!-- Complaint Button -->
<div @click="toComplaint" class="complaint-button">
2025-10-24 17:08:42 +08:00
<img src="@/assets/images/homelayout/ts.png" alt="投诉" class="w-4 h-4 mr-1 inline-block" />
<span class="">投诉</span>
2025-09-27 17:41:14 +08:00
</div>
<div class="disclaimer">
<div class="flex flex-col items-center">
<div class="flex items-center">
2025-10-24 14:39:32 +08:00
<img class="w-4 h-4 mr-2" src="@/assets/images/public_security_record_icon.png" alt="公安备案" />
2025-09-27 17:41:14 +08:00
<text>琼公网安备46010002000584号</text>
</div>
<div>
<a class="text-blue-500" href="https://beian.miit.gov.cn">
2026-02-11 15:02:56 +08:00
琼ICP备2024038584号-13
2025-09-27 17:41:14 +08:00
</a>
</div>
</div>
2025-12-25 12:57:40 +08:00
<div>海南海宇大数据有限公司版权所有</div>
2025-09-27 17:41:14 +08:00
</div>
</div>
</template>
<script setup>
2025-10-24 14:39:32 +08:00
import { ref, reactive, onMounted, watch } from "vue";
2025-09-27 17:41:14 +08:00
import { useRoute, useRouter } from "vue-router"; // 引入 Vue Router
const router = useRouter();
const route = useRoute();
const tabbar = ref("index");
const menu = reactive([
{ title: "首页", icon: "home-o", name: "index" },
2025-10-24 14:39:32 +08:00
{ title: "更多", icon: "more-o", name: "more" },
2025-09-27 17:41:14 +08:00
{ title: "资产", icon: "gold-coin-o", name: "agent" },
{ title: "我的", icon: "user-o", name: "me" }
]);
// 根据当前路由设置 Tabbar 的高亮项
onMounted(() => {
const currentPage = route.name; // 获取当前路由的名称
tabbar.value = currentPage;
});
2025-10-24 14:39:32 +08:00
// 监听路由变化,更新 tabbar
watch(() => route.name, (newName) => {
if (newName) {
tabbar.value = newName;
}
});
const onClickOverlay = () => { };
2025-09-27 17:41:14 +08:00
// 跳转到相应页面
2025-10-24 14:39:32 +08:00
const tabChange = (name, a, b, c) => {
if (name === "more") {
showConfirmDialog({
title: '更多报告',
message:
'是否前往天远查查询更多报告',
})
.then(() => {
window.location.href = "https://www.tianyuancha.cn";
})
.catch(() => {
tabbar.value = route.name;
})
return;
}
2025-09-27 17:41:14 +08:00
router.push({ name }); // 使用 Vue Router 进行跳转
};
// 跳转到投诉页面
const toComplaint = () => {
window.location.href =
2025-10-24 14:39:32 +08:00
"https://work.weixin.qq.com/kfid/kfc8a32720024833f57"; // 跳转到客服页面
2025-09-27 17:41:14 +08:00
// router.push({ name: 'complaint' }); // 使用 Vue Router 进行跳转
};
</script>
<style scoped>
.home-layout {
2025-10-24 17:08:42 +08:00
@apply from-sky-100/20 to-white bg-gradient-to-b
2025-09-27 17:41:14 +08:00
}
.header {
display: flex;
align-items: center;
background-color: white;
padding-left: 1rem;
padding-right: 1rem;
height: 3rem;
}
.logo {
width: 2rem;
height: 2rem;
margin-right: 0.5rem;
object-fit: contain;
}
.title {
font-size: 1.25rem;
font-weight: bold;
}
.content {
/* min-height: calc(100vh - 3rem); */
}
.complaint-button {
position: fixed;
bottom: 6rem;
right: 1rem;
2025-10-28 12:12:48 +08:00
background: #ff6b6b;
2025-09-27 17:41:14 +08:00
border-radius: 1.5rem;
padding: 0.25rem 1rem;
color: white;
display: flex;
align-items: center;
cursor: pointer;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
2025-10-24 17:08:42 +08:00
z-index: 2000;
2025-09-27 17:41:14 +08:00
}
2025-10-28 12:12:48 +08:00
2025-09-27 17:41:14 +08:00
.complaint-button i {
margin-right: 0.5rem;
}
.disclaimer {
/* margin-top: 24px; */
padding: 10px;
font-size: 12px;
color: #999;
text-align: center;
border-top: 1px solid #e0e0e0;
padding-bottom: 60px;
background: #ffffff;
margin-bottom: 50px;
}
</style>