728 lines
20 KiB
Vue
728 lines
20 KiB
Vue
<template>
|
|
<view>
|
|
<div class="outter-wrapper">
|
|
<div class="login-page">
|
|
<div class="header w-1180 flex-h-ac">
|
|
<a href="" class="zg-logo fl nuxt-link-active">
|
|
<img src="@/static/images/logo-small.png" alt="买卖钢材,上金久信">
|
|
</a>
|
|
</div>
|
|
<div class="main-container">
|
|
<div class="w-1180 flex-h-e">
|
|
<div class="login-container">
|
|
<h2 style="margin-bottom: 15px;">手机号绑定</h2>
|
|
<template v-if="showBind">
|
|
<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 v-show="form1.accountType === 1" class="input-group clear">
|
|
<div class="input-group-addon">
|
|
<i class="icon_yaoqingma"></i>
|
|
</div>
|
|
<input type="text" class="form-control" v-model="form1.nickname"
|
|
placeholder="请输入姓名" autocomplete="off">
|
|
</div>
|
|
<div v-show="form1.accountType === 2" class="input-group clear">
|
|
<div class="input-group-addon">
|
|
<i class="icon_yaoqingma"></i>
|
|
</div>
|
|
<input type="text" class="form-control" v-model="form1.nickname"
|
|
placeholder="请输入公司名称" autocomplete="off">
|
|
</div>
|
|
<div class="input-group clear">
|
|
<div class="input-group-addon">
|
|
<i class="icon_user"></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 class="input-group clear">
|
|
<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>
|
|
|
|
<div class="input-group clear">
|
|
<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>
|
|
<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-groupread clear">
|
|
<el-checkbox v-model="agree"></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="submit" id="login" class="btnMarymt"
|
|
style="width: 100%;">绑定
|
|
</button>
|
|
</div>
|
|
</template>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<el-dialog title="" :visible.sync="dialogVisible" width="40%">
|
|
<div v-html="info"></div>
|
|
</el-dialog>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {Loading} from "element-ui";
|
|
|
|
var vk = uni.vk
|
|
let timer = null
|
|
let timeS = 60
|
|
export default {
|
|
data() {
|
|
return {
|
|
dialogVisible: false,
|
|
agree: false,
|
|
info: null,
|
|
showBind: false,
|
|
smsTips: '获取验证码',
|
|
form1: {
|
|
mobile: '',
|
|
password: '',
|
|
repassword: '',
|
|
smsCode: '',
|
|
username: '',
|
|
inviteCode: '',
|
|
accountType: 2,
|
|
nickname: '',
|
|
},
|
|
accountType: null,
|
|
code: null,
|
|
loginType: null,
|
|
uid: null
|
|
};
|
|
},
|
|
methods: {
|
|
async handleSubmit() {
|
|
if (!this.agree) {
|
|
this.$message({
|
|
message: '请先阅读并同意《金久信注册协议》',
|
|
type: 'warning'
|
|
})
|
|
return
|
|
}
|
|
if (this.testForm()) {
|
|
await vk.callFunction({
|
|
url: '/client/user/kh/updateLoginInfo',
|
|
data: {
|
|
uid: this.uid,
|
|
accountType: this.form1.accountType,
|
|
nickname: this.form1.nickname,
|
|
inviteCode: this.form1.inviteCode,
|
|
}
|
|
})
|
|
vk.userCenter.bindMobile({
|
|
data: {
|
|
mobile: this.form1.mobile,
|
|
code: this.form1.smsCode,
|
|
},
|
|
success: () => {
|
|
vk.userCenter.resetPwd({
|
|
data: {
|
|
password: this.form1.password,
|
|
},
|
|
success: async () => {
|
|
vk.redirectTo({url: '/pages/auth/login/login'})
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
},
|
|
sendSmsCode() {
|
|
if (timer != null) {
|
|
return
|
|
}
|
|
vk.userCenter.sendSmsCode({
|
|
loading: false,
|
|
data: {
|
|
mobile: this.form1.mobile,
|
|
type: 'bind',
|
|
},
|
|
success: (data) => {
|
|
this.$message({
|
|
message: "验证码已发送",
|
|
type: 'success'
|
|
})
|
|
timeS = 60
|
|
timer = setInterval(() => {
|
|
timeS--
|
|
if (timeS <= 0) {
|
|
this.smsTips = "重新发送"
|
|
this.stopTimer()
|
|
} else {
|
|
this.smsTips = timeS + "秒"
|
|
}
|
|
|
|
}, 1000)
|
|
}
|
|
});
|
|
},
|
|
stopTimer() {
|
|
if (timer != null) {
|
|
clearInterval(timer)
|
|
timer = null
|
|
}
|
|
},
|
|
loginSuccess() {
|
|
uni.reLaunch({url: '/'})
|
|
},
|
|
testForm() {
|
|
const {
|
|
mobile, // 手机号
|
|
smsCode, // 短信验证码4-8位
|
|
password, // 密码 6-20位
|
|
repassword, // 重复输入密码
|
|
nickname
|
|
} = 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 (!nickname) {
|
|
return this.$message({
|
|
message: '请输入' + (this.form1.accountType === 2 ? '公司名称' : '您的姓名'),
|
|
type: 'error'
|
|
})
|
|
}
|
|
return true
|
|
|
|
},
|
|
async getInfo() {
|
|
const {content} = await vk.callFunction({
|
|
url: `client/otherArticle/list/pub/getDetail`,
|
|
data: {id: 'adea4666684a336402937a2c5dcc448e'}
|
|
});
|
|
this.info = content
|
|
this.dialogVisible = true
|
|
}
|
|
},
|
|
async onLoad(options) {
|
|
if (options.state && options.state.includes('jjx')) {
|
|
this.form1.accountType = parseInt(options.state.split('_')[1])
|
|
if (options.code) {
|
|
this.code = options.code
|
|
const {uid, type, mobileConfirmed} = await vk.callFunction({
|
|
url: 'user/pub/loginByWeixin',
|
|
data: {
|
|
code: this.code,
|
|
accountType: this.form1.accountType,
|
|
},
|
|
})
|
|
this.uid = uid
|
|
this.showBind = type === "register"
|
|
if (mobileConfirmed) this.loginSuccess()
|
|
else this.showBind = true
|
|
|
|
} else {
|
|
this.showBind = !vk.getVuex('$user.userInfo.mobile')
|
|
}
|
|
} else this.loginSuccess()
|
|
},
|
|
onUnload() {
|
|
if (timer != null) {
|
|
clearInterval(timer)
|
|
timer = null
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
@charset "utf-8";
|
|
|
|
.login-method {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
font-size: 14px;
|
|
margin-bottom: 2px;
|
|
|
|
&-item {
|
|
color: #d0111a;
|
|
cursor: pointer;
|
|
}
|
|
}
|
|
|
|
|
|
.outter-wrapper {
|
|
background-color: #fff;
|
|
}
|
|
|
|
.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: #e8f5fd url(/static/images/login-bg.jpg) 50% no-repeat;
|
|
}
|
|
|
|
.flex-h-e,
|
|
.flex-h-e-ac {
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: flex-end;
|
|
}
|
|
|
|
.main-container .login-container {
|
|
height: 640px;
|
|
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;
|
|
}
|
|
</style> |