|
@@ -10,65 +10,11 @@ Page({
|
|
|
// 主体高度
|
|
|
infoHeight: '',
|
|
|
frameStyle: { useTop: true, name: '个人信息', leftArrow: true, useBar: false },
|
|
|
- form: {
|
|
|
- ranks: '比赛第一名队',
|
|
|
- mechanism: '吉佳通达',
|
|
|
- sex: ['男', '女'],
|
|
|
- objectSex: [{ id: 0, name: '男' }, { id: 1, name: '女' },],
|
|
|
- post: '后勤部长',
|
|
|
- phone: '12311111111',
|
|
|
- email: '123@qq.com',
|
|
|
- },
|
|
|
- index: 0,
|
|
|
+ form: {},
|
|
|
+ // index: 0,
|
|
|
// 上传图片
|
|
|
fileList: [],
|
|
|
},
|
|
|
- //上传头像,更改头像
|
|
|
- // changeSrc: function (event) {
|
|
|
- // var that = this;
|
|
|
- // wx.chooseImage({
|
|
|
- // count: 1,//最多可以选择的图片数量,默认9
|
|
|
- // sizeType: ['compressed', 'original'],
|
|
|
- // sourceType: ['album', 'camera'],
|
|
|
- // success: function (res) {
|
|
|
- // console.log(res.tempFilePaths + "修改页面")
|
|
|
- // var src = res.tempFilePaths;
|
|
|
- // that.setData({
|
|
|
- // src: src,
|
|
|
- // upSrc: true,
|
|
|
-
|
|
|
- // })
|
|
|
- // const { file } = event.detail;
|
|
|
- // console.log(file);
|
|
|
- // wx.uploadFile({
|
|
|
- // url: `${app.globalData.imageUrl}/files/court/elimg/upload`,
|
|
|
- // filePath: file.url,
|
|
|
- // name: 'file',
|
|
|
- // formData: {},
|
|
|
- // success: (res) => {
|
|
|
- // console.log(res);
|
|
|
- // if (res.statusCode == '200') {
|
|
|
- // let data = [{ name: JSON.parse(res.data).name, url: `${app.globalData.imageUrl}` + JSON.parse(res.data).uri }]
|
|
|
- // const { fileList = [] } = that.data;
|
|
|
- // fileList.push({ ...file, url: res.data });
|
|
|
- // that.setData({ fileList });
|
|
|
- // } else {
|
|
|
- // wx.showToast({ title: `${res.data.errmsg}`, icon: 'fail', duration: 2000 })
|
|
|
- // }
|
|
|
- // },
|
|
|
- // });
|
|
|
-
|
|
|
-
|
|
|
- // }
|
|
|
- // })
|
|
|
-
|
|
|
- // },
|
|
|
- // 上传图片
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- //上传图片
|
|
|
-
|
|
|
|
|
|
afterRead: function (event) {
|
|
|
const { file } = event.detail;
|
|
@@ -92,26 +38,69 @@ Page({
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
- //选择
|
|
|
- bindPickerChange: function (e) {
|
|
|
- console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
|
- this.setData({
|
|
|
- index: e.detail.value
|
|
|
- })
|
|
|
- },
|
|
|
+ // //选择
|
|
|
+ // bindPickerChange: function (e) {
|
|
|
+ // console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
|
+ // this.setData({
|
|
|
+ // index: e.detail.value
|
|
|
+ // })
|
|
|
+ // },
|
|
|
back: function () {
|
|
|
wx.navigateBack({ url: '/pages/me/index' })
|
|
|
},
|
|
|
- //提交
|
|
|
- formSubmit: function (e) {
|
|
|
- console.log('form发生了submit事件,携带数据为:', e.detail.value)
|
|
|
- },
|
|
|
+
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
- onLoad: function (options) {
|
|
|
+ onLoad: function (e) {
|
|
|
// 计算高度
|
|
|
this.searchHeight()
|
|
|
+ const that = this;
|
|
|
+ // 获取用户信息
|
|
|
+ wx.getStorage({
|
|
|
+ key: 'token',
|
|
|
+ success: function (res) {
|
|
|
+ wx.request({
|
|
|
+ url: `${app.globalData.publicUrl}/courtAdmin/api/user`, //接口地址
|
|
|
+ method: "post",
|
|
|
+ data: { "id": "", "phone": "", "type": "", "status": "" },
|
|
|
+ header: {},
|
|
|
+ success: res => {
|
|
|
+ that.setData({ form: res.data.data });
|
|
|
+ console.log(res.data.data);
|
|
|
+ console.log(res.data.data.id);
|
|
|
+ },
|
|
|
+ error: err => {
|
|
|
+ console.log(err);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //提交
|
|
|
+ formSubmit: function (e) {
|
|
|
+ let value = e.detail.value;
|
|
|
+ console.log(value);
|
|
|
+ wx.getStorage({
|
|
|
+ key: 'token',
|
|
|
+ success: function (res) {
|
|
|
+ console.log(res);
|
|
|
+ wx.request({
|
|
|
+ url: `${app.globalData.publicUrl}/courtAdmin/api/user`, //接口地址
|
|
|
+ method: "post",
|
|
|
+ data: value,
|
|
|
+ header: {},
|
|
|
+ success: res => {
|
|
|
+ wx.showToast({
|
|
|
+ title: '保存成功',
|
|
|
+ icon: 'success',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ console.log(res);
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
// 计算高度
|
|
|
searchHeight: function () {
|