Browse Source

提示修改

娄底高职分支
王晓寒 2 weeks ago
parent
commit
99a78dafdd
2 changed files with 45 additions and 32 deletions
  1. +11
    -3
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/UserApi.cs
  2. +34
    -29
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/login.vue

+ 11
- 3
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/UserApi.cs View File

@@ -73,7 +73,7 @@ namespace Learun.Application.WebApi
var isSend = GetAccountIsSendMsg(account.account); var isSend = GetAccountIsSendMsg(account.account);
if (!isSend.HasValue) if (!isSend.HasValue)
{ {
return Fail("请维护用户手机号信息");
return Fail("请检查登录账号信息");
} }
return Success(new { sendresult = isSend }); return Success(new { sendresult = isSend });
} }
@@ -86,7 +86,7 @@ namespace Learun.Application.WebApi
var account = this.GetReqData<UserAccount>(); var account = this.GetReqData<UserAccount>();
var isSend = GetAccountIsSendMsg(account.account); var isSend = GetAccountIsSendMsg(account.account);
if (!isSend.HasValue) if (!isSend.HasValue)
return Fail("请维护用户手机号信息");
return Fail("请检查登录账号信息");


if (!isSend.Value) if (!isSend.Value)
return Fail("该用户不需要短信登录"); return Fail("该用户不需要短信登录");
@@ -143,6 +143,14 @@ namespace Learun.Application.WebApi
private bool? GetAccountIsSendMsg(string account) private bool? GetAccountIsSendMsg(string account)
{ {
var userEntity = userIBLL.GetEntityByMobile(account); var userEntity = userIBLL.GetEntityByMobile(account);
if (userEntity==null)
{
userEntity = userIBLL.GetEntityByAccount(account);
if (userEntity==null)
{
return null;
}
}
//是否强密码验证 //是否强密码验证
bool pwd = !string.IsNullOrEmpty(ConfigurationManager.AppSettings["verifypwd"]) && ConfigurationManager.AppSettings["verifypwd"] == "true"; bool pwd = !string.IsNullOrEmpty(ConfigurationManager.AppSettings["verifypwd"]) && ConfigurationManager.AppSettings["verifypwd"] == "true";
//是否发送短信 //是否发送短信
@@ -343,7 +351,7 @@ namespace Learun.Application.WebApi
return Fail(userEntity.LoginMsg); return Fail(userEntity.LoginMsg);
} }
if (!isSend.HasValue) if (!isSend.HasValue)
return Fail("请维护用户手机号信息");
return Fail("请检查登录账号信息");
if (isSend.Value) if (isSend.Value)
{ {
if (string.IsNullOrEmpty(loginModel.verifycode)) if (string.IsNullOrEmpty(loginModel.verifycode))


+ 34
- 29
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/login.vue View File

@@ -27,7 +27,7 @@
</view> </view>


<!-- 账户密码表单 --> <!-- 账户密码表单 -->
<l-input v-if="ready" v-model="username" @blur="getNeedCode" placeholder="号" left>
<l-input v-if="ready" v-model="username" @blur="getNeedCode" placeholder="手机号" left>
<l-icon slot="title" type="people" /> <l-icon slot="title" type="people" />
</l-input> </l-input>
<l-input v-if="ready" v-model="password" placeholder="请输入密码" password left> <l-input v-if="ready" v-model="password" placeholder="请输入密码" password left>
@@ -37,7 +37,8 @@
<l-icon slot="title" type="lock" /> <l-icon slot="title" type="lock" />
<template #suffix> <template #suffix>
<view style="margin-top: 4px;color: #606266;"> <view style="margin-top: 4px;color: #606266;">
<text :style="{color:time==0?'#409EFF':'#999'}" @click="time==0&&sendCode()">{{hasSendCode?'重新发送':'发送验证码'}}</text>
<text :style="{color:time==0?'#409EFF':'#999'}"
@click="time==0&&sendCode()">{{hasSendCode?'重新发送':'发送验证码'}}</text>
{{time?'('+time+ 's'+')' :''}} {{time?'('+time+ 's'+')' :''}}
</view> </view>
</template> </template>
@@ -62,8 +63,8 @@


<!-- 【仅小程序】一键登录按钮 --> <!-- 【仅小程序】一键登录按钮 -->
<!-- #ifdef MP --> <!-- #ifdef MP -->
<l-button v-if="MPLogin" @click="login(PLATFORM)" size="lg" line="green"
class="margin-top-sm block" block>
<l-button v-if="MPLogin" @click="login(PLATFORM)" size="lg" line="green" class="margin-top-sm block"
block>
{{ PLATFORM_TEXT }}一键登录 {{ PLATFORM_TEXT }}一键登录
</l-button> </l-button>
<!-- #endif --> <!-- #endif -->
@@ -101,10 +102,10 @@
devAccountList: [], devAccountList: [],


resData: {}, resData: {},
loginResult:{},
logininfo:{},
loginResult: {},
logininfo: {},
needCode: false, needCode: false,
hasSendCode:false,
hasSendCode: false,
mobile: '', mobile: '',
verifycode: '', verifycode: '',
time: 0, time: 0,
@@ -210,7 +211,7 @@
if (!type && !check()) { if (!type && !check()) {
return return
} }
if (this.needCode&&!this.verifycode) {
if (this.needCode && !this.verifycode) {
this.TOAST('请输入验证码'); this.TOAST('请输入验证码');
return return
} }
@@ -231,10 +232,10 @@
username, username,
password: this.MD5(password), password: this.MD5(password),
up: up, up: up,
verifycode:this.verifycode||undefined
verifycode: this.verifycode || undefined
}) })
if (postResult[1].data.code == '200') { if (postResult[1].data.code == '200') {
if(postResult[1].data.data.sendresult){
if (postResult[1].data.data.sendresult) {
// this.TOAST(postResult[1].data.data.msg); // this.TOAST(postResult[1].data.data.msg);
this.HIDE_LOADING() this.HIDE_LOADING()
this.needCode = true this.needCode = true
@@ -251,7 +252,7 @@
this.username = "" this.username = ""
this.password = "" this.password = ""
this.verifycode = "" this.verifycode = ""
} else { } else {
this.TOAST(postResult[1].data.info); this.TOAST(postResult[1].data.info);
} }
@@ -300,7 +301,7 @@
user user
} }
this.HIDE_LOADING() this.HIDE_LOADING()
this.SET_GLOBAL('token', this.resData.token) this.SET_GLOBAL('token', this.resData.token)
this.SET_GLOBAL('loginUser', this.resData.user) this.SET_GLOBAL('loginUser', this.resData.user)
this.SET_STORAGE("logintime", this.resData.user.logTime); this.SET_STORAGE("logintime", this.resData.user.logTime);
@@ -312,15 +313,15 @@
if (this.loginResult.pwd === true) { if (this.loginResult.pwd === true) {
this.SET_STORAGE('pwd', true); this.SET_STORAGE('pwd', true);
this.TOAST("您的密码不满足强度要求,请您先修改密码后再执行系统其他操作"); this.TOAST("您的密码不满足强度要求,请您先修改密码后再执行系统其他操作");
setTimeout(()=>{
setTimeout(() => {
this.NAV_TO('/pages/my/newpassword') this.NAV_TO('/pages/my/newpassword')
},1000)
}, 1000)
return; return;
} else { } else {
this.SET_STORAGE('pwd', false); this.SET_STORAGE('pwd', false);
this.TAB_TO('/pages/home') this.TAB_TO('/pages/home')
} }
// // 如果没发短信直接登录 // // 如果没发短信直接登录
// if(!this.loginResult.sendresult){ // if(!this.loginResult.sendresult){
// this.checkverifycode(false) // this.checkverifycode(false)
@@ -342,14 +343,16 @@
// }, 1000); // }, 1000);
}, },
// 获取是否需要验证码 // 获取是否需要验证码
getNeedCode(){
if(!this.username)return
this.POST('learun/adms/user/loginverify',{account:this.username}).then(res=>{
getNeedCode() {
if (!this.username) return
this.POST('learun/adms/user/loginverify', {
account: this.username
}).then(res => {
if (res[1].data.code != '200') { if (res[1].data.code != '200') {
this.TOAST(res[1].data.info); this.TOAST(res[1].data.info);
return return
} }
if(res[1].data.data.sendresult){
if (res[1].data.data.sendresult) {
this.needCode = true this.needCode = true
} }
}) })
@@ -368,15 +371,17 @@
return true return true
}, },
// 发送验证码 // 发送验证码
sendCode(){
sendCode() {
this.LOADING() this.LOADING()
this.HTTP_POST('learun/adms/user/sendmsg',{account:this.username}).then(res=>{
this.HTTP_POST('learun/adms/user/sendmsg', {
account: this.username
}).then(res => {
this.HIDE_LOADING() this.HIDE_LOADING()
if(!res){
if (!res) {
return return
} }
this.TOAST(res.msg); this.TOAST(res.msg);
if(!res.sendstate)return
if (!res.sendstate) return
this.hasSendCode = true this.hasSendCode = true
this.time = 60 this.time = 60
this.timeT = setInterval(() => { this.timeT = setInterval(() => {
@@ -390,8 +395,8 @@
}) })
}, },
// 验证码校验 // 验证码校验
async checkverifycode(needCheck=true) {
if(needCheck){
async checkverifycode(needCheck = true) {
if (needCheck) {
if (!this.verifycode) { if (!this.verifycode) {
this.TOAST('请输入验证码'); this.TOAST('请输入验证码');
return return
@@ -426,16 +431,16 @@
if (this.loginResult.pwd === true) { if (this.loginResult.pwd === true) {
this.SET_STORAGE('pwd', true); this.SET_STORAGE('pwd', true);
this.TOAST("您的密码不满足强度要求,请您先修改密码后再执行系统其他操作"); this.TOAST("您的密码不满足强度要求,请您先修改密码后再执行系统其他操作");
setTimeout(()=>{
setTimeout(() => {
this.NAV_TO('/pages/my/newpassword') this.NAV_TO('/pages/my/newpassword')
},1000)
}, 1000)
return; return;
} else { } else {
this.SET_STORAGE('pwd', false); this.SET_STORAGE('pwd', false);
this.TAB_TO('/pages/home') this.TAB_TO('/pages/home')
} }
}, },
toLogin() { toLogin() {
this.resData = {} this.resData = {}


Loading…
Cancel
Save