From 74954007aee3b237bcba3b4a37a53c79db4150e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=82=85=E5=85=89=E5=AD=9F?= Date: Fri, 30 Jan 2026 12:31:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E7=BB=84=E4=BB=B6=E5=B9=B6=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=AF=BC=E8=88=AA=E6=A0=8F=E8=BF=94=E5=9B=9E=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/foreign/index.vue | 9 +- src/pages/macroscopic/index.vue | 13 +- .../components/FooterView/index.vue | 34 +- .../components/HeaderView/index.vue | 30 +- .../components/LoginDialog/index.vue | 310 ++++++++++++++++++ src/pages/realtimeInfo/index.vue | 51 ++- src/pages/recommend/index.vue | 9 +- src/stores/user/index.ts | 118 +++++++ src/types/global.d.ts | 4 + 9 files changed, 563 insertions(+), 15 deletions(-) create mode 100644 src/pages/realtimeInfo/components/LoginDialog/index.vue create mode 100644 src/stores/user/index.ts create mode 100644 src/types/global.d.ts diff --git a/src/pages/foreign/index.vue b/src/pages/foreign/index.vue index 918d5c3..2045c30 100644 --- a/src/pages/foreign/index.vue +++ b/src/pages/foreign/index.vue @@ -3,7 +3,7 @@ - + 海外先机 @@ -147,6 +147,13 @@ \ No newline at end of file + diff --git a/src/pages/realtimeInfo/components/HeaderView/index.vue b/src/pages/realtimeInfo/components/HeaderView/index.vue index c63e062..5927c45 100644 --- a/src/pages/realtimeInfo/components/HeaderView/index.vue +++ b/src/pages/realtimeInfo/components/HeaderView/index.vue @@ -4,7 +4,7 @@ 数据更新时间:{{ date }} - + {{ menu.name }} @@ -20,30 +20,58 @@ import MENUICON2 from "@/assets/images/page/icon_2@2x.png"; import MENUICON3 from "@/assets/images/page/icon_3@2x.png"; import MENUICON4 from "@/assets/images/page/icon_4@2x.png"; import MENUICON5 from "@/assets/images/page/icon_5@2x.png"; +import { useUserStore } from "@/stores/user"; const menus = reactive([ { name: "海外先机", icon: MENUICON1, + auth: "menu1", + path: "/pages/foreign/index", }, { name: "编辑精选", icon: MENUICON2, + auth: "menu2", + path: "/pages/recommend/index", }, { name: "宏观知微", icon: MENUICON3, + auth: "menu3", + path: "/pages/macroscopic/index", }, { name: "热门行业", icon: MENUICON4, + auth: "menu4", + path: "/pages/foreign/index", }, { name: "风口概念", icon: MENUICON5, + auth: "menu5", + path: "/pages/foreign/index", }, ]); const date = computed(() => dayjs().format("YYYY-MM-DD")); +const userStore = useUserStore(); +const userInfos = computed(() => { + return userStore.getUserInfos(); +}); + +const goto = (path: string, auth: string) => { + if (userInfos.value.auth.includes(auth)) { + uni.navigateTo({ + url: path, + }); + } else { + uni.showToast({ + title: "无权限访问", + icon: "none", + }); + } +}; diff --git a/src/pages/realtimeInfo/index.vue b/src/pages/realtimeInfo/index.vue index fd6be50..9c2a9e4 100644 --- a/src/pages/realtimeInfo/index.vue +++ b/src/pages/realtimeInfo/index.vue @@ -26,8 +26,16 @@ - + + + + + @@ -40,6 +48,47 @@ import HotNewsView from "./components/HotNewsView/index.vue"; import ConceptNewsView from "./components/ConceptNewsView/index.vue"; import TodayNewsView from "./components/TodayNewsView/index.vue"; import FooterView from "./components/FooterView/index.vue"; +import LoginDialog from "./components/LoginDialog/index.vue"; +import { Session } from "@/utils/storage"; +import { doLogout } from "@/api"; + +// 登录弹框 +const LoginShow = ref(false); +const isLoginStatus = ref(); +// 关闭弹框 +const handleLoginCancel = () => { + LoginShow.value = false; +}; + +// 登录成功之后的回调 +const handleLoginSuccess = () => { + LoginShow.value = false; +}; + +// 登录失败之后的回调 +const handlePopupErrorCallback = () => { + console.log("登录失败"); +}; +function loginOut() { + doLogout({ + financialAccount: Session.get("userPhone"), + }); + + Session.clear(); + window.location.reload(); +} + +onMounted(async () => { + if (!Session.get("token")) { + LoginShow.value = true; + } + + const { aplus_queue } = window; + aplus_queue.push({ + action: "aplus.sendPV", + arguments: [{ is_auto: false }], // 此处上报的数据暂时在后台没有展示 + }); +});