feat: app端首次登录修改密码功能
parent
315d2ecbbe
commit
5022ad0ca0
|
|
@ -25,6 +25,7 @@ export const setFeedbackUpload = (params) => upload('/app/feedback/upload', para
|
||||||
export const setFeedbackAdd = (params) => post('/app/feedback/add', params) //反馈问题提交
|
export const setFeedbackAdd = (params) => post('/app/feedback/add', params) //反馈问题提交
|
||||||
export const getVersion = (params) => post('/app/versionmanager/getVersion', params) // 版本更新
|
export const getVersion = (params) => post('/app/versionmanager/getVersion', params) // 版本更新
|
||||||
export const setUpdatePassword = (params) => post('/app/user/editUserPasswordByUserId', params) //修改密码
|
export const setUpdatePassword = (params) => post('/app/user/editUserPasswordByUserId', params) //修改密码
|
||||||
|
export const changePasswordFirstLogin = (params) => post("/sys/changePasswordFirstLogin", params) // 首次登录修改密码
|
||||||
export const getUserInfo = (params) => post('/app/user/getDetailByUserIdAndCorpInfoId', params) //用户信息
|
export const getUserInfo = (params) => post('/app/user/getDetailByUserIdAndCorpInfoId', params) //用户信息
|
||||||
export const setUserInfo = (params) => post('/app/user/edit', params) //修改用户信息
|
export const setUserInfo = (params) => post('/app/user/edit', params) //修改用户信息
|
||||||
export const setEntry = (params) => post('/app/user/entry', params) //用户入职
|
export const setEntry = (params) => post('/app/user/entry', params) //用户入职
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"crypto-js": "^4.2.0",
|
||||||
"uview-ui": "^2.0.36",
|
"uview-ui": "^2.0.36",
|
||||||
"vue": "^2.7.14",
|
"vue": "^2.7.14",
|
||||||
"vuex-persistedstate": "^3.2.1"
|
"vuex-persistedstate": "^3.2.1"
|
||||||
|
|
@ -55,6 +56,12 @@
|
||||||
"source-map": "^0.6.1"
|
"source-map": "^0.6.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/crypto-js": {
|
||||||
|
"version": "4.2.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.2.0.tgz",
|
||||||
|
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/csstype": {
|
"node_modules/csstype": {
|
||||||
"version": "3.1.2",
|
"version": "3.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz",
|
||||||
|
|
@ -218,6 +225,11 @@
|
||||||
"source-map": "^0.6.1"
|
"source-map": "^0.6.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"crypto-js": {
|
||||||
|
"version": "4.2.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.2.0.tgz",
|
||||||
|
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="
|
||||||
|
},
|
||||||
"csstype": {
|
"csstype": {
|
||||||
"version": "3.1.2",
|
"version": "3.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz",
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,12 @@
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/login/change-password/change-password",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "首次登录修改密码"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/login/register",
|
"path": "pages/login/register",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
<template>
|
||||||
|
<view class="content">
|
||||||
|
<view class="change-password">
|
||||||
|
<u--form labelPosition="top" :model="form" :rules="rules" ref="form" labelWidth="100%"
|
||||||
|
:labelStyle="{color:'#333', fontSize:'34rpx', fontWeight:'bold'}">
|
||||||
|
<u-form-item label="新密码" prop="nowPwd" borderBottom>
|
||||||
|
<u--input v-model="form.nowPwd" type="password" border="none" placeholder="请输入新密码"></u--input>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="确认新密码" prop="confirmPwd" borderBottom>
|
||||||
|
<u--input v-model="form.confirmPwd" type="password" border="none" placeholder="请确认新密码"></u--input>
|
||||||
|
</u-form-item>
|
||||||
|
<u--text type="error" text="*密码规则:密码长度为8-16位,必须由大写字母,小写字母,数字,特殊符号(!#@*&.)组成"></u--text>
|
||||||
|
<u-form-item>
|
||||||
|
<u-button type="primary" shape="circle" text="确认修改" @click="$u.debounce(submitPassword, 1000, true)">
|
||||||
|
</u-button>
|
||||||
|
</u-form-item>
|
||||||
|
</u--form>
|
||||||
|
</view>
|
||||||
|
<u-toast ref="uToast"></u-toast>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { changePasswordFirstLogin } from "@/api";
|
||||||
|
import { encrypt } from "@/utils/aes_secret";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
form: {
|
||||||
|
nowPwd: '',
|
||||||
|
confirmPwd: '',
|
||||||
|
},
|
||||||
|
testPassword: /^(?=.*?[a-z])(?=.*?[A-Z])(?=.*?\d)(?=.*?[!#@*&.])[a-zA-Z\d!#@*&.].*.{8,16}$/,
|
||||||
|
rules: {
|
||||||
|
nowPwd: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入新密码',
|
||||||
|
trigger: 'blur'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
min: 8,
|
||||||
|
max: 16,
|
||||||
|
message: '长度最少8个字符最多16个字符',
|
||||||
|
trigger: 'blur'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
return this.testPassword.test(value)
|
||||||
|
},
|
||||||
|
message: '新密码格式不对,请重新输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
confirmPwd: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请再次输入新密码',
|
||||||
|
trigger: 'blur'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
min: 8,
|
||||||
|
max: 16,
|
||||||
|
message: '长度最少8个字符最多16个字符',
|
||||||
|
trigger: 'blur'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
return value === this.form.nowPwd
|
||||||
|
},
|
||||||
|
message: '两次输入密码不一致',
|
||||||
|
trigger: 'blur',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
submitPassword() {
|
||||||
|
this.$refs.form.validate().then(async () => {
|
||||||
|
await changePasswordFirstLogin({
|
||||||
|
newPassword: encrypt(this.form.nowPwd),
|
||||||
|
postMethod: 'application/json'
|
||||||
|
})
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
message: '密码修改成功,请重新登录',
|
||||||
|
type: 'success',
|
||||||
|
complete: () => {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
this.$refs.uToast.error('请填写完整')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.content {
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
padding: 20rpx;
|
||||||
|
}
|
||||||
|
.change-password {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 40rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -76,6 +76,14 @@ export default {
|
||||||
const keydataVal = jsencrypt.encrypt('qdkjchina' + this.form.userName + ',qd,' + this.form.userPwd)
|
const keydataVal = jsencrypt.encrypt('qdkjchina' + this.form.userName + ',qd,' + this.form.userPwd)
|
||||||
let resData = await submitLogin({'KEYDATA': keydataVal});
|
let resData = await submitLogin({'KEYDATA': keydataVal});
|
||||||
// console.log(resData)
|
// console.log(resData)
|
||||||
|
if (resData.firstLogin === 1) {
|
||||||
|
await this.$store.dispatch('setUserInfo', resData);
|
||||||
|
uni.$u.route({
|
||||||
|
url: '/pages/login/change-password/change-password',
|
||||||
|
type: 'reLaunch'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (resData.PHOTO != '') {
|
if (resData.PHOTO != '') {
|
||||||
resData.PHOTO = this.$filePath + resData.PHOTO
|
resData.PHOTO = this.$filePath + resData.PHOTO
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ function decryptAes(params) {
|
||||||
|
|
||||||
const key = CryptoJS.enc.Utf8.parse("fa4e0fae59534676"); // 16 bytes key for AES
|
const key = CryptoJS.enc.Utf8.parse("fa4e0fae59534676"); // 16 bytes key for AES
|
||||||
|
|
||||||
const bytes = CryptoJS.AES.decrypt(params.info, key, {
|
const bytes = CryptoJS.AES.decrypt(params.encryptData, key, {
|
||||||
mode: CryptoJS.mode.ECB,
|
mode: CryptoJS.mode.ECB,
|
||||||
padding: CryptoJS.pad.Pkcs7,
|
padding: CryptoJS.pad.Pkcs7,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue