From cc6da8adfd1ffae7c65c85878d86b9414e870154 Mon Sep 17 00:00:00 2001 From: francis_fh <13935151924@163.com> Date: Wed, 14 Jan 2026 18:46:13 +0800 Subject: [PATCH] =?UTF-8?q?H5=E7=8E=AF=E5=A2=83=E7=99=BB=E5=BD=95=E6=94=B9?= =?UTF-8?q?=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.vue | 12 +++++++++++- pages/login/h5-login.vue | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index b32f937..6e7bbfa 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -19,10 +19,20 @@ import IndexOne from './components/index-one.vue'; // import IndexTwo from './components/index-two.vue'; import { storeToRefs } from 'pinia'; import { useReadMsg } from '@/stores/useReadMsg'; +import useUserStore from '@/stores/useUserStore'; import { tabbarManager } from '@/utils/tabbarManager'; const { unreadCount } = storeToRefs(useReadMsg()); +const userStore = useUserStore(); -onLoad(() => { +onLoad((options) => { + // H5环境下从URL获取token并自动登录 + // #ifdef H5 + const token = options.token || ''; + alert(token) + if (token) { + userStore.loginSetToken(token); + } + // #endif // useReadMsg().fetchMessages(); }); diff --git a/pages/login/h5-login.vue b/pages/login/h5-login.vue index cd58ace..41eb30c 100644 --- a/pages/login/h5-login.vue +++ b/pages/login/h5-login.vue @@ -194,7 +194,7 @@ const handleLogin = async () => { icon: 'success' }) // window.location.assign('http://222.80.110.161:11111/mechine-dual-vue/login') - window.location.assign('https://www.xjksly.cn/mechine-single-vue/login') + // window.location.assign('https://www.xjksly.cn/mechine-single-vue/login') // // 跳转到首页 // uni.reLaunch({ // url: '/pages/index/index'