783 lines
20 KiB
Vue
783 lines
20 KiB
Vue
<template>
|
||
<view>
|
||
<top-bar></top-bar>
|
||
<!-- <common-header></common-header>-->
|
||
<!-- <category-bar></category-bar>-->
|
||
<div class="outter-wrapper">
|
||
<div class="login-page">
|
||
<div class="main-container" :style="registerPageStyle">
|
||
<div class="w-1180 flex-h-e">
|
||
<div class="login-container">
|
||
<h2 style="margin-bottom: 15px;">免费注册会员</h2>
|
||
<view id="from" action="">
|
||
<div class="input-grouptabs clear">
|
||
<span @click="form1.accountType = 2"
|
||
:class="{'tab-active': form1.accountType === 2}" class="nopassword"
|
||
data-id="1"
|
||
id="nopw"><i></i>企业用户</span>
|
||
<span @click="form1.accountType = 1"
|
||
:class="{'tab-active': form1.accountType === 1}" class="normal" data-id="0"
|
||
id="normal"><i></i>个人用户</span>
|
||
</div>
|
||
<div class="tabContent">
|
||
<div class="login-con active" id="rc">
|
||
<div v-show="form1.accountType == 1" class="input-group clear">
|
||
<div class="input-group-addon">
|
||
<i class="icon_user"></i>
|
||
</div>
|
||
<input type="text" class="form-control" v-model="form1.person.personName"
|
||
placeholder="请输入姓名或昵称" autocomplete="off">
|
||
</div>
|
||
<div v-show="form1.accountType == 2" class="input-group clear">
|
||
<div class="input-group-addon">
|
||
<i class="icon_user"></i>
|
||
</div>
|
||
<input type="text" class="form-control" v-model="form1.company.companyName"
|
||
placeholder="请输入公司名称" autocomplete="off">
|
||
</div>
|
||
<div class="input-group clear">
|
||
<div class="input-group-addon">
|
||
<i class="icon_yaoqingma"></i>
|
||
</div>
|
||
<input type="text" class="form-control" v-model="form1.inviteCode"
|
||
placeholder="请输入邀请码,选填" autocomplete="off">
|
||
</div>
|
||
<div class="input-group clear" style="margin-bottom: 0">
|
||
<div class="input-group-addon">
|
||
<i class="icon_password"></i>
|
||
</div>
|
||
<input type="password" class="form-control" v-model="form1.password"
|
||
name="password"
|
||
placeholder="设置登录密码" autocomplete="off">
|
||
</div>
|
||
<p class="tips mb-15 text-gray">6~20位的数字、字母组合</p>
|
||
|
||
<div class="input-group clear" style="margin-bottom: 0">
|
||
<div class="input-group-addon">
|
||
<i class="icon_password"></i>
|
||
</div>
|
||
<input type="password" class="form-control" v-model="form1.repassword"
|
||
placeholder="确认登录密码" autocomplete="off">
|
||
</div>
|
||
<p class="tips mb-15 text-gray">6~20位的数字、字母组合</p>
|
||
<div class="input-group clear">
|
||
<div class="input-group-addon">
|
||
<i class="icon_phone"></i>
|
||
</div>
|
||
<input v-model="form1.mobile" type="text" class="form-control" name="mobile"
|
||
placeholder="请输入手机号" autocomplete="off">
|
||
</div>
|
||
<div class="input-group clear">
|
||
<div class="input-group-addon">
|
||
<i class="icon_phone"></i>
|
||
</div>
|
||
<input type="text" class="form-control" v-model="form1.smsCode"
|
||
name="smsCode"
|
||
placeholder="请输入短信验证码" autocomplete="off"/>
|
||
<view @click="sendSmsCode" id="btnSendCode1" type="button"
|
||
class="btn-default" value="">{{ smsTips }}
|
||
</view>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="input-groupread clear">
|
||
<el-checkbox v-model="agree" @click.native="clickAgree"
|
||
:disabled="!hasRead"></el-checkbox>
|
||
<label class="ml-20">已阅读并同意<a href="javascript:;" style="display: inline-block;"
|
||
@click="getInfo">
|
||
<span style="color: #3288b2">《用户协议和隐私政策》</span></a></label>
|
||
</div>
|
||
<div class="input-groupp clear">
|
||
<button @click="handleSubmit" type="button" class="btnMarymt"
|
||
style="width: 100%;">立即免费注册
|
||
</button>
|
||
</div>
|
||
</view>
|
||
<div class="input-groupwp clear">
|
||
<navigator url="/pages/auth/login/login">已有账号?<span
|
||
style="color: #a92924">去登录</span></navigator>
|
||
</div>
|
||
<!-- <div class=" threeBorder"><span>第三方登录</span></div>-->
|
||
|
||
<!-- <div class="input-groupwpg clear">-->
|
||
<!-- <a href="javascript:;" @click="toWechat" class="dsf-wetChat" title="微信"><i></i></a>-->
|
||
<!-- <!– <a href="javascript:;" @click="toQQ" class="dsf-qq" title="QQ"><i></i></a>–>-->
|
||
<!-- <!– <a href="" class="dsf-dx" title="短信"><i></i></a>–>-->
|
||
<!-- </div>-->
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<el-dialog title="" :visible.sync="dialogVisible" width="70%" :close-on-press-escape="false"
|
||
:close-on-click-modal="false" :show-close="false"
|
||
>
|
||
<div v-html="info"></div>
|
||
<div slot="footer" class="dialog-footer">
|
||
<el-button type="primary" @click="dialogVisible = false;hasRead = true" :disabled="readCountDown > 0">确
|
||
定{{
|
||
readCountDown === 0 ? '' : `${readCountDown}秒`
|
||
}}
|
||
</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
let timer = null
|
||
let timeS = 60
|
||
var vk = uni.vk;
|
||
export default {
|
||
data() {
|
||
return {
|
||
dialogVisible: false,
|
||
agree: false,
|
||
smsTips: '点击获取',
|
||
form1: {
|
||
accountType: 2, // business 企业 、、personal个人
|
||
mobile: '',
|
||
smsCode: '',
|
||
password: '',
|
||
repassword: '',
|
||
inviteCode: '',
|
||
person: {
|
||
personName: ''
|
||
},
|
||
company: {
|
||
companyName: ''
|
||
}
|
||
},
|
||
info: null,
|
||
hasRead: false,
|
||
registerBgImage: '',
|
||
readCountDown: 10,
|
||
readInterval: null
|
||
};
|
||
},
|
||
onLoad(option) {
|
||
if (option.code) this.form1.inviteCode = option.code
|
||
this.loadSiteConfig()
|
||
},
|
||
computed: {
|
||
registerPageStyle() {
|
||
return this.registerBgImage ? {backgroundImage: `url(${this.registerBgImage})`} : {}
|
||
}
|
||
},
|
||
methods: {
|
||
sendSmsCode() {
|
||
if (timer != null) {
|
||
return
|
||
}
|
||
vk.userCenter.sendSmsCode({
|
||
loading: false,
|
||
data: {
|
||
mobile: this.form1.mobile,
|
||
type: 'register',
|
||
},
|
||
success: (data) => {
|
||
this.$message({
|
||
message: "验证码已发送",
|
||
type: 'success'
|
||
})
|
||
timeS = 60
|
||
timer = setInterval(() => {
|
||
timeS--
|
||
if (timeS <= 0) {
|
||
this.smsTips = "重新发送"
|
||
this.stopTimer()
|
||
} else {
|
||
this.smsTips = timeS + "秒"
|
||
}
|
||
}, 1000)
|
||
}
|
||
});
|
||
},
|
||
handleSubmit() {
|
||
if (!this.agree) {
|
||
this.$message({
|
||
message: '请先阅读并同意《用户协议和隐私政策》',
|
||
type: 'warning'
|
||
})
|
||
} else {
|
||
if (this.testForm()) {
|
||
const {
|
||
mobile, // 手机号
|
||
smsCode, // 短信验证码4-8位
|
||
password, // 密码 6-20位
|
||
repassword, // 重复输入密码
|
||
inviteCode, // 邀请码
|
||
accountType,
|
||
company,
|
||
person
|
||
} = this.form1
|
||
|
||
vk.userCenter.loginBySms({
|
||
data: {
|
||
type: 'register',
|
||
mobile: mobile,
|
||
code: smsCode,
|
||
password,
|
||
inviteCode,
|
||
accountType,
|
||
company,
|
||
person,
|
||
isSignOnly: true
|
||
},
|
||
success: (data) => {
|
||
uni.reLaunch({
|
||
url: '/'
|
||
})
|
||
|
||
}
|
||
});
|
||
}
|
||
}
|
||
},
|
||
testForm() {
|
||
const {
|
||
mobile, // 手机号
|
||
smsCode, // 短信验证码4-8位
|
||
password, // 密码 6-20位
|
||
repassword, // 重复输入密码
|
||
inviteCode, // 邀请码
|
||
accountType,
|
||
company,
|
||
person
|
||
} = this.form1;
|
||
|
||
// 手机号验证
|
||
if (!mobile || !/^1[3456789]\d{9}$/.test(mobile)) {
|
||
this.$message({
|
||
message: '手机号为空或格式不正确',
|
||
type: 'error'
|
||
})
|
||
return false
|
||
}
|
||
|
||
// 短信验证码验证
|
||
if (!smsCode || !/^\d{4,8}$/.test(smsCode)) {
|
||
// 短信验证码为空或格式不正确
|
||
// 处理错误逻辑
|
||
this.$message({
|
||
message: '短信验证码为空或格式不正确',
|
||
type: 'error'
|
||
})
|
||
return false
|
||
}
|
||
|
||
// 密码验证
|
||
if (!password || password.length < 6 || password.length > 20) {
|
||
// 密码为空或长度不符合要求
|
||
this.$message({
|
||
message: '密码长度不符合要求',
|
||
type: 'error'
|
||
})
|
||
return false
|
||
// 处理错误逻辑
|
||
}
|
||
|
||
const reg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]+$/
|
||
if (!reg.test(password)) {
|
||
this.$message({
|
||
message: '密码必须由数字和字母组成',
|
||
type: 'error'
|
||
})
|
||
return false
|
||
}
|
||
|
||
// 重复输入密码验证
|
||
if (password !== repassword) {
|
||
// 两次输入的密码不一致
|
||
this.$message({
|
||
message: '两次输入的密码不一致',
|
||
type: 'error'
|
||
})
|
||
return false
|
||
// 处理错误逻辑
|
||
}
|
||
|
||
if (accountType == 1 && !person.personName) {
|
||
this.$message({
|
||
message: '请输入姓名',
|
||
type: 'error'
|
||
})
|
||
return false
|
||
}
|
||
|
||
if (accountType == 2 && !company.companyName) {
|
||
this.$message({
|
||
message: '请输入公司名称',
|
||
type: 'error'
|
||
})
|
||
return false
|
||
}
|
||
|
||
|
||
return true
|
||
|
||
},
|
||
stopTimer() {
|
||
if (timer != null) {
|
||
clearInterval(timer)
|
||
timer = null
|
||
}
|
||
},
|
||
async loadSiteConfig() {
|
||
try {
|
||
const {data = {}} = await vk.callFunction({
|
||
url: 'client/site_config/pub/detail',
|
||
loading: false
|
||
})
|
||
this.registerBgImage = data.registerSignPcBgImage || ''
|
||
} catch (e) {
|
||
this.registerBgImage = ''
|
||
}
|
||
},
|
||
navTo(url) {
|
||
vk.navigateTo({
|
||
url
|
||
})
|
||
},
|
||
async getInfo() {
|
||
const {content} = await vk.callFunction({
|
||
url: `client/otherArticle/list/pub/getDetail`,
|
||
data: {id: 'adea4666684a336402937a2c5dcc448e'}
|
||
});
|
||
this.info = content
|
||
this.dialogVisible = true
|
||
this.readCountDown = 10
|
||
this.readInterval = setInterval(() => {
|
||
this.readCountDown--
|
||
if (this.readCountDown <= 0) {
|
||
clearInterval(this.readInterval)
|
||
}
|
||
}, 1000)
|
||
},
|
||
clickAgree(check) {
|
||
if (check && !this.hasRead) {
|
||
this.agree = false
|
||
return this.$message.error('请先阅读并同意《用户协议和隐私政策》')
|
||
}
|
||
},
|
||
async toWechat() {
|
||
const redirect_uri = 'https://www.jinjiuxinzg.cn/#/pages/auth/login/wechat'
|
||
// const redirect_uri = 'https://tcb-nnexmh3j3i5hwh5-7caw62c422be-1252168680.tcloudbaseapp.com/#/pages/auth/login/wechat_test'
|
||
const state = `jjx_` + (this.memberType === 'business' ? 2 : 1)
|
||
let url = 'https://open.weixin.qq.com/connect/qrconnect?appid=wxf44c1b32124fe1d5'
|
||
url += '&redirect_uri=' + encodeURIComponent(redirect_uri)
|
||
url += `&response_type=code&scope=snsapi_login&state=${state}#wechat_redirect`
|
||
window.location.href = url
|
||
}
|
||
},
|
||
onUnload() {
|
||
if (timer != null) {
|
||
clearInterval(timer)
|
||
timer = null
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
@charset "utf-8";
|
||
|
||
.zg-logo img {
|
||
width: 230px;
|
||
border: none;
|
||
}
|
||
|
||
.layout-common-footer {
|
||
text-align: center;
|
||
margin: 15px 0px 10px;
|
||
}
|
||
|
||
.layout-common-footer .copyright .link > a {
|
||
color: #666;
|
||
padding: 0 10px;
|
||
display: inline-block;
|
||
line-height: 2
|
||
}
|
||
|
||
.w-1180 {
|
||
width: 1200px;
|
||
margin: 0px auto;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.flex-h-ac {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.header {
|
||
height: 90px;
|
||
}
|
||
|
||
.main-container {
|
||
min-width: 1200px;
|
||
padding: 60px 0;
|
||
background: #5499CE url('@/static/images/logo-bg.jpg') no-repeat;
|
||
//background-size: 1920px 990px;
|
||
background-size: cover;
|
||
background-position: center center;
|
||
min-height: calc(100vh - 80px);
|
||
}
|
||
|
||
.flex-h-e,
|
||
.flex-h-e-ac {
|
||
display: flex;
|
||
flex-direction: row;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
.main-container .login-container {
|
||
width: 350px;
|
||
box-sizing: border-box;
|
||
padding: 30px 35px 30px;
|
||
background-color: #fff;
|
||
}
|
||
|
||
.login-container h2 {
|
||
text-align: center;
|
||
line-height: 2;
|
||
color: #000;
|
||
font-size: 25px;
|
||
margin-bottom: 25px;
|
||
}
|
||
|
||
.btnMarymt {
|
||
height: 48px;
|
||
line-height: 48px;
|
||
background: #a92924;
|
||
color: #fff !important;
|
||
text-align: center;
|
||
width: 100%;
|
||
background: linear-gradient(90deg, #f0242e, #d0111a);
|
||
font-size: 16px;
|
||
cursor: pointer;
|
||
text-align: center;
|
||
}
|
||
|
||
.btnMarymt:hover {
|
||
background: #f12d36
|
||
}
|
||
|
||
.input-group {
|
||
width: 100%;
|
||
height: 46px;
|
||
}
|
||
|
||
.input-group-addon {
|
||
}
|
||
|
||
.input-group .form-control {
|
||
flex: 1;
|
||
height: 100%;
|
||
border: none;
|
||
background: none;
|
||
margin-left: 12px;
|
||
outline: none;
|
||
font-size: 13px;
|
||
color: #333;
|
||
}
|
||
|
||
.input-group {
|
||
display: flex;
|
||
align-items: center;
|
||
border: 1px solid #d4d4d4;
|
||
margin-bottom: 15px;
|
||
position: relative;
|
||
}
|
||
|
||
.input-group-addon i {
|
||
background: url('@/static/images/iconsmall.png') no-repeat center center;
|
||
width: 38px;
|
||
border-right: 1px solid #d4d4d4;
|
||
height: 26px;
|
||
overflow: hidden;
|
||
display: inline-block
|
||
}
|
||
|
||
.input-group-addon .icon_user {
|
||
background-position: -212px -35px;
|
||
}
|
||
|
||
.input-group-addon .icon_phone {
|
||
background-position: -212px -67px;
|
||
}
|
||
|
||
.input-group-addon .icon_password {
|
||
background-position: -212px -100px;
|
||
}
|
||
|
||
.input-group-addon .icon_yaoqingma {
|
||
background-position: -209px -318px;
|
||
}
|
||
|
||
.input-groupp {
|
||
width: 100%;
|
||
}
|
||
|
||
#btnSendCode1 {
|
||
position: absolute;
|
||
right: 1px;
|
||
top: 8px;
|
||
line-height: 31px;
|
||
color: #d0111a;
|
||
width: 79px;
|
||
text-align: center;
|
||
cursor: pointer;
|
||
border-left: 1px solid;
|
||
background: none;
|
||
font-size: 14px;
|
||
}
|
||
|
||
.input-group.focus {
|
||
background-color: #fff;
|
||
box-shadow: 0 2px 11px 0 rgba(0, 0, 0, .04)
|
||
}
|
||
|
||
.input-groupwp {
|
||
width: 100%;
|
||
text-align: center;
|
||
height: 60px;
|
||
line-height: 60px;
|
||
font-size: 14px;
|
||
margin-bottom: 10px;
|
||
}
|
||
|
||
.input-groupwpg a {
|
||
display: inline-block;
|
||
}
|
||
|
||
.input-groupwpg .dsf-wetChat i {
|
||
background: url('@/static/images/iconsmall.png') no-repeat;
|
||
width: 50px;
|
||
height: 40px;
|
||
display: block;
|
||
background-position: -218px -132px;
|
||
}
|
||
|
||
.input-groupwpg .dsf-qq i {
|
||
background: url('@/static/images/iconsmall.png') no-repeat;
|
||
width: 50px;
|
||
height: 40px;
|
||
display: block;
|
||
background-position: -216px -178px;
|
||
margin: 0px 24px;
|
||
}
|
||
|
||
.input-groupwpg .dsf-dx i {
|
||
background: url('@/static/images/iconsmall.png') no-repeat;
|
||
width: 50px;
|
||
height: 40px;
|
||
display: block;
|
||
background-position: -215px -224px;
|
||
}
|
||
|
||
.threeBorder {
|
||
position: relative;
|
||
text-align: center;
|
||
|
||
}
|
||
|
||
.threeBorder:after {
|
||
content: '';
|
||
position: absolute;
|
||
z-index: 0;
|
||
bottom: 10px;
|
||
left: 10px;
|
||
width: 95%;
|
||
height: 1px;
|
||
border-bottom: 1px solid #CCCCCC;
|
||
-webkit-transform: scaleY(0.5);
|
||
transform: scaleY(0.5);
|
||
-webkit-transform-origin: 0 100%;
|
||
transform-origin: 0 100%;
|
||
}
|
||
|
||
.threeBorder span {
|
||
color: #888888;
|
||
background: #fff;
|
||
width: 90px;
|
||
margin: 0 auto;
|
||
z-index: 1002;
|
||
position: relative;
|
||
display: block;
|
||
}
|
||
|
||
.input-groupwpg {
|
||
width: 100%;
|
||
text-align: center;
|
||
height: 48px;
|
||
font-size: 14px;
|
||
margin-top: 22px;
|
||
|
||
}
|
||
|
||
.login-con {
|
||
display: none;
|
||
}
|
||
|
||
.input-grouptabs span {
|
||
color: #666;
|
||
cursor: pointer;
|
||
font-size: 16px;
|
||
line-height: 23px;
|
||
font-weight: normal;
|
||
display: inline-block;
|
||
padding: 0px 18px;
|
||
text-align: center;
|
||
margin: 0px auto;
|
||
}
|
||
|
||
.input-grouptabs {
|
||
text-align: center;
|
||
margin: 0px auto 30px;
|
||
width: 100%;
|
||
}
|
||
|
||
.input-grouptabs i {
|
||
background: url('@/static/images/iconsmall.png') no-repeat;
|
||
width: 25px;
|
||
height: 25px;
|
||
float: left;
|
||
margin-right: 5px;
|
||
}
|
||
|
||
.input-grouptabs .tab-active#normal i {
|
||
background-position: -218px -269px;
|
||
}
|
||
|
||
.input-grouptabs .tab-active#nopw i {
|
||
background-position: -218px -269px;
|
||
}
|
||
|
||
.input-grouptabs #normal i {
|
||
background-position: -218px -293px;
|
||
}
|
||
|
||
.input-grouptabs #nopw i {
|
||
background-position: -218px -293px;
|
||
}
|
||
|
||
.input-grouptabs span.tab-active {
|
||
color: #a92924
|
||
}
|
||
|
||
.active {
|
||
display: block;
|
||
}
|
||
|
||
.input-groupread {
|
||
//height: 40px;
|
||
line-height: 30px;
|
||
width: 100%;
|
||
text-align: left;
|
||
}
|
||
|
||
.agreement_dialogs {
|
||
position: fixed;
|
||
top: 0px;
|
||
left: 0px;
|
||
right: 0px;
|
||
bottom: 0px;
|
||
width: 100%;
|
||
height: 100%;
|
||
z-index: 99999;
|
||
text-align: center;
|
||
display: none;
|
||
background-color: rgba(35, 35, 35, 0.4);
|
||
-webkit-transition: all 0.5s linear;
|
||
transition: all 0.5s linear;
|
||
}
|
||
|
||
.agreement_dialogs .dialog_lay_1syd {
|
||
position: absolute;
|
||
left: 50%;
|
||
top: 50%;
|
||
transform: translate(-50%, -50%);
|
||
display: inline-block;
|
||
width: 750px;
|
||
color: #656565;
|
||
font-size: 12px;
|
||
line-height: 20px;
|
||
background-color: #fff;
|
||
text-align: left;
|
||
vertical-align: middle;
|
||
-webkit-transition: all 0.2s linear;
|
||
transition: all 0.2s linear;
|
||
}
|
||
|
||
.agreement_dialogs .dialog_foot_1hHfr {
|
||
height: 80px;
|
||
display: -webkit-box;
|
||
display: -ms-flexbox;
|
||
display: flex;
|
||
-webkit-box-align: center;
|
||
-ms-flex-align: center;
|
||
align-items: center;
|
||
-webkit-box-pack: center;
|
||
-ms-flex-pack: center;
|
||
justify-content: center;
|
||
border-top: 1px solid #d5d5d5;
|
||
margin: 0;
|
||
text-align: center;
|
||
}
|
||
|
||
.agreement_dialogs .dialog_minorBtn_1u8nf {
|
||
display: inline-block;
|
||
-webkit-box-sizing: border-box;
|
||
box-sizing: border-box;
|
||
border: 1px #316ccb solid;
|
||
padding: 0 30px;
|
||
height: 40px;
|
||
background: #a92924;
|
||
background: linear-gradient(90deg, #f0242e, #d0111a);
|
||
line-height: 40px;
|
||
cursor: pointer;
|
||
font-size: 16px;
|
||
vertical-align: top;
|
||
-webkit-user-select: none;
|
||
-moz-user-select: none;
|
||
-ms-user-select: none;
|
||
user-select: none;
|
||
color: #fff;
|
||
border-color: #fff;
|
||
}
|
||
|
||
.agreement_titley {
|
||
height: 55px;
|
||
line-height: 55px;
|
||
font-size: 16px;
|
||
color: #666;
|
||
text-align: center;
|
||
border-bottom: 1px solid #d5d5d5;
|
||
font-weight: 400;
|
||
}
|
||
|
||
.agreement_content {
|
||
margin: 23px 32px;
|
||
}
|
||
|
||
.con-subhead {
|
||
font-size: 14px;
|
||
|
||
font-weight: 500;
|
||
color: #333;
|
||
margin-bottom: 16px;
|
||
}
|
||
|
||
.con-content {
|
||
height: 240px;
|
||
overflow-y: scroll;
|
||
line-height: 2;
|
||
font-size: 13px;
|
||
}
|
||
|
||
#btnSendCode1 {
|
||
cursor: pointer;
|
||
}
|
||
</style>
|