默认提交
Showing
3 changed files
with
117 additions
and
79 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,50 +146,49 @@ Page({ | ... | @@ -129,50 +146,49 @@ Page({ |
129 | options, | 146 | options, |
130 | lunarDate | 147 | lunarDate |
131 | }); | 148 | }); |
132 | checkAuth().then((result) => { | ||
133 | this.setData({ | ||
134 | isAuth: result | ||
135 | }) | ||
136 | this.initData(); | ||
137 | this.queryBlessDetail().then((result) => { | ||
138 | this.playBgm(); | ||
139 | let { | ||
140 | detailData, | ||
141 | ownerMember, | ||
142 | memberList | ||
143 | } = this.data; | ||
144 | |||
145 | // 判断memberList里面是否有自己 | ||
146 | let joined = false; | ||
147 | memberList.forEach(element => { | ||
148 | if (element.mySelf == 1) { | ||
149 | joined = true; | ||
150 | } | ||
151 | }); | ||
152 | 149 | ||
153 | /**q | 150 | // this.initData(); |
154 | * 显示加入房间条件 | 151 | this.queryBlessDetail().then((result) => { |
155 | * 1.已定制 | 152 | this.playBgm(); |
156 | * 2.类型为组队类型 | 153 | let { |
157 | * 3.非房主 | 154 | detailData, |
158 | * 4.shareType为join t="join" | 155 | ownerMember, |
159 | * 5.未加入过 判断memberList里面是否有自己 | 156 | memberList |
160 | */ | 157 | } = this.data; |
161 | console.log("---- 判断是否显示加入 Start ----"); | 158 | |
162 | console.log("已定制:", detailData.customMade == 1); | 159 | this.checkAuth(); |
163 | console.log("类型为组队类型:", detailData.type == 1); | 160 | |
164 | console.log("非房主:", ownerMember.mySelf == 0); | 161 | // 判断memberList里面是否有自己 |
165 | console.log("shareType为join:", options); | 162 | let joined = false; |
166 | console.log("是否加入过:", joined); | 163 | memberList.forEach(element => { |
167 | if (detailData.customMade == 1 && detailData.type == 1 && ownerMember.mySelf == 0 && options.t == "join" && !joined) { | 164 | if (element.mySelf == 1) { |
168 | this.setData({ | 165 | joined = true; |
169 | joinRoomDialogVisible: true, | ||
170 | isJoin: true | ||
171 | }) | ||
172 | } | 166 | } |
173 | }); | 167 | }); |
174 | console.log("memberCode:", app.store.getItem("memberCode")); | 168 | |
175 | }).catch((err) => {}); | 169 | /**q |
170 | * 显示加入房间条件 | ||
171 | * 1.已定制 | ||
172 | * 2.类型为组队类型 | ||
173 | * 3.非房主 | ||
174 | * 4.shareType为join t="join" | ||
175 | * 5.未加入过 判断memberList里面是否有自己 | ||
176 | */ | ||
177 | console.log("---- 判断是否显示加入 Start ----"); | ||
178 | console.log("已定制:", detailData.customMade == 1); | ||
179 | console.log("类型为组队类型:", detailData.type == 1); | ||
180 | console.log("非房主:", ownerMember.mySelf == 0); | ||
181 | console.log("shareType为join:", options); | ||
182 | console.log("是否加入过:", joined); | ||
183 | if (detailData.customMade == 1 && detailData.type == 1 && ownerMember.mySelf == 0 && options.t == "join" && !joined) { | ||
184 | this.setData({ | ||
185 | joinRoomDialogVisible: true, | ||
186 | isJoin: true | ||
187 | }) | ||
188 | } | ||
189 | }); | ||
190 | console.log("memberCode:", app.store.getItem("memberCode")); | ||
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 { | |
371 | // 先获取小程序码 | 383 | detailData |
372 | this.getWxCode().then((result) => { | 384 | } = this.data; |
373 | let posterData = this.getPosterConfig(); | 385 | if (detailData.customMade == 1) { |
374 | this.onCreatePoster(posterData); | 386 | // 先获取小程序码 |
375 | }); | 387 | this.getWxCode().then((result) => { |
388 | let posterData = this.getPosterConfig(); | ||
389 | this.onCreatePoster(posterData); | ||
390 | }); | ||
391 | } else { | ||
392 | wx.showModal({ | ||
393 | content: "请先定制祝福", | ||
394 | success(res) {} | ||
395 | }) | ||
396 | } | ||
376 | }, | 397 | }, |
377 | 398 | ||
378 | onPosterSuccess(e) { | 399 | onPosterSuccess(e) { |
... | @@ -545,13 +566,24 @@ Page({ | ... | @@ -545,13 +566,24 @@ Page({ |
545 | 566 | ||
546 | // 显示更新用户信息 | 567 | // 显示更新用户信息 |
547 | showUpdateUserInfoDialog() { | 568 | showUpdateUserInfoDialog() { |
548 | this.checkAuthShowComp().then((result) => { | 569 | let { |
549 | this.setData({ | 570 | detailData |
550 | updateUserInfoDialogVisible: true, | 571 | } = this.data; |
551 | updateUserInfo: {}, | 572 | if (detailData.customMade == 1) { |
552 | files: [] | 573 | this.checkAuthShowComp().then((result) => { |
574 | this.setData({ | ||
575 | updateUserInfoDialogVisible: true, | ||
576 | updateUserInfo: {}, | ||
577 | files: [] | ||
578 | }) | ||
579 | }); | ||
580 | } else { | ||
581 | wx.showModal({ | ||
582 | content: "请先定制祝福", | ||
583 | success(res) {} | ||
553 | }) | 584 | }) |
554 | }); | 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() { |
568 | this.checkAuthShowComp().then((result) => { | 600 | let { |
569 | this.setData({ | 601 | detailData |
570 | updateRoomDialogVisible: true, | 602 | } = this.data; |
571 | updateRoomInfo: {}, | 603 | if (detailData.customMade == 1) { |
604 | this.checkAuthShowComp().then((result) => { | ||
605 | this.setData({ | ||
606 | updateRoomDialogVisible: true, | ||
607 | updateRoomInfo: {}, | ||
608 | }) | ||
609 | }); | ||
610 | } else { | ||
611 | wx.showModal({ | ||
612 | content: "请先定制祝福", | ||
613 | success(res) {} | ||
572 | }) | 614 | }) |
573 | }); | 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