个人中心新增

This commit is contained in:
zdx
2020-12-30 15:16:04 +08:00
parent 29f807609f
commit b4cfbad98f
50 changed files with 2012 additions and 48 deletions

View File

@@ -0,0 +1,89 @@
Page({
/**
* 页面的初始数据
*/
data: {
userId: "", //用户id
phone: "", //用户信息
nickname: "", //用户昵称
cover: "", //用户头像
columns: ["未知", "男", "女"],
gender: 0 || wx.getStorageSync("gender") * 1,
date: '2016-09-01',
region: ['广东省', '广州市', '海珠区'],
},
// 选择性别
pickSex: function (e) {
this.setData({
gender: e.detail.value
});
// console.log("当前选择性别-sex", e.detail.value);
},
// 选择出生年月日
bindTimeChange: function (e) {
console.log('picker发送选择改变携带值为', e.detail.value)
this.setData({
time: e.detail.value
})
},
// 选择所在区域
bindRegionChange: function (e) {
console.log('picker发送选择改变携带值为', e.detail.value)
this.setData({
region: e.detail.value
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {
wx.$api.user.userInfoEdit().then(res => {
this.setData({
phone: res.username,
nickname: res.nickname,
cover: res.avatar
})
})
},
// 跳转到修改页面
goUrl() {
wx.navigateTo({
url: "../editUserInfo/editUserInfo?nickname=" + this.data.nickname
})
},
// 更新头像
upload() {
wx.chooseImage({
count: 1, // 默认9
success: res => {
const src = res.tempFilePaths[0]
wx.navigateTo({
url: '../tailoring/tailoring?src=' + src
})
}
})
},
logOut() {
wx.showModal({
title: "退出提示",
content: "是否现在就退出",
showCancel: true,
confirmColor: "#0b0041",
confirmText: "确定",
success: (res) => {
if (res.confirm) {
wx.clearStorage({
success: () => {
wx.navigateBack()
}
})
}
}
})
}
})