登录修改

static-project
chen 2022-06-10 11:26:10 +08:00
parent 8f0859622d
commit f4d80df8ca
4 changed files with 40 additions and 58 deletions

View File

@ -115,13 +115,12 @@
choosefoot(index){
if(index==0){
uni.reLaunch({url:'/pages/tabbar/pagehome/pagehome'})
}else if(index==1){
uni.reLaunch({url:'/pages/tabbar/cate/cate'})
}else {
if(this.$toolAll.tools.judgeAuth()) {
//
switch (index){
case 1:
uni.reLaunch({url:'/pages/tabbar/cate/cate'})
break;
case 2:
uni.reLaunch({url:'/pages/tabbar/cart/cart'})
break;

View File

@ -8,30 +8,11 @@ const goLogin = () => {
let flag = true;
// 刷新token并跳转到当前页面
const refreshTokenPage = () => {
uni.login({
provider: 'weixin',
success: (result)=> {
uni.request({
url: `${getApp().globalData.hostapi}user/login`,
method: 'post',
data: {code:result.code},
success: res => {
if(res.data.data.token!=''){
flag = true;
uni.setStorageSync('token',res.data.data.token); // 缓存token
uni.setStorageSync('openid',res.data.data.openid)//缓存openid
uni.setStorageSync('expire',res.data.data.expire); // 缓存失效时间(时间戳格式)
uni.reLaunch({ // 重新进入当前页面
url:uni.getStorageSync('page-path-options')
})
}
}
})
},
});
}
// 请求错误处理
const checkError = (e) => {
console.log('500接口错误');
// console.error("----接口错误----", e)
if (e.data) {
if (e.data.code) {
@ -112,6 +93,10 @@ const request = (method, url, options) => {
console.log(`${url}返的结果===>`,res);
if (res.statusCode == 200) {
resolve(res.data);
if(res.data.code !== 0){
// 接口返回错误信息
checkError(res);
}
} else {
// 接口返回错误信息
checkError(res);

View File

@ -117,7 +117,6 @@
},
//
chooseGe(obj) {
if(this.$toolAll.tools.judgeAuth()) {
let exist = obj.url.slice(0,18);
if(exist=='/pages/tabbar/cate') {
uni.reLaunch({
@ -128,7 +127,6 @@
url:obj.url
})
}
}
},
//
goSearch(){

View File

@ -55,7 +55,6 @@
//
submit(){
if(this.checkEmpty() && this.flag){
console.log(121231222)
this.flag = false;
let params = {
sku_list: uni.getStorageSync('buyList'),
@ -71,6 +70,7 @@
url:`/pagesB/finish/finish?id=${res.data.id}`
})
}else{
console.log(res.msg,'提示信息')
this.$toolAll.tools.showToast(res.msg);
this.flag = true;
}