소스 검색

登录

娄底高职分支
yxq 2 주 전
부모
커밋
3a7daf850f
2개의 변경된 파일113개의 추가작업 그리고 49개의 파일을 삭제
  1. +5
    -1
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-mpui/learun-ui-mp/input.vue
  2. +108
    -48
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/login.vue

+ 5
- 1
Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-mpui/learun-ui-mp/input.vue 파일 보기

@@ -6,6 +6,7 @@
</view>
<input
@input="input"
@blur="blur"
:value="value"
:type="type"
:disabled="disabled"
@@ -38,7 +39,10 @@ export default {
input(e) {
this.$emit('input', e.detail.value)
this.$emit('change', e.detail.value)
}
},
blur(e) {
this.$emit('blur', e.detail.value)
}
},

computed: {


+ 108
- 48
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/login.vue 파일 보기

@@ -27,24 +27,31 @@
</view>

<!-- 账户密码表单 -->
<l-input v-if="ready&&!isCode" v-model="username" placeholder="账号" left>
<l-input v-if="ready" v-model="username" @blur="getNeedCode" placeholder="账号" left>
<l-icon slot="title" type="people" />
</l-input>
<l-input v-if="ready&&!isCode" v-model="password" placeholder="请输入密码" password left>
<l-input v-if="ready" v-model="password" placeholder="请输入密码" password left>
<l-icon slot="title" type="lock" />
</l-input>
<l-input v-model="verifycode" v-if="isCode" placeholder="请输入验证码" left>
<l-input v-model="verifycode" v-if="needCode" placeholder="请输入验证码" left password>
<l-icon slot="title" type="lock" />
<template #suffix>
<view style="margin-top: 4px;color: #606266;">
<text :style="{color:time==0?'#409EFF':'#999'}" @click="time==0&&sendCode()">{{hasSendCode?'重新发送':'发送验证码'}}</text>
{{time?'('+time+ 's'+')' :''}}
</view>
</template>
</l-input>
<view v-if="isCode" :class="{codeSend:true,ok:time == ''}" style="margin-bottom: 12px;">
未收到验证码?<text class="sendbtn" @click="()=>{isCode=false;if(!time)login(null)}">重新发送</text>
<!-- <l-input v-model="verifycode" v-if="needCode" placeholder="请输入验证码" left>
<l-icon slot="title" type="lock" />
</l-input>
<view v-if="needCode" :class="{codeSend:true,ok:time == ''}" style="margin-bottom: 12px;">
未收到验证码?<text class="sendbtn" @click="()=>{needCode=false;if(!time)login(null)}">重新发送</text>
{{time?'( '+time+ 's'+' )' :''}}
</view>
</view> -->
<l-button @click="login(null)" size="lg" color="blue" class="margin-top-sm block" block>登 录</l-button>
<l-button v-if="isCode" @click="toLogin()" size="lg" color="white" class="margin-top-sm block"
block>重新登录</l-button>
<!-- #ifndef APP-PLUS -->
<view class="otherLogin" v-if="!isCode">
<view class="otherLogin">
<navigator url="/pages/forgotPassword">忘记密码?</text></navigator>
<navigator url="/pages/weixinLogin">微信登录</text></navigator>
</view>
@@ -55,7 +62,7 @@

<!-- 【仅小程序】一键登录按钮 -->
<!-- #ifdef MP -->
<l-button v-if="MPLogin&&!isCode" @click="login(PLATFORM)" size="lg" line="green"
<l-button v-if="MPLogin" @click="login(PLATFORM)" size="lg" line="green"
class="margin-top-sm block" block>
{{ PLATFORM_TEXT }}一键登录
</l-button>
@@ -96,7 +103,8 @@
resData: {},
loginResult:{},
logininfo:{},
isCode: false,
needCode: false,
hasSendCode:false,
mobile: '',
verifycode: '',
time: 0,
@@ -188,10 +196,10 @@
if (!await this.checkupdate())
return;
// #endif
if (this.isCode) {
this.checkverifycode()
return
}
// if (this.needCode) {
// this.checkverifycode()
// return
// }
const {
username,
password,
@@ -202,6 +210,10 @@
if (!type && !check()) {
return
}
if (this.needCode&&!this.verifycode) {
this.TOAST('请输入验证码');
return
}
this.LOADING('登录中…')

// 根据不同的登录方式,调用 API
@@ -218,9 +230,16 @@
let postResult = await this.POST('learun/adms/user/login', {
username,
password: this.MD5(password),
up: up
up: up,
verifycode:this.verifycode||undefined
})
if (postResult[1].data.code == '200') {
if(postResult[1].data.data.sendresult){
// this.TOAST(postResult[1].data.data.msg);
this.HIDE_LOADING()
this.needCode = true
return
}
loginResult = postResult[1].data.data;
this.loginResult = loginResult
var logininfo = {
@@ -231,6 +250,7 @@
this.logininfo = logininfo
this.username = ""
this.password = ""
this.verifycode = ""
} else {
this.TOAST(postResult[1].data.info);
@@ -280,28 +300,59 @@
user
}
this.HIDE_LOADING()
// 如果没发短信直接登录
if(!this.loginResult.sendresult){
this.checkverifycode(false)
return
this.SET_GLOBAL('token', this.resData.token)
this.SET_GLOBAL('loginUser', this.resData.user)
this.SET_STORAGE("logintime", this.resData.user.logTime);
this.SET_STORAGE('token', this.resData.token)
this.SET_STORAGE('logininfo', this.logininfo);
this.SET_STORAGE('userinfo', this.loginResult.baseinfo);
this.HIDE_LOADING()
// 密码强度校验
if (this.loginResult.pwd === true) {
this.SET_STORAGE('pwd', true);
this.TOAST("您的密码不满足强度要求,请您先修改密码后再执行系统其他操作");
setTimeout(()=>{
this.NAV_TO('/pages/my/newpassword')
},1000)
return;
} else {
this.SET_STORAGE('pwd', false);
this.TAB_TO('/pages/home')
}
// 发了短信 进入输入验证码页面
this.mobile = baseinfo.mobile
this.isCode = true
this.TOAST('已发送短信,请输入验证码');

this.time = 60
this.timeT = setInterval(() => {
this.time--
if (this.time == 0) {
clearInterval(this.timeT)
this.timeT = ''
// // 如果没发短信直接登录
// if(!this.loginResult.sendresult){
// this.checkverifycode(false)
// return
// }
// // 发了短信 进入输入验证码页面
// this.mobile = baseinfo.mobile
// this.needCode = true
// this.TOAST('已发送短信,请输入验证码');

// this.time = 60
// this.timeT = setInterval(() => {
// this.time--
// if (this.time == 0) {
// clearInterval(this.timeT)
// this.timeT = ''
// return
// }
// }, 1000);
},
// 获取是否需要验证码
getNeedCode(){
this.POST('learun/adms/user/loginverify',{account:this.username}).then(res=>{
if (res[1].data.code != '200') {
this.TOAST(res[1].data.info);
return
}
}, 1000);
if(res[1].data.data.sendresult){
this.needCode = true
}
})
},

// 验证用户输入
check() {
const {
@@ -315,7 +366,28 @@

return true
},

// 发送验证码
sendCode(){
this.LOADING()
this.HTTP_POST('learun/adms/user/sendmsg',{account:this.username}).then(res=>{
this.HIDE_LOADING()
if(!res){
return
}
this.TOAST(res.msg);
if(!res.sendstate)return
this.hasSendCode = true
this.time = 60
this.timeT = setInterval(() => {
this.time--
if (this.time == 0) {
clearInterval(this.timeT)
this.timeT = ''
return
}
}, 1000);
})
},
// 验证码校验
async checkverifycode(needCheck=true) {
if(needCheck){
@@ -369,7 +441,7 @@
this.mobile = ''
this.verifycode = ''
this.timeT && clearInterval(this.timeT)
this.isCode = false
this.needCode = false
},
},

@@ -483,17 +555,5 @@
bottom: 10px;
/* #endif */
}

.codeSend {
color: #999;
}

.codeSend.ok {
color: #666;
}

.codeSend.ok .sendbtn {
color: #409EFF;
}
}
</style>

불러오는 중...
취소
저장