修复BUG,1.当用户设置吉祥物页面强制退出,也能重新回到吉祥物设置也。2.改AI问答页为起始页,详细优化了从登录页到AI问答页的逻辑,详细的优化了从首页到AI问答页的逻辑。3。改了wensocket的全局弹出框跳转到登录页的逻辑
This commit is contained in:
+20
-7
@@ -17,7 +17,7 @@ export const get_base_url = url => {
|
||||
return baseUrl
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
return ENV.VITE_APP_BASE_API_Url
|
||||
return ENV.VITE_APP_BASE_API_Url
|
||||
// #endif
|
||||
} else { // 其他环境,包括生产环境,sit环境,uat环境
|
||||
return ENV.VITE_APP_BASE_API_Url
|
||||
@@ -32,15 +32,28 @@ export const REQUES_ERROR_CODES = {
|
||||
// 去登录弹窗状态
|
||||
let no_login_show_modal_state = false
|
||||
// 去登录方法
|
||||
export const goto_login_fun = () => {
|
||||
export const goto_login_fun = (from = 'http') => {
|
||||
if (no_login_show_modal_state) return;
|
||||
no_login_show_modal_state = true
|
||||
let page_route = ''
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length >= 1) {
|
||||
const page = pages[pages.length - 1];
|
||||
page_route = page.route
|
||||
}
|
||||
if (page_route === 'pages/login/login') return;
|
||||
common.hideLoading()
|
||||
common.show('未登录', '现在去登录').then(() => {
|
||||
common.show('未登录', '现在去登录', false).then(() => {
|
||||
common.navigateTo('/pages/login/login')
|
||||
if (from === 'socket' && page_route !== '') {
|
||||
common.redirectTo('/pages/login/login?path=' + page_route)
|
||||
} else {
|
||||
common.navigateTo('/pages/login/login')
|
||||
}
|
||||
|
||||
}).finally(() => {
|
||||
no_login_show_modal_state = false
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export default function request({
|
||||
@@ -73,7 +86,7 @@ export default function request({
|
||||
data: data,
|
||||
method: method,
|
||||
header: headers_base,
|
||||
timeout:timeout,
|
||||
timeout: timeout,
|
||||
success: (response) => {
|
||||
if (isStream) { // 流式传输,直接返回
|
||||
return resolve(response);
|
||||
@@ -83,8 +96,8 @@ export default function request({
|
||||
const res = response.data
|
||||
if (res?.rtnCode === '0000') {
|
||||
return resolve(res)
|
||||
}else{
|
||||
if(toastErrors){
|
||||
} else {
|
||||
if (toastErrors) {
|
||||
common.msg(res?.message)
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -69,13 +69,13 @@ export default class WebSocketUtil {
|
||||
clearInterval(this.reconnectTimer);
|
||||
this.reconnectTimer = null
|
||||
this.close()
|
||||
goto_login_fun();
|
||||
goto_login_fun('socket');
|
||||
return
|
||||
}
|
||||
}else{
|
||||
clearInterval(this.reconnectTimer); // 清除重连计时器
|
||||
this.reconnectTimer = null
|
||||
goto_login_fun();
|
||||
goto_login_fun('socket');
|
||||
return
|
||||
}
|
||||
this.triggerEvent('message', res); // 触发消息接收事件
|
||||
@@ -224,7 +224,7 @@ export default class WebSocketUtil {
|
||||
this.triggerEvent('error', new Error('达到最大重连次数'));
|
||||
this.reconnectTimer = null
|
||||
this.close()
|
||||
goto_login_fun()
|
||||
goto_login_fun('socket')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user