处理忘记密码、注册、登录短信等问题
This commit is contained in:
parent
dbb1723309
commit
a84364ea40
@ -13,8 +13,8 @@ module.exports = {
|
||||
proxyTable: {},
|
||||
|
||||
// Various Dev Server settings
|
||||
host: '192.168.1.8', // can be overwritten by process.env.HOST
|
||||
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
|
||||
host: '127.0.0.1', // can be overwritten by process.env.HOST
|
||||
port: 8888, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
|
||||
autoOpenBrowser: false,
|
||||
errorOverlay: true,
|
||||
notifyOnErrors: true,
|
||||
|
14306
package-lock.json
generated
14306
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,15 +1,10 @@
|
||||
// const registerUrl = 'https://www.yjkaoshi.cn/signup/'
|
||||
// const loginUrl = 'https://www.yjkaoshi.cn/signup/'
|
||||
// const signUrl = 'https://www.yjkaoshi.cn/signup/'
|
||||
// const personInfoUrl = 'https://www.yjkaoshi.cn/signup/'
|
||||
const registerUrl = 'http://1.180.60.42:8092/signup/'
|
||||
const loginUrl = 'http://1.180.60.42:8092/signup/'
|
||||
const signUrl = 'http://1.180.60.42:8092/signup/'
|
||||
const personInfoUrl = 'http://1.180.60.42:8092/signup/'
|
||||
// const registerUrl = 'http://175.24.42.217:9101/signup/'
|
||||
// const loginUrl = 'http://175.24.42.217:9101/signup/'
|
||||
// const signUrl = 'http://175.24.42.217:9101/signup/'
|
||||
// const personInfoUrl = 'http://175.24.42.217:9101/signup/'
|
||||
// const baseUrl = 'https://www.yjkaoshi.cn/'
|
||||
const baseUrl = 'http://1.180.60.42:8092/'
|
||||
// const baseUrl = 'http://192.168.0.15:7009/'
|
||||
const registerUrl = `${baseUrl}signup/`
|
||||
const loginUrl = `${baseUrl}signup/`
|
||||
const signUrl = `${baseUrl}signup/`
|
||||
const personInfoUrl = `${baseUrl}signup/`
|
||||
export default {
|
||||
registerUrl,
|
||||
loginUrl,
|
||||
|
@ -5,7 +5,7 @@
|
||||
<h3>包头市安全生产三项岗位人员培训考试服务平台</h3>
|
||||
<div class="yz-code-box">
|
||||
<input class="yz-code" v-model="loginInfo.username" placeholder="请输入手机号" autocomplete="off">
|
||||
<button class="get-code" @click="getCode" v-if="restTime >= 120">获取验证码</button>
|
||||
<button class="get-code" @click="getCode" v-if="restTime >= 120 && !isSendCode">获取验证码</button>
|
||||
<button class="get-code got" v-else>{{ restTime }}</button>
|
||||
</div>
|
||||
<input type="text" v-model="loginInfo.code" placeholder="请输入验证码" autocomplete="off">
|
||||
@ -47,11 +47,15 @@ export default {
|
||||
newPassword: '',
|
||||
url: url.loginUrl,
|
||||
isLoading: false,
|
||||
restTime: 120
|
||||
restTime: 120,
|
||||
isSendCode: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitUpdate: function () {
|
||||
if (this.isLoading) {
|
||||
return
|
||||
}
|
||||
if (!this.loginInfo.code) {
|
||||
this.$layer.msg('验证码不能为空')
|
||||
return
|
||||
@ -67,21 +71,16 @@ export default {
|
||||
var self = this
|
||||
var info = {
|
||||
phone: self.loginInfo.username,
|
||||
code: self.loginInfo.code,
|
||||
verificationCode: self.loginInfo.code,
|
||||
newPassWord: self.loginInfo.password
|
||||
}
|
||||
axios.post(self.url + 'app/release/find-pwd/update-pwd-by-sms-verify-code', info).then(function (res) {
|
||||
console.log(res)
|
||||
if (res.data.code == '200') {
|
||||
axios.put(self.url + 'app/user/forget-phone-password', info).then(function (res) {
|
||||
self.$layer.msg('修改成功')
|
||||
setTimeout(function () {
|
||||
self.$router.push({
|
||||
path: '/'
|
||||
})
|
||||
}, 1500)
|
||||
} else {
|
||||
self.$layer.msg(res.data.msg)
|
||||
}
|
||||
}, 1000)
|
||||
}).catch(function (error) {
|
||||
self.$layer.msg(error.response.data.msg)
|
||||
})
|
||||
@ -92,9 +91,8 @@ export default {
|
||||
return
|
||||
}
|
||||
var self = this
|
||||
axios.get(self.url + 'app/release/find-pwd/get-sms-verify-code/' + self.loginInfo.username).then(function (res) {
|
||||
if (res.data.code == '200') {
|
||||
self.$layer.msg(res.data.msg)
|
||||
self.isSendCode = true
|
||||
self.restTime--
|
||||
var timer = setInterval(function () {
|
||||
self.restTime--
|
||||
if (self.restTime < 0) {
|
||||
@ -102,11 +100,12 @@ export default {
|
||||
self.restTime = 120
|
||||
}
|
||||
}, 1000)
|
||||
} else {
|
||||
self.$layer.msg(res.data.msg)
|
||||
}
|
||||
axios.get(self.url + 'app/sms/verify-code/' + self.loginInfo.username).then(function (res) {
|
||||
self.$layer.msg('验证码发送成功,请注意查收')
|
||||
}).catch(function (error) {
|
||||
self.$layer.msg(error.response.data.msg)
|
||||
}).finally(() => {
|
||||
self.isSendCode = false;
|
||||
})
|
||||
}
|
||||
},
|
||||
|
@ -44,6 +44,9 @@ export default {
|
||||
methods: {
|
||||
submitLogin: function () {
|
||||
var self = this
|
||||
if (self.isLoading) {
|
||||
return
|
||||
}
|
||||
if (self.loginInfo.username && self.loginInfo.password) {
|
||||
self.isLoading = true
|
||||
var info = {
|
||||
|
@ -1785,7 +1785,6 @@ export default {
|
||||
}
|
||||
}
|
||||
axios.post(self.signUrl + 'app/apply/save', info, {
|
||||
// axios.post('http://192.168.0.109:8070/signup/app/apply/save', info,{
|
||||
headers: {
|
||||
token: self.token
|
||||
}
|
||||
|
@ -4,7 +4,12 @@
|
||||
<div class="login-box">
|
||||
<h3>注册新用户</h3>
|
||||
<!-- <p>Baotou Unified Identity Verification Platform</p>-->
|
||||
<input type="text" v-model="registerInfo.username" placeholder="请输入手机号">
|
||||
<div class="yz-code-box">
|
||||
<input class="yz-code" v-model="registerInfo.username" placeholder="请输入手机号" autocomplete="off">
|
||||
<button class="get-code" @click="onGetCode" v-if="restTime >= 120 && !isSendCode">获取验证码</button>
|
||||
<button class="get-code got" v-else>{{ restTime }}</button>
|
||||
</div>
|
||||
<input type="text" v-model="registerInfo.code" placeholder="请输入验证码" autocomplete="off">
|
||||
<input type="password" v-model="registerInfo.password" placeholder="请输入密码">
|
||||
<input type="password" v-model="registerInfo.passwordSame" placeholder="请再次输入密码">
|
||||
<button @click="submitRegister">注册</button>
|
||||
@ -25,14 +30,18 @@
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import url from '@/assets/public/url'
|
||||
|
||||
export default {
|
||||
name: 'Register',
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
url: url.registerUrl,
|
||||
restTime: 120,
|
||||
isSendCode: false,
|
||||
registerInfo: {
|
||||
username: '',
|
||||
code: '',
|
||||
password: '',
|
||||
passwordSame: ''
|
||||
},
|
||||
@ -40,13 +49,47 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onGetCode: function () {
|
||||
if (!this.registerInfo.username) {
|
||||
this.$layer.msg('请输入手机号')
|
||||
return
|
||||
}
|
||||
var self = this
|
||||
self.isSendCode = true
|
||||
self.restTime--
|
||||
var timer = setInterval(function () {
|
||||
self.restTime--
|
||||
if (self.restTime < 0) {
|
||||
clearInterval(timer)
|
||||
self.restTime = 120
|
||||
}
|
||||
}, 1000)
|
||||
axios.get(self.url + 'app/sms/verify-code/' + self.registerInfo.username).then(function (res) {
|
||||
self.$layer.msg('验证码发送成功,请注意查收')
|
||||
}).catch(function (error) {
|
||||
self.$layer.msg(error.response.data.msg)
|
||||
}).finally(() => {
|
||||
self.isSendCode = false
|
||||
})
|
||||
},
|
||||
submitRegister: function () {
|
||||
var self = this
|
||||
if(self.isLoading) {
|
||||
return
|
||||
}
|
||||
var reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
|
||||
var pwdReg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]*$/;
|
||||
var pwdReg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,}$/;
|
||||
if (!self.isLoading) {
|
||||
if (!self.registerInfo.username) {
|
||||
self.$layer.msg('用户名不能为空')
|
||||
self.$layer.msg('手机号不能为空')
|
||||
return
|
||||
}
|
||||
if (!reg.test(self.registerInfo.username)) {
|
||||
self.$layer.msg('手机号码格式错误')
|
||||
return
|
||||
}
|
||||
if (!self.registerInfo.code) {
|
||||
self.$layer.msg('验证码不能为空')
|
||||
return
|
||||
}
|
||||
if (!self.registerInfo.password) {
|
||||
@ -57,31 +100,29 @@ export default {
|
||||
self.$layer.msg('请再次输入密码')
|
||||
return
|
||||
}
|
||||
if (!reg.test(self.registerInfo.username)) {
|
||||
self.$layer.msg('用户名应为有效手机号码')
|
||||
return
|
||||
}
|
||||
if (self.registerInfo.password != self.registerInfo.passwordSame) {
|
||||
self.$layer.msg('两次输入的密码不一致')
|
||||
return
|
||||
}
|
||||
if (!pwdReg.test(self.registerInfo.password)) {
|
||||
self.$layer.msg('密码应由字母和数字组成')
|
||||
self.$layer.msg('密码长度至少为6-16位,包含数字、字母、特殊字符,其中的任意两种')
|
||||
return
|
||||
}
|
||||
if (self.registerInfo.username && self.registerInfo.password && self.registerInfo.passwordSame) {
|
||||
self.isLoading = true
|
||||
axios.post(self.url + 'app/register/default', self.registerInfo).then(function (res) {
|
||||
if (res.status == '200') {
|
||||
axios.post(self.url + 'app/register/phone-password', {
|
||||
phone: self.registerInfo.username,
|
||||
verifyCode: self.registerInfo.code,
|
||||
password: self.registerInfo.password,
|
||||
passwordSame: self.registerInfo.passwordSame
|
||||
}).then(function (res) {
|
||||
self.isLoading = false
|
||||
self.$layer.msg('注册成功')
|
||||
setTimeout(function () {
|
||||
self.$router.push('/login')
|
||||
}, 1500)
|
||||
}
|
||||
}, 1000)
|
||||
}).catch(function (error) {
|
||||
// self.$layer.msg(error.response.data.message)
|
||||
self.$layer.msg('用户名可能已存在')
|
||||
self.$layer.msg(error.response.data.msg)
|
||||
self.isLoading = false
|
||||
})
|
||||
} else {
|
||||
@ -180,6 +221,13 @@ export default {
|
||||
font-size 12px
|
||||
margin-bottom 0
|
||||
color #999
|
||||
.yz-code-box
|
||||
display flex
|
||||
.get-code
|
||||
width 180px
|
||||
.got
|
||||
background-color #B9B9B9
|
||||
|
||||
.bottom-text
|
||||
text-align center
|
||||
color #fff
|
||||
|
Loading…
Reference in New Issue
Block a user