| | |
| | | <view class="change-password-page"> |
| | | <view class="change-password-page__form"> |
| | | <view class="change-password-page__item"> |
| | | <text class="change-password-page__label">新密码</text> |
| | | <text class="change-password-page__label"><text style="color: red;">*</text>原始密码</text> |
| | | <input v-model="form.oldPassword" class="change-password-page__input" password placeholder="请输入原始密码" placeholder-style="color: #c2c7d0;" /> |
| | | </view> |
| | | <view class="change-password-page__item"> |
| | | <text class="change-password-page__label"><text style="color: red;">*</text>新密码</text> |
| | | <input v-model="form.password" class="change-password-page__input" password placeholder="请输入新密码" placeholder-style="color: #c2c7d0;" /> |
| | | </view> |
| | | |
| | | <view class="change-password-page__item"> |
| | | <text class="change-password-page__label">确认密码</text> |
| | | <text class="change-password-page__label"><text style="color: red;">*</text>确认密码</text> |
| | | <input v-model="form.confirmPassword" class="change-password-page__input" password placeholder="请再次输入新密码" placeholder-style="color: #c2c7d0;" /> |
| | | </view> |
| | | |
| | |
| | | <button class="change-password-page__submit" hover-class="change-password-page__submit--hover" @click="handleSubmit">确认修改</button> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | form: { |
| | | oldPassword:'', |
| | | password: '', |
| | | confirmPassword: '' |
| | | } |
| | |
| | | }, |
| | | methods: { |
| | | handleSubmit() { |
| | | if (!this.form.oldPassword) { |
| | | uni.showToast({ title: '请输入原始密码', icon: 'none' }) |
| | | return |
| | | } |
| | | if (!this.form.password) { |
| | | uni.showToast({ title: '请输入新密码', icon: 'none' }) |
| | | return |
| | |
| | | return |
| | | } |
| | | uni.showLoading({ title: '修改中...' }) |
| | | this.$u.api.changePassword({ newPassword: this.form.password }).then(res => { |
| | | this.$u.api.changePassword({ newPassword: this.form.password,oldPassword:this.form.oldPassword }).then(res => { |
| | | uni.hideLoading() |
| | | if (res.code === 200) { |
| | | uni.showToast({ title: '修改成功', icon: 'success' }) |
| | | setTimeout(() => { |
| | | this.$store.commit('clearAll') |
| | | uni.reLaunch({ |
| | | url: '/pages/login/login' |
| | | }) |
| | | }, 1500) |
| | | uni.showToast({ title: '修改成功,下次登录请使用新密码登录', icon: 'success' }) |
| | | } |
| | | }).catch(err => { |
| | | uni.hideLoading() |