This commit is contained in:
zoujiandong
2025-06-17 14:38:01 +08:00
parent b0eb163c21
commit 54a2da7d22
34 changed files with 109 additions and 92 deletions
+27 -6
View File
@@ -11,10 +11,10 @@ import BASE_URL from "./config.js";
//import host from "@/utils/host";
//import {msg} from "./util.js"
import pageUrl from './pageUrl'
// # ifdef H5
import cookie from "./cookie.js";
//# endif
// #ifdef h5
import api from './api/api'
import cookie from './utils/cookie'
// #endif
//const BASE_URL=host+"/api"
export const request = (url, data = {}, method = 'post', loading = false, contentType = 'application/x-www-form-urlencoded') => {
if (loading) {
@@ -76,7 +76,7 @@ export const request = (url, data = {}, method = 'post', loading = false, conten
sslVerify: false,
header: url.indexOf('/manager/getSignature4bing') == -1 ? header : {},
timeout: 10000,
success: function (res) {
success: async function (res) {
var Authorization_token = res.header.Authorization;
if (Authorization_token) {
if (process.env.NODE_ENV === 'development') {
@@ -93,11 +93,32 @@ export const request = (url, data = {}, method = 'post', loading = false, conten
e(res)
} else if (res.data.code == 401 || res.data.code == 403 || res.data.code == 405 || res.data.code == 406) {
if(process.env.UNI_PLATFORM =="h5"){
let video_token = cookie.readCookie('video_token');
if(video_token){
const res = await api.h5Login({
token: video_token
});
let result = res.data;
if (window.location.href.indexOf('//casedata.igandan.com')>-1) {
uni.setStorageSync("AUTH_TOKEN_CASEDATA",result.token);
} else {
uni.setStorageSync("DEV_AUTH_TOKEN_CASEDATA",result.token);
};
uni.setStorageSync("userInfo",{
avatar:result.avatar,
user_id:result.user_id,
status:result.status,
user_name:result.user_name,
doctor_id:result.doctor_id,
});
window.location.reload();
}else{
let H5url = 'https://dev-wx.igandan.com';
if (window.location.href.indexOf('//dev-casedata.igandan.com') == -1) {
if(window.location.href.indexOf('//dev-casedata.igandan.com') == -1) {
H5url = 'https://wx.igandan.com'
}
window.location.href = H5url + "/hcp/Signup2020online_tologin?back_url=" + encodeURIComponent(window.location.href);
}
}else{
let freeList = ['/login/wechat/mobile', '/code/phone', '/login/mobile_login', '/index', '/user/check'];
if (freeList.indexOf(url) == -1) {