This commit is contained in:
徐哼唧L
2024-01-08 13:50:53 +08:00
parent c3f3918c9b
commit 50da1d7e38
14 changed files with 2610 additions and 347 deletions

View File

@@ -15,58 +15,79 @@
<!-- <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="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 v-if="type == 2000">
<view class="flexbox" style=" margin-top: 50rpx;">
<view class="input_tit emaPho" style="margin-top: 0; margin-right: 20rpx;">
<view @click="brand=3000" :class="{ active: brand == 3000 }">手机号</view>
<span>/</span>
<view @click="brand=4000" :class="{ active: brand == 4000 }">邮箱</view>
</view>
</view>
</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 class="flexbox" v-if="brand == 3000" 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 class="quhao">
<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>
<view class="triangle borderBottom phoneNumberInput"
<!-- 不带区号 -->
<!-- <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" />
<input type="number" v-model="phone" @input="onInput" placeholder="请输入您的手机号" placeholder-class="grey" />
</view> -->
<!-- 邮箱 -->
<view class="input_box" v-if="brand == 4000">
<input v-model="email" placeholder="请输入您的邮箱" placeholder-class="grey" @input="onInput" />
</view>
<view class="input_tit">验证码</view>
<view class="input_box">
<input v-model="code" placeholder="请输入您的验证码" placeholder-class="grey" @input="onInput" maxlength="6"
@confirm="onSubmit" />
<button class="active" @click="onSetCode">{{ codeText }}</button>
</view>
</view>
<!-- 不带区号 -->
<!-- <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 class="input_tit" v-if="type == 1000">密码</view>
<view class="input_box" v-if="type == 1000">
<input class="input_item" v-model="password" @input="onInput" :password="!isSee" placeholder="请输入密码"
placeholder-class="grey" @confirm="onSubmit" />
<image v-if="isSee" src="../../static/icon/ic_logon_display.png" mode="aspectFit"
@click="isSee = false">
</image>
<image v-else-if="!isSee" src="../../static/icon/ic_logon_hide.png" mode="aspectFit"
@click="isSee = true">
</image>
<!-- 密码登录 -->
<view v-if="type == 1000">
<!-- 手机号/邮箱 -->
<view class="input_tit" style=" margin-top: 80rpx;">手机号 / 邮箱</view>
<view class="input_box">
<input v-model="phoneEmail" placeholder="请输入您的手机号或者邮箱" placeholder-class="grey" @input="onInput" />
</view>
<view class="input_tit">密码</view>
<view class="input_box">
<input class="input_item" v-model="password" @input="onInput" :password="!isSee" placeholder="请输入密码"
placeholder-class="grey" @confirm="onSubmit" />
<image v-if="isSee" src="../../static/icon/ic_logon_display.png" mode="aspectFit"
@click="isSee = false">
</image>
<image v-else-if="!isSee" src="../../static/icon/ic_logon_hide.png" mode="aspectFit"
@click="isSee = true">
</image>
</view>
</view>
<view class="input_tit" v-if="type == 2000">验证码</view>
<view class="input_box" v-if="type == 2000">
<input v-model="code" placeholder="请输入您的验证码" placeholder-class="grey" @input="onInput" maxlength="6"
@confirm="onSubmit" />
<button class="active" @click="onSetCode">{{ codeText }}</button>
</view>
<view class="protocol_box">
<view class="select" :class="{active: agree}" @click="agree = !agree"></view>
我已同意
<!-- <text @click="plus.runtime.openURL('https://main.nuttyreading.com/agreement.html')">用户协议</text> -->
<!-- <text @click="onPageJump('/pages/user/protocol')">用户协议</text> -->
<span class="highlight" @click="showXieyi('user')">用户协议</span>
<span class="highlight" @click="yhxyShow=true">用户协议</span>
<span class="highlight" @click="showXieyi('privacy')">隐私协议</span>
<span class="highlight" @click="yszcShow=true">隐私协议</span>
<!-- <text @click="onPageJump('/pages/user/protocol')">隐私协议</text>-->
</view>
<view class="btn_box">
@@ -93,6 +114,11 @@
</view>
</view>
<view class="youKeL">
<view @click="onPageJump('/pages/user/visitor')">免登陆体验</view>
</view>
<z-popup v-model="HealthOpen" type="center" :hideOnBlur="false">
<view class="popup_box">
<view class="popup_title">
@@ -138,14 +164,22 @@
</view> -->
<!-- #endif -->
<u-popup :show="xieyiShow" :round="10" @close="xieyiShow=false">
<u-popup :show="yhxyShow" title='用户协议' :round="10" @close="yhxyShow=false">
<view class="tanchu">
<view class="dp_title">{{xieyi.title}}</view>
<view style="max-height: 1000rpx;overflow-y: scroll;">
<view v-html="xieyi.Content"></view>
</view>
<view class="dp_title" v-html="yhxyText.title"></view>
<view class="dp_content" v-html="yhxyText.content"></view>
<!-- <yhxyPage></yhxyPage> -->
</view>
</u-popup>
<u-popup :show="yszcShow" title='隐私政策' :round="10" @close="yszcShow=false">
<view class="tanchu">
<view class="dp_title" v-html="yszcText.title"></view>
<view class="dp_content" v-html="yszcText.content"></view>
<!-- <yszcPage></yszcPage> -->
</view>
</u-popup>
</view>
</view>
@@ -154,9 +188,12 @@
<script>
import $http from '@/config/requestConfig.js';
import md5 from '@/plugins/md5';
// import yhxyPage from '@/pages/agreement/yhxyPage.vue';
// import yszcPage from '@/pages/agreement/yszcPage.vue';
import localuserxieyi from '@/static/json/userAndyinsiP.json'
import localyinsixieyi from '@/static/json/yinsiP.json'
// import localuserxieyi from '@/static/json/userAndyinsiP.json'
// import localyinsixieyi from '@/static/json/yinsiP.json'
var clear;
import {
mapState,
@@ -164,14 +201,21 @@
} from 'vuex';
import socket from '@/config/socket';
export default {
// components: {
// yhxyPage,
// yszcPage
// },
data() {
return {
type: 2000,
brand: 3000,
isSee: false,
code: '',
// phone: '15022449475',
// phone: '18047689535',
phone: '',
email: '',
phoneEmail: '',
password: '',
//验证码
codeText: '获取验证码',
@@ -189,11 +233,10 @@
health_phone: '',
health_password: '',
isSee_H: false,
xieyiShow: false,
xieyi: {
title: '',
Content: ''
},
yhxyShow: false,
yszcShow: false,
yhxyText: {},
yszcText: {},
quShow: false,
quCodeList: [], // 国家区域码
quCode: 86,
@@ -215,6 +258,7 @@
//页面显示
onShow() {
this.getCountyCode()
this.getSettlement()
},
//方法
methods: {
@@ -236,7 +280,7 @@
// this.quCodeList = res.baseAreas
this.quCodeList = res.baseAreas.map(item => {
let obj = {
'text': item.title,
'text': item.title + ' (+' + item.code + ')',
'value': item.code,
}
return obj
@@ -250,6 +294,35 @@
console.log(e, 'e')
});
},
// 获取协议内容
getSettlement() {
this.$http
.post('sys/agreement/getPrivacyDetail')
.then(res => {
this.yszcText = res.privacy
this.yszcText.content = this.yszcText.content.replace(/<h5>/g,
'<view style="font-weight: bold;font-size: 32rpx;margin-top: 20rpx;margin-bottom: 20rpx;">'
);
this.yszcText.content = this.yszcText.content.replace(/<\/h5>/g, '</view>');
}).catch((e) => {
console.log(e, 'e')
})
this.$http
.post('sys/agreement/getUserDetail')
.then(res => {
this.yhxyText = res.user
this.yhxyText.content = this.yhxyText.content.replace(/<h5>/g,
'<view style="font-weight: bold;font-size: 32rpx;margin-top: 20rpx;margin-bottom: 20rpx;">'
);
this.yhxyText.content = this.yhxyText.content.replace(/<\/h5>/g, '</view>');
}).catch((e) => {
console.log(e, 'e')
})
},
quChange(e) {
console.log(e, 'e')
},
@@ -260,17 +333,8 @@
url: "/pages/home/shop/goodsDetail"
})
},
// 显示协议
showXieyi(str) {
if (str == 'user') {
this.xieyi = localuserxieyi
} else {
this.xieyi = localyinsixieyi
}
//console.log(localuserxieyi)
this.xieyiShow = true
},
onPageJump(url) {
uni.navigateTo({
url: url
@@ -316,23 +380,7 @@
if (this.readonly) {
return;
}
if (!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({
title: '请先同意《用户协议》和《隐私协议》',
@@ -341,19 +389,66 @@
return;
}
this.$http
.get('book/user/sms/sendcode', {
phone: this.phone,
areaCode: this.quCode,
type: 2000
})
.then(res => {
if (this.brand == 3000) {
if (!this.phone) {
uni.showToast({
title: '验证码发送成功',
title: '请输入手机号',
icon: 'none'
});
this.getCodeState();
});
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, '选择的区段')
}
this.$http
.get('book/user/sms/sendcode', {
phone: this.phone,
areaCode: this.quCode,
type: 2000
})
.then(res => {
uni.showToast({
title: '验证码发送成功',
icon: 'none'
});
this.getCodeState();
});
} else {
if (!this.email) {
uni.showToast({
title: '请输入邮箱',
icon: 'none'
});
return;
}
if (!this.$base.mailRegular.test(this.email)) {
uni.showToast({
title: '邮箱格式不正确',
icon: 'none'
});
return;
}
this.$http
.get('book/user/getMailCaptcha', {
email: this.email
})
.then(res => {
uni.showToast({
title: '验证码发送成功',
icon: 'none'
});
this.getCodeState();
});
}
},
// 手机密码登录
@@ -365,24 +460,44 @@
});
return;
}
if (!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) {
if (this.brand == 3000) {
if (!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;
}
}
httpData.tel = this.phone;
} else {
if (!this.email) {
uni.showToast({
title: '请输入邮箱',
icon: 'none'
});
return;
}
if (!this.$base.mailRegular.test(this.email)) {
uni.showToast({
title: '邮箱格式不正确',
icon: 'none'
});
return;
}
httpData.tel = this.email;
}
if (!this.code) {
uni.showToast({
title: '请输入验证码',
@@ -391,7 +506,7 @@
return;
}
httpData.code = this.code;
httpData.tel = this.phone;
this.$http
.get('book/user/registerOrLogin', httpData)
.then(res => {
@@ -409,6 +524,13 @@
}, 1000);
});
} else {
if (!this.phoneEmail) {
uni.showToast({
title: '请输入手机号或邮箱',
icon: 'none'
});
return;
}
if (!this.password) {
uni.showToast({
title: '请输入密码',
@@ -418,7 +540,7 @@
}
// httpData.password = md5(this.password);
httpData.password = this.password;
httpData.phone = this.phone;
httpData.phone = this.phoneEmail;
this.$http
.post('book/user/login', httpData)
.then(res => {
@@ -670,7 +792,7 @@
</script>
<style lang="scss" scoped>
@import '@/style/mixin.scss';
.myselect{height: 50rpx !important;}
.phoneNumberInput {
width: calc(100% - 160rpx);
// width: 100%;
@@ -692,9 +814,28 @@
.quhao {
height: 50rpx;
width: 180rpx;
width: 290rpx;
margin: 12rpx 15rpx 0 0;
}
.myselect {
height: 50rpx !important;
/deep/.uni-select {
font-size: 24rpx;
}
/deep/.uni-select__selector-item {
font-size: 24rpx;
}
}
.highlight {
color: $themeColor;
}
@@ -704,13 +845,6 @@
position: relative;
.dp_title {
font-size: 32rpx;
margin-bottom: 50rpx;
color: #555;
text-align: center;
font-weight: bold;
}
@@ -817,6 +951,28 @@
margin-top: 20rpx;
font-size: 34rpx;
font-weight: bold;
color: #54a966;
}
.emaPho {}
.emaPho>view {
display: inline-block;
padding: 10rpx 0;
color: #888;
}
.emaPho>view.active {
color: #54a966;
padding: 10rpx 10rpx;
border-bottom: 2px solid #54a966;
font-weight: bold;
}
.emaPho>span {
display: inline-block;
margin: 0 30rpx;
color: #ccc;
}
.input_box {
@@ -1019,9 +1175,61 @@
}
}
.dp_title {
font-size: 36rpx;
margin-bottom: 50rpx;
color: #555;
text-align: center;
font-weight: bold;
}
.dp_content {
max-height: 1000rpx;
overflow-y: scroll;
font-size: 28rpx;
color: #555;
line-height: 45rpx;
.dp_con1 {
font-weight: bold;
font-size: 32rpx;
margin-top: 20rpx;
margin-bottom: 20rpx;
}
// .dp_con2 {
// font-size: 30rpx;
// margin-top: 10rpx;
// margin-bottom: 10rpx;
// }
}
.qie_huan {
font-size: 26rpx;
margin: 20rpx 0 0 0;
text-align: center;
}
.comTy {
font-size: 28rpx;
line-height: 46rpx;
text-align: left;
}
.youKeL {
display: flex;
justify-content: center;
margin: 30rpx 0 0 0;
font-size: 26rpx;
color: #54a966;
view {
font-weight: bold;
border: 1px solid #54a966;
border-radius: 10rpx;
padding: 5rpx 15rpx;
}
}
</style>