请求
This commit is contained in:
@@ -190,8 +190,8 @@
|
||||
const result = await api.getCode(postData,{
|
||||
sign:sign
|
||||
});
|
||||
|
||||
if (result.data.code === 200) {
|
||||
console.log(result);
|
||||
if (result.code === 200) {
|
||||
uni.showToast({
|
||||
title: '验证码已发送',
|
||||
icon: 'none'
|
||||
@@ -313,15 +313,40 @@
|
||||
});
|
||||
|
||||
uni.hideLoading();
|
||||
|
||||
if (result.data.code == 1) {
|
||||
console.log(result)
|
||||
if (result.code == 1) {
|
||||
// 保存用户信息到本地存储
|
||||
if (result.data.data && result.data.data.token) {
|
||||
uni.setStorageSync('AUTH_TOKEN_App', result.data.data.token);
|
||||
if (result.data.data) {
|
||||
uni.setStorageSync('USER_INFO', result.data.data);
|
||||
if (process.env.UNI_PLATFORM == "h5") {
|
||||
if (window.location.href.indexOf('dev') > -1) {
|
||||
uni.setStorageSync('AUTH_TOKEN_App',result.access_token);
|
||||
uni.setStorageSync('AUTH_YX_ACCID_App', result.YX_accid);
|
||||
uni.setStorageSync('AUTH_YX_TOKEN_App', result.YX_token);
|
||||
uni.setStorageSync('userInfo', result.data);
|
||||
|
||||
} else {
|
||||
uni.setStorageSync('DEV_AUTH_TOKEN_App', result.access_token);
|
||||
uni.setStorageSync('DEV_AUTH_YX_ACCID_App', result.YX_accid);
|
||||
uni.setStorageSync('DEV_AUTH_YX_TOKEN_App', result.YX_token);
|
||||
uni.setStorageSync('userInfo', result.data);
|
||||
}
|
||||
} else if(process.env.UNI_PLATFORM == "mp-weixin") {
|
||||
const {
|
||||
envVersion
|
||||
} = uni.getAccountInfoSync().miniProgram;
|
||||
if (envVersion == "release") {
|
||||
uni.setStorageSync('AUTH_TOKEN_App',result.access_token);
|
||||
uni.setStorageSync('AUTH_YX_ACCID_App', result.YX_accid);
|
||||
uni.setStorageSync('AUTH_YX_TOKEN_App', result.YX_token);
|
||||
uni.setStorageSync('userInfo', result.data);
|
||||
} else {
|
||||
uni.setStorageSync('DEV_AUTH_TOKEN_App', result.access_token);
|
||||
uni.setStorageSync('DEV_AUTH_YX_ACCID_App', result.YX_accid);
|
||||
uni.setStorageSync('DEV_AUTH_YX_TOKEN_App', result.YX_token);
|
||||
uni.setStorageSync('userInfo', result.data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
uni.showToast({
|
||||
title: '登录成功',
|
||||
@@ -330,7 +355,7 @@
|
||||
|
||||
// 跳转到首页
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
uni.redirectTo({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
},0);
|
||||
|
||||
Reference in New Issue
Block a user