补齐店务端改密导出员工订单

This commit is contained in:
2026-07-16 12:00:06 +08:00
parent 08d24853a6
commit a9a23bfa6d
28 changed files with 768 additions and 33 deletions
+39 -3
View File
@@ -1,12 +1,48 @@
const userApi = require('../../api/user')
function clearSessionAndGoLogin() {
const app = getApp()
if (app && typeof app.clearSession === 'function') {
app.clearSession()
}
wx.reLaunch({ url: '/pages/login/index' })
}
Page({
data: { form: { oldPassword: '', newPassword: '', confirmPassword: '' } },
data: {
form: { oldPassword: '', newPassword: '', confirmPassword: '' },
saving: false
},
onInput(event) { this.setData({ [`form.${event.currentTarget.dataset.field}`]: event.detail.value }) },
save() {
async save() {
if (this.data.saving) {
return
}
if (!this.data.form.oldPassword) {
wx.showToast({ title: '请填写原密码', icon: 'none' })
return
}
if (!this.data.form.newPassword || !this.data.form.confirmPassword) {
wx.showToast({ title: '请填写新密码', icon: 'none' })
return
}
if (this.data.form.newPassword !== this.data.form.confirmPassword) {
wx.showToast({ title: '两次密码不一致', icon: 'none' })
return
}
wx.showToast({ title: '已提交' })
this.setData({ saving: true })
try {
await userApi.updatePassword({
oldPassword: this.data.form.oldPassword,
password: this.data.form.newPassword
})
wx.showToast({ title: '密码已修改', icon: 'success' })
setTimeout(clearSessionAndGoLogin, 600)
} catch (error) {
wx.showToast({ title: error.message || '密码修改失败', icon: 'none' })
} finally {
this.setData({ saving: false })
}
},
back() { wx.navigateBack() }
})
+1 -1
View File
@@ -4,5 +4,5 @@
<view class="field"><text class="field-label">新密码</text><input password value="{{form.newPassword}}" data-field="newPassword" bindinput="onInput" /></view>
<view class="field"><text class="field-label">确认密码</text><input password value="{{form.confirmPassword}}" data-field="confirmPassword" bindinput="onInput" /></view>
</view>
<view class="fixed-bottom"><button class="primary-btn" bindtap="save">保存密码</button></view>
<view class="fixed-bottom"><button class="primary-btn" loading="{{saving}}" disabled="{{saving}}" bindtap="save">保存密码</button></view>
</view>