Browse Source

update login

master
zmt 3 years ago
parent
commit
d8f0587251
  1. 3
      nxTemp/apis/userAPI.js
  2. 8
      pages/index/index.vue
  3. 63
      pages/login/login.vue

3
nxTemp/apis/userAPI.js

@ -117,7 +117,6 @@ export function rankSave(data) {
/**
* @description: 消息中心-消息列表
* @param {*}
* brand_id, order_no , rank_data{id,val}
*/
export function msgList(data) {
return http.post(`${config.baseUrl}/matchAssistant/msgCenter/list`,data);
@ -126,7 +125,6 @@ export function msgList(data) {
/**
* @description: 消息中心-未读消息数量
* @param {*}
* brand_id, order_no , rank_data{id,val}
*/
export function msgNum(data) {
return http.post(`${config.baseUrl}/matchAssistant/msgCenter/notReadNum`,data);
@ -135,7 +133,6 @@ export function msgNum(data) {
/**
* @description: 消息中心-消息详情
* @param {*}
* brand_id, order_no , rank_data{id,val}
*/
export function msgGet(data) {
return http.post(`${config.baseUrl}/matchAssistant/msgCenter/get`,data);

8
pages/index/index.vue

@ -45,9 +45,11 @@
computed:{
...mapState(['userInfo']),
...mapGetters(['hasLogin']),
},
onShow() {
this.updateMsgNum()
},
onLoad(opt) {
this.updateMsgNum()
},
onUnload() {
@ -58,11 +60,11 @@
this.$Router.push({name:name})
},
updateMsgNum(){
console.log(123);
if(!this.hasLogin) return console.log("该用户还未登录");
msgNum(this.postData).then(res => {
this.unReadNum = res
}).catch(e=>{
this.$tools.showNone(e.errMsg)
// this.$tools.showNone(e.errMsg)
})
},
async clickEvent(){

63
pages/login/login.vue

@ -8,7 +8,7 @@
<view class="sjh list-call">
<input class="sl-input" v-model="login.mobile" type="number" maxlength="11" placeholder="输入手机号码" />
</view>
<view class="tips">手机号码格式错误请重新填写</view>
<view class="tips" v-if="showPhoneErr">手机号码格式错误请重新填写</view>
<view class="yzm flex_row">
<view class="list-call l-short">
@ -21,7 +21,7 @@
</view>
<view v-else class="list-call l-small flex_col">{{count}}s</view>
</view>
<view class="tips">验证码错误请重新填写</view>
<view class="tips" v-if="showCodeErr">验证码错误请重新填写</view>
</view>
@ -59,20 +59,32 @@
count:5,
code:"",
agreed:false,//
login: {//
mobile: '13500071371',//
ticket: 'test',//
verify_code:'666666',//
login: {//
mobile: '',//
ticket: '',//
verify_code:'',//
// mobile: '13500071371',//
// ticket: 'test',//
// verify_code:'666666',//
},
WXdetail:{
code:"",
appid:"",
encryptedData:"",
iv:"",
}
},
showCodeErr:false,
showPhoneErr:false
};
},
computed:{
checkMobile(){
return this.login.mobile
},
checkCode(){
return this.login.verify_code
}
},
async onLoad() {
// let _login = await this.$tools.promisify(uni.login)()
// this.code = _login.code
@ -84,11 +96,23 @@
},
methods: {
...mapActions(["setUserData"]),
bindLogin() {
if (this.login.mobile.length != 11) {
return this.$tools.showNone("请输入正确的手机号");}
if (this.login.verify_code.length < 6) {
return this.$tools.showNone("请输入正确的验证码");}
bindLogin() {
let {mobile} = this.login
let phoneReg = new RegExp(/^1(3|4|5|6|7|8|9)\d{9}$/);
if (!phoneReg.test(mobile)) {
this.showPhoneErr = true
return this.$tools.showNone("请输入正确的手机号");
}
this.showPhoneErr = false
if (this.login.verify_code.length < 6) {
this.showCodeErr = true
return this.$tools.showNone("请输入正确的验证码");
}
this.showCodeErr = false
if(!this.agreed){
return this.$tools.showNone("请确认已阅读并同意隐私协议");
}
postLogin(this.login).then(res => {
this.loginSuccess(res)
}).catch((e)=>{
@ -104,7 +128,15 @@
this.$Router.push('/pages/login/agreement')
},
sendSMS(){
console.log("sendSMS");
let {mobile} = this.login
let phoneReg = new RegExp(/^1(3|4|5|6|7|8|9)\d{9}$/);
if(!mobile||!phoneReg.test(mobile)){
this.showPhoneErr = true
return
}else if(phoneReg.test(mobile)){
this.showPhoneErr = false
}
postSendSMS({mobile}).then(res => {
this.$tools.showNone("发送成功");
this.login.ticket = res.data||""
@ -125,6 +157,9 @@
},
async decryptPhoneNumber(e){
console.log("decryptPhoneNumber",e);
if(!this.agreed){
return this.$tools.showNone("请确认已阅读并同意隐私协议");
}
if(e.detail.errMsg!=="getPhoneNumber:ok")return this.$tools.showNone(e.detail.errMsg)
this.$tools.showNone("解析数据...")
@ -136,6 +171,7 @@
this.getWXPhoneNumber(this.WXdetail)
},
getWXPhoneNumber(WXdetail){
wechatGetPhoneNumberLogin(WXdetail).then(res => {
// this.login.ticket = res.data||""
this.loginSuccess(res)
@ -259,6 +295,7 @@
}
.agreement-box{
margin-top: 20rpx;
padding-left: 30rpx;
color: #696D6F;
.a-icon{

Loading…
Cancel
Save