Browse Source

登录方式

master
453530270@qq.com 2 years ago
parent
commit
7e9d26af0f
  1. 10
      core/app.js
  2. 7
      pages/login/loginsms.vue
  3. 218
      pages/login/smscode.vue

10
core/app.js

@ -220,13 +220,3 @@ export const tohex=(str)=>{
} }
return hexStr; return hexStr;
} }
function aesEncrypt(text, key) {
var encrypted = CryptoJS.AES.encrypt(text, key);
return encrypted.toString();
}
function aesDecrypt(text, key) {
var decrypted = CryptoJS.AES.decrypt(text, key);
return decrypted.toString(CryptoJS.enc.Utf8);
}

7
pages/login/loginsms.vue

@ -73,9 +73,8 @@ import store from '@/store'
const app = this const app = this
if (!app.isLoading && app.formValidationMobile(app.mobile)) { if (!app.isLoading && app.formValidationMobile(app.mobile)) {
//app.submitLogin() //app.submitLogin()
console.log(this.$tohex("sss"))
// //
// app.$navTo("pages/login/smscode?rt="+app.mobile) app.$navTo("pages/login/smscode?rt="+app.mobile)
} }
}, },
@ -85,6 +84,10 @@ import store from '@/store'
this.$toast('手机号不能为空') this.$toast('手机号不能为空')
return false return false
} }
if(!Verify.isMobile(str)){
this.$toast("输入的手机号码格式不对")
return false
}
return true return true
}, },

218
pages/login/smscode.vue

@ -1,5 +1,6 @@
<template> <template>
<view class="phone_code"> <view class="phone_code">
<view class="kbzone"></view>
<text class="phone_code_label">验证码已发送至</text> <text class="phone_code_label">验证码已发送至</text>
<view class="phone_code_count"> <view class="phone_code_count">
<text class="phone_code_count_new">{{ newPhone }}</text> <text class="phone_code_count_new">{{ newPhone }}</text>
@ -24,98 +25,128 @@
<script> <script>
export default { import store from '@/store'
data() { import * as LoginApi from '@/api/login'
return { export default {
newPhone: "167****8898", // data() {
isReget: false, // return {
timer: null, // newPhone: "13800138000", //
count: 60, // isReget: false, //
code:"", // timer: null, //
focus:true, // count: 60, //
isCode:true // code:"", //
focus:true, //
//
isLoading: false,
isCode:true //
}
},
onLoad(options) {
// console.log(options)
if(options.rt!=""){
this.newPhone = options.rt
}
this.getTimer() //
this.getCode() //
},
watch: {
count(val) {
if (val == 0) {
this.isReget = true
clearInterval(this.timer)
}
},
},
methods: {
/**
* AUTHOR: 单乘风
* DESC: 定时器
* */
getTimer() {
this.timer = setInterval(() => {
if (this.count == 0) {
clearInterval(this.timer)
uni.navigateBack({
delta: 1
})
return
} }
}, this.count--
onLoad(options) { }, 1000)
console.log(options) },
this.getTimer() //
this.getCode() // /**
}, * AUTHOR: 单乘风
watch: { * DESC: 获取验证码
count(val) { * */
if (val == 0) { getCode() {
this.isReget = true // console.log("", this.newPhone)
clearInterval(this.timer) if (this.count == 0) {
} this.count = 60
}, this.isReget = false
}, this.getTimer()
methods: {
/**
* AUTHOR: 单乘风
* DESC: 定时器
* */
getTimer() {
this.timer = setInterval(() => {
if (this.count == 0) {
clearInterval(this.timer)
uni.navigateBack({
delta: 1
})
return
}
this.count--
}, 1000)
},
/**
* AUTHOR: 单乘风
* DESC: 获取验证码
* */
getCode() {
console.log("获取验证码", this.newPhone)
if (this.count == 0) {
this.count = 60
this.isReget = false
this.getTimer()
}
},
/**
* AUTHOR: 单乘风
* DESC: 输入框输入事件
* */
codeNumInputFun(e) {
let val = e.detail.value
this.code = val
if (val.length == 6) this.isCode = false
else this.isCode = true
},
/**
* AUTHOR: 单乘风
* DESC: 输入框失去焦点事件
* */
codeNumBlurFun(e) {
let val = e.detail.value
this.focus = false
if (val.length == 6) this.isCode = false
else this.isCode = true
},
/**
* AUTHOR: 单乘风
* DESC: 输入框点击事件
* @param {Number} index 当前点击框索引
* */
codefocusFun(index) {
this.focus = true
},
/**
* AUTHOR: 单乘风
* DESC: 按钮点击事件
* */
submitFun() {
console.log("确认更换手机号")
},
} }
} },
/**
* AUTHOR: 单乘风
* DESC: 输入框输入事件
* */
codeNumInputFun(e) {
let val = e.detail.value
this.code = val
if (val.length == 6) this.isCode = false
else this.isCode = true
},
/**
* AUTHOR: 单乘风
* DESC: 输入框失去焦点事件
* */
codeNumBlurFun(e) {
let val = e.detail.value
this.focus = false
if (val.length == 6) this.isCode = false
else this.isCode = true
},
/**
* AUTHOR: 单乘风
* DESC: 输入框点击事件
* @param {Number} index 当前点击框索引
* */
codefocusFun(index) {
this.focus = true
},
/**
* AUTHOR: 单乘风
* DESC: 按钮点击事件
* */
submitFun() {
const app = this
app.isLoading = true
store.dispatch('Login', {
smsCode: app.smsCode,
mobile: app.mobile,
isParty: app.isParty,
partyData: app.partyData
})
.then(result => {
//
app.$toast(result.message)
// :
uni.$emit('syncRefresh', true)
//
setTimeout(() => app.onNavigateBack(1), 2000)
})
.catch(err => {
//
if (err.result.data.isBack) {
setTimeout(() => app.onNavigateBack(1), 2000)
}
})
.finally(() => app.isLoading = false)
//console.log("")
},
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -127,6 +158,11 @@
&_code { &_code {
padding: 30rpx; padding: 30rpx;
.kbzone{
width: 100%;
height: 32vh;
}
&_label { &_label {
font-size: 30rpx; font-size: 30rpx;
color: #999; color: #999;
@ -160,6 +196,7 @@
} }
} }
//
&_single { &_single {
margin-top: 30rpx; margin-top: 30rpx;
@ -168,6 +205,7 @@
left: -100rpx; left: -100rpx;
width: 50rpx; width: 50rpx;
height: 50rpx; height: 50rpx;
border-bottom: #313131 solid 2rpx;
} }
&_codeinput { &_codeinput {

Loading…
Cancel
Save