默认提交
Showing
3 changed files
with
66 additions
and
28 deletions
1 | import { | 1 | import { |
2 | getBindtapData, | 2 | getBindtapData, |
3 | checkAuth | 3 | checkAuthUtils |
4 | } from '../../utils/util'; | 4 | } from '../../utils/util'; |
5 | 5 | ||
6 | import Dialog from '../../ui/vant-weapp/dialog/dialog'; | 6 | import Dialog from '../../ui/vant-weapp/dialog/dialog'; |
... | @@ -98,12 +98,29 @@ Page({ | ... | @@ -98,12 +98,29 @@ Page({ |
98 | authorizeVisible: true | 98 | authorizeVisible: true |
99 | }) | 99 | }) |
100 | }, | 100 | }, |
101 | checkAuthShowComp() { | 101 | checkAuth() { |
102 | return new Promise((resolve, reject) => { | 102 | return new Promise((resolve, reject) => { |
103 | checkAuth().then((result) => { | 103 | let { |
104 | detailData | ||
105 | } = this.data; | ||
106 | checkAuthUtils().then((result) => { | ||
107 | console.log("checkAuth result:", result); | ||
108 | console.log("checkAuth detailData.isAuth:", detailData.isAuth); | ||
109 | let isAuth = result && detailData.isAuth == 1; | ||
104 | this.setData({ | 110 | this.setData({ |
105 | isAuth: result | 111 | isAuth |
106 | }) | 112 | }); |
113 | console.log("checkAuth isAuth:", isAuth); | ||
114 | resolve(isAuth); | ||
115 | }); | ||
116 | }); | ||
117 | }, | ||
118 | checkAuthShowComp() { | ||
119 | return new Promise((resolve, reject) => { | ||
120 | this.checkAuth().then((result) => { | ||
121 | // this.setData({ | ||
122 | // isAuth: result | ||
123 | // }) | ||
107 | if (result) { | 124 | if (result) { |
108 | resolve(true); | 125 | resolve(true); |
109 | } else { | 126 | } else { |
... | @@ -129,11 +146,8 @@ Page({ | ... | @@ -129,11 +146,8 @@ Page({ |
129 | options, | 146 | options, |
130 | lunarDate | 147 | lunarDate |
131 | }); | 148 | }); |
132 | checkAuth().then((result) => { | 149 | |
133 | this.setData({ | 150 | // this.initData(); |
134 | isAuth: result | ||
135 | }) | ||
136 | this.initData(); | ||
137 | this.queryBlessDetail().then((result) => { | 151 | this.queryBlessDetail().then((result) => { |
138 | this.playBgm(); | 152 | this.playBgm(); |
139 | let { | 153 | let { |
... | @@ -142,6 +156,8 @@ Page({ | ... | @@ -142,6 +156,8 @@ Page({ |
142 | memberList | 156 | memberList |
143 | } = this.data; | 157 | } = this.data; |
144 | 158 | ||
159 | this.checkAuth(); | ||
160 | |||
145 | // 判断memberList里面是否有自己 | 161 | // 判断memberList里面是否有自己 |
146 | let joined = false; | 162 | let joined = false; |
147 | memberList.forEach(element => { | 163 | memberList.forEach(element => { |
... | @@ -172,7 +188,7 @@ Page({ | ... | @@ -172,7 +188,7 @@ Page({ |
172 | } | 188 | } |
173 | }); | 189 | }); |
174 | console.log("memberCode:", app.store.getItem("memberCode")); | 190 | console.log("memberCode:", app.store.getItem("memberCode")); |
175 | }).catch((err) => {}); | 191 | |
176 | 192 | ||
177 | }, | 193 | }, |
178 | 194 | ||
... | @@ -181,11 +197,7 @@ Page({ | ... | @@ -181,11 +197,7 @@ Page({ |
181 | * 授权完毕重拉数据用 | 197 | * 授权完毕重拉数据用 |
182 | */ | 198 | */ |
183 | initData() { | 199 | initData() { |
184 | checkAuth().then((result) => { | 200 | this.checkAuth().then((result) => {}); |
185 | _this.setData({ | ||
186 | isAuth: result | ||
187 | }); | ||
188 | }).catch((err) => {}); | ||
189 | }, | 201 | }, |
190 | playBgm() { | 202 | playBgm() { |
191 | let _this = this; | 203 | let _this = this; |
... | @@ -367,12 +379,21 @@ Page({ | ... | @@ -367,12 +379,21 @@ Page({ |
367 | */ | 379 | */ |
368 | onPosterHandler() { | 380 | onPosterHandler() { |
369 | console.log("onPosterHandler"); | 381 | console.log("onPosterHandler"); |
370 | 382 | let { | |
383 | detailData | ||
384 | } = this.data; | ||
385 | if (detailData.customMade == 1) { | ||
371 | // 先获取小程序码 | 386 | // 先获取小程序码 |
372 | this.getWxCode().then((result) => { | 387 | this.getWxCode().then((result) => { |
373 | let posterData = this.getPosterConfig(); | 388 | let posterData = this.getPosterConfig(); |
374 | this.onCreatePoster(posterData); | 389 | this.onCreatePoster(posterData); |
375 | }); | 390 | }); |
391 | } else { | ||
392 | wx.showModal({ | ||
393 | content: "请先定制祝福", | ||
394 | success(res) {} | ||
395 | }) | ||
396 | } | ||
376 | }, | 397 | }, |
377 | 398 | ||
378 | onPosterSuccess(e) { | 399 | onPosterSuccess(e) { |
... | @@ -545,6 +566,10 @@ Page({ | ... | @@ -545,6 +566,10 @@ Page({ |
545 | 566 | ||
546 | // 显示更新用户信息 | 567 | // 显示更新用户信息 |
547 | showUpdateUserInfoDialog() { | 568 | showUpdateUserInfoDialog() { |
569 | let { | ||
570 | detailData | ||
571 | } = this.data; | ||
572 | if (detailData.customMade == 1) { | ||
548 | this.checkAuthShowComp().then((result) => { | 573 | this.checkAuthShowComp().then((result) => { |
549 | this.setData({ | 574 | this.setData({ |
550 | updateUserInfoDialogVisible: true, | 575 | updateUserInfoDialogVisible: true, |
... | @@ -552,6 +577,13 @@ Page({ | ... | @@ -552,6 +577,13 @@ Page({ |
552 | files: [] | 577 | files: [] |
553 | }) | 578 | }) |
554 | }); | 579 | }); |
580 | } else { | ||
581 | wx.showModal({ | ||
582 | content: "请先定制祝福", | ||
583 | success(res) {} | ||
584 | }) | ||
585 | } | ||
586 | |||
555 | }, | 587 | }, |
556 | 588 | ||
557 | // 房主名字 | 589 | // 房主名字 |
... | @@ -565,12 +597,22 @@ Page({ | ... | @@ -565,12 +597,22 @@ Page({ |
565 | 597 | ||
566 | // 显示更新用户信息 | 598 | // 显示更新用户信息 |
567 | showUpdateRoomDialog() { | 599 | showUpdateRoomDialog() { |
600 | let { | ||
601 | detailData | ||
602 | } = this.data; | ||
603 | if (detailData.customMade == 1) { | ||
568 | this.checkAuthShowComp().then((result) => { | 604 | this.checkAuthShowComp().then((result) => { |
569 | this.setData({ | 605 | this.setData({ |
570 | updateRoomDialogVisible: true, | 606 | updateRoomDialogVisible: true, |
571 | updateRoomInfo: {}, | 607 | updateRoomInfo: {}, |
572 | }) | 608 | }) |
573 | }); | 609 | }); |
610 | } else { | ||
611 | wx.showModal({ | ||
612 | content: "请先定制祝福", | ||
613 | success(res) {} | ||
614 | }) | ||
615 | } | ||
574 | }, | 616 | }, |
575 | 617 | ||
576 | // 家庭名称 | 618 | // 家庭名称 |
... | @@ -847,9 +889,6 @@ Page({ | ... | @@ -847,9 +889,6 @@ Page({ |
847 | }).catch((err) => { | 889 | }).catch((err) => { |
848 | 890 | ||
849 | }); | 891 | }); |
850 | |||
851 | |||
852 | |||
853 | }, | 892 | }, |
854 | 893 | ||
855 | // 点击确认授权按钮 | 894 | // 点击确认授权按钮 |
... | @@ -892,12 +931,11 @@ Page({ | ... | @@ -892,12 +931,11 @@ Page({ |
892 | content: '授权成功', | 931 | content: '授权成功', |
893 | success(res) {} | 932 | success(res) {} |
894 | }) | 933 | }) |
895 | checkAuth().then((result) => { | 934 | |
896 | _this.setData({ | 935 | this.queryBlessDetail().then((result) => { |
897 | isAuth: result | 936 | this.checkAuth().then((result) => {}).catch((err) => {}); |
898 | }); | ||
899 | this.queryBlessDetail(); | ||
900 | }).catch((err) => {}); | 937 | }).catch((err) => {}); |
938 | |||
901 | }).catch((err) => { | 939 | }).catch((err) => { |
902 | wx.hideLoading(); | 940 | wx.hideLoading(); |
903 | console.log("授权成功 err:", err); | 941 | console.log("授权成功 err:", err); | ... | ... |
... | @@ -80,7 +80,7 @@ | ... | @@ -80,7 +80,7 @@ |
80 | <view class="blessing"> | 80 | <view class="blessing"> |
81 | <view wx:for="{{blessContent}}" wx:key="{{index}}" class="blessing-item"> | 81 | <view wx:for="{{blessContent}}" wx:key="{{index}}" class="blessing-item"> |
82 | <!-- 图片 --> | 82 | <!-- 图片 --> |
83 | <image mode="widthFix" wx:if="{{item.type == 'image'}}" class="blessing-item-image" src="{{item.url}}" /> | 83 | <image mode="widthFix" wx:if="{{item.type == 'image' && item.url}}" class="blessing-item-image" src="{{item.url}}" /> |
84 | <!-- 文本 --> | 84 | <!-- 文本 --> |
85 | <text wx:if="{{item.type == 'text'}}" class="blessing-item-text" style="color: {{item.color ? item.color : '#333333'}};"> | 85 | <text wx:if="{{item.type == 'text'}}" class="blessing-item-text" style="color: {{item.color ? item.color : '#333333'}};"> |
86 | {{item.content}} | 86 | {{item.content}} | ... | ... |
... | @@ -232,7 +232,7 @@ function throttle(func, wait, type) { | ... | @@ -232,7 +232,7 @@ function throttle(func, wait, type) { |
232 | * 检查是否授权 | 232 | * 检查是否授权 |
233 | * @param {*} name | 233 | * @param {*} name |
234 | */ | 234 | */ |
235 | function checkAuth(name, url) { | 235 | function checkAuthUtils(name, url) { |
236 | return new Promise((resolve, reject) => { | 236 | return new Promise((resolve, reject) => { |
237 | wx.getSetting({ | 237 | wx.getSetting({ |
238 | success(res) { | 238 | success(res) { |
... | @@ -260,5 +260,5 @@ module.exports = { | ... | @@ -260,5 +260,5 @@ module.exports = { |
260 | wxacodeGet: wxacodeGet, | 260 | wxacodeGet: wxacodeGet, |
261 | getObjByListKeyValue: getObjByListKeyValue, | 261 | getObjByListKeyValue: getObjByListKeyValue, |
262 | getQueryByUrl: getQueryByUrl, | 262 | getQueryByUrl: getQueryByUrl, |
263 | checkAuth: checkAuth | 263 | checkAuthUtils: checkAuthUtils |
264 | } | 264 | } | ... | ... |
-
Please register or sign in to post a comment