From 3bbd80a63ac7728ac01b641a48a26befcb171a0f Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期一, 15 十二月 2025 07:19:21 +0800
Subject: [PATCH] feat:增加企业微信登录判断
---
app/App.vue | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/app/App.vue b/app/App.vue
index 86cbf17..dd3a43f 100644
--- a/app/App.vue
+++ b/app/App.vue
@@ -4,6 +4,7 @@
import { getToken } from '@/utils/auth'
import { getUnreadCount } from '@/api/message'
import storage from '@/utils/storage'
+ import { redirectToLoginByEnvironment } from '@/utils/wechat'
export default {
data() {
@@ -12,9 +13,9 @@
lastToken: null // 鐢ㄤ簬妫�娴� token 鍙樺寲
}
},
- onLaunch: function() {
+ onLaunch: function(options) {
this.lastToken = getToken()
- this.initApp()
+ this.initApp(options)
// 妫�鏌ュ苟娓呯悊瀛樺偍绌洪棿
this.checkStorage()
@@ -72,13 +73,11 @@
},
methods: {
// 鍒濆鍖栧簲鐢�
- initApp() {
+ initApp(options) {
// 鍒濆鍖栧簲鐢ㄩ厤缃�
this.initConfig()
- // 妫�鏌ョ敤鎴风櫥褰曠姸鎬�
- //#ifdef H5
- this.checkLogin()
- //#endif
+ // 妫�鏌ョ敤鎴风櫥褰曠姸鎬佸苟鑷姩璺宠浆鍒板悎閫傜殑鐧诲綍椤甸潰
+ this.checkLoginAndRedirect(options)
// 娉ㄦ剰锛氫笉鍦ㄥ簲鐢ㄥ惎鍔ㄦ椂鑷姩鍚姩杞
// 鍙湁鍦ㄧ敤鎴蜂富鍔ㄧ櫥褰曟垚鍔熷悗鎵嶅惎鍔紙閫氳繃 user-login 浜嬩欢瑙﹀彂锛�
@@ -86,9 +85,11 @@
initConfig() {
this.globalData.config = config
},
- checkLogin() {
+ // 妫�鏌ョ櫥褰曠姸鎬佸苟鑷姩璺宠浆鍒板悎閫傜殑鐧诲綍椤甸潰
+ checkLoginAndRedirect(options) {
if (!getToken()) {
- this.$tab.reLaunch('/pages/login')
+ // 浣跨敤宸ュ叿绫绘牴鎹幆澧冭嚜鍔ㄨ烦杞埌鍚堥�傜殑鐧诲綍椤甸潰
+ redirectToLoginByEnvironment(options, this.$tab);
}
},
@@ -187,4 +188,4 @@
<style lang="scss">
@import '@/static/scss/index.scss'
-</style>
+</style>
\ No newline at end of file
--
Gitblit v1.9.1