|
@@ -9,13 +9,21 @@ Page({
|
|
|
// 主体高度
|
|
|
infoHeight: '',
|
|
|
frameStyle: { useTop: true, name: '个人信息', leftArrow: true, useBar: false },
|
|
|
- form: {
|
|
|
- },
|
|
|
- // index: 0,
|
|
|
- // 上传图片
|
|
|
+ form: {},
|
|
|
fileList: [],
|
|
|
+ genderList: [{ id: '0', name: '男' }, { id: 1, name: '女' },],
|
|
|
+ index: 0,
|
|
|
+ },
|
|
|
+ //验证必填项
|
|
|
+ initValidate() {
|
|
|
+ const rules = { phone: { required: true, tel: true }, }
|
|
|
+ // 验证字段的提示信息,若不传则调用默认的信息
|
|
|
+ const messages = { phone: { required: '请输入手机号' }, };
|
|
|
+ this.WxValidate = new WxValidate(rules, messages)
|
|
|
+ },
|
|
|
+ back: function () {
|
|
|
+ wx.navigateBack({ url: '/pages/me/index' })
|
|
|
},
|
|
|
-
|
|
|
//上传图片
|
|
|
imgUpload: function (e) {
|
|
|
const that = this;
|
|
@@ -30,8 +38,12 @@ Page({
|
|
|
let arr = data.filter((i, index) => index != e.detail.index)
|
|
|
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.genderList[index];
|
|
|
+ if (data) that.setData({ 'form.gender': data.name });
|
|
|
},
|
|
|
//提交
|
|
|
formSubmit: function (e) {
|
|
@@ -42,8 +54,9 @@ Page({
|
|
|
return false
|
|
|
} else {
|
|
|
value.icon = this.data.fileList;
|
|
|
+ value.id = this.data.form.id;
|
|
|
wx.request({
|
|
|
- url: `${app.globalData.publicUrl}/courtAdmin/api/user/${res.data.id}`, //接口地址
|
|
|
+ url: `${app.globalData.publicUrl}/courtAdmin/api/user/${value.id}`, //接口地址
|
|
|
method: "post",
|
|
|
data: value,
|
|
|
header: {},
|
|
@@ -65,24 +78,27 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
+ //验证规则函数
|
|
|
+ this.initValidate();
|
|
|
// 计算高度
|
|
|
this.searchHeight();
|
|
|
// 监听用户是否登录
|
|
|
this.watchLogin();
|
|
|
- //验证规则函数
|
|
|
- this.initValidate();
|
|
|
},
|
|
|
- //验证必填项
|
|
|
- initValidate() {
|
|
|
- const rules = { phone: { required: true, tel: true }, }
|
|
|
- // 验证字段的提示信息,若不传则调用默认的信息
|
|
|
- const messages = { phone: { required: '请输入手机号' }, };
|
|
|
- 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 () {
|
|
@@ -93,13 +109,13 @@ Page({
|
|
|
//数据请求
|
|
|
wx.request({
|
|
|
url: `${app.globalData.publicUrl}/courtAdmin/api/user/${res.data.id}`, //接口地址
|
|
|
- method: "get",//请求方法
|
|
|
- data: {},//请求参数
|
|
|
+ method: "get",
|
|
|
+ data: {},
|
|
|
header: {},
|
|
|
success: res => {
|
|
|
that.setData({ form: res.data.data })
|
|
|
let icon = res.data.data.icon;
|
|
|
- this.setData({ fileList: icon })
|
|
|
+ that.setData({ fileList: icon })
|
|
|
},
|
|
|
error: err => {
|
|
|
}
|
|
@@ -110,18 +126,6 @@ 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 })
|
|
|
- },
|
|
|
-
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|