|
@@ -42,70 +42,48 @@ Page({
|
|
|
}
|
|
|
],
|
|
|
},
|
|
|
- chooseGrade: function(e) {
|
|
|
+ chooseGrade: function (e) {
|
|
|
console.log('选择年级')
|
|
|
},
|
|
|
- saveNickName: function(e) {
|
|
|
+ saveNickName: function (e) {
|
|
|
let nickname = e.detail.value;
|
|
|
this.setData({
|
|
|
nicename: nickname
|
|
|
});
|
|
|
},
|
|
|
- saveAddress: function(e) {
|
|
|
+ saveAddress: function (e) {
|
|
|
let msg = e.detail.value;
|
|
|
this.setData({
|
|
|
msg: msg
|
|
|
});
|
|
|
},
|
|
|
- bindDateChange: function(e) {
|
|
|
+ bindDateChange: function (e) {
|
|
|
console.log(e.detail.value)
|
|
|
this.setData({
|
|
|
date: e.detail.value
|
|
|
});
|
|
|
},
|
|
|
- optionAction: function(e) {
|
|
|
- console.log(e.detail.value);
|
|
|
- },
|
|
|
- optionSetting: function(e) {
|
|
|
- console.log(e.detail.value);
|
|
|
- },
|
|
|
- onChooseAvatar(e) {
|
|
|
+ changeAvatar: function (e) {
|
|
|
const {
|
|
|
avatarUrl
|
|
|
} = e.detail
|
|
|
- this.setData({
|
|
|
- ['user.avatar']: avatarUrl,
|
|
|
- })
|
|
|
- },
|
|
|
- changeAvatar: function(e) {
|
|
|
- const _this = this;
|
|
|
- wx.chooseImage({
|
|
|
- count: 1,
|
|
|
- sizeType: ['compressed'],
|
|
|
- sourceType: ['album', 'camera'],
|
|
|
- success(res) {
|
|
|
- // tempFilePath可以作为img标签的src属性显示图片
|
|
|
- const localImage = res.tempFilePaths[0];
|
|
|
- wx.uploadFile({
|
|
|
- url: 'https://reader-api.ai160.com/file/upload',
|
|
|
- filePath: localImage,
|
|
|
- name: '头像',
|
|
|
- header: {
|
|
|
- uid: wx.getStorageSync('uid')
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- // console.log(JSON.parse(res.data));
|
|
|
- const newAvatar = JSON.parse(res.data).data;
|
|
|
- const str = 'user.avatar'
|
|
|
- _this.setData({
|
|
|
- [str]: newAvatar
|
|
|
- })
|
|
|
- }
|
|
|
+ wx.uploadFile({
|
|
|
+ url: 'https://reader-api.ai160.com/file/upload',
|
|
|
+ filePath: avatarUrl,
|
|
|
+ name: '头像',
|
|
|
+ header: {
|
|
|
+ uid: wx.getStorageSync('uid')
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ const newAvatar = JSON.parse(res.data).data;
|
|
|
+ const str = 'user.avatar'
|
|
|
+ this.setData({
|
|
|
+ [str]: newAvatar
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- formSubmit: function(e) {
|
|
|
+ formSubmit: function (e) {
|
|
|
if (e.detail.value.nickname === '') {
|
|
|
wx.showToast({
|
|
|
title: '请填写昵称',
|
|
@@ -134,7 +112,7 @@ Page({
|
|
|
})
|
|
|
});
|
|
|
},
|
|
|
- bindGradeChange: function(e) {
|
|
|
+ bindGradeChange: function (e) {
|
|
|
console.log('年级选择', e)
|
|
|
this.setData({
|
|
|
gradeIndex: e.detail.value,
|
|
@@ -146,10 +124,10 @@ Page({
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
- getUserInfo: function() {
|
|
|
+ getUserInfo: function () {
|
|
|
|
|
|
},
|
|
|
- onLoad: function(option) {
|
|
|
+ onLoad: function (option) {
|
|
|
httpRequestApi.getUserInfo().success(res => {
|
|
|
const user = res.data.data;
|
|
|
let gradeIndex = 0;
|
|
@@ -212,42 +190,42 @@ Page({
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
|
- onReady: function() {
|
|
|
+ onReady: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
- onShow: function() {
|
|
|
+ onShow: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
- onHide: function() {
|
|
|
+ onHide: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
- onUnload: function() {
|
|
|
+ onUnload: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
*/
|
|
|
- onPullDownRefresh: function() {
|
|
|
+ onPullDownRefresh: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
- onReachBottom: function() {
|
|
|
+ onReachBottom: function () {
|
|
|
|
|
|
},
|
|
|
|