|
@@ -7,7 +7,7 @@ Page({
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
- frameStyle: { useTop: true, name: '修改密码', leftArrow: false, useBar: false },
|
|
|
+ frameStyle: { useTop: true, name: '修改密码', leftArrow: true, useBar: false },
|
|
|
// 主体高度
|
|
|
infoHeight: '',
|
|
|
form: {},
|
|
@@ -20,17 +20,23 @@ Page({
|
|
|
this.WxValidate = new WxValidate(rules, messages)
|
|
|
},
|
|
|
back: function () {
|
|
|
- wx.navigateBack({ url: '/pages/home/index' })
|
|
|
+ wx.navigateBack({ url: '/pages/me/index' })
|
|
|
},
|
|
|
//提交
|
|
|
- formSubmit: function (e) {
|
|
|
+ onSubmit: async function (e) {
|
|
|
+ const that = this;
|
|
|
+ let data = that.data.form;
|
|
|
const parmas = e.detail.value;
|
|
|
if (!this.WxValidate.checkForm(parmas)) {
|
|
|
const error = this.WxValidate.errorList[0];
|
|
|
wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
|
|
|
return false
|
|
|
} else {
|
|
|
- console.log(parmas);
|
|
|
+ const arr = await app.$post(`/courtAdmin/api/user/updatePwd/${data.id}`, parmas);
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ wx.showToast({ title: `密码修改成功`, icon: 'error', duration: 2000 });
|
|
|
+ wx.removeStorage({ key: 'token', success(res) { return wx.redirectTo({ url: '/pages/index/index', }) } })
|
|
|
+ } else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
@@ -51,7 +57,7 @@ Page({
|
|
|
key: 'token',
|
|
|
success: async res => {
|
|
|
const arr = await app.$get(`/courtAdmin/api/user/${res.data.id}`);
|
|
|
- console.log(arr);
|
|
|
+ if (arr.errcode == '0') this.setData({ form: arr.data })
|
|
|
},
|
|
|
fail: res => {
|
|
|
wx.redirectTo({ url: '/pages/login/index', })
|