|
|
@@ -182,7 +182,7 @@
|
|
|
};
|
|
|
|
|
|
|
|
|
- const loginSuccess = async(result: any) : Promise<void> => {
|
|
|
+ const loginSuccess = async(result: any, nextUrl:string) : Promise<void> => {
|
|
|
// 提取 data 部分
|
|
|
const resultObj = result as UTSJSONObject
|
|
|
// const data = resultObj['data'] as UTSJSONObject
|
|
|
@@ -218,9 +218,9 @@
|
|
|
|
|
|
// 跳转到首页
|
|
|
setTimeout(() => {
|
|
|
- uni.redirectTo({
|
|
|
- url: '/pages/index/index'
|
|
|
- })
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/index/index'
|
|
|
+ })
|
|
|
}, 1000)
|
|
|
}
|
|
|
|
|
|
@@ -255,7 +255,7 @@
|
|
|
saveStoreIsKey(isKey); */
|
|
|
|
|
|
const result = await loginByAccount(username.value, password.value)
|
|
|
- loginSuccess(result);
|
|
|
+ loginSuccess(result, null);
|
|
|
|
|
|
uni.showToast({
|
|
|
title: '登录成功',
|
|
|
@@ -274,11 +274,11 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- const handleLoginSSO = async (apptoken:string): Promise<void> => {
|
|
|
+ const handleLoginSSO = async (apptoken:string, nextUrl:string): Promise<void> => {
|
|
|
try {
|
|
|
let result = await loginSSO(apptoken)
|
|
|
console.log('自动登录:', result)
|
|
|
- loginSuccess(result);
|
|
|
+ loginSuccess(result, nextUrl);
|
|
|
} catch (e: any) {
|
|
|
uni.showToast({
|
|
|
title: e.message ?? '登录失败',
|
|
|
@@ -421,12 +421,13 @@
|
|
|
// 2. 从页面参数获取
|
|
|
if (options != null) {
|
|
|
const ticketValue = options['ticket']
|
|
|
+ const nextUrl = options['next']
|
|
|
if (ticketValue != null) {
|
|
|
if (typeof ticketValue == 'string') {
|
|
|
if(ticketValue.length > 0){
|
|
|
const ticket = ticketValue as string
|
|
|
console.log('获取到自动登录ticket:', ticket)
|
|
|
- handleLoginSSO(ticket);
|
|
|
+ handleLoginSSO(ticket, nextUrl);
|
|
|
}
|
|
|
}
|
|
|
}
|