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