Commit 9bebc27e1aac000446ec144ecc7d06fae6af79ac
1 parent
7853cd33
oa单
Showing
8 changed files
with
224 additions
and
4 deletions
app.json
... | ... | @@ -211,6 +211,7 @@ |
211 | 211 | "pages/user/user_fw/user_fw", |
212 | 212 | "pages/user/cardinfo/cardinfo", |
213 | 213 | "pages/user/nick_avatar/nick_avatar", |
214 | + "pages/user/nick_avatar_add/nick_avatar_add", | |
214 | 215 | "pages/user/slimming/slimming", |
215 | 216 | "pages/user/punchInhistory/punchInhistory", |
216 | 217 | "pages/user/grow_value/grow_value", |
... | ... | @@ -297,6 +298,9 @@ |
297 | 298 | "usingComponents": { |
298 | 299 | "customtabbar": "custom-tab-bar/index" |
299 | 300 | }, |
301 | + "requiredPrivateInfos":[ | |
302 | + "getLocation" | |
303 | + ], | |
300 | 304 | "useExtendedLib": { |
301 | 305 | "weui": true |
302 | 306 | }, | ... | ... |
packageA/pages/profile/profile.js
... | ... | @@ -474,7 +474,16 @@ Page({ |
474 | 474 | choice_sort_store: 0 |
475 | 475 | }); |
476 | 476 | }, |
477 | - | |
477 | + // 获取用户头像昵称 | |
478 | + getUserProfile(e) { | |
479 | + var th = this; | |
480 | + var ob={ | |
481 | + nickname:this.data.nickname, | |
482 | + head_pic:this.data.head_pic, | |
483 | + } | |
484 | + getApp().globalData.up_nick_avatar=ob; | |
485 | + getApp().goto('/packageE/pages/user/nick_avatar_add/nick_avatar_add'); | |
486 | + }, | |
478 | 487 | |
479 | 488 | //身份证号严格校验 |
480 | 489 | IdentityIDCard: function (e) { |
... | ... | @@ -783,6 +792,13 @@ Page({ |
783 | 792 | choice_guide = JSON.parse(JSON.stringify(getApp().globalData.choice_guide)); |
784 | 793 | getApp().globalData.choice_guide = null; |
785 | 794 | } |
795 | + //获取头像和昵称 | |
796 | + let nick_obj = wx.getStorageSync('nick_obj') | |
797 | + if (nick_obj && nick_obj.head_pic && nick_obj.nickname) { | |
798 | + this.setData({head_pic: nick_obj.head_pic, nickname: nick_obj.nickname}) | |
799 | + wx.removeStorageSync('nick_obj') | |
800 | + } | |
801 | + | |
786 | 802 | |
787 | 803 | }, |
788 | 804 | getIsBool(){ |
... | ... | @@ -1365,7 +1381,10 @@ Page({ |
1365 | 1381 | app.my_warnning("请您先阅读和勾选指定的内容", 0, this); |
1366 | 1382 | return false; |
1367 | 1383 | } |
1368 | - | |
1384 | + let uu = getApp().globalData.zc_dd; | |
1385 | + uu.head_pic=this.data.head_pic | |
1386 | + uu.nickname=this.data.nickname | |
1387 | + getApp().globalData.zc_dd=uu | |
1369 | 1388 | var post_data = {...getApp().globalData.zc_dd, ...data}; |
1370 | 1389 | |
1371 | 1390 | delete post_data.sessionKey; | ... | ... |
packageA/pages/profile/profile.wxml
... | ... | @@ -17,8 +17,9 @@ |
17 | 17 | </view> |
18 | 18 | </view> |
19 | 19 | </view> |
20 | + | |
20 | 21 | </view> |
21 | - | |
22 | + <button bindtap="getUserProfile" style="margin-left:10rpx;float:left;width: 50rpx;height:50rpx;font-size:20rpx;background:rgba(217, 81, 99, 0.9);" class="flex-center fs30 confirmtext"><text class="iconfont icon-tongbu"></text></button> | |
22 | 23 | </view> |
23 | 24 | </view> |
24 | 25 | ... | ... |
packageE/pages/user/nick_avatar_add/nick_avatar_add.js
0 → 100644
1 | +// pages/user/userfw/userfw.js | |
2 | +var e = getApp(), os = e.globalData.setting; | |
3 | +var utils = require('../../../../utils/util.js'); | |
4 | +var regeneratorRuntime = require('../../../../utils/runtime.js'); | |
5 | + | |
6 | + | |
7 | +Page({ | |
8 | + /** | |
9 | + * 页面的初始数据 | |
10 | + */ | |
11 | + data: { | |
12 | + defaultAvatar: os.imghost + "/miniapp/images/no-head.jpg", | |
13 | + ob: {}, | |
14 | + load: 0 | |
15 | + }, | |
16 | + | |
17 | + /** | |
18 | + * 生命周期函数--监听页面加载 | |
19 | + */ | |
20 | + onLoad: function (options) { | |
21 | + if(getApp().globalData.up_nick_avatar){ | |
22 | + this.setData({ | |
23 | + ob: JSON.parse(JSON.stringify(getApp().globalData.up_nick_avatar)) | |
24 | + }) | |
25 | + getApp().globalData.up_nick_avatar=null; | |
26 | + } | |
27 | + | |
28 | + }, | |
29 | + /** | |
30 | + * 生命周期函数--监听页面显示 | |
31 | + */ | |
32 | + onShow: async function () { | |
33 | + | |
34 | + }, | |
35 | + | |
36 | + | |
37 | + onChooseAvatar: function (e) { | |
38 | + console.log(e, 1111); | |
39 | + var th = this; | |
40 | + getApp().request.uploadFile(os.url + "/api/weshop/comment/uploadCommentImg", { | |
41 | + filePath: e.detail.avatarUrl, | |
42 | + name: "file", | |
43 | + success: function (t) { | |
44 | + var u = t.data.data; | |
45 | + th.setData({'ob.head_pic': u}) | |
46 | + } | |
47 | + }); | |
48 | + | |
49 | + }, | |
50 | + | |
51 | + get_val: function (e) { | |
52 | + console.log(e, 2222); | |
53 | + this.setData({'ob.nickname': e.detail.value}) | |
54 | + }, | |
55 | + | |
56 | + save_data() { | |
57 | + | |
58 | + var that=this; | |
59 | + setTimeout(()=>{ | |
60 | + if (!this.data.ob.head_pic) { | |
61 | + wx.showToast({ | |
62 | + title: '请选择头像', | |
63 | + icon: 'none', | |
64 | + duration: 2000 | |
65 | + }); | |
66 | + return false; | |
67 | + } | |
68 | + | |
69 | + if (!this.data.ob.nickname) { | |
70 | + wx.showToast({ | |
71 | + title: '请输入昵称', | |
72 | + icon: 'none', | |
73 | + duration: 2000 | |
74 | + }); | |
75 | + return false; | |
76 | + } | |
77 | + | |
78 | + if (this.data.load) return false; | |
79 | + this.setData({load: 1}) | |
80 | + | |
81 | + wx.showLoading(); | |
82 | + | |
83 | + getApp().request.put("/api/weshop/users/update", { | |
84 | + data: { | |
85 | + store_id: os.stoid, | |
86 | + user_id: getApp().globalData.user_id, | |
87 | + nickname: this.data.ob.nickname, | |
88 | + head_pic: this.data.ob.head_pic | |
89 | + | |
90 | + }, | |
91 | + success: function (su) { | |
92 | + | |
93 | + setTimeout(()=>{ | |
94 | + wx.hideLoading(); | |
95 | + if (su.data.code == 0) { | |
96 | + wx.navigateBack({delta: 1}) | |
97 | + }else{ | |
98 | + that.setData({load: 0}) | |
99 | + wx.showToast({ | |
100 | + title: su.data.msg, | |
101 | + icon: 'none', | |
102 | + duration: 2000 | |
103 | + }); | |
104 | + } | |
105 | + },1000) | |
106 | + | |
107 | + | |
108 | + } | |
109 | + }); | |
110 | + },500) | |
111 | + | |
112 | + | |
113 | + }, | |
114 | + save_cell(){ | |
115 | + if (!this.data.ob.head_pic) { | |
116 | + wx.showToast({ | |
117 | + title: '请选择头像', | |
118 | + icon: 'none', | |
119 | + duration: 2000 | |
120 | + }); | |
121 | + return false; | |
122 | + } | |
123 | + if (!this.data.ob.nickname) { | |
124 | + wx.showToast({ | |
125 | + title: '请输入昵称', | |
126 | + icon: 'none', | |
127 | + duration: 2000 | |
128 | + }); | |
129 | + return false; | |
130 | + } | |
131 | + if (this.data.load) return false; | |
132 | + this.setData({load: 1}) | |
133 | + wx.setStorageSync('nick_obj', this.data.ob) | |
134 | + wx.navigateBack() | |
135 | + } | |
136 | + | |
137 | +}) | |
0 | 138 | \ No newline at end of file | ... | ... |
packageE/pages/user/nick_avatar_add/nick_avatar_add.json
0 → 100644
packageE/pages/user/nick_avatar_add/nick_avatar_add.wxml
0 → 100644
1 | +<view class='page_set'> | |
2 | + <view class="item flex jc_sb ai_c"> | |
3 | + <view>头像</view> | |
4 | + <button open-type='chooseAvatar' bind:chooseavatar="onChooseAvatar" class="avatar_btn"> | |
5 | + <image class="head_img" src="{{ob.head_pic || defaultAvatar}} "></image> | |
6 | + </button> | |
7 | + </view> | |
8 | + | |
9 | + <view class="item flex jc_sb ai_c"> | |
10 | + <view>昵称</view> | |
11 | + <view> | |
12 | + <input class="nick_inp" type="nickname" placeholder="用户昵称" value="{{ob.nickname || ''}}" bind:change='get_val' ></input> | |
13 | + </view> | |
14 | + </view> | |
15 | + | |
16 | + | |
17 | + | |
18 | + <!-- 确认修改按钮 --> | |
19 | + <view class="flex-center confirm"> | |
20 | + <view class="flex-center fs30 confirmtext {{load?'load':''}}" bindtap="save_cell"> | |
21 | + <view>确认</view> | |
22 | + </view> | |
23 | + </view> | |
24 | + | |
25 | +</view> | |
0 | 26 | \ No newline at end of file | ... | ... |
packageE/pages/user/nick_avatar_add/nick_avatar_add.wxss
0 → 100644
1 | +.avatar_btn{ width: 60rpx !important; height: 60rpx !important; border-radius:50%; border: none !important; | |
2 | + margin-left:0 !important;margin-right: 0 !important; } | |
3 | +.head_img{ width: 60rpx; height: 60rpx; border-radius: 50%} | |
4 | + | |
5 | +.page_set{ border-top: 20rpx solid #eee; } | |
6 | +.item{ height: 80rpx; border-bottom: 1rpx solid #eee;padding:0 20rpx} | |
7 | +.nick_inp{ text-align: right; color: #999} | |
8 | + | |
9 | + | |
10 | +.confirm { | |
11 | + width: 100%; | |
12 | + left: 0rpx; | |
13 | + bottom: 0rpx; | |
14 | + height: 130rpx; | |
15 | + background-color: rgb(255, 255, 255); | |
16 | + z-index: 9; | |
17 | + | |
18 | +} | |
19 | + | |
20 | +.confirmtext { | |
21 | + width: 495rpx; | |
22 | + height: 65rpx; | |
23 | + color: rgb(255, 255, 255); | |
24 | + background-color: rgb(214, 1, 33); | |
25 | + border-radius: 35rpx; | |
26 | +} | |
27 | + | |
28 | +.load{ | |
29 | + background-color:#eee !important; | |
30 | +} | |
0 | 31 | \ No newline at end of file | ... | ... |