|
@@ -11,16 +11,12 @@ Page({
|
|
frameStyle: { useTop: true, name: '个人信息', leftArrow: true, useBar: false },
|
|
frameStyle: { useTop: true, name: '个人信息', leftArrow: true, useBar: false },
|
|
form: {},
|
|
form: {},
|
|
fileList: [],
|
|
fileList: [],
|
|
- gender: ['男', '女'],
|
|
|
|
- // objectGender: [{id: 0,name: '男'},{id: 1,name: '女'},],
|
|
|
|
- // index: 0,
|
|
|
|
|
|
+ gender: [{ id: '0', name: '男' }, { id: 1, name: '女' },],
|
|
|
|
+ index: 0,
|
|
|
|
+ },
|
|
|
|
+ back: function () {
|
|
|
|
+ wx.navigateBack({ url: '/pages/me/index' })
|
|
},
|
|
},
|
|
- bindPickerChange: function (e) {
|
|
|
|
- console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
|
|
- this.setData({
|
|
|
|
- index: e.detail.value
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
//上传图片
|
|
//上传图片
|
|
imgUpload: function (e) {
|
|
imgUpload: function (e) {
|
|
const that = this;
|
|
const that = this;
|
|
@@ -35,8 +31,12 @@ Page({
|
|
let arr = data.filter((i, index) => index != e.detail.index)
|
|
let arr = data.filter((i, index) => index != e.detail.index)
|
|
that.setData({ fileList: arr })
|
|
that.setData({ fileList: arr })
|
|
},
|
|
},
|
|
- back: function () {
|
|
|
|
- wx.navigateBack({ url: '/pages/me/index' })
|
|
|
|
|
|
+ // 选择用户性别
|
|
|
|
+ bindPickerChange: function (e) {
|
|
|
|
+ const that = this;
|
|
|
|
+ let index = e.detail.value;
|
|
|
|
+ let data = that.data.gender[index];
|
|
|
|
+ if (data) that.setData({ 'form.gender': data.name });
|
|
},
|
|
},
|
|
//提交
|
|
//提交
|
|
formSubmit: function (e) {
|
|
formSubmit: function (e) {
|
|
@@ -47,40 +47,44 @@ Page({
|
|
return false
|
|
return false
|
|
} else {
|
|
} else {
|
|
value.icon = this.data.fileList;
|
|
value.icon = this.data.fileList;
|
|
- console.log(value);
|
|
|
|
- // wx.request({
|
|
|
|
- // url: `${app.globalData.publicUrl}/courtAdmin/api/user/${res.data.id}`, //接口地址
|
|
|
|
- // method: "post",
|
|
|
|
- // data: value,
|
|
|
|
- // header: {},
|
|
|
|
- // success: res => {
|
|
|
|
- // if (res.data.errcode == 0) {
|
|
|
|
- // wx.showToast({
|
|
|
|
- // title: '保存成功',
|
|
|
|
- // icon: 'success',
|
|
|
|
- // duration: 2000//延迟两秒
|
|
|
|
- // })
|
|
|
|
- // } else {
|
|
|
|
- // wx.showToast({
|
|
|
|
- // title: '保存失败',
|
|
|
|
- // icon: 'success',
|
|
|
|
- // duration: 2000
|
|
|
|
- // })
|
|
|
|
- // }
|
|
|
|
- // },
|
|
|
|
- // })
|
|
|
|
|
|
+ value.id = this.data.form.id;
|
|
|
|
+ value.status = this.data.form.status;
|
|
|
|
+ value.type = this.data.form.type;
|
|
|
|
+ value.gender = this.data.form.gender;
|
|
|
|
+ wx.request({
|
|
|
|
+ url: `${app.globalData.publicUrl}/courtAdmin/api/user/${value.id}`, //接口地址
|
|
|
|
+ method: "post",
|
|
|
|
+ data: value,
|
|
|
|
+ header: {},
|
|
|
|
+ success: res => {
|
|
|
|
+ if (res.data.errcode == 0) {
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: '保存成功',
|
|
|
|
+ icon: 'success',
|
|
|
|
+ duration: 2000//延迟两秒
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: '保存失败',
|
|
|
|
+ icon: 'success',
|
|
|
|
+ duration: 2000
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ })
|
|
}
|
|
}
|
|
},
|
|
},
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
*/
|
|
onLoad: function (options) {
|
|
onLoad: function (options) {
|
|
|
|
+ //验证规则函数
|
|
|
|
+ this.initValidate();
|
|
// 计算高度
|
|
// 计算高度
|
|
this.searchHeight();
|
|
this.searchHeight();
|
|
// 监听用户是否登录
|
|
// 监听用户是否登录
|
|
this.watchLogin();
|
|
this.watchLogin();
|
|
- //验证规则函数
|
|
|
|
- this.initValidate();
|
|
|
|
|
|
+
|
|
},
|
|
},
|
|
//验证必填项
|
|
//验证必填项
|
|
initValidate() {
|
|
initValidate() {
|
|
@@ -89,6 +93,17 @@ Page({
|
|
const messages = { phone: { required: '请输入手机号' }, };
|
|
const messages = { phone: { required: '请输入手机号' }, };
|
|
this.WxValidate = new WxValidate(rules, messages)
|
|
this.WxValidate = new WxValidate(rules, messages)
|
|
},
|
|
},
|
|
|
|
+ // 计算高度
|
|
|
|
+ searchHeight: function () {
|
|
|
|
+ let frameStyle = this.data.frameStyle;
|
|
|
|
+ let client = app.globalData.client;
|
|
|
|
+ let infoHeight = client.windowHeight;
|
|
|
|
+ // 是否去掉状态栏
|
|
|
|
+ if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
|
|
|
|
+ // 是否减去底部菜单
|
|
|
|
+ if (frameStyle.useBar) infoHeight = infoHeight - 50;
|
|
|
|
+ if (infoHeight) this.setData({ infoHeight: infoHeight })
|
|
|
|
+ },
|
|
// 监听用户是否登录
|
|
// 监听用户是否登录
|
|
watchLogin: function () {
|
|
watchLogin: function () {
|
|
const that = this;
|
|
const that = this;
|
|
@@ -115,16 +130,7 @@ Page({
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- // 计算高度
|
|
|
|
- searchHeight: function () {
|
|
|
|
- let frameStyle = this.data.frameStyle;
|
|
|
|
- let client = app.globalData.client;
|
|
|
|
- // 减去状态栏
|
|
|
|
- let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
|
|
|
|
- // 是否减去底部菜单
|
|
|
|
- if (frameStyle.useBar) infoHeight = infoHeight - 50;
|
|
|
|
- if (infoHeight) this.setData({ infoHeight: infoHeight })
|
|
|
|
- },
|
|
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
* 生命周期函数--监听页面初次渲染完成
|