境外短信验证登陆

This commit is contained in:
@fawn-nine
2023-11-14 18:08:16 +08:00
parent 1172043635
commit 5277ab3f5b
3 changed files with 83 additions and 46 deletions

View File

@@ -6,8 +6,8 @@ if (process.env.NODE_ENV === 'development') {
// socketUrl = "ws://localhost:6001/";
// baseUrl = "https://twin-ui.com/demo/";
// baseUrl = "http://59.110.212.44:9200/pb/";
// baseUrl = "https://testapi.nuttyreading.com/"; // 线上测试环境
baseUrl = "https://api.nuttyreading.com/"; // 线上正式
baseUrl = "https://testapi.nuttyreading.com/"; // 线上测试环境
// baseUrl = "https://api.nuttyreading.com/"; // 线上正式
// baseUrl = "http://192.168.110.100:9100/pb/"; // 开发用电脑
// baseUrl = "http://192.168.110.110:9200/pb/";
// baseUrl = "http://192.168.110.38:9200/pb/"; // 吴春磊笔记本1
@@ -45,9 +45,10 @@ const courtConfig = {
}
};
//手机号验证正则表达式
// const phoneRegular = /^1\d{10}$/;
// (中国大陆)
const phoneRegular = /^1\d{10}$/;
// 手机号码验证 支持港澳台 大陆
const phoneRegular = /^[1][3-8]\d{9}$|^([6|9])\d{7}$|^[0][9]\d{8}$|^[6]([8|6])\d{5}$|^(00){0,1}(65){1}[13689]\d{6,7}$/;
// const phoneRegular = /^[1][3-8]\d{9}$|^([6|9])\d{7}$|^[0][9]\d{8}$|^[6]([8|6])\d{5}$|^(00){0,1}(65){1}[13689]\d{6,7}$/;
//邮箱验证正则表达式
const mailRegular = /^\w+@\w+(\.[a-zA-Z]{2,3}){1,2}$/;
//密码验证正则表达式

View File

@@ -12,8 +12,8 @@
"src" : "图片路径"
}
],
"versionName" : "1.2.14",
"versionCode" : 1214,
"versionName" : "1.2.15",
"versionCode" : 1215,
"app-plus" : {
"compatible" : {
"ignoreVersion" : true

View File

@@ -15,26 +15,31 @@
<!-- <view class="title" :class="{ active: type == 2000 }" @click="type = 2000">验证码登录/注册</view>
<view class="title" :class="{ active: type == 1000 }" @click="type = 1000">密码登录</view> -->
</view>
<view class="input_tit">手机号</view>
<!-- 带区号 -->
<!-- <view class="flexbox " style="margin:36rpx 0; justify-content: space-between;">
<view class="flexbox" style=" margin-top: 20rpx;">
<view class="input_tit" style="margin-top: 0; margin-right: 20rpx;">手机号</view>
<view class="quhao">
<uni-data-select
placeholder="区号" model="quCode"
:localdata="quCodeList"
@change="quChange"
></uni-data-select>
<uni-data-select class="myselect" placeholder="选择区号" v-model="quCode" :localdata="quCodeList" style="height: 30rpx !important;"
@change="quChange"></uni-data-select>
</view>
<view class="triangle borderBottom phoneNumberInput" :clasfs="[type == 1000 ? 'left_triangle': 'right_triangle']">
<input type="number" v-model="phone" @input="onInput" placeholder="请输入您的手机号" placeholder-class="grey" />
</view>
<!-- 带区号 -->
<view class="flexbox " style="margin:36rpx 0; justify-content: space-between;">
<view class="triangle borderBottom phoneNumberInput" style="width: 150rpx;">
<input type="number" v-model="quCode" placeholder="区号" placeholder-class="grey" />
</view>
</view> -->
<view class="triangle borderBottom phoneNumberInput"
:clasfs="[type == 1000 ? 'left_triangle': 'right_triangle']">
<input type="number" v-model="phone" @input="onInput" placeholder="请输入您的手机号"
placeholder-class="grey" />
</view>
</view>
<!-- 不带区号 -->
<view class="triangle borderBottom phoneNumberInput input_box"
<!-- <view class="triangle borderBottom phoneNumberInput input_box"
:clasfs="[type == 1000 ? 'left_triangle': 'right_triangle']">
<input type="number" v-model="phone" @input="onInput" placeholder="请输入您的手机号" placeholder-class="grey" />
</view>
</view> -->
<view class="input_tit" v-if="type == 1000">密码</view>
<view class="input_box" v-if="type == 1000">
@@ -190,16 +195,8 @@
Content: ''
},
quShow: false,
quCodeList: [{
value: '1',
text: '江'
},
{
value: '2',
text: '湖'
}
],
quCode: null,
quCodeList: [], // 国家区域码
quCode: 86,
};
},
@@ -216,11 +213,43 @@
// #endif
},
//页面显示
onShow() {},
onShow() {
this.getCountyCode()
},
//方法
methods: {
...mapMutations(['setUserInfo']),
...mapMutations(['setHealthMes']),
// 获取国家区域编码
getCountyCode() {
$http.request({
url: "book/baseArea/getAllBaseArea",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
// console.log(res,'区域码')
if (res.code == 0 && res.baseAreas.length > 0) {
// this.quCodeList = res.baseAreas
this.quCodeList = res.baseAreas.map(item => {
let obj = {
'text': item.title,
'value': item.code,
}
return obj
})
// console.log('改变格式后',this.quCodeList)
} else {
this.quCodeList = []
// this.totalPage = 0
}
}).catch(e => {
console.log(e, 'e')
});
},
quChange(e) {
console.log(e, 'e')
},
@@ -294,12 +323,15 @@
});
return;
}
if (!this.$base.phoneRegular.test(this.phone)) {
uni.showToast({
title: '手机格式不正确',
icon: 'none'
});
return;
if (this.quCode == null || this.quCode == 86) { // 如果没选择国家code默认是中国大陆
if (!this.$base.phoneRegular.test(this.phone)) {
uni.showToast({
title: '手机格式不正确',
icon: 'none'
});
return;
}
console.log(this.quCode, '选择的区段')
}
if (!this.agree) {
uni.showToast({
@@ -312,6 +344,7 @@
this.$http
.get('book/user/sms/sendcode', {
phone: this.phone,
areaCode: this.quCode,
type: 2000
})
.then(res => {
@@ -339,12 +372,14 @@
});
return;
}
if (!this.$base.phoneRegular.test(this.phone)) {
uni.showToast({
title: '手机格式不正确',
icon: 'none'
});
return;
if (this.quCode == null || this.quCode == 86) {
if (!this.$base.phoneRegular.test(this.phone)) {
uni.showToast({
title: '手机格式不正确',
icon: 'none'
});
return;
}
}
let httpData = {};
if (this.type == 2000) {
@@ -635,10 +670,10 @@
</script>
<style lang="scss" scoped>
@import '@/style/mixin.scss';
.myselect{height: 50rpx !important;}
.phoneNumberInput {
width: calc(100% - 130rpx);
width: 100%;
width: calc(100% - 160rpx);
// width: 100%;
height: 67rpx;
input {
@@ -656,7 +691,8 @@
}
.quhao {
width: 120rpx;
height: 50rpx;
width: 180rpx;
}
.highlight {