import { imine, ihome } from '../../../../api/api.js' Page({ data: { user: {}, modalKeys: { realname: '姓名', mobile: '联系方式', birthday: '出生年月', gender: '性别', brief_intro: '自我介绍' }, placeholder: { realname: '请填写姓名', mobile: '请填写手机号', birthday: '请填写出生年月', brief_intro: '请填写自我介绍' } }, changeBirthday(e) { this.data.user['birthday'] = e.detail.value imine.loadEditMyinformation(this.data.user, r => { this.loadMyinformation() }) }, clickConfirm() { this.data.user[this.data.modalKey] = this.data.inputInfo imine.loadEditMyinformation(this.data.user, r => { this.setData({ inputInfo: '', modalKey: '' }) this.loadMyinformation() }) }, clickRadio(e) { this.setData({ inputInfo: e.currentTarget.dataset.v }) }, inputInfo(e) { console.log(e) this.setData({ inputInfo: e.detail.value }) }, hideModal() { this.setData({ modalKey: '' }) }, clickInfo(e) { let k = e.currentTarget.dataset.key this.setData({ modalKey: k, inputText: this.data.user[k], inputInfo: this.data.user[k] }) }, loadMyinformation() { imine.loadMyinformation({reqdata:{id:1}},r => { this.setData({ user: Object.assign(this.data.user, r.userinfo) }) wx.setStorage({ key: 'user', data: this.data.user }) }) }, onLoad(args) { wx.getStorage({ key: 'user', success: r => { this.setData({ user: Object.assign(this.data.user, r.data) }) }, }) this.loadMyinformation() this.setData({ endDate: new Date().format('yyyy-MM-dd'), }) }, })