|
|
@ -60,6 +60,97 @@ const http = (url, method, data, isLoading = true) => {
|
|
|
|
resolve(res.data);
|
|
|
|
resolve(res.data);
|
|
|
|
} else if (10008 === res.data.code && res.data.msg === "未注册!") {
|
|
|
|
} else if (10008 === res.data.code && res.data.msg === "未注册!") {
|
|
|
|
resolve(res.data)
|
|
|
|
resolve(res.data)
|
|
|
|
|
|
|
|
} else if (10010 === res.data.code) {
|
|
|
|
|
|
|
|
wx.login({
|
|
|
|
|
|
|
|
success: res => {
|
|
|
|
|
|
|
|
http("/user/login", "post", {
|
|
|
|
|
|
|
|
code: res.code
|
|
|
|
|
|
|
|
}).then(res => {
|
|
|
|
|
|
|
|
if (res.msg === "未注册!") {
|
|
|
|
|
|
|
|
wx.getSystemInfo({
|
|
|
|
|
|
|
|
success(res) {
|
|
|
|
|
|
|
|
if (res.environment) {
|
|
|
|
|
|
|
|
// 企业微信环境
|
|
|
|
|
|
|
|
this.getUserProfile()
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 微信·环境
|
|
|
|
|
|
|
|
wx.showToast({
|
|
|
|
|
|
|
|
title: '初次打开请在企业微信中',
|
|
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
|
|
duration: 3000
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
getApp().globalData.token = res.data.token
|
|
|
|
|
|
|
|
wx.setStorage({
|
|
|
|
|
|
|
|
key: 'user',
|
|
|
|
|
|
|
|
data: res.data.user
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
wx.setStorage({
|
|
|
|
|
|
|
|
key: 'token',
|
|
|
|
|
|
|
|
data: res.data.token
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
if (res.data.user.departmentName === '' || res.data.user.departmentName === null) {
|
|
|
|
|
|
|
|
wx.getSystemInfo({
|
|
|
|
|
|
|
|
success(res) {
|
|
|
|
|
|
|
|
if (res.environment) {
|
|
|
|
|
|
|
|
// 企业微信环境
|
|
|
|
|
|
|
|
wx.qy.login({
|
|
|
|
|
|
|
|
success: function (res) {
|
|
|
|
|
|
|
|
http("/qywx/userDepartmentRefresh", "post", {
|
|
|
|
|
|
|
|
code: res.code
|
|
|
|
|
|
|
|
}).then(res => {
|
|
|
|
|
|
|
|
console.log(res)
|
|
|
|
|
|
|
|
if (res.success) {
|
|
|
|
|
|
|
|
wx.showToast({
|
|
|
|
|
|
|
|
title: '刷新成功',
|
|
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
|
|
duration: 3000
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
this.userlogin()
|
|
|
|
|
|
|
|
} else {}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 微信·环境
|
|
|
|
|
|
|
|
wx.showToast({
|
|
|
|
|
|
|
|
title: '请在企业微信中打开\r\n以获取企业架构',
|
|
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
|
|
duration: 3000
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
wx.getSystemInfo({
|
|
|
|
|
|
|
|
success(res) {
|
|
|
|
|
|
|
|
if (res.environment) {
|
|
|
|
|
|
|
|
// 企业微信环境
|
|
|
|
|
|
|
|
wx.qy.login({
|
|
|
|
|
|
|
|
success: function (res) {
|
|
|
|
|
|
|
|
http("/qywx/userDepartmentRefresh", "post", {
|
|
|
|
|
|
|
|
code: res.code
|
|
|
|
|
|
|
|
}).then(res => {
|
|
|
|
|
|
|
|
console.log(res)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 微信·环境
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
http(url, method, data, isLoading = true).then(res => {
|
|
|
|
|
|
|
|
console.log(res)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
wx.showToast({
|
|
|
|
wx.showToast({
|
|
|
|
title: res.data.msg,
|
|
|
|
title: res.data.msg,
|
|
|
|