Commit 46433c39 authored by youjie's avatar youjie

Merge branch 'master' of http://gitlab.oytour.com/youjie/thinkapp

parents f37ef587 01b1ad50
......@@ -25,7 +25,7 @@ let request = (param) => {
if (res.data.Code === 1) {
resolve(res.data)
} else {
if (res.data.Code==10001 || res.data.Code == 10000) {
if (res.data.Code == 10001 || res.data.Code == 10000) {
// uni.showToast({
// title: "用户凭证失效,请重新授权",
// duration: 2000,
......@@ -36,15 +36,18 @@ let request = (param) => {
// url:"/pages/login/login"
// })
// reject()
//重新获取TOKEN
// updateToken()
// request(param)
} else {
uni.showToast({
title: res.data.Message,
duration: 2000,
icon: "none",
success() {
if(res.data.Code === 0){
if (res.data.Code === 0) {
resolve(res.data)
}else{
} else {
reject()
}
}
......@@ -66,4 +69,40 @@ let request = (param) => {
});
})
}
let updateToken= ()=> {
let u = uni.getStorageSync('erpUserInfo')
let userWxInfo = uni.getStorageSync('userWxInfo')
let wxUserAuthInfo = uni.getStorageSync('wxUserAuthInfo')
if (u) {
request({
url: '/AppletLogin/GetStudentsByClassInAccount',
method: 'post',
data: {
Account: u.Account,
WName: userWxInfo.userInfo.nickName,
WImage: userWxInfo.userInfo.avatarUrl,
UnionId: wxUserAuthInfo.unionid
}
}).then(r => {
if (r.Data && r.Data.length > 0) {
r.Data.forEach(x => {
if (x.ClassInAccount == u.Account) {
uni.setStorageSync('erpUserInfo', x)
}
})
if (!flag) {
r.Data.forEach(x => {
if (x.RealPhone == u.Account) {
flag = true
uni.setStorageSync('erpUserInfo', x)
}
})
}
uni.setStorageSync("ErpStus", r.Data)
}
})
}
}
export default request
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment