境外短信验证登陆

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/"; // socketUrl = "ws://localhost:6001/";
// baseUrl = "https://twin-ui.com/demo/"; // baseUrl = "https://twin-ui.com/demo/";
// baseUrl = "http://59.110.212.44:9200/pb/"; // baseUrl = "http://59.110.212.44:9200/pb/";
// baseUrl = "https://testapi.nuttyreading.com/"; // 线上测试环境 baseUrl = "https://testapi.nuttyreading.com/"; // 线上测试环境
baseUrl = "https://api.nuttyreading.com/"; // 线上正式 // baseUrl = "https://api.nuttyreading.com/"; // 线上正式
// baseUrl = "http://192.168.110.100:9100/pb/"; // 开发用电脑 // baseUrl = "http://192.168.110.100:9100/pb/"; // 开发用电脑
// baseUrl = "http://192.168.110.110:9200/pb/"; // baseUrl = "http://192.168.110.110:9200/pb/";
// baseUrl = "http://192.168.110.38:9200/pb/"; // 吴春磊笔记本1 // 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}$/; const mailRegular = /^\w+@\w+(\.[a-zA-Z]{2,3}){1,2}$/;
//密码验证正则表达式 //密码验证正则表达式

View File

@@ -12,8 +12,8 @@
"src" : "图片路径" "src" : "图片路径"
} }
], ],
"versionName" : "1.2.14", "versionName" : "1.2.15",
"versionCode" : 1214, "versionCode" : 1215,
"app-plus" : { "app-plus" : {
"compatible" : { "compatible" : {
"ignoreVersion" : true "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 == 2000 }" @click="type = 2000">验证码登录/注册</view>
<view class="title" :class="{ active: type == 1000 }" @click="type = 1000">密码登录</view> --> <view class="title" :class="{ active: type == 1000 }" @click="type = 1000">密码登录</view> -->
</view> </view>
<view class="input_tit">手机号</view> <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 class="myselect" placeholder="选择区号" v-model="quCode" :localdata="quCodeList" style="height: 30rpx !important;"
@change="quChange"></uni-data-select>
</view>
</view>
<!-- 带区号 --> <!-- 带区号 -->
<!-- <view class="flexbox " style="margin:36rpx 0; justify-content: space-between;"> <view class="flexbox " style="margin:36rpx 0; justify-content: space-between;">
<view class="quhao"> <view class="triangle borderBottom phoneNumberInput" style="width: 150rpx;">
<uni-data-select <input type="number" v-model="quCode" placeholder="区号" placeholder-class="grey" />
placeholder="区号" model="quCode"
:localdata="quCodeList"
@change="quChange"
></uni-data-select>
</view> </view>
<view class="triangle borderBottom phoneNumberInput" :clasfs="[type == 1000 ? 'left_triangle': 'right_triangle']"> <view class="triangle borderBottom phoneNumberInput"
<input type="number" v-model="phone" @input="onInput" placeholder="请输入您的手机号" placeholder-class="grey" /> :clasfs="[type == 1000 ? 'left_triangle': 'right_triangle']">
<input type="number" v-model="phone" @input="onInput" placeholder="请输入您的手机号"
placeholder-class="grey" />
</view> </view>
</view> --> </view>
<!-- 不带区号 --> <!-- 不带区号 -->
<view class="triangle borderBottom phoneNumberInput input_box" <!-- <view class="triangle borderBottom phoneNumberInput input_box"
:clasfs="[type == 1000 ? 'left_triangle': 'right_triangle']"> :clasfs="[type == 1000 ? 'left_triangle': 'right_triangle']">
<input type="number" v-model="phone" @input="onInput" placeholder="请输入您的手机号" placeholder-class="grey" /> <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_tit" v-if="type == 1000">密码</view>
<view class="input_box" v-if="type == 1000"> <view class="input_box" v-if="type == 1000">
@@ -190,16 +195,8 @@
Content: '' Content: ''
}, },
quShow: false, quShow: false,
quCodeList: [{ quCodeList: [], // 国家区域码
value: '1', quCode: 86,
text: '江'
},
{
value: '2',
text: '湖'
}
],
quCode: null,
}; };
}, },
@@ -216,11 +213,43 @@
// #endif // #endif
}, },
//页面显示 //页面显示
onShow() {}, onShow() {
this.getCountyCode()
},
//方法 //方法
methods: { methods: {
...mapMutations(['setUserInfo']), ...mapMutations(['setUserInfo']),
...mapMutations(['setHealthMes']), ...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) { quChange(e) {
console.log(e, 'e') console.log(e, 'e')
}, },
@@ -294,12 +323,15 @@
}); });
return; return;
} }
if (!this.$base.phoneRegular.test(this.phone)) { if (this.quCode == null || this.quCode == 86) { // 如果没选择国家code默认是中国大陆
uni.showToast({ if (!this.$base.phoneRegular.test(this.phone)) {
title: '手机格式不正确', uni.showToast({
icon: 'none' title: '手机格式不正确',
}); icon: 'none'
return; });
return;
}
console.log(this.quCode, '选择的区段')
} }
if (!this.agree) { if (!this.agree) {
uni.showToast({ uni.showToast({
@@ -312,6 +344,7 @@
this.$http this.$http
.get('book/user/sms/sendcode', { .get('book/user/sms/sendcode', {
phone: this.phone, phone: this.phone,
areaCode: this.quCode,
type: 2000 type: 2000
}) })
.then(res => { .then(res => {
@@ -339,12 +372,14 @@
}); });
return; return;
} }
if (!this.$base.phoneRegular.test(this.phone)) { if (this.quCode == null || this.quCode == 86) {
uni.showToast({ if (!this.$base.phoneRegular.test(this.phone)) {
title: '手机格式不正确', uni.showToast({
icon: 'none' title: '手机格式不正确',
}); icon: 'none'
return; });
return;
}
} }
let httpData = {}; let httpData = {};
if (this.type == 2000) { if (this.type == 2000) {
@@ -635,10 +670,10 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '@/style/mixin.scss'; @import '@/style/mixin.scss';
.myselect{height: 50rpx !important;}
.phoneNumberInput { .phoneNumberInput {
width: calc(100% - 130rpx); width: calc(100% - 160rpx);
width: 100%; // width: 100%;
height: 67rpx; height: 67rpx;
input { input {
@@ -656,7 +691,8 @@
} }
.quhao { .quhao {
width: 120rpx; height: 50rpx;
width: 180rpx;
} }
.highlight { .highlight {