""<view class="p-10" style="width: 100%;">
<button type="default" style="background-color:#069cca ; color: #FFFFFF; width: 70%;" @click="login()">立即登陆</button>
</view>""
""
login() {
_self = this;
if(!this.is_pass_word){
var num = /^\d{6}$/; // 验证是否6位数字
if (!num.test(this.code)) {
uni.showModal({
title: '提示',
content: '验证格式错误!',
success(res) {
if (res.confirm) {
_self.code = '';
}
}
});
} else {
//console.log(_self.phoneNum)
//console.log(_self.code)
if(!this.is_pass_word){
uni.request({
url: this.Url + 'f_login_confirm',
data: { tel: _self.phoneNum, code: _self.code,code_uid:_self.code_uid },
method: 'GET',
success(res) {
console.log(res.data);
if (res.data.res == 200) {
uni.showToast({
title:res.data.msg,
success() {
try{
uni.setStorage({
key: 'user_uuid',
data: res.data.user_uuid,
success() {
console.log('缓存userna成功');
//全局绑定即时通讯发送者
setTimeout(function(){
uni.reLaunch({
url: '../index/index'
});
},1500)
}
});
}catch(e){
//TODO handle the exception
}
}
})
} else {
uni.showModal({
title: '提示',
content: res.data.msg
});
_self.code=''
}
}
});
}else{
this.login_by_password()
}
}
}else{
this.login_by_password()
}
},
login_by_password(){
_self=this
var z=/^1[3456789]\d{9}$/;
if(this.pass_word.length<6 || !/^1[3456789]\d{9}$/.test(this.phoneNum)){
uni.showToast({
title:'手机号或密码格式错误!',
icon:'none'
})
return
}else{
uni.request({
url: this.Url + 'f_login_by_password_confirm',
data: { tel: this.phoneNum, password:this.pass_word },
method: 'GET',
success(res) {
console.log(res.data);
if (res.data.res == 200) {
uni.showToast({
title:res.data.msg,
success() {
try{
uni.setStorage({
key: 'user_uuid',
data: res.data.user_uuid,
success() {
console.log('缓存userna成功');
//全局绑定即时通讯发送者
setTimeout(function(){
uni.reLaunch({
url: '../index/index'
});
},1500)
}
});
}catch(e){
//TODO handle the exception
}
}
})
} else {
uni.showModal({
title: '提示',
content: res.data.msg
});
_self.code=''
}
}
});
}
}
""
0 个回复