处理忘记密码、注册、登录短信等问题

This commit is contained in:
TS-QD1 2023-03-15 18:22:58 +08:00
parent dbb1723309
commit a84364ea40
7 changed files with 14415 additions and 309 deletions

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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,

View File

@ -5,16 +5,16 @@
<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">
<input type="password" v-model="loginInfo.password" placeholder="请输入新密码" autocomplete="off"> <input type="password" v-model="loginInfo.password" placeholder="请输入新密码" autocomplete="off">
<input type="password" v-model="newPassword" placeholder="请再次输入新密码" autocomplete="off"> <input type="password" v-model="newPassword" placeholder="请再次输入新密码" autocomplete="off">
<!-- <div class="link">--> <!-- <div class="link">-->
<!-- <router-link to="/register" class="register">立即注册</router-link>--> <!-- <router-link to="/register" class="register">立即注册</router-link>-->
<!-- <router-link to="/forget" class="back">忘记密码</router-link>--> <!-- <router-link to="/forget" class="back">忘记密码</router-link>-->
<!-- </div>--> <!-- </div>-->
<button @click="submitUpdate">提交修改</button> <button @click="submitUpdate">提交修改</button>
<div class="info"> <div class="info">
<p>主办包头市应急管理局</p> <p>主办包头市应急管理局</p>
@ -36,7 +36,7 @@ import md5 from 'js-md5'
export default { export default {
name: 'ForgetPassword', name: 'ForgetPassword',
components: {}, components: {},
data () { data() {
return { return {
loginInfo: { loginInfo: {
username: '', username: '',
@ -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) self.$layer.msg('修改成功')
if (res.data.code == '200') { setTimeout(function () {
self.$layer.msg('修改成功') self.$router.push({
setTimeout(function () { path: '/'
self.$router.push({ })
path: '/' }, 1000)
})
}, 1500)
} 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,25 +91,25 @@ 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) { clearInterval(timer)
clearInterval(timer) self.restTime = 120
self.restTime = 120
}
}, 1000)
} else {
self.$layer.msg(res.data.msg)
} }
}, 1000)
axios.get(self.url + 'app/sms/verify-code/' + self.loginInfo.username).then(function (res) {
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;
}) })
} }
}, },
mounted: function () {} mounted: function () { }
} }
</script> </script>

View File

@ -1,27 +1,27 @@
<template> <template>
<div> <div>
<div class="login"> <div class="login">
<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="loginInfo.username" placeholder="请输入账号"> <input type="text" v-model="loginInfo.username" placeholder="请输入账号">
<input type="password" v-model="loginInfo.password" placeholder="请输入密码" @keyup.enter="submitLogin"> <input type="password" v-model="loginInfo.password" placeholder="请输入密码" @keyup.enter="submitLogin">
<div class="link"> <div class="link">
<router-link to="/register" class="register">立即注册</router-link> <router-link to="/register" class="register">立即注册</router-link>
<router-link to="/forget" class="back">忘记密码</router-link> <router-link to="/forget" class="back">忘记密码</router-link>
</div> </div>
<button @click="submitLogin">登录</button> <button @click="submitLogin">登录</button>
<div class="info"> <div class="info">
<p>主办包头市应急管理局</p> <p>主办包头市应急管理局</p>
<p>如有问题咨询电话: 0472-5222813</p> <p>如有问题咨询电话: 0472-5222813</p>
</div>
</div> </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>
<div class="bottom-text">Copyright:2012-2020包头市应急管理局 All Rights Reserved建议使用90以上版本浏觉器1024*768以上分辨率</div>
</div> </div>
<div class="loading" v-if="isLoading">
<img src="@/assets/images/loading.gif" alt="">
</div>
</div>
</template> </template>
<script> <script>
@ -29,44 +29,47 @@ import url from '@/assets/public/url'
import axios from 'axios' import axios from 'axios'
import md5 from 'js-md5' import md5 from 'js-md5'
export default { export default {
name: 'Login', name: 'Login',
components: {}, components: {},
data () { data() {
return { return {
loginInfo: { loginInfo: {
username: '', username: '',
password: '' password: ''
}, },
url: url.loginUrl, url: url.loginUrl,
isLoading: false isLoading: false
} }
}, },
methods: { methods: {
submitLogin: function () { submitLogin: function () {
var self = this var self = this
if (self.loginInfo.username && self.loginInfo.password) { if (self.isLoading) {
self.isLoading = true return
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('用户名或密码不能为空')
}
} }
}, if (self.loginInfo.username && self.loginInfo.password) {
mounted: function () {} 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> </script>

View File

@ -1784,8 +1784,7 @@ export default {
return return
} }
} }
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
} }

View File

@ -1,99 +1,140 @@
<template> <template>
<div> <div>
<div class="login"> <div class="login">
<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 type="password" v-model="registerInfo.password" placeholder="请输入密码"> <input class="yz-code" v-model="registerInfo.username" placeholder="请输入手机号" autocomplete="off">
<input type="password" v-model="registerInfo.passwordSame" placeholder="请再次输入密码"> <button class="get-code" @click="onGetCode" v-if="restTime >= 120 && !isSendCode">获取验证码</button>
<button @click="submitRegister">注册</button> <button class="get-code got" v-else>{{ restTime }}</button>
<router-link to="/" class="back">返回首页</router-link> </div>
<div class="info"> <input type="text" v-model="registerInfo.code" placeholder="请输入验证码" autocomplete="off">
<p>主办包头市应急管理局</p> <input type="password" v-model="registerInfo.password" placeholder="请输入密码">
<p>如有问题咨询电话: 0472-5222813</p> <input type="password" v-model="registerInfo.passwordSame" placeholder="请再次输入密码">
</div> <button @click="submitRegister">注册</button>
<router-link to="/" class="back">返回首页</router-link>
<div class="info">
<p>主办包头市应急管理局</p>
<p>如有问题咨询电话: 0472-5222813</p>
</div> </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>
<div class="bottom-text">Copyright:2012-2020包头市应急管理局 All Rights Reserved建议使用90以上版本浏觉器1024*768以上分辨率</div>
</div> </div>
<div class="loading" v-if="isLoading">
<img src="@/assets/images/loading.gif" alt="">
</div>
</div>
</template> </template>
<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,
registerInfo: { restTime: 120,
username: '', isSendCode: false,
password: '', registerInfo: {
passwordSame: '' username: '',
}, code: '',
isLoading: false 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 () {
submitRegister: function () { var self = this
var self = this if(self.isLoading) {
var reg=/^[1][3,4,5,6,7,8,9][0-9]{9}$/; return
var pwdReg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]*$/; }
if (!self.isLoading) { var reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
if (!self.registerInfo.username) { var pwdReg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,}$/;
self.$layer.msg('用户名不能为空') if (!self.isLoading) {
return if (!self.registerInfo.username) {
} self.$layer.msg('手机号不能为空')
if (!self.registerInfo.password) { return
self.$layer.msg('密码不能为空') }
return if (!reg.test(self.registerInfo.username)) {
} self.$layer.msg('手机号码格式错误')
if (!self.registerInfo.passwordSame) { return
self.$layer.msg('请再次输入密码') }
return if (!self.registerInfo.code) {
} self.$layer.msg('验证码不能为空')
if (!reg.test(self.registerInfo.username)) { return
self.$layer.msg('用户名应为有效手机号码') }
return if (!self.registerInfo.password) {
} self.$layer.msg('密码不能为空')
if (self.registerInfo.password != self.registerInfo.passwordSame) { return
self.$layer.msg('两次输入的密码不一致') }
return if (!self.registerInfo.passwordSame) {
} self.$layer.msg('请再次输入密码')
if (!pwdReg.test(self.registerInfo.password)) { return
self.$layer.msg('密码应由字母和数字组成') }
return if (self.registerInfo.password != self.registerInfo.passwordSame) {
} self.$layer.msg('两次输入的密码不一致')
if (self.registerInfo.username && self.registerInfo.password && self.registerInfo.passwordSame) { return
self.isLoading = true }
axios.post(self.url + 'app/register/default', self.registerInfo).then(function (res) { if (!pwdReg.test(self.registerInfo.password)) {
if (res.status == '200') { self.$layer.msg('密码长度至少为6-16位包含数字、字母、特殊字符其中的任意两种')
self.isLoading = false return
self.$layer.msg('注册成功') }
setTimeout(function () { if (self.registerInfo.username && self.registerInfo.password && self.registerInfo.passwordSame) {
self.$router.push('/login') self.isLoading = true
}, 1500) axios.post(self.url + 'app/register/phone-password', {
} phone: self.registerInfo.username,
}).catch(function (error) { verifyCode: self.registerInfo.code,
// self.$layer.msg(error.response.data.message) password: self.registerInfo.password,
self.$layer.msg('用户名可能已存在') passwordSame: self.registerInfo.passwordSame
self.isLoading = false }).then(function (res) {
}) self.isLoading = false
} else { self.$layer.msg('注册成功')
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> </script>
@ -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