|
|
|
@ -53,7 +53,45 @@ Page({
|
|
|
|
|
this.throttledMsgSecCheck(this.data);
|
|
|
|
|
},
|
|
|
|
|
onGetUserInfo(e){
|
|
|
|
|
// 填入微信个人信息
|
|
|
|
|
console.log(e);
|
|
|
|
|
let {detail:{userInfo}} = e;
|
|
|
|
|
if(!userInfo)
|
|
|
|
|
return wx.showToast({
|
|
|
|
|
title: '获取信息失败',icon:"none"
|
|
|
|
|
})
|
|
|
|
|
let {nickName:nickname, gender, province:location, city:location_city, avatarUrl} = userInfo;
|
|
|
|
|
if(gender)
|
|
|
|
|
gender = 1 - gender;
|
|
|
|
|
let location_index = this.data.locations.indexOf(location);
|
|
|
|
|
let cities = locationData[location] || locationData['北京'];
|
|
|
|
|
let city_index = cities.indexOf(location_city);
|
|
|
|
|
this.setData({nickname, gender, cities, location, location_city, city_index, location_index});
|
|
|
|
|
avatarUrl = "" //@todo
|
|
|
|
|
if(avatarUrl){
|
|
|
|
|
wx.showModal({
|
|
|
|
|
title:"提示",
|
|
|
|
|
content:"是否使用微信头像",
|
|
|
|
|
confirmText:"使用",
|
|
|
|
|
success: res=>{
|
|
|
|
|
if(res.confirm)
|
|
|
|
|
this.updateWechatAvatar({avatarUrl});
|
|
|
|
|
},
|
|
|
|
|
complete: ()=>{
|
|
|
|
|
wx.showToast({
|
|
|
|
|
title: '填入成功'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
wx.showToast({
|
|
|
|
|
title: '填入成功'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
updateWechatAvatar({avatarUrl}){
|
|
|
|
|
// @todo
|
|
|
|
|
},
|
|
|
|
|
setInfo(res){
|
|
|
|
|
let locations = Object.keys(locationData);
|
|
|
|
@ -146,6 +184,10 @@ Page({
|
|
|
|
|
this.pullDepartments({school_id,department_id});
|
|
|
|
|
},
|
|
|
|
|
catchAvatar(){
|
|
|
|
|
/*wx.showActionSheet({
|
|
|
|
|
itemList: ["更改头像", "使用微信头像"],
|
|
|
|
|
|
|
|
|
|
})*/
|
|
|
|
|
app.navigateTo({url:"{image_crop}"});
|
|
|
|
|
},
|
|
|
|
|
addDepartment(){
|
|
|
|
@ -273,7 +315,7 @@ Page({
|
|
|
|
|
let { target: { id } } = e;
|
|
|
|
|
if (id) {
|
|
|
|
|
if ((id == 'name' || id == "gender") && this.data.authen)
|
|
|
|
|
this.showError({ message: `请重新实名认证以更改${id == "name" ? "姓名" : id == 'gender' ? "性别" : '此信息'}`, during: 1400 });
|
|
|
|
|
this.showError({ message: `请到官网重新实名认证以更改${id == "name" ? "姓名" : id == 'gender' ? "性别" : '此信息'}`, during: 1400 });
|
|
|
|
|
this.setData({edited:1});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|