Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
W
wly-APP
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘川
wly-APP
Commits
f3a7167d
Commit
f3a7167d
authored
Jan 04, 2026
by
李驰骋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
未安装门户情况进入首页异常解决,门户登录地址不能访问情况不提示加载中
parent
6dd4917d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
15 deletions
+78
-15
App.vue
App.vue
+7
-3
login.nvue
pages/login/login.nvue
+60
-11
http.interceptor.js
servers/http.interceptor.js
+11
-1
No files found.
App.vue
View file @
f3a7167d
...
...
@@ -21,9 +21,13 @@
onShow
:
function
()
{
// #ifdef APP-PLUS
setTimeout
(
function
()
{
// 被唤醒获取参数 需异步一下
const
args
=
plus
.
runtime
.
arguments
if
(
plus
.
runtime
.
arguments
&&
typeof
args
===
'string'
)
{
const
data
=
nativePlugin
.
handleOpenURL
(
args
)
try
{
const
args
=
plus
.
runtime
.
arguments
if
(
plus
.
runtime
.
arguments
&&
typeof
args
===
'string'
)
{
const
data
=
nativePlugin
.
handleOpenURL
(
args
)
}
}
catch
(
e
)
{
console
.
error
(
'handleOpenURL error:'
,
e
)
}
},
100
);
// #endif
...
...
pages/login/login.nvue
View file @
f3a7167d
...
...
@@ -132,6 +132,10 @@
ToastPlusModule && this.initEx()
},
onShow() {
// 如果用户已经登录,不调用 authEx
if (this.userInfo && this.userInfo.code) {
return
}
// 判断是否正在等待authEx的返回结果,第一次进入页面默认是false
if (!this.flag && !this.accessToken) {
ToastPlusModule && this.authEx()
...
...
@@ -160,13 +164,22 @@
uni.showLoading({
title: '加载中'
});
// 调用同步方法
var obj = ToastPlusModule.registerSyncFunc({
appKey: 'com.wuliangye.emobilewlycrm',
secretKey: '9ab24ae4bfb349cca739ab15b78f1c7f8737eb73',
packageName: 'com.uusafe.portal.wly'
})
console.log(obj)
try {
// 调用同步方法
var obj = ToastPlusModule.registerSyncFunc({
appKey: 'com.wuliangye.emobilewlycrm',
secretKey: '9ab24ae4bfb349cca739ab15b78f1c7f8737eb73',
packageName: 'com.uusafe.portal.wly'
})
console.log(obj)
} catch (e) {
console.error('initEx error:', e)
} finally {
// 确保隐藏 loading
setTimeout(() => {
uni.hideLoading()
}, 500)
}
},
checkboxChangeNum(){
if (e.detail.value.length == 1) {
...
...
@@ -200,14 +213,49 @@
});
// 开启等待被唤醒
this.flag = true
ToastPlusModule.registerExSyncFunc({}, res => {
// 设置超时,确保 loading 一定会被隐藏
const timeoutId = setTimeout(() => {
if (this.flag) {
this.flag = false
uni.hideLoading()
}
}, 5000)
try {
if (ToastPlusModule && typeof ToastPlusModule.registerExSyncFunc === 'function') {
ToastPlusModule.registerExSyncFunc({}, res => {
clearTimeout(timeoutId)
this.flag = false
// 只有从第三方APP进入且返回有效token时才调用getIdToken
// 检查返回结果:必须有token且是有效字符串
const token = res?.data?.token || (typeof res === 'string' ? res : null)
if (token && typeof token === 'string' && token.trim() !== '') {
this.accessToken = token
this.getIdToken()
} else {
// 不是从第三方APP进入,或者返回数据无效,不执行getIdToken
uni.hideLoading()
}
})
} else {
clearTimeout(timeoutId)
this.flag = false
uni.hideLoading()
}
} catch (e) {
clearTimeout(timeoutId)
this.flag = false
this.accessToken = res.data?.token || res
this.getIdToken(
)
}
)
uni.hideLoading()
console.error('authEx error:', e
)
}
},
async getIdToken(){
// 再次检查 accessToken 是否有效,确保只有从第三方APP进入才执行
if (!this.accessToken || typeof this.accessToken !== 'string' || this.accessToken.trim() === '') {
uni.hideLoading()
return
}
uni.showLoading({
title: '加载中'
});
...
...
@@ -241,6 +289,7 @@
}
}catch(e){
uni.hideLoading()
uni.showToast({
title: e,
icon: 'none',
...
...
servers/http.interceptor.js
View file @
f3a7167d
...
...
@@ -76,8 +76,18 @@ const install = (Vue, vm) => {
if
(
!
res
.
status
&&!
res
.
msgtype
&&!
res
.
MSGTYPE
){
return
res
;
}
// 获取错误信息
let
errorMsg
=
res
.
MESSAGE
||
res
.
msg
||
res
.
message
||
res
.
ErrMsg
||
''
if
(
res
.
errors
&&
Array
.
isArray
(
res
.
errors
)
&&
res
.
errors
.
length
>
0
)
{
errorMsg
=
res
.
errors
[
0
]
}
// 过滤技术错误信息,不显示给用户
if
(
errorMsg
&&
typeof
errorMsg
===
'string'
&&
(
errorMsg
.
indexOf
(
'cannot be cast'
)
!==
-
1
||
errorMsg
.
indexOf
(
'DCloudApplication'
)
!==
-
1
))
{
return
false
}
uni
.
showToast
({
title
:
res
.
MESSAGE
||
res
.
msg
||
res
.
message
||
res
.
Er
rMsg
,
title
:
erro
rMsg
,
duration
:
4000
,
icon
:
'none'
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment