处理忘记密码、注册、登录短信等问题
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,16 +5,16 @@
|
||||
<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">
|
||||
<input type="password" v-model="loginInfo.password" placeholder="请输入新密码" autocomplete="off">
|
||||
<input type="password" v-model="newPassword" placeholder="请再次输入新密码" autocomplete="off">
|
||||
<!-- <div class="link">-->
|
||||
<!-- <router-link to="/register" class="register">立即注册</router-link>-->
|
||||
<!-- <router-link to="/forget" class="back">忘记密码?</router-link>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="link">-->
|
||||
<!-- <router-link to="/register" class="register">立即注册</router-link>-->
|
||||
<!-- <router-link to="/forget" class="back">忘记密码?</router-link>-->
|
||||
<!-- </div>-->
|
||||
<button @click="submitUpdate">提交修改</button>
|
||||
<div class="info">
|
||||
<p>主办:包头市应急管理局</p>
|
||||
@ -36,7 +36,7 @@ import md5 from 'js-md5'
|
||||
export default {
|
||||
name: 'ForgetPassword',
|
||||
components: {},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
loginInfo: {
|
||||
username: '',
|
||||
@ -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') {
|
||||
self.$layer.msg('修改成功')
|
||||
setTimeout(function () {
|
||||
self.$router.push({
|
||||
path: '/'
|
||||
})
|
||||
}, 1500)
|
||||
} else {
|
||||
self.$layer.msg(res.data.msg)
|
||||
}
|
||||
axios.put(self.url + 'app/user/forget-phone-password', info).then(function (res) {
|
||||
self.$layer.msg('修改成功')
|
||||
setTimeout(function () {
|
||||
self.$router.push({
|
||||
path: '/'
|
||||
})
|
||||
}, 1000)
|
||||
}).catch(function (error) {
|
||||
self.$layer.msg(error.response.data.msg)
|
||||
})
|
||||
@ -92,25 +91,25 @@ 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)
|
||||
var timer = setInterval(function () {
|
||||
self.restTime--
|
||||
if (self.restTime < 0) {
|
||||
clearInterval(timer)
|
||||
self.restTime = 120
|
||||
}
|
||||
}, 1000)
|
||||
} else {
|
||||
self.$layer.msg(res.data.msg)
|
||||
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.loginInfo.username).then(function (res) {
|
||||
self.$layer.msg('验证码发送成功,请注意查收')
|
||||
}).catch(function (error) {
|
||||
self.$layer.msg(error.response.data.msg)
|
||||
}).finally(() => {
|
||||
self.isSendCode = false;
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted: function () {}
|
||||
mounted: function () { }
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -1,27 +1,27 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="login">
|
||||
<div class="login-box">
|
||||
<h3>包头市安全生产三项岗位人员培训考试服务平台</h3>
|
||||
<!-- <p>Baotou Unified Identity Verification Platform</p>-->
|
||||
<input type="text" v-model="loginInfo.username" placeholder="请输入账号">
|
||||
<input type="password" v-model="loginInfo.password" placeholder="请输入密码" @keyup.enter="submitLogin">
|
||||
<div class="link">
|
||||
<router-link to="/register" class="register">立即注册</router-link>
|
||||
<router-link to="/forget" class="back">忘记密码?</router-link>
|
||||
</div>
|
||||
<button @click="submitLogin">登录</button>
|
||||
<div class="info">
|
||||
<p>主办:包头市应急管理局</p>
|
||||
<p>如有问题,咨询电话: 0472-5222813</p>
|
||||
</div>
|
||||
<div>
|
||||
<div class="login">
|
||||
<div class="login-box">
|
||||
<h3>包头市安全生产三项岗位人员培训考试服务平台</h3>
|
||||
<!-- <p>Baotou Unified Identity Verification Platform</p>-->
|
||||
<input type="text" v-model="loginInfo.username" placeholder="请输入账号">
|
||||
<input type="password" v-model="loginInfo.password" placeholder="请输入密码" @keyup.enter="submitLogin">
|
||||
<div class="link">
|
||||
<router-link to="/register" class="register">立即注册</router-link>
|
||||
<router-link to="/forget" class="back">忘记密码?</router-link>
|
||||
</div>
|
||||
<button @click="submitLogin">登录</button>
|
||||
<div class="info">
|
||||
<p>主办:包头市应急管理局</p>
|
||||
<p>如有问题,咨询电话: 0472-5222813</p>
|
||||
</div>
|
||||
<div class="bottom-text">Copyright:2012-2020包头市应急管理局 All Rights Reserved建议使用90以上版本浏觉器1024*768以上分辨率</div>
|
||||
</div>
|
||||
<div class="loading" v-if="isLoading">
|
||||
<img src="@/assets/images/loading.gif" alt="">
|
||||
</div>
|
||||
<div class="bottom-text">Copyright:2012-2020包头市应急管理局 All Rights Reserved建议使用90以上版本浏觉器1024*768以上分辨率</div>
|
||||
</div>
|
||||
<div class="loading" v-if="isLoading">
|
||||
<img src="@/assets/images/loading.gif" alt="">
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@ -29,44 +29,47 @@ import url from '@/assets/public/url'
|
||||
import axios from 'axios'
|
||||
import md5 from 'js-md5'
|
||||
export default {
|
||||
name: 'Login',
|
||||
components: {},
|
||||
data () {
|
||||
return {
|
||||
loginInfo: {
|
||||
username: '',
|
||||
password: ''
|
||||
},
|
||||
url: url.loginUrl,
|
||||
isLoading: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitLogin: function () {
|
||||
var self = this
|
||||
if (self.loginInfo.username && self.loginInfo.password) {
|
||||
self.isLoading = true
|
||||
var info = {
|
||||
username: self.loginInfo.username,
|
||||
password: md5(md5(md5(self.loginInfo.password)))
|
||||
}
|
||||
axios.post(self.url + 'app/sign/default', info).then(function (res) {
|
||||
window.sessionStorage.setItem('token', res.data.data)
|
||||
self.$layer.msg('登录成功')
|
||||
self.isLoading = false
|
||||
setTimeout(function () {
|
||||
self.$router.push('/')
|
||||
}, 1000)
|
||||
}).catch(function (error) {
|
||||
self.$layer.msg(error.response.data.msg)
|
||||
self.isLoading = false
|
||||
})
|
||||
} else {
|
||||
self.$layer.msg('用户名或密码不能为空')
|
||||
}
|
||||
name: 'Login',
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
loginInfo: {
|
||||
username: '',
|
||||
password: ''
|
||||
},
|
||||
url: url.loginUrl,
|
||||
isLoading: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitLogin: function () {
|
||||
var self = this
|
||||
if (self.isLoading) {
|
||||
return
|
||||
}
|
||||
},
|
||||
mounted: function () {}
|
||||
if (self.loginInfo.username && self.loginInfo.password) {
|
||||
self.isLoading = true
|
||||
var info = {
|
||||
username: self.loginInfo.username,
|
||||
password: md5(md5(md5(self.loginInfo.password)))
|
||||
}
|
||||
axios.post(self.url + 'app/sign/default', info).then(function (res) {
|
||||
window.sessionStorage.setItem('token', res.data.data)
|
||||
self.$layer.msg('登录成功')
|
||||
self.isLoading = false
|
||||
setTimeout(function () {
|
||||
self.$router.push('/')
|
||||
}, 1000)
|
||||
}).catch(function (error) {
|
||||
self.$layer.msg(error.response.data.msg)
|
||||
self.isLoading = false
|
||||
})
|
||||
} else {
|
||||
self.$layer.msg('用户名或密码不能为空')
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted: function () { }
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -1784,8 +1784,7 @@ export default {
|
||||
return
|
||||
}
|
||||
}
|
||||
axios.post(self.signUrl + 'app/apply/save', info,{
|
||||
// axios.post('http://192.168.0.109:8070/signup/app/apply/save', info,{
|
||||
axios.post(self.signUrl + 'app/apply/save', info, {
|
||||
headers: {
|
||||
token: self.token
|
||||
}
|
||||
|
@ -1,99 +1,140 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="login">
|
||||
<div class="login-box">
|
||||
<h3>注册新用户</h3>
|
||||
<!-- <p>Baotou Unified Identity Verification Platform</p>-->
|
||||
<input type="text" v-model="registerInfo.username" placeholder="请输入手机号">
|
||||
<input type="password" v-model="registerInfo.password" placeholder="请输入密码">
|
||||
<input type="password" v-model="registerInfo.passwordSame" placeholder="请再次输入密码">
|
||||
<button @click="submitRegister">注册</button>
|
||||
<router-link to="/" class="back">返回首页</router-link>
|
||||
<div class="info">
|
||||
<p>主办:包头市应急管理局</p>
|
||||
<p>如有问题,咨询电话: 0472-5222813</p>
|
||||
</div>
|
||||
<div>
|
||||
<div class="login">
|
||||
<div class="login-box">
|
||||
<h3>注册新用户</h3>
|
||||
<!-- <p>Baotou Unified Identity Verification Platform</p>-->
|
||||
<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>
|
||||
<router-link to="/" class="back">返回首页</router-link>
|
||||
<div class="info">
|
||||
<p>主办:包头市应急管理局</p>
|
||||
<p>如有问题,咨询电话: 0472-5222813</p>
|
||||
</div>
|
||||
<div class="bottom-text">Copyright:2012-2020包头市应急管理局 All Rights Reserved建议使用90以上版本浏觉器1024*768以上分辨率</div>
|
||||
</div>
|
||||
<div class="loading" v-if="isLoading">
|
||||
<img src="@/assets/images/loading.gif" alt="">
|
||||
</div>
|
||||
<div class="bottom-text">Copyright:2012-2020包头市应急管理局 All Rights Reserved建议使用90以上版本浏觉器1024*768以上分辨率</div>
|
||||
</div>
|
||||
<div class="loading" v-if="isLoading">
|
||||
<img src="@/assets/images/loading.gif" alt="">
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import url from '@/assets/public/url'
|
||||
|
||||
export default {
|
||||
name: 'Register',
|
||||
components: {},
|
||||
data () {
|
||||
return {
|
||||
url: url.registerUrl,
|
||||
registerInfo: {
|
||||
username: '',
|
||||
password: '',
|
||||
passwordSame: ''
|
||||
},
|
||||
isLoading: false
|
||||
name: 'Register',
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
url: url.registerUrl,
|
||||
restTime: 120,
|
||||
isSendCode: false,
|
||||
registerInfo: {
|
||||
username: '',
|
||||
code: '',
|
||||
password: '',
|
||||
passwordSame: ''
|
||||
},
|
||||
isLoading: false
|
||||
}
|
||||
},
|
||||
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
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
submitRegister: function () {
|
||||
var self = this
|
||||
var reg=/^[1][3,4,5,6,7,8,9][0-9]{9}$/;
|
||||
var pwdReg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]*$/;
|
||||
if (!self.isLoading) {
|
||||
if (!self.registerInfo.username) {
|
||||
self.$layer.msg('用户名不能为空')
|
||||
return
|
||||
}
|
||||
if (!self.registerInfo.password) {
|
||||
self.$layer.msg('密码不能为空')
|
||||
return
|
||||
}
|
||||
if (!self.registerInfo.passwordSame) {
|
||||
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('密码应由字母和数字组成')
|
||||
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') {
|
||||
self.isLoading = false
|
||||
self.$layer.msg('注册成功')
|
||||
setTimeout(function () {
|
||||
self.$router.push('/login')
|
||||
}, 1500)
|
||||
}
|
||||
}).catch(function (error) {
|
||||
// self.$layer.msg(error.response.data.message)
|
||||
self.$layer.msg('用户名可能已存在')
|
||||
self.isLoading = false
|
||||
})
|
||||
} else {
|
||||
self.$layer.msg('用户名或密码不能为空')
|
||||
}
|
||||
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]{6,}$/;
|
||||
if (!self.isLoading) {
|
||||
if (!self.registerInfo.username) {
|
||||
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) {
|
||||
self.$layer.msg('密码不能为空')
|
||||
return
|
||||
}
|
||||
if (!self.registerInfo.passwordSame) {
|
||||
self.$layer.msg('请再次输入密码')
|
||||
return
|
||||
}
|
||||
if (self.registerInfo.password != self.registerInfo.passwordSame) {
|
||||
self.$layer.msg('两次输入的密码不一致')
|
||||
return
|
||||
}
|
||||
if (!pwdReg.test(self.registerInfo.password)) {
|
||||
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/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')
|
||||
}, 1000)
|
||||
}).catch(function (error) {
|
||||
self.$layer.msg(error.response.data.msg)
|
||||
self.isLoading = false
|
||||
})
|
||||
} else {
|
||||
self.$layer.msg('用户名或密码不能为空')
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
var self = this
|
||||
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
var self = this
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -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