【优化】优化用户后台被禁用或者标注删除状态下,小程序前端禁止登录及提示的处理。

This commit is contained in:
大灰灰
2023-01-01 23:53:39 +08:00
parent a110ce1ccb
commit 1dbfc429e5
3 changed files with 42 additions and 4 deletions

View File

@@ -2,7 +2,7 @@
<view>
<u-toast ref="uToast" />
<!-- #ifndef MP-WEIXIN -->
<u-popup class="coreshop-bottom-popup-box" :show="showLogin" @close="hideModal" mode="bottom" :closeable="true">
<u-popup class="coreshop-bottom-popup-box" :show="showLogin && sessionAuthIdTool" @close="hideModal" mode="bottom" :closeable="true">
<view class="radius coreshop-bg-white wrap">
<view v-if="!showCodeBox">
<view class="wrap-content">
@@ -41,7 +41,7 @@
</u-popup>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<u-popup class="coreshop-bottom-popup-box" :show="showLogin" @close="hideModal" mode="center">
<u-popup class="coreshop-bottom-popup-box" :show="showLogin && sessionAuthIdTool" @close="hideModal" mode="center">
<view class="radius coreshop-bg-white">
<view class="modal-box">
<view class="modal-box-detail-detail">
@@ -196,9 +196,11 @@
// #ifdef MP-WEIXIN
var userInfo = this.$store.state.userInfo;
//var token = this.$db.get('userToken');
if (Object.keys(userInfo).length != 0) {
//if (Object.keys(userInfo).length != 0) {
if (userInfo) {
//console.log("获取到store.state用户数据");
} else {
_this.$store.commit('userInfo', "");
_this.doToken();
}
// #endif
@@ -361,6 +363,8 @@
_this.sessionAuthIdTool = res.otherData;
//console.log("成功后获取sessionAuthIdTool" + _this.sessionAuthIdTool);
} else {
_this.$u.toast(res.msg);
_this.$store.commit('userInfo', "");
_this.sessionAuthIdTool = res.otherData;
//console.log("失败后获取sessionAuthIdTool" + _this.sessionAuthIdTool);
}

View File

@@ -541,6 +541,9 @@
this.isShopManager = res.data.isShopManager
this.storeId = res.data.storeId;
})
} else {
this.hasLogin = false;
this.userInfo = null;
}
})
} else {
@@ -596,7 +599,9 @@
},
watch: {
hasLogin() {
this.getUserInfo();
if (this.hasLogin == true) {
this.getUserInfo();
}
}
},
//分享

View File

@@ -218,6 +218,20 @@ namespace CoreCms.Net.Web.WebApi.Controllers
var user = await _userServices.QueryByClauseAsync(p => p.id == userInfo.userId);
if (user != null)
{
if (user.status == (int)GlobalEnumVars.UserStatus.)
{
jm.status = false;
jm.msg = "您的账号已经被禁用。";
return jm;
}
if (user.isDelete == true)
{
jm.status = false;
jm.msg = "您的账号已经被禁用。";
return jm;
}
var claims = new List<Claim> {
new Claim(ClaimTypes.Name, user.nickName),
new Claim(JwtRegisteredClaimNames.Jti, user.id.ToString()),
@@ -832,6 +846,21 @@ namespace CoreCms.Net.Web.WebApi.Controllers
jm.code = 14007;
return jm;
}
if (user.status == (int)GlobalEnumVars.UserStatus.)
{
jm.status = false;
jm.msg = "您的账号已经被禁用。";
return jm;
}
if (user.isDelete == true)
{
jm.status = false;
jm.msg = "您的账号已经被禁用。";
return jm;
}
//获取用户等级
var userGrade = await _userGradeServices.QueryByClauseAsync(p => p.id == user.grade);
//获取优惠券