123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <template>
- <div style="height: 100vh; width: 100vw">
- <van-nav-bar title="密码修改" @click-left="toMain">
- <template #left>
- <van-icon name="arrow-left" />
- </template>
- </van-nav-bar>
- <van-row style="margin-top: 10%; z-index: 99">
- <van-col :span="22" :offset="1" style="border-radius: 10px; overflow: hidden">
- <van-cell-group class="bx">
- <br />
- <van-field
- v-model="password.wxmm"
- label="当前密码:"
- placeholder="请输入当前密码"
- type="password"
- />
- <van-field
- v-model="password.newWxmm"
- label="修改密码:"
- placeholder="密码不少于6位,需要字母与数字构成"
- type="password"
- />
- <van-field
- v-model="password.repeatPsw"
- label="确认修改密码:"
- placeholder="密码不少于6位,需要字母与数字构成"
- type="password"
- />
- <br />
- <van-button
- round
- block
- @click="save"
- type="info"
- style="width: 50%; margin: 0 auto"
- >
- 修改
- </van-button>
- <br />
- </van-cell-group>
- </van-col>
- </van-row>
- </div>
- </template>
- <script>
- import { Toast } from 'vant'
- import apis from '@.mobile/api/apis'
- import common from '@.mobile/plugin/axios/common'
- export default {
- data() {
- return {
- password: {
- rowguid: '',
- wxmm: '',
- newWxmm: '',
- repeatPsw: ''
- }
- }
- },
- mounted() {
- const user = common.currUser()
- if (user && user.rowguid) {
- this.password.rowguid = user.rowguid
- } else {
- this.$router.push('/mobile-login')
- }
- },
- methods: {
- toMain() {
- this.$router.push('/mobile-main')
- },
- save() {
- if (this.password.newWxmm !== this.password.repeatPsw) {
- Toast('两次输入的密码不一致')
- return
- }
- apis.requestData('EcCompanyInfoController', 'editPwd', this.password).then(res => {
- if (res.data.code === 200) {
- Toast('密码修改成功,请重新登录')
- this.$store.dispatch('user/cleanCache').then(res => {
- this.$router.push('/mobile-login')
- })
- } else {
- Toast(res.data.msg)
- }
- })
- }
- }
- }
- </script>
- <style scoped>
- ::v-deep .van-cell {
- height: 60px;
- line-height: 60px;
- }
- ::v-deep .van-cell__title {
- height: 60px;
- line-height: 60px;
- }
- ::v-deep .van-cell__right-icon {
- height: 60px;
- line-height: 60px;
- }
- </style>
|