|
@ -44,7 +44,7 @@ |
|
|
<span @click="redirectUrl(qqLoginAuthorizeUrl)"> |
|
|
<span @click="redirectUrl(qqLoginAuthorizeUrl)"> |
|
|
<svg-icon name="loginQQ" class="other-login-icon" /> |
|
|
<svg-icon name="loginQQ" class="other-login-icon" /> |
|
|
</span> |
|
|
</span> |
|
|
<svg-icon name="loginWx" class="other-login-icon" /> |
|
|
<!-- <svg-icon name="loginWx" class="other-login-icon" />--> |
|
|
</div> |
|
|
</div> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
@ -114,7 +114,13 @@ |
|
|
<span @click="redirectUrl(qqLoginAuthorizeUrl)"> |
|
|
<span @click="redirectUrl(qqLoginAuthorizeUrl)"> |
|
|
<svg-icon name="loginQQ" class="other-login-icon" /> |
|
|
<svg-icon name="loginQQ" class="other-login-icon" /> |
|
|
</span> |
|
|
</span> |
|
|
<svg-icon name="loginWx" class="other-login-icon" /> |
|
|
<svg-icon name="loginWx" |
|
|
|
|
|
class="other-login-icon" |
|
|
|
|
|
@click="()=>{ |
|
|
|
|
|
this.formType='login', |
|
|
|
|
|
this.loginType='wx' |
|
|
|
|
|
}" |
|
|
|
|
|
/> |
|
|
</div> |
|
|
</div> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
@ -127,23 +133,27 @@ |
|
|
@tab-click="registerHandleClick" |
|
|
@tab-click="registerHandleClick" |
|
|
> |
|
|
> |
|
|
<el-tab-pane label="手机号注册" name="regPhone"> |
|
|
<el-tab-pane label="手机号注册" name="regPhone"> |
|
|
<el-form ref="form" :model="accountForm" label-width="0px"> |
|
|
<el-form ref="phoneRegForm" :model="accountForm" :rules="phoneRegRules" label-width="0px"> |
|
|
<el-form-item label=""> |
|
|
<el-form-item label="" prop="phoneNumber"> |
|
|
<el-input v-model="accountForm.username" placeholder="请输入手机号" autocomplete="off" /> |
|
|
<el-input v-model="accountForm.phoneNumber" placeholder="请输入手机号" autocomplete="off" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label=""> |
|
|
<el-form-item label="" prop="password"> |
|
|
<el-input v-model="accountForm.password" show-password placeholder="请输入密码" |
|
|
<el-input v-model="accountForm.password" show-password placeholder="请输入密码" |
|
|
autocomplete="off" |
|
|
autocomplete="off" |
|
|
/> |
|
|
/> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label=""> |
|
|
<el-form-item label="" prop="code"> |
|
|
<el-input v-model="accountForm.code" style="width: 150px;" placeholder="请输入验证码" |
|
|
<el-input v-model="accountForm.code" style="width: 150px;" placeholder="请输入验证码" |
|
|
autocomplete="off" |
|
|
autocomplete="off" |
|
|
/> |
|
|
/> |
|
|
<el-button style="margin-left: 20px;" type="primary">发送验证码</el-button> |
|
|
<el-button style="margin-left: 20px;" :disabled="phoneValidateCodeBtn" type="primary" |
|
|
|
|
|
@click="sendPhoneCodeHandle" |
|
|
|
|
|
> |
|
|
|
|
|
{{ phoneValidateCodeBtnText }} |
|
|
|
|
|
</el-button> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item> |
|
|
<el-form-item> |
|
|
<el-button type="primary" style="width: 100%;">登录</el-button> |
|
|
<el-button type="primary" style="width: 100%;" @click="phoneRegHandle">确定</el-button> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-form> |
|
|
</el-form> |
|
|
</el-tab-pane> |
|
|
</el-tab-pane> |
|
@ -164,10 +174,10 @@ |
|
|
style="width: 150px;" maxlength="4" placeholder="请输入验证码" |
|
|
style="width: 150px;" maxlength="4" placeholder="请输入验证码" |
|
|
autocomplete="off" |
|
|
autocomplete="off" |
|
|
/> |
|
|
/> |
|
|
<el-button style="margin-left: 20px;" :disabled="validateCodeBtn" type="primary" |
|
|
<el-button style="margin-left: 20px;" :disabled="emailValidateCodeBtn" type="primary" |
|
|
@click="sendEmailCodeHandle" |
|
|
@click="sendEmailCodeHandle" |
|
|
> |
|
|
> |
|
|
{{ validateCodeBtnText }} |
|
|
{{ emailValidateCodeBtnText }} |
|
|
</el-button> |
|
|
</el-button> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item> |
|
|
<el-form-item> |
|
@ -182,7 +192,13 @@ |
|
|
<span @click="redirectUrl(qqLoginAuthorizeUrl)"> |
|
|
<span @click="redirectUrl(qqLoginAuthorizeUrl)"> |
|
|
<svg-icon name="loginQQ" class="other-login-icon" /> |
|
|
<svg-icon name="loginQQ" class="other-login-icon" /> |
|
|
</span> |
|
|
</span> |
|
|
<svg-icon name="loginWx" class="other-login-icon" /> |
|
|
<svg-icon name="loginWx" |
|
|
|
|
|
class="other-login-icon" |
|
|
|
|
|
@click="()=>{ |
|
|
|
|
|
this.formType='login', |
|
|
|
|
|
this.loginType='wx' |
|
|
|
|
|
}" |
|
|
|
|
|
/> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</el-tabs> |
|
|
</el-tabs> |
|
@ -229,17 +245,30 @@ export default { |
|
|
} |
|
|
} |
|
|
return { |
|
|
return { |
|
|
loginType: 'wx', |
|
|
loginType: 'wx', |
|
|
validateCodeBtn: false, |
|
|
emailValidateCodeBtn: false, |
|
|
validateCodeBtnText: '发送验证码', |
|
|
emailValidateCodeBtnText: '发送验证码', |
|
|
|
|
|
phoneValidateCodeBtn: false, |
|
|
|
|
|
phoneValidateCodeBtnText: '发送验证码', |
|
|
formType: 'login', |
|
|
formType: 'login', |
|
|
regType: 'regPhone', |
|
|
regType: 'regPhone', |
|
|
agreeProtocol: '', |
|
|
agreeProtocol: '', |
|
|
|
|
|
phoneRegRules: { |
|
|
|
|
|
phoneNumber: [ |
|
|
|
|
|
{required: true, trigger: 'blur', message: '请输入手机号'}, |
|
|
|
|
|
{ |
|
|
|
|
|
pattern: /^(?:0|86|\+86)?1[3456789]\d{9}$/, |
|
|
|
|
|
message: '请输入正确的手机号' |
|
|
|
|
|
} |
|
|
|
|
|
], |
|
|
|
|
|
password: [{required: true, trigger: 'blur', validator: validatePassword}], |
|
|
|
|
|
code: {required: true, trigger: 'blur', message: '请输入验证码'} |
|
|
|
|
|
}, |
|
|
emailRegRules: { |
|
|
emailRegRules: { |
|
|
email: [ |
|
|
email: [ |
|
|
{required: true, trigger: 'blur', message: '请输入邮箱'}, |
|
|
{required: true, trigger: 'blur', message: '请输入邮箱'}, |
|
|
{ |
|
|
{ |
|
|
pattern: /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/, |
|
|
pattern: /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/, |
|
|
message: '请输入正确的邮箱,多个使用;分隔' |
|
|
message: '请输入正确的邮箱' |
|
|
} |
|
|
} |
|
|
], |
|
|
], |
|
|
password: [{required: true, trigger: 'blur', validator: validatePassword}], |
|
|
password: [{required: true, trigger: 'blur', validator: validatePassword}], |
|
@ -252,6 +281,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
accountForm: { |
|
|
accountForm: { |
|
|
email: '', |
|
|
email: '', |
|
|
|
|
|
phoneNumber: '', |
|
|
password: '' |
|
|
password: '' |
|
|
}, |
|
|
}, |
|
|
wxQrCodeLoading: true, |
|
|
wxQrCodeLoading: true, |
|
@ -261,6 +291,9 @@ export default { |
|
|
wxQrcodeResultTimer: null, |
|
|
wxQrcodeResultTimer: null, |
|
|
qqLoginAuthorizeUrl: '' |
|
|
qqLoginAuthorizeUrl: '' |
|
|
} |
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
watch: { |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
created() { |
|
|
created() { |
|
|
this.getLoginWxQrCode() |
|
|
this.getLoginWxQrCode() |
|
@ -325,16 +358,17 @@ export default { |
|
|
sendEmailCodeHandle() { |
|
|
sendEmailCodeHandle() { |
|
|
this.$refs['emailRegForm'].validateField('email', err => { |
|
|
this.$refs['emailRegForm'].validateField('email', err => { |
|
|
if (!err) { |
|
|
if (!err) { |
|
|
this.validateCodeBtn = true |
|
|
this.emailValidateCodeBtn = true |
|
|
this.$api.get(`/register/email/code?email=${this.accountForm.email}`).then(() => { |
|
|
this.$api.get(`/register/email/code?email=${this.accountForm.email}`).then(() => { |
|
|
this.msgSuccess('验证码发送成功,5分钟内有效') |
|
|
this.msgSuccess('验证码发送成功,5分钟内有效') |
|
|
this.validateCodeBtn = true |
|
|
this.emailValidateCodeBtn = true |
|
|
let count = 60 |
|
|
let count = 60 |
|
|
let timer = setInterval(() => { |
|
|
let timer = setInterval(() => { |
|
|
count-- |
|
|
count-- |
|
|
this.validateCodeBtnText = count + 's后重新发送' |
|
|
this.emailValidateCodeBtnText = count + 's后重新发送' |
|
|
if (count == 0) { |
|
|
if (count == 0) { |
|
|
this.validateCodeBtnText = '发送验证码' |
|
|
this.emailValidateCodeBtnText = '发送验证码' |
|
|
|
|
|
this.emailValidateCodeBtn = false |
|
|
clearInterval(timer) |
|
|
clearInterval(timer) |
|
|
} |
|
|
} |
|
|
}, 1000) |
|
|
}, 1000) |
|
@ -342,21 +376,56 @@ export default { |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
sendPhoneCodeHandle() { |
|
|
|
|
|
this.$refs['phoneRegForm'].validateField('phoneNumber', err => { |
|
|
|
|
|
if (!err) { |
|
|
|
|
|
this.phoneValidateCodeBtn = true |
|
|
|
|
|
this.$api.get(`/register/phone/code?phoneNumber=${this.accountForm.phoneNumber}`).then(() => { |
|
|
|
|
|
this.msgSuccess('验证码发送成功,5分钟内有效') |
|
|
|
|
|
this.phoneValidateCodeBtn = true |
|
|
|
|
|
let count = 60 |
|
|
|
|
|
let timer = setInterval(() => { |
|
|
|
|
|
count-- |
|
|
|
|
|
this.phoneValidateCodeBtnText = count + 's后重新发送' |
|
|
|
|
|
if (count == 0) { |
|
|
|
|
|
this.phoneValidateCodeBtnText = '发送验证码' |
|
|
|
|
|
this.phoneValidateCodeBtn = false |
|
|
|
|
|
clearInterval(timer) |
|
|
|
|
|
} |
|
|
|
|
|
}, 1000) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
phoneRegHandle() { |
|
|
|
|
|
this.$refs['phoneRegForm'].validate(valid => { |
|
|
|
|
|
if (valid) { |
|
|
|
|
|
this.$api.post('/register/phone', this.accountForm).then(() => { |
|
|
|
|
|
this.registerSuccessHandle() |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
emailRegHandle() { |
|
|
emailRegHandle() { |
|
|
this.$refs['emailRegForm'].validate(valid => { |
|
|
this.$refs['emailRegForm'].validate(valid => { |
|
|
if (valid) { |
|
|
if (valid) { |
|
|
this.$api.post('/register/email', this.accountForm).then(() => { |
|
|
this.$api.post('/register/email', this.accountForm).then(() => { |
|
|
this.msgSuccess('注册成功,快去登录吧') |
|
|
this.registerSuccessHandle() |
|
|
setTimeout(() => { |
|
|
|
|
|
this.formType = 'login' |
|
|
|
|
|
this.loginType = 'account' |
|
|
|
|
|
}, 1000) |
|
|
|
|
|
}) |
|
|
}) |
|
|
} else { |
|
|
} else { |
|
|
return false |
|
|
return false |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
registerSuccessHandle() { |
|
|
|
|
|
this.msgSuccess('注册成功,快去登录吧') |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
this.formType = 'login' |
|
|
|
|
|
this.loginType = 'account' |
|
|
|
|
|
}, 1000) |
|
|
|
|
|
}, |
|
|
loginSuccessHandle(data) { |
|
|
loginSuccessHandle(data) { |
|
|
this.msgSuccess('登录成功') |
|
|
this.msgSuccess('登录成功') |
|
|
this.$store.dispatch('user/login', data).then(() => { |
|
|
this.$store.dispatch('user/login', data).then(() => { |
|
|