Commit ff4cc78b authored by liwei's avatar liwei

增加了我的页面的校验,如果用户被禁用,则显示未登录,去除localstorage存储的信息

parent 66de7e5c
...@@ -247,6 +247,13 @@ import {articleList, getOssUrl} from "../../api/article"; ...@@ -247,6 +247,13 @@ import {articleList, getOssUrl} from "../../api/article";
//获取用户详情信息 //获取用户详情信息
getUserDetail(){ getUserDetail(){
userDetail(this.userInfo.memberId).then(res => { userDetail(this.userInfo.memberId).then(res => {
//如果flag=0 被禁用了 踢出该用户
if (res.data.data.flag == '0'){
uni.removeStorageSync('userInfo')
uni.removeStorageSync('token')
this.nologin = true
return;
}
//处理头像 //处理头像
if (res.data.data.avatar != null){ if (res.data.data.avatar != null){
getOssUrl(res.data.data.avatar).then( imgRes =>{ getOssUrl(res.data.data.avatar).then( imgRes =>{
......
...@@ -54,6 +54,19 @@ ...@@ -54,6 +54,19 @@
} }
login(code).then(res => { login(code).then(res => {
this.openId = res.data.openId this.openId = res.data.openId
if (res.data.code == 1001){
//用户已被停用 提示报错信息 返回首页
uni.showToast({
title: res.data.message,
icon: 'none'
})
//间隔1秒 跳转到首页
setTimeout(() => {
uni.switchTab({
url: '/pages/tab/index'
});
}, 1500)
}
//证明不是第一次登录 //证明不是第一次登录
if (res.data.token !== undefined && res.data.token !== null) { if (res.data.token !== undefined && res.data.token !== null) {
this.token = res.data.token this.token = res.data.token
......
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