Merge remote-tracking branch 'origin/pet-2.0' into pet-2.0
commit
1c53c0573a
|
@ -1,12 +1,33 @@
|
||||||
|
|
||||||
// export var requestPath = 'https://skqhdg.porthebei.com:9005/qa-regulatory-gwj/'; // 后台请求地址
|
|
||||||
|
|
||||||
export var requestPath = 'http://192.168.0.101:8060/new_template';
|
|
||||||
|
|
||||||
let videoApiPath = 'https://arqsp.qhdsafety.com:10010'; // 视频平台后台请求地址
|
|
||||||
import store from '../store/index'
|
import store from '../store/index'
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { setRefreshToken } from "@/api";
|
import { setRefreshToken } from "@/api";
|
||||||
|
// export var requestPath = 'https://skqhdg.porthebei.com:9005/qa-regulatory-gwj/'; // 后台请求地址
|
||||||
|
|
||||||
|
export var requestPath = 'http://192.168.192.201:8992/regulatory_gwj_2.0/';
|
||||||
|
|
||||||
|
let videoApiPath = 'https://arqsp.qhdsafety.com:10010'; // 视频平台后台请求地址
|
||||||
|
|
||||||
|
function logOut(reject,data) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '登录失效,请重新登录',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
reject(data)
|
||||||
|
setTimeout(()=>{
|
||||||
|
let userInfo = {}
|
||||||
|
for (const userInfoKey in store.state.userInfo) {
|
||||||
|
if (store.state.userInfo.hasOwnProperty(userInfoKey)) {
|
||||||
|
userInfo[userInfoKey] = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
store.dispatch('setUserInfo', userInfo)
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
})
|
||||||
|
},1000)
|
||||||
|
}
|
||||||
|
|
||||||
function post(url, data) {
|
function post(url, data) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (data && data.loading !== false) {
|
if (data && data.loading !== false) {
|
||||||
|
@ -41,9 +62,13 @@ function post(url, data) {
|
||||||
});
|
});
|
||||||
reject(res.data)
|
reject(res.data)
|
||||||
}else{
|
}else{
|
||||||
|
if(res.data.code === 401){
|
||||||
|
logOut(reject,res.data)
|
||||||
|
return
|
||||||
|
}
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.data.msg || '系统开小差了',
|
title: res.data.msg || '系统开小差了',
|
||||||
icon: 'error',
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
reject(res.data)
|
reject(res.data)
|
||||||
|
@ -83,15 +108,20 @@ function upload(url, data) {
|
||||||
},
|
},
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
if (JSON.parse(res.data).result === 'success') {
|
const data = JSON.parse(res.data)
|
||||||
resolve(JSON.parse(res.data))
|
if (data.result === 'success') {
|
||||||
|
resolve(data)
|
||||||
} else {
|
} else {
|
||||||
|
if(data.code === 401){
|
||||||
|
logOut(reject,data)
|
||||||
|
return
|
||||||
|
}
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: JSON.parse(res.data).msg || '系统开小差了',
|
title: data.msg || '系统开小差了',
|
||||||
icon: 'error',
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
reject(JSON.parse(res.data))
|
reject(data)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
|
@ -123,15 +153,20 @@ function uploads(url, data) {
|
||||||
},
|
},
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
if (JSON.parse(res.data).result === 'success') {
|
const data = JSON.parse(res.data)
|
||||||
resolve(JSON.parse(res.data))
|
if (data.result === 'success') {
|
||||||
|
resolve(data)
|
||||||
} else {
|
} else {
|
||||||
|
if(data.code === 401){
|
||||||
|
logOut(reject,data)
|
||||||
|
return
|
||||||
|
}
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: JSON.parse(res.data).msg || '系统开小差了',
|
title: data.msg || '系统开小差了',
|
||||||
icon: 'error',
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
reject(JSON.parse(res.data))
|
reject(data)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
|
|
Loading…
Reference in New Issue