diff --git a/pages/user/index/index.js b/pages/user/index/index.js
index 9f283d7..08d61bf 100644
--- a/pages/user/index/index.js
+++ b/pages/user/index/index.js
@@ -41,7 +41,9 @@ Page({
actImg: "",
is_assistance: 0, //助力活动
ad_img:"",
- add_card_data:'', //等级卡的内容
+ add_card_data:'', //等级卡的内容
+
+
},
goto_nav: function(e) {
var th = this;
@@ -72,6 +74,9 @@ Page({
})
app.getUserFir();
+
+
+
//-- 读取会员中心按钮列表 --
/*--
getApp().request.get("/api/weshop/userTool/page?pageSize=100&store_id="+os.stoid, {
@@ -460,6 +465,8 @@ Page({
},
+
+
//判断会员是后有改服务项目
check_is_has_qy: function(item, g_qy_list) {
if (!g_qy_list) return false;
diff --git a/pages/user/userinfo/userinfo.js b/pages/user/userinfo/userinfo.js
index 7392c72..4628203 100644
--- a/pages/user/userinfo/userinfo.js
+++ b/pages/user/userinfo/userinfo.js
@@ -69,6 +69,10 @@ Page({
check_label: [], //我选择的兴趣标签
fir_guide_id:null, //存储会员详情接口出来的美导ID
+ userInfo: {},
+ hasUserInfo: false,
+ canIUseGetUserProfile: false,
+
},
//通过路径跳转到其他页面
goto: function(e) {
@@ -615,7 +619,55 @@ Page({
}
}
this.initial_user();
+
+ // 获取用户昵称
+ if (wx.getUserProfile) {
+ this.setData({
+ canIUseGetUserProfile: true
+ })
+ }
+
+ },
+
+ // 获取用户头像昵称
+ getUserProfile(e) {
+ var th = this;
+ new Promise((resolve, reject) => {
+ wx.getUserProfile({
+ desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
+ success: (res) => {
+ th.data.user.nickname = res.userInfo.nickName;
+ th.data.user.head_pic = res.userInfo.avatarUrl;
+ this.setData({
+ userInfo: res.userInfo,
+ hasUserInfo: true,
+ user: th.data.user,
+ });
+ resolve(res.userInfo);
+ },
+
+ });
+ }).then((userInfo) => {
+ getApp().request.put("/api/weshop/users/update", {
+ data: {
+ storeId: r.stoid,
+ user_id: getApp().globalData.user_id,
+ nickname: userInfo.nickName,
+ head_pic: userInfo.avatarUrl
+
+ },
+ success: function(su) {
+ if (su.data.code == 0) {
+ console.log("update user info OK");
+ }
+ }
+ });
+ });
+
+
},
+
+
//-----------会员是否初始化---------------------
initial_user: function() {
diff --git a/pages/user/userinfo/userinfo.wxml b/pages/user/userinfo/userinfo.wxml
index adf65c3..5d93e3e 100644
--- a/pages/user/userinfo/userinfo.wxml
+++ b/pages/user/userinfo/userinfo.wxml
@@ -8,11 +8,16 @@
+
+
- {{user.nickname}}
+
+ {{user.nickname}}
+
+
@@ -33,6 +38,8 @@
+
+