emis-app/pages/user/updatePassword.vue

122 lines
2.9 KiB
Vue
Raw Normal View History

2024-05-27 06:14:23 +00:00
<template>
<tpx-page>
<tpx-layout>
<template v-slot:body>
<view class="com-jianju pos-rlt pb-30" style="padding-top: 2rpx;">
<view class="blcok-white radius-20">
<view class="">
<view class="">
2024-06-08 18:06:43 +00:00
<tpx-input type="password" v-model:value="submitParam.oldPassword" placeholder="原密码"></tpx-input>
2024-05-27 06:14:23 +00:00
</view>
<view class="mt-30">
2024-06-08 18:06:43 +00:00
<tpx-input type="password" v-model:value="submitParam.newPassword" placeholder="新密码"></tpx-input>
2024-05-27 06:14:23 +00:00
</view>
<view class="mt-30">
2024-06-08 18:06:43 +00:00
<tpx-input type="password" v-model:value="submitParam._confirmNewPassword" placeholder="新确认密码"></tpx-input>
2024-05-27 06:14:23 +00:00
</view>
</view>
</view>
</view>
</template>
<template v-slot:footer>
<view class="blcok-white-noradius">
<u-button @click="handleSubmit()" type="primary" size="large" shape="circle"
custom-style="height:80rpx;font-size: 30rpx;"
>确定</u-button>
</view>
</template>
</tpx-layout>
</tpx-page>
</template>
<script>
2024-06-08 18:06:43 +00:00
import { USERKEY } from "@/store/actionKey"
2024-06-10 17:07:56 +00:00
import { encrypt } from "@/common/libs/jsencrypt_utils"
2024-05-27 06:14:23 +00:00
import * as apiService from "@/common/api"
2024-06-08 18:06:43 +00:00
import { checkParams } from "@/common/validate"
import { getSessionLoginInfo, setSessionLoginInfo } from "@/session"
2024-06-10 17:07:56 +00:00
2024-05-27 06:14:23 +00:00
export default {
props: {
},
computed: {
},
data() {
return {
queryOption: {
},
submitParam: {
2024-06-08 18:06:43 +00:00
oldPassword: '',
newPassword: '',
_confirmNewPassword: '',
},
submitValidConfig: {
oldPassword: { required: true, requiredMsg: '原密码不能为空' },
newPassword: { required: true, requiredMsg: '新密码不能为空' },
_confirmNewPassword: {
required: true, requiredMsg: '新确认密码不能为空',
validMsgFun: ({ val })=> {
let msg = ''
if(val.newPassword != val._confirmNewPassword) {
msg = '新确认密码和新密码必须一样'
}
return msg
}
},
},
2024-05-27 06:14:23 +00:00
}
},
onShareAppMessage() {
return {
// title: '',
// path: 'TODO'
}
},
onLoad(queryOption) {
this.queryOption = queryOption
this.initData();
},
onUnload() {
},
methods: {
async initData() {
},
async handleSubmit() {
2024-06-10 17:07:56 +00:00
let params = {
...this.submitParam,
// oldPassword: encrypt(this.submitParam.oldPassword),
// newPassword: encrypt(this.submitParam.newPassword),
}
2024-06-08 18:06:43 +00:00
await checkParams(this.submitParam, this.submitValidConfig)
await apiService.updatePwdByApp(params)
this.showToast("修改成功,请重新登录")
let info = getSessionLoginInfo()
delete info.password
2024-06-08 18:08:24 +00:00
setSessionLoginInfo(info)
2024-06-08 18:06:43 +00:00
await this.$store.dispatch(USERKEY.LOGOUT)
this.goto(`login/login`, 2)
2024-05-27 06:14:23 +00:00
},
}
}
</script>
<style lang="scss">
@import '@/common/uni-nvue.scss';
page {
background-color: #F6F6F6;
height: 100% !important;
}
</style>
<style scoped lang="scss">
</style>