91d68f79 by simon

版本提交

1 parent 8c056043
...@@ -67,16 +67,7 @@ App({ ...@@ -67,16 +67,7 @@ App({
67 }).then((result) => { 67 }).then((result) => {
68 this.globalData.indexInfo = result; 68 this.globalData.indexInfo = result;
69 this.globalData.userInfo = result.userInfo; 69 this.globalData.userInfo = result.userInfo;
70 if (result.isNeedAuth == 1 && auth == true) {
71 //需要授权
72 this.router.push({
73 path: "authorize"
74 })
75 reject();
76 // resolve();
77 } else {
78 resolve(result) 70 resolve(result)
79 }
80 }).catch((err) => { 71 }).catch((err) => {
81 reject(); 72 reject();
82 }); 73 });
......
...@@ -24,6 +24,11 @@ Component({ ...@@ -24,6 +24,11 @@ Component({
24 name: "_evt_hide_mask" 24 name: "_evt_hide_mask"
25 }); 25 });
26 }, 26 },
27 authComplete() {
28 this.triggerEvent('evtcomp', {
29 name: "_evt_auth_complete"
30 });
31 },
27 bindGetUserInfo(e) { 32 bindGetUserInfo(e) {
28 wx.showLoading(); 33 wx.showLoading();
29 this.getUserInfo(e.detail); 34 this.getUserInfo(e.detail);
...@@ -51,6 +56,7 @@ Component({ ...@@ -51,6 +56,7 @@ Component({
51 // }) 56 // })
52 } 57 }
53 _this.hideMask(); 58 _this.hideMask();
59 _this.authComplete();
54 }).catch((err) => {}) 60 }).catch((err) => {})
55 }, 61 },
56 } 62 }
......
...@@ -8,7 +8,8 @@ $contentWidth:690px; ...@@ -8,7 +8,8 @@ $contentWidth:690px;
8 position: relative; 8 position: relative;
9 background-color: #fff; 9 background-color: #fff;
10 // width: 750px; 10 // width: 750px;
11 max-height: 860px; 11 // max-height: 860px;
12 height: 860px;
12 13
13 .cont { 14 .cont {
14 // width: 750px; 15 // width: 750px;
......
...@@ -32,8 +32,13 @@ Page({ ...@@ -32,8 +32,13 @@ Page({
32 this.setData({ 32 this.setData({
33 options 33 options
34 }) 34 })
35 console.log("onLoad");
36 },
37 onHide() {
38
35 }, 39 },
36 onShow() { 40 onShow() {
41 console.log("onShow");
37 this.initData(); 42 this.initData();
38 }, 43 },
39 initData() { 44 initData() {
...@@ -41,19 +46,6 @@ Page({ ...@@ -41,19 +46,6 @@ Page({
41 this.setData({ 46 this.setData({
42 userInfo: app.globalData.userInfo 47 userInfo: app.globalData.userInfo
43 }) 48 })
44 // 判断是否需要授权
45 if (result.isNeedAuth == 1) {
46 app.router.push({
47 path: "authorize",
48 query: {
49 redirect: "coop"
50 }
51 })
52 } else {
53 // this.queryWishbillDetail();
54 // this.initShake();
55 }
56
57 this.queryWishbillDetail(); 49 this.queryWishbillDetail();
58 this.initShake(); 50 this.initShake();
59 }) 51 })
...@@ -81,20 +73,29 @@ Page({ ...@@ -81,20 +73,29 @@ Page({
81 }, 73 },
82 // 助力 74 // 助力
83 queryWishbillAssist() { 75 queryWishbillAssist() {
76 if (!this.data.canShake || this.data.tipsCommonVisible) {
77 return;
78 }
79 this.setData({
80 canShake: false
81 })
84 app.post({ 82 app.post({
85 url: app.api.wishbillAssist, 83 url: app.api.wishbillAssist,
86 data: { 84 data: {
87 billCode: this.data.options.code 85 billCode: this.data.options.code
88 } 86 }
89 }).then((result) => { 87 }).then((result) => {
90 console.log("queryWishbillAssist result:", result);
91 let status = result.status; 88 let status = result.status;
89 this.setData({
90 status: status
91 })
92 if (status == 1) { 92 if (status == 1) {
93 // 助力成功 93 // 助力成功
94 // 合并数据 94 // 合并数据
95 let wishList = result.elasticValueList; 95 let wishList = result.elasticValueList;
96 wishList.forEach(element => { 96 wishList.forEach(element => {
97 let product = productMap[element.prizeDefineCode + ""]; 97 let product = productMap[element.prizeDefineCode + ""];
98 console.log("product:", product);
98 element = Object.assign(element, product); 99 element = Object.assign(element, product);
99 let progress = element.elasticValue / element.conditionElasticValue * 100; 100 let progress = element.elasticValue / element.conditionElasticValue * 100;
100 if (progress > 100) progress = 100; 101 if (progress > 100) progress = 100;
...@@ -103,6 +104,7 @@ Page({ ...@@ -103,6 +104,7 @@ Page({
103 element.progress = progress; 104 element.progress = progress;
104 element.progressLeft = progressLeft; 105 element.progressLeft = progressLeft;
105 }); 106 });
107 console.log("wishList:", wishList);
106 this.setData({ 108 this.setData({
107 coopInfo: result, 109 coopInfo: result,
108 wishList: wishList 110 wishList: wishList
...@@ -125,10 +127,15 @@ Page({ ...@@ -125,10 +127,15 @@ Page({
125 }) 127 })
126 } 128 }
127 129
130 this.setData({
131 canShake: true
132 })
133
128 }) 134 })
129 }, 135 },
130 // 获取心愿单详情 136 // 获取心愿单详情
131 queryWishbillDetail() { 137 queryWishbillDetail() {
138 console.log("queryWishbillDetail code:", this.data.options.code);
132 return new Promise((resolve, reject) => { 139 return new Promise((resolve, reject) => {
133 app.post({ 140 app.post({
134 url: app.api.wishbillDetail, 141 url: app.api.wishbillDetail,
...@@ -136,10 +143,10 @@ Page({ ...@@ -136,10 +143,10 @@ Page({
136 billCode: this.data.options.code 143 billCode: this.data.options.code
137 } 144 }
138 }).then((result) => { 145 }).then((result) => {
139 let status = result.isAssist; 146 // let status = result.isAssist;
140 this.setData({ 147 // this.setData({
141 status 148 // status
142 }) 149 // })
143 let wishList = result.wishGifts; 150 let wishList = result.wishGifts;
144 wishList.forEach(element => { 151 wishList.forEach(element => {
145 let product = productMap[element.prizeDefineCode + ""]; 152 let product = productMap[element.prizeDefineCode + ""];
...@@ -157,7 +164,7 @@ Page({ ...@@ -157,7 +164,7 @@ Page({
157 }) 164 })
158 console.log("wishInfo:", this.data.wishInfo); 165 console.log("wishInfo:", this.data.wishInfo);
159 console.log("wishList:", this.data.wishList); 166 console.log("wishList:", this.data.wishList);
160 167 resolve();
161 }) 168 })
162 }); 169 });
163 }, 170 },
...@@ -180,6 +187,10 @@ Page({ ...@@ -180,6 +187,10 @@ Page({
180 this.hideMask(); 187 this.hideMask();
181 break; 188 break;
182 189
190 case "_evt_auth_complete:":
191 this.initData();
192 break;
193
183 default: 194 default:
184 break; 195 break;
185 } 196 }
......
...@@ -60,7 +60,8 @@ ...@@ -60,7 +60,8 @@
60 color: #333333; 60 color: #333333;
61 font-size: 28px; 61 font-size: 28px;
62 line-height: 1.6; 62 line-height: 1.6;
63 height: 150px; 63 height: 140px;
64 @include ellipsis(3);
64 } 65 }
65 66
66 // 心愿 67 // 心愿
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
9 <view class="content"> 9 <view class="content">
10 <!-- 摇一摇 --> 10 <!-- 摇一摇 -->
11 <!-- bindtap="queryWishbillAssist" --> 11 <!-- bindtap="queryWishbillAssist" -->
12 <view wx:if="{{status != 1}}" class="shake"> 12 <view bindtap="queryWishbillAssist" wx:if="{{status != 1}}" class="shake">
13 <image class="ebg" mode="widthFix" src="../../image/oss/coop/coop-c2.png" /> 13 <image class="ebg" mode="widthFix" src="../../image/oss/coop/coop-c2.png" />
14 <view class="space1"></view> 14 <view class="space1"></view>
15 <view class="cont"> 15 <view class="cont">
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
47 </view> 47 </view>
48 </view> 48 </view>
49 <view class="tips2"> 49 <view class="tips2">
50 <text class="t1">太厉害了\n您总共摇出了{{wishInfo.totalElasticValue}}弹力值</text> 50 <text class="t1">太厉害了\n您总共摇出了{{coopInfo.totalElasticValue}}弹力值</text>
51 </view> 51 </view>
52 <!-- 奖品 --> 52 <!-- 奖品 -->
53 <view class="wish"> 53 <view class="wish">
......
...@@ -30,6 +30,7 @@ Page({ ...@@ -30,6 +30,7 @@ Page({
30 wishList: [], // 创建后的心愿单列表 30 wishList: [], // 创建后的心愿单列表
31 userInfo: {}, 31 userInfo: {},
32 isPageVisible: false, 32 isPageVisible: false,
33 // canShake:false,
33 }, 34 },
34 onShareAppMessage() {}, 35 onShareAppMessage() {},
35 onShow() { 36 onShow() {
...@@ -39,10 +40,11 @@ Page({ ...@@ -39,10 +40,11 @@ Page({
39 this.isPageVisible = false; 40 this.isPageVisible = false;
40 }, 41 },
41 onLoad(options) { 42 onLoad(options) {
43 // console.log("cw -- onLoad");
42 this.initData(); 44 this.initData();
43 }, 45 },
44 initData() { 46 initData() {
45 47 this.hideMask();
46 // 还原缓存心愿单 48 // 还原缓存心愿单
47 let myWishList = app.store.getItem("wish") || []; 49 let myWishList = app.store.getItem("wish") || [];
48 this.setData({ 50 this.setData({
...@@ -56,6 +58,7 @@ Page({ ...@@ -56,6 +58,7 @@ Page({
56 this.queryWishbillPrizeCandidate().then((result) => { 58 this.queryWishbillPrizeCandidate().then((result) => {
57 this.initBorder(); 59 this.initBorder();
58 }) 60 })
61 this.checkNeedQuestion();
59 }); 62 });
60 this.initShake(); 63 this.initShake();
61 }, 64 },
...@@ -93,6 +96,68 @@ Page({ ...@@ -93,6 +96,68 @@ Page({
93 } 96 }
94 }); 97 });
95 }, 98 },
99
100 /**
101 * 检验是否需要先答题 是的话弹答题
102 * 1.已经登陆
103 * 2.是新会员
104 * 3.不是黑名单
105 * 4.未答题
106 */
107 checkNeedQuestion() {
108 return new Promise((resolve, reject) => {
109 let indexInfo = app.globalData.indexInfo;
110 let {
111 isCrmLogin,
112 isNewMember,
113 isBlackList,
114 hadAnswerQuestion,
115 } = indexInfo;
116 if (isCrmLogin == 1 && isNewMember == 1 && isBlackList == 0 && hadAnswerQuestion == 0) {
117 this.setData({
118 tipsNewMemberVisible: true,
119 })
120 } else {}
121 resolve();
122 });
123 },
124
125 /**
126 * 检查是否有资格玩
127 * 1.未已经登陆 => 提示登陆
128 * 2.非黑名单 => 弹团购会员弹窗
129 * 3.是新会员且未答题 => 弹未答题弹窗
130 */
131 checkCanPlay() {
132 return new Promise((resolve, reject) => {
133 let indexInfo = app.globalData.indexInfo;
134 let {
135 isCrmLogin,
136 isNewMember,
137 isBlackList,
138 hadAnswerQuestion,
139 } = indexInfo;
140 if (isCrmLogin == 0) {
141 this.setData({
142 tipsRegisterVisible: true,
143 })
144 reject();
145 } else if (isBlackList == 1) {
146 this.setData({
147 tipsGroupMemberVisible: true,
148 })
149 reject();
150 } else if (isNewMember == 1 && hadAnswerQuestion == 0) {
151 this.setData({
152 tipsNewMemberVisible: true,
153 })
154 reject();
155 } else {
156 resolve();
157 }
158 });
159 },
160
96 /** 161 /**
97 * 提交前判断状态 162 * 提交前判断状态
98 * 判断顺序 163 * 判断顺序
...@@ -109,8 +174,6 @@ Page({ ...@@ -109,8 +174,6 @@ Page({
109 isNewMember, 174 isNewMember,
110 isBlackList, 175 isBlackList,
111 hadAnswerQuestion, 176 hadAnswerQuestion,
112 isSelfAssist,
113 wishBillCode
114 } = indexInfo; 177 } = indexInfo;
115 // 未登陆 出注册弹窗提示 178 // 未登陆 出注册弹窗提示
116 // isCrmLogin = 1; 179 // isCrmLogin = 1;
...@@ -121,6 +184,7 @@ Page({ ...@@ -121,6 +184,7 @@ Page({
121 reject(); 184 reject();
122 return; 185 return;
123 } 186 }
187
124 // 黑名单 188 // 黑名单
125 if (isBlackList == 1) { 189 if (isBlackList == 1) {
126 this.setData({ 190 this.setData({
...@@ -129,6 +193,7 @@ Page({ ...@@ -129,6 +193,7 @@ Page({
129 reject(); 193 reject();
130 return; 194 return;
131 } 195 }
196
132 // 新老会员 197 // 新老会员
133 // isNewMember 198 // isNewMember
134 // hadAnswerQuestion = 1; //硬编码答题 199 // hadAnswerQuestion = 1; //硬编码答题
...@@ -193,9 +258,13 @@ Page({ ...@@ -193,9 +258,13 @@ Page({
193 }).then((result) => { 258 }).then((result) => {
194 if (app.globalData.indexInfo.isNewMember == 1) { 259 if (app.globalData.indexInfo.isNewMember == 1) {
195 // 新会员 260 // 新会员
196 this.setData({ 261 // this.setData({
197 tipsCreateCompleteVisible: true, 262 // tipsCreateCompleteVisible: true,
198 wishBillInfo: result 263 // wishBillInfo: result
264 // })
265 app.router.push({
266 openType: "reLaunch",
267 path: "wish"
199 }) 268 })
200 } else { 269 } else {
201 // 老会员,自动助力,出提示页面 270 // 老会员,自动助力,出提示页面
...@@ -247,6 +316,7 @@ Page({ ...@@ -247,6 +316,7 @@ Page({
247 * @param {*} evt 316 * @param {*} evt
248 */ 317 */
249 onAddWishHandler(evt) { 318 onAddWishHandler(evt) {
319 this.checkCanPlay().then((result) => {
250 let myWishList = this.data.myWishList; 320 let myWishList = this.data.myWishList;
251 let curWish = this.data.curWish; 321 let curWish = this.data.curWish;
252 322
...@@ -277,6 +347,8 @@ Page({ ...@@ -277,6 +347,8 @@ Page({
277 myWishList 347 myWishList
278 }) 348 })
279 app.store.setItem("wish", myWishList); 349 app.store.setItem("wish", myWishList);
350 });
351
280 }, 352 },
281 /** 353 /**
282 * 取消心愿单 354 * 取消心愿单
......
...@@ -35,10 +35,12 @@ Page({ ...@@ -35,10 +35,12 @@ Page({
35 let { 35 let {
36 wishBillCode 36 wishBillCode
37 } = app.globalData.indexInfo; 37 } = app.globalData.indexInfo;
38 // 判断页面跳转
38 let path = "createWish"; 39 let path = "createWish";
39 if (wishBillCode) { 40 if (wishBillCode) {
40 path = "wish" 41 path = "wish"
41 } 42 }
43 console.log("path:",path);
42 app.router.push({ 44 app.router.push({
43 path: path 45 path: path
44 }) 46 })
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
19 <view class="display"> 19 <view class="display">
20 <view class="border border2"> 20 <view class="border border2">
21 <view class="inner inner2"> 21 <view class="inner inner2">
22 <image class="portrait" mode="widthFix" src="{{rank[0].avatar}}" /> 22 <image class="portrait" mode="widthFix" src="{{rank[1].avatar}}" />
23 </view> 23 </view>
24 <view class="no no2 ">NO.2</view> 24 <view class="no no2 ">NO.2</view>
25 </view> 25 </view>
......
...@@ -12,7 +12,7 @@ Page({ ...@@ -12,7 +12,7 @@ Page({
12 data: { 12 data: {
13 isOverShare: true, //自定义分享 13 isOverShare: true, //自定义分享
14 tipsRuleVisible: false, 14 tipsRuleVisible: false,
15 tipsPirzeVisible: true, 15 tipsPirzeVisible: false,
16 userInfo: {}, 16 userInfo: {},
17 wishInfo: {}, 17 wishInfo: {},
18 wishList: [], 18 wishList: [],
......