产品库开发环境已调整好
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import axios from 'axios'
|
||||
import store from '../store'
|
||||
import util from "./util";
|
||||
|
||||
let instance = axios.create({
|
||||
baseURL: process.env.NODE_ENV === "production" ? "/" : "/lan",
|
||||
timeout: 600000,
|
||||
withCredentials: true,
|
||||
})
|
||||
@@ -23,27 +23,7 @@ instance.interceptors.response.use(res => {
|
||||
return res.data
|
||||
} else if (res.data.code == 401) {
|
||||
store.commit("logout");
|
||||
let reg = new RegExp('.*code=(.+$)', "g")
|
||||
if (reg.test(location.search)) {
|
||||
let code = location.search.replace(reg, '$1')
|
||||
store.commit('bindAccount', {
|
||||
code, then: res => {
|
||||
store.commit("login", [res?.token_type, res?.access_token].join(" ").trim())
|
||||
location.href = location.href.replace('code=' + code, '')
|
||||
}
|
||||
})
|
||||
} else util.confirm("用户信息验证失效,是否要重新登录?").then(() => {
|
||||
store.commit('redirectCode')
|
||||
// let app = store.state.apps?.find(e => location.href.indexOf(e.path) > -1)
|
||||
// const goto = path => {
|
||||
// location.href = location.origin + "/pages/loading?" + path
|
||||
// }
|
||||
// if (app) {
|
||||
// goto(location.search + `&app=${app.key}`)
|
||||
// } else {
|
||||
// goto(location.search + `#error`)
|
||||
// }
|
||||
}).catch(() => 0)
|
||||
uni.navigateTo({url: "/pages/login"})
|
||||
} else {
|
||||
console.error(res.data.msg || "请求失败!")
|
||||
return Promise.reject(res.data.msg)
|
||||
|
||||
Reference in New Issue
Block a user