no message
Showing
9 changed files
with
72 additions
and
11 deletions
1 | { | 1 | { |
2 | "pages": [ | 2 | "pages": [ |
3 | "pages/index/index", | 3 | "pages/index/index", |
4 | "pages/scan-result/scan-result", | ||
5 | "pages/user-center/user-center", | 4 | "pages/user-center/user-center", |
5 | "pages/scan-result/scan-result", | ||
6 | "pages/gift-shop/gift-shop", | 6 | "pages/gift-shop/gift-shop", |
7 | "pages/gift-detail/gift-detail", | 7 | "pages/gift-detail/gift-detail", |
8 | "pages/contact/contact", | 8 | "pages/contact/contact", | ... | ... |
... | @@ -6,6 +6,7 @@ Page({ | ... | @@ -6,6 +6,7 @@ Page({ |
6 | authorizeVisible: false, | 6 | authorizeVisible: false, |
7 | userInfo: {}, | 7 | userInfo: {}, |
8 | qrImagePath: "", | 8 | qrImagePath: "", |
9 | imageUrl: "", | ||
9 | }, | 10 | }, |
10 | onShareAppMessage() {}, | 11 | onShareAppMessage() {}, |
11 | showAuth() { | 12 | showAuth() { |
... | @@ -25,17 +26,29 @@ Page({ | ... | @@ -25,17 +26,29 @@ Page({ |
25 | * 获取会员信息 | 26 | * 获取会员信息 |
26 | */ | 27 | */ |
27 | queryMember() { | 28 | queryMember() { |
29 | let _this = this; | ||
28 | return new Promise((resolve, reject) => { | 30 | return new Promise((resolve, reject) => { |
29 | app.post({ | 31 | app.post({ |
30 | url: app.api.member, | 32 | url: app.api.member, |
31 | data: {} | 33 | data: {} |
32 | }).then((result) => { | 34 | }).then((result) => { |
33 | let userInfo = result | 35 | let userInfo = result |
34 | this.setData({ | 36 | _this.setData({ |
35 | userInfo: userInfo, | 37 | userInfo: userInfo, |
36 | qrImagePath: userInfo.memberUrl, | 38 | qrImagePath: userInfo.memberUrl, |
37 | }) | 39 | }) |
38 | 40 | ||
41 | wx.downloadFile({ | ||
42 | url: userInfo.memberUrl, | ||
43 | success(res) { | ||
44 | if (res.statusCode === 200) { | ||
45 | _this.setData({ | ||
46 | imageUrl: res.tempFilePath | ||
47 | }) | ||
48 | } | ||
49 | } | ||
50 | }) | ||
51 | |||
39 | // 生成个人二维码 | 52 | // 生成个人二维码 |
40 | // let tlMemberCode = userInfo.memberCode; | 53 | // let tlMemberCode = userInfo.memberCode; |
41 | // let qrSize = this.setCanvasSize(440); | 54 | // let qrSize = this.setCanvasSize(440); |
... | @@ -86,4 +99,48 @@ Page({ | ... | @@ -86,4 +99,48 @@ Page({ |
86 | return size; | 99 | return size; |
87 | }, | 100 | }, |
88 | 101 | ||
102 | /** | ||
103 | * 保存图片到本地 | ||
104 | */ | ||
105 | saveImageToPhotosAlbum() { | ||
106 | console.log("saveImageToPhotosAlbum"); | ||
107 | let _this = this; | ||
108 | if (!_this.data.imageUrl) { | ||
109 | wx.showToast({ | ||
110 | title: "图片加载中,请重试", | ||
111 | icon: "none" | ||
112 | }) | ||
113 | return; | ||
114 | } | ||
115 | wx.saveImageToPhotosAlbum({ | ||
116 | filePath: _this.data.imageUrl, | ||
117 | success(res) { | ||
118 | wx.showToast({ | ||
119 | title: '保存成功', | ||
120 | icon: 'success' | ||
121 | }); | ||
122 | }, | ||
123 | fail(err) { | ||
124 | wx.getSetting({ | ||
125 | success: (res) => { | ||
126 | if (!res.authSetting['scope.writePhotosAlbum']) { | ||
127 | // 未授权 | ||
128 | wx.showModal({ | ||
129 | title: '提示', | ||
130 | content: '小程序请求访问相册权限', | ||
131 | confirmText: '前往授权', | ||
132 | success(res) { | ||
133 | if (res.confirm) { | ||
134 | wx.openSetting({ | ||
135 | success(res) {} | ||
136 | }) | ||
137 | } else if (res.cancel) {} | ||
138 | } | ||
139 | }) | ||
140 | } | ||
141 | } | ||
142 | }) | ||
143 | } | ||
144 | }) | ||
145 | }, | ||
89 | }) | 146 | }) | ... | ... |
... | @@ -15,7 +15,7 @@ | ... | @@ -15,7 +15,7 @@ |
15 | </view> | 15 | </view> |
16 | <view class="tips">分享邀请好友加入,赢取推广积分</view> | 16 | <view class="tips">分享邀请好友加入,赢取推广积分</view> |
17 | <view class="btn-wrap"> | 17 | <view class="btn-wrap"> |
18 | <view class="btn">保存图片</view> | 18 | <view bindtap="saveImageToPhotosAlbum" class="btn">保存图片</view> |
19 | </view> | 19 | </view> |
20 | </view> | 20 | </view> |
21 | </view> | 21 | </view> | ... | ... |
... | @@ -195,7 +195,7 @@ $contentWidth:690px; | ... | @@ -195,7 +195,7 @@ $contentWidth:690px; |
195 | // 排行item | 195 | // 排行item |
196 | .rank-item { | 196 | .rank-item { |
197 | display: flex; | 197 | display: flex; |
198 | justify-content: space-between; | 198 | // justify-content: space-between; |
199 | border-bottom: solid 1px #dddddd; | 199 | border-bottom: solid 1px #dddddd; |
200 | $itemHeight: 104px; | 200 | $itemHeight: 104px; |
201 | height: $itemHeight; | 201 | height: $itemHeight; |
... | @@ -217,8 +217,8 @@ $contentWidth:690px; | ... | @@ -217,8 +217,8 @@ $contentWidth:690px; |
217 | .user { | 217 | .user { |
218 | display: flex; | 218 | display: flex; |
219 | align-items: center; | 219 | align-items: center; |
220 | font-size: 32px; | 220 | font-size: 28px; |
221 | width: 300px; | 221 | width: 360px; |
222 | // background-color: wheat; | 222 | // background-color: wheat; |
223 | @include no-wrap(); | 223 | @include no-wrap(); |
224 | overflow-x: hidden; | 224 | overflow-x: hidden; | ... | ... |
... | @@ -24,11 +24,14 @@ $contentWidth:690px; | ... | @@ -24,11 +24,14 @@ $contentWidth:690px; |
24 | .func-wrap{ | 24 | .func-wrap{ |
25 | } | 25 | } |
26 | .func { | 26 | .func { |
27 | @extend .fcc; | 27 | // @extend .fcc; |
28 | display: flex; | ||
29 | align-items: center; | ||
28 | height: 80px; | 30 | height: 80px; |
29 | // border-bottom: solid 1px #DDDDDD; | ||
30 | font-size: 32px; | 31 | font-size: 32px; |
31 | color: #3680EB; | 32 | color: #3680EB; |
33 | @extend .bb; | ||
34 | padding-left: 150px; | ||
32 | 35 | ||
33 | .icon { | 36 | .icon { |
34 | width: 32px; | 37 | width: 32px; | ... | ... |
... | @@ -123,7 +123,7 @@ | ... | @@ -123,7 +123,7 @@ |
123 | </view> | 123 | </view> |
124 | <view bindtap="onContactUsHandler" class="func-wrap-item"> | 124 | <view bindtap="onContactUsHandler" class="func-wrap-item"> |
125 | <view class="icon-wrap"> | 125 | <view class="icon-wrap"> |
126 | <image class="icon" mode="aspectFit" src="../../image/icon//icon-concat-us.png" /> | 126 | <image class="icon" mode="aspectFit" src="../../image/icon/icon-concat-us.png" /> |
127 | </view> | 127 | </view> |
128 | <view class="txt">联系我们</view> | 128 | <view class="txt">联系我们</view> |
129 | </view> | 129 | </view> | ... | ... |
... | @@ -397,6 +397,7 @@ Page({ | ... | @@ -397,6 +397,7 @@ Page({ |
397 | this.setData({ | 397 | this.setData({ |
398 | membersShipIndex: index, | 398 | membersShipIndex: index, |
399 | memberTypeName: this.data.membersShipList[index].memberTypeName, | 399 | memberTypeName: this.data.membersShipList[index].memberTypeName, |
400 | memberTypeCode: this.data.membersShipList[index].memberTypeCode, | ||
400 | }) | 401 | }) |
401 | }, | 402 | }, |
402 | 403 | ... | ... |
-
Please register or sign in to post a comment