| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class=""> |
| | | <page-nav title="å¯ç 设置"></page-nav> |
| | | |
| | | |
| | | <view class="flex_column head titleFont" style="min-height: 1400rpx;"> |
| | | <view class="flex_center marginTop20 marginLeft20"> |
| | | <view style="margin-left: 36rpx;">åå¯ç ï¼</view> |
| | | <view class='inputClass'> |
| | | <u--input placeholder="请è¾å
¥" border="surround" v-model="oldPassword"></u--input> |
| | | </view> |
| | | </view> |
| | | <view class="flex_center marginTop20 marginLeft20"> |
| | | <view style="margin-left: 36rpx;">æ°å¯ç ï¼</view> |
| | | <view class='inputClass'> |
| | | <u--input placeholder="请è¾å
¥" border="surround" v-model="newPassword"></u--input> |
| | | </view> |
| | | </view> |
| | | <view class="flex_center marginTop20 marginLeft20"> |
| | | <view>确认å¯ç ï¼</view> |
| | | <view class='inputClass'> |
| | | <u--input placeholder="请è¾å
¥" border="surround" v-model="newPasswordConfirm"></u--input> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | |
| | | <view class="footer"> |
| | | <u-button :loading="isDisabledSubmitButtonReset" loadingText="éç½®ä¸..." |
| | | style='width: 50%;border-radius: 10rpx 0 0 10rpx;' type="success" @click="resetPassword" text="éç½®å¯ç " |
| | | size="large"> |
| | | </u-button> |
| | | <u-button :loading="isDisabledSubmitButtonEdit" loadingText="ä¿®æ¹ä¸..." |
| | | style='width: 50%;border-radius:0 10rpx 10rpx 0' @click="editPassword" type="primary" text="ä¿®æ¹å¯ç " |
| | | size="large"></u-button> |
| | | </view> |
| | | |
| | | </view> |
| | | </template> |
| | | |
| | | |
| | | <script> |
| | | import { |
| | | UpdateUserPassword, |
| | | ResettUserPassword |
| | | } from '../../config/api.js'; |
| | | |
| | | export default { |
| | | onLoad(option) { |
| | | |
| | | }, |
| | | |
| | | onPullDownRefresh() { |
| | | setTimeout(() => { |
| | | this.init(() => { |
| | | uni.stopPullDownRefresh(); |
| | | }) |
| | | }, 1000); |
| | | }, |
| | | |
| | | data() { |
| | | return { |
| | | topRightMessageCount: '', |
| | | |
| | | isDisabledSubmitButtonReset: false, |
| | | |
| | | isDisabledSubmitButtonEdit: false, |
| | | |
| | | oldPassword: '', //åå¯ç |
| | | newPassword: '', //æ°å¯ç |
| | | newPasswordConfirm: '', //确认å¯ç |
| | | |
| | | |
| | | } |
| | | }, |
| | | created() { |
| | | |
| | | }, |
| | | mounted() { |
| | | this.init() |
| | | |
| | | }, |
| | | methods: { |
| | | init() { |
| | | uni.stopPullDownRefresh(); |
| | | }, |
| | | |
| | | // éç½®å¯ç |
| | | async resetPassword() { |
| | | const data = { |
| | | usercode: uni.getStorageSync("usercode"), |
| | | username: uni.getStorageSync("username"), |
| | | usertype: 'APP' |
| | | } |
| | | this.isDisabledSubmitButtonReset = true |
| | | const res = await ResettUserPassword(this.global.formatData(data)) |
| | | |
| | | if (res.code === '200') { |
| | | this.isDisabledSubmitButtonReset = false |
| | | this.$u.toast('å¯ç éç½®æåï¼') |
| | | |
| | | uni.setStorageSync("Token", '') |
| | | uni.setStorageSync("usercode", '') |
| | | uni.setStorageSync("username", '') |
| | | uni.setStorageSync("storg_code", '') |
| | | uni.setStorageSync("storg_name", '') |
| | | |
| | | setTimeout(() => { |
| | | uni.redirectTo({ |
| | | url: '../login/index' |
| | | }); |
| | | }, 2000) |
| | | |
| | | } else { |
| | | this.isDisabledSubmitButtonReset = false |
| | | this.$u.toast('å¯ç é置失败ï¼') |
| | | } |
| | | |
| | | }, |
| | | // ä¿®æ¹å¯ç |
| | | async editPassword() { |
| | | if (!this.oldPassword) { |
| | | return this.$u.toast('请è¾å
¥åå¯ç ï¼') |
| | | } |
| | | if (!this.newPassword) { |
| | | return this.$u.toast('请è¾å
¥æ°å¯ç ï¼') |
| | | } |
| | | if (!this.newPasswordConfirm) { |
| | | return this.$u.toast('请è¾å
¥ç¡®è®¤å¯ç ï¼') |
| | | } |
| | | |
| | | if (this.newPassword.trim() !== this.newPasswordConfirm.trim()) { |
| | | return this.$u.toast('æ°å¯ç ä¸ç¡®è®¤å¯ç ä¸ä¸è´ï¼') |
| | | } |
| | | |
| | | const data = { |
| | | // usercode: uni.getStorageSync("usercode"), |
| | | // username: uni.getStorageSync("username"), |
| | | password: this.oldPassword.trim(), |
| | | newpassword: this.newPassword.trim() |
| | | } |
| | | |
| | | this.isDisabledSubmitButtonEdit = true |
| | | const res = await UpdateUserPassword(this.global.formatData(data)) |
| | | |
| | | if (res.code === '200') { |
| | | this.isDisabledSubmitButtonEdit = false |
| | | this.$u.toast('å¯ç ä¿®æ¹æåï¼') |
| | | uni.setStorageSync("Token", '') |
| | | uni.setStorageSync("usercode", '') |
| | | uni.setStorageSync("username", '') |
| | | uni.setStorageSync("storg_code", '') |
| | | uni.setStorageSync("storg_name", '') |
| | | |
| | | setTimeout(() => { |
| | | uni.redirectTo({ |
| | | url: '../login/index' |
| | | }); |
| | | }, 2000) |
| | | |
| | | } else { |
| | | this.isDisabledSubmitButtonEdit = false |
| | | this.$u.toast('å¯ç ä¿®æ¹å¤±è´¥ï¼') |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | @import url('@/style/global.css'); |
| | | |
| | | ::v-deep .uicon-arrow-left>span { |
| | | display: block; |
| | | } |
| | | </style> |