123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- <template>
- <view class="container">
- <view class="mim-view">
- <!-- <view>
- <view class="mim-font-16 bold mim-flex-wrap-left" style="margin-bottom: 24rpx;">
- <text class="mim-font-16 bold">原密码</text>
- <text class="mim-font-16 bold mimRed">*</text>
- </view>
- <u-input type="password" v-model="form.password" placeholder='请输入原密码'
- placeholder-style="color: #BDBDBD;" height="96" cursor-spacing="12" :clearable='false'
- :custom-style="customStyle" />
- </view> -->
- <view class="marginTop">
- <view class="mim-font-16 bold mim-flex-wrap-left" style="margin-bottom: 24rpx;">
- <text class="mim-font-16 bold">新密码</text>
- <text class="mim-font-16 bold mimRed">*</text>
- </view>
- <u-input type="password" v-model="form.password" placeholder='请输入新密码'
- placeholder-style="color: #BDBDBD;" height="96" cursor-spacing="12" :clearable='false'
- :custom-style="customStyle" />
- </view>
- <view class="marginTop">
- <view class="mim-font-16 bold mim-flex-wrap-left" style="margin-bottom: 24rpx;">
- <text class="mim-font-16 bold">再次输入新密码</text>
- <text class="mim-font-16 bold mimRed">*</text>
- </view>
- <u-input type="password" v-model="form.password_confirmation" placeholder='请再次输入新密码'
- placeholder-style="color: #BDBDBD;" height="96" cursor-spacing="12" :clearable='false'
- :custom-style="customStyle" />
- </view>
- </view>
- <view class="mim-foot">
- <view class="mim-foot-button mim-button mim-flex-wrap" :class="{ disabled: isButtonDisabled }"
- @click="amend">
- 修改密码
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- customStyle: {
- fontSize: '32rpx',
- paddingLeft: '24rpx',
- background: '#f7f7f7',
- borderRadius: '8rpx'
- },
- form: {
- password: '',
- password_confirmation: '',
- },
- isButtonDisabled: false, // 按钮是否禁用
- };
- },
- methods: {
- amend() {
- if (this.isButtonDisabled) {
- return false; // 如果按钮已禁用,直接返回
- }
- if (!this.form.password || !this.form.password_confirmation) {
- this.$u.toast('请将密码信息输入完整!')
- return false
- }
- if (this.form.password != this.form.password_confirmation) {
- this.$u.toast('二次输入的密码信息不一致!')
- return false
- }
- this.isButtonDisabled = true; // 禁用按钮
- this.amendPasswordFn()
- },
- async amendPasswordFn() {
- setTimeout(() => {
- this.isButtonDisabled = false; // 启用按钮
- }, 1000)
- const res = await this.$u.api.amendPassword(this.form)
- console.log(res)
- this.$u.toast(res.message)
- setTimeout(() => {
- uni.removeStorageSync('token')
- uni.removeStorageSync('password')
- this.$u.route({
- type: 'reLaunch',
- url: '/pages/login/login'
- })
- }, 1000)
- },
- }
- }
- </script>
- <style lang="scss">
- page {
- background-color: #f7f7f7;
- .container {
- .mim-view {
- .marginTop {
- margin-top: 24rpx;
- }
- }
- .mim-foot {
- width: 100%;
- height: 136rpx;
- position: fixed;
- bottom: 0;
- left: 0;
- background-color: #ffffff;
- padding: 20rpx 24rpx;
- box-sizing: border-box;
- z-index: 9;
- &-button {
- border-radius: 48rpx;
- opacity: 1;
- background: #DE2E27;
- font-size: 32rpx;
- font-weight: normal;
- line-height: 32rpx;
- letter-spacing: 0px;
- color: #FFFFFF;
- height: 96rpx;
- cursor: pointer;
- }
- }
- }
- }
- </style>
|