├── .idea
├── inspectionProfiles
│ └── Project_Default.xml
├── misc.xml
├── modules.xml
├── watcherTasks.xml
├── workspace.xml
└── 答题.iml
├── app.js
├── app.json
├── app.wxss
├── pages
├── answer
│ ├── answer.js
│ ├── answer.wxml
│ └── answer.wxss
├── answerResult
│ ├── answerResult.js
│ ├── answerResult.wxml
│ └── answerResult.wxss
├── challenge
│ ├── challenge.js
│ ├── challenge.wxml
│ └── challenge.wxss
├── friend
│ ├── friend.js
│ ├── friend.wxml
│ └── friend.wxss
├── index
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── info
│ ├── info.js
│ ├── info.wxml
│ └── info.wxss
├── jackpot
│ ├── jackpot.js
│ ├── jackpot.wxml
│ └── jackpot.wxss
├── jackpotTime
│ ├── jackpotTime.js
│ ├── jackpotTime.wxml
│ └── jackpotTime.wxss
├── prize
│ ├── prize.js
│ ├── prize.wxml
│ └── prize.wxss
├── recharge
│ ├── recharge.js
│ ├── recharge.wxml
│ └── recharge.wxss
├── store
│ ├── store.js
│ ├── store.wxml
│ └── store.wxss
├── storeRecord
│ ├── storeRecord.js
│ ├── storeRecord.wxml
│ └── storeRecord.wxss
└── succeed
│ ├── succeed.js
│ ├── succeed.wxml
│ └── succeed.wxss
├── project.config.json
└── utils
├── citys.js
└── util.js
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
16 |
17 |
18 |
19 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/watcherTasks.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
70 |
71 |
72 |
73 | sub
74 | myGrade
75 | record
76 | console
77 | this
78 | @
79 | 0
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 | true
134 |
135 | false
136 | true
137 | true
138 |
139 |
140 | true
141 | DEFINITION_ORDER
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 | 1517021761600
217 |
218 |
219 | 1517021761600
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
--------------------------------------------------------------------------------
/.idea/答题.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | App({
3 | onLaunch: function () {
4 | // 展示本地存储能力
5 | var logs = wx.getStorageSync('logs') || []
6 | logs.unshift(Date.now())
7 | wx.setStorageSync('logs', logs)
8 |
9 | // 登录
10 | wx.login({
11 | success: res => {
12 | // 发送 res.code 到后台换取 openId, sessionKey, unionId
13 | }
14 | })
15 | // 获取用户信息
16 | wx.getSetting({
17 | success: res => {
18 | if (res.authSetting['scope.userInfo']) {
19 | // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
20 | wx.getUserInfo({
21 | success: res => {
22 | // 可以将 res 发送给后台解码出 unionId
23 | this.globalData.userInfo = res.userInfo
24 |
25 | // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
26 | // 所以此处加入 callback 以防止这种情况
27 | if (this.userInfoReadyCallback) {
28 | this.userInfoReadyCallback(res)
29 | }
30 | }
31 | })
32 | }
33 | }
34 | })
35 | },
36 | globalData: {
37 | userInfo: null
38 | }
39 | })
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages":[
3 | "pages/index/index",
4 | "pages/challenge/challenge",
5 | "pages/recharge/recharge",
6 | "pages/friend/friend",
7 | "pages/answer/answer",
8 | "pages/store/store",
9 | "pages/info/info",
10 | "pages/storeRecord/storeRecord",
11 | "pages/succeed/succeed",
12 | "pages/answerResult/answerResult",
13 | "pages/prize/prize",
14 | "pages/jackpot/jackpot",
15 | "pages/jackpotTime/jackpotTime"
16 | ],
17 | "window":{
18 | "backgroundTextStyle":"light",
19 | "navigationBarBackgroundColor": "#3d3587",
20 | "navigationBarTitleText": "WeChat",
21 | "navigationBarTextStyle":"#ffffff"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 | .container {
3 | box-sizing: border-box;
4 | padding: 0 20rpx;
5 | font-size: 30rpx;
6 | color: #fff;
7 | max-width: 750rpx;
8 | margin: 0 auto;
9 | font-family: "PingFang-SC-Regular";
10 | }
11 |
12 | page {
13 | padding: 0 20 rpx 100 rpx 20 rpx;
14 | box-sizing: border-box;
15 | background-size: 100%;
16 | background-image: url("http://47.97.185.141/xcx-images/beijingg_@3x.png");
17 | }
18 |
--------------------------------------------------------------------------------
/pages/answer/answer.js:
--------------------------------------------------------------------------------
1 | let id;
2 |
3 |
4 | Page({
5 | data: {
6 | items: '',
7 | subject: "", //题目
8 | errorIcon: true, //点击后是否显示
9 | result: true, /*结果*/
10 | answer: true, //问题
11 | answers: true, //问题
12 | choose: "", /*回答问题所选项*/
13 | right: "", /*正确选项*/
14 | count: '', //用来记录当然元素的id
15 | bg: 'error', /*背景颜色*/
16 | falg: true, /*节流阀*/
17 | record: "", /*遍历题目*/
18 | number: 0,
19 | hint: false,//提示
20 | title: "第一题",
21 | time: 10,
22 | timer: "",
23 | userName: "",//用户名字
24 | userPic: "", //用户头像
25 | myWidth: 0,//进度条
26 | myGrade: 0,//分数
27 | click: 0,//点击
28 | user_id: '', //用户id
29 | name: "",//好友名称
30 | pic: '',//好友头像
31 | match_id: '',//房间id
32 | yId: '',//好友id
33 | myGr: 0,//好友分数
34 | yWidth: 0,//好友进度条,
35 | },
36 | onLoad: function (options) {
37 | console.log(options);
38 | wx.setNavigationBarTitle({
39 | title: '对战题目',
40 | });
41 |
42 | this.setData({
43 | user_id: options.user_id,
44 | name: options.name,
45 | pic: options.pic,
46 | match_id: options.match_id,
47 | yId: options.yId
48 | });
49 | //获取用户的头像与名字/
50 | let that = this;
51 | wx.login({
52 | success: function (e) {
53 | wx.getUserInfo({
54 | success: function (res) {
55 | let userInfo = res.userInfo;
56 | let nickName = userInfo.nickName; //用户名
57 | let avatarUrl = userInfo.avatarUrl; //头像链接
58 | that.setData({
59 | userName: nickName,
60 | userPic: avatarUrl
61 | })
62 | }
63 | });
64 | }
65 | });
66 |
67 | wx.request({
68 | url: "https://dati.51laiding.com/?r=friend/start",
69 | data: {
70 | match_id: that.data.match_id
71 | },
72 | method: "GET",
73 | success: function (res) {
74 | that.setData({
75 | items: res.data
76 | });
77 | // 初始渲染题目
78 | that.setData({
79 | subject: that.data.items[that.data.number][0].content,
80 | record: that.data.items[that.data.number][1]
81 | });
82 | }
83 | });
84 |
85 | // 倒计时功能
86 | setTimeout(_ => {
87 | this.setData({
88 | hint: true,
89 | answer: false,
90 | answers: false
91 | });
92 | }, 1000);
93 |
94 | if (that.data.time === 10) {
95 | that.setData({
96 | tim: setInterval(function () {
97 | that.setData({
98 | time: that.data.time - 1
99 | });
100 |
101 | //当用户没有点击发送请求倒计时结束自动发送请求
102 | if (that.data.time === 0) {
103 | console.log("我被触发了");
104 | that.setData({
105 | number: that.data.number + 1,
106 | time: "",
107 | answers: true
108 | });
109 |
110 | // 发送请求
111 | wx.request({
112 | url: "https://dati.51laiding.com/?r=friend/go",
113 | data: {
114 | user_id: that.data.user_id,
115 | yId: that.data.yId,
116 | myGrade: that.data.myGrade
117 | },
118 | method: "GET"
119 | });
120 | }
121 | }
122 | ,
123 | 1000
124 | )
125 | })
126 | }
127 | },
128 |
129 | onShow: function () {
130 | let that = this;
131 | let timer;
132 | // 拿到信息
133 | timer = setInterval(function () {
134 | wx.request({
135 | url: "https://dati.51laiding.com/?r=friend/come",
136 | method: "GET",
137 | data:{
138 | match_id:that.data.match_id
139 | },
140 | success: function (res) {
141 | if (res.data !== "") {
142 | console.log(res.data);
143 | console.log(that.data.number + "----");
144 | //渲染个人的成绩与进度条
145 | console.log(res.data);
146 | if (that.data.user_id === res.data[0].user_id) {
147 | that.setData({
148 | myGr: res.data[1].grade,
149 | yWidth: res.data[1].grade * 0.52
150 | });
151 | }
152 | else if (that.data.yId === res.data[0].user_id) {
153 | that.setData({
154 | myGr: res.data[1].grade,
155 | yWidth: res.data[1].grade * 0.52
156 | });
157 | }
158 | else {
159 | that.setData({
160 | myGr: res.data[0].grade,
161 | yWidth: res.data[0].grade * 0.52
162 | });
163 | }
164 | //到下一题
165 | if (that.data.number <= that.data.items.length - 1) {
166 | //清空数据
167 | wx.request({
168 | url: "https://dati.51laiding.com/?r=friend/delete",
169 | method: "GET",
170 | });
171 | console.log("我走了");
172 |
173 | setTimeout(_ => {
174 | that.setData({
175 | result: true,
176 | hint: false,
177 | errorIcon: false,
178 | });
179 | id = ""; //每次到下一题让id为空
180 | switch (that.data.number) {
181 | case 1:
182 | that.setData({
183 | title: "第二题",
184 | });
185 | break;
186 | case 2:
187 | that.setData({
188 | title: "第三题",
189 | });
190 | break;
191 | case 3:
192 | that.setData({
193 | title: "第四题",
194 | });
195 | break;
196 | case 4:
197 | that.setData({
198 | title: "最后一题",
199 | });
200 | break;
201 | case 5:
202 | }
203 | that.setData({
204 | subject: that.data.items[that.data.number][0].content,
205 | record: that.data.items[that.data.number][1],
206 | bg: '',
207 | falg: true
208 | });
209 | // 题目出现
210 | setTimeout(_ => {
211 | that.setData({
212 | answer: false,
213 | answers: false,
214 | hint: true
215 | });
216 |
217 | //重新开始倒计时
218 | that.setData({
219 | time: 10
220 | });
221 | // 点击后自动
222 | // that.setData({
223 | // timer: setInterval(_ => {
224 | // that.setData({
225 | // time: that.data.time - 1
226 | // });
227 | // // 当时间为0时
228 | // if (that.data.time === 0) {
229 | //
230 | // that.setData({
231 | // answer: true,
232 | // errorIcon: true,
233 | // });
234 | // for (let i = 0; i < that.data.record.length; i++) {
235 | // if (that.data.record[i].name === 'shh') {
236 | // that.setData({
237 | // result: false,
238 | // right: that.data.record[i].value,
239 | // time: 10,
240 | // number: that.data.number + 1,
241 | // });
242 | // if (that.data.number > that.data.items.length - 1) {
243 | // clearInterval(that.data.timer);
244 | // wx.redirectTo({
245 | // url: '../answerResult/answerResult?myGrade=' + that.data.myGrade + "&user_id=" + that.data.user_id + "&myGr=" + that.data.myGr + "&name=" + that.data.name + "&pic=" + that.data.pic
246 | // });
247 | // return;
248 | // }
249 | // // 题号
250 | // switch (that.data.number) {
251 | // case 1:
252 | // that.setData({
253 | // title: "第二题",
254 | // });
255 | // break;
256 | // case 2:
257 | // that.setData({
258 | // title: "第三题",
259 | // });
260 | // break;
261 | // case 3:
262 | // that.setData({
263 | // title: "第四题",
264 | // });
265 | // break;
266 | // case 4:
267 | // that.setData({
268 | // title: "第五题",
269 | // });
270 | // break;
271 | // case 5:
272 | // that.setData({
273 | // title: "第六题",
274 | // });
275 | // break;
276 | // case 6:
277 | // that.setData({
278 | // title: "第七题",
279 | // });
280 | // break;
281 | // case 7:
282 | // that.setData({
283 | // title: "第八题",
284 | // });
285 | // break;
286 | // case 8:
287 | // that.setData({
288 | // title: "第九题",
289 | // });
290 | // break;
291 | // case 9:
292 | // that.setData({
293 | // title: "第十题",
294 | // });
295 | // break;
296 | // }
297 | // // 第二题开始
298 | // setTimeout(_ => {
299 | // that.setData({
300 | // time: 10,
301 | // result: true,
302 | // hint: false
303 | // });
304 | // // 提示消失,题目出来
305 | // setTimeout(_ => {
306 | // that.setData({
307 | // time: 10,
308 | // hint: true,
309 | // answer: false,
310 | // subject: that.data.items[that.data.number][0].content,
311 | // record: that.data.items[that.data.number][1]
312 | // });
313 | // }, 900);
314 | // }, 900)
315 | // }
316 | // }
317 | // }
318 | // }, 1000)
319 | // });
320 | }, 1000);
321 | }, 2000);
322 | }
323 |
324 | if (that.data.number === 5) {
325 | that.setData({
326 | number: 0,
327 | hint: true,
328 | title: ""
329 | });
330 | setTimeout(function () {
331 | console.log("我被跳转了");
332 | wx.navigateTo({
333 | url: '../answerResult/answerResult?myGrade=' + that.data.myGrade + "&user_id=" + that.data.user_id + "&myGr=" + that.data.myGr + "&name=" + that.data.name + "&pic=" + that.data.pic + "&match_id=" + that.data.match_id
334 | });
335 | }, 2500)
336 | }
337 | }
338 | }
339 | });
340 | }, 200)
341 | },
342 |
343 | // 答题
344 | affirm: function (e) {
345 | let that = this;
346 | if (this.data.falg) {
347 | //点击后停止倒计时
348 | clearInterval(this.data.timer);
349 |
350 | if (that.data.time > 0) {
351 | // clearInterval(that.data.tim);
352 | that.setData({
353 | number: that.data.number + 1,
354 | })
355 | } else {
356 | that.setData({
357 | number: that.data.number
358 | })
359 | }
360 |
361 | this.setData({
362 | falg: false,
363 | click: this.data.click++,
364 | answers: true
365 | });
366 |
367 | id = e.currentTarget.dataset.id;
368 | this.setData({
369 | count: id
370 | });
371 | for (let i = 0; i < this.data.record.length; i++) {
372 | if (this.data.record[i].name === 'shh') {
373 | this.setData({
374 | right: this.data.record[i].value,
375 | });
376 |
377 | if (this.data.count === i) {
378 | this.setData({
379 | bg: 'correct',
380 | myGrade: +this.data.myGrade + (this.data.time / 10) * 100
381 | });
382 | this.setData({
383 | myWidth: this.data.myGrade * 0.52,
384 | })
385 | }
386 | if (this.data.count !== i) {
387 | this.setData({
388 | bg: 'error'
389 | })
390 | }
391 | }
392 | }
393 |
394 | that.setData({
395 | time: ""
396 | });
397 |
398 | setTimeout(function () {
399 | that.setData({
400 | result: false,
401 | answer: true,
402 | choose: that.data.record[id].value
403 | });
404 | if (that.data.choose === that.data.right) {
405 | that.setData({
406 | errorIcon: true
407 | })
408 | } else {
409 | that.setData({
410 | errorIcon: false
411 | })
412 | }
413 | }, 1000);
414 |
415 |
416 | //发送请求
417 | wx.request({
418 | url: "https://dati.51laiding.com/?r=friend/go",
419 | data: {
420 | user_id: that.data.user_id,
421 | yId: that.data.yId,
422 | myGrade: that.data.myGrade
423 | },
424 | method: "GET"
425 | });
426 |
427 | }
428 | },
429 | });
430 |
--------------------------------------------------------------------------------
/pages/answer/answer.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{userName}}
7 |
8 |
9 | 1400
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | {{myGrade}}
18 |
19 | {{time}}S
20 |
21 |
22 |
23 |
24 |
25 | {{name}}
26 |
27 |
28 | 1400
29 |
30 |
31 |
32 | {{myGr}}
33 |
34 |
35 |
36 |
37 | {{time}}S
38 |
39 |
40 |
41 | {{title}}
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
52 |
53 |
54 |
58 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/pages/answer/answer.wxss:
--------------------------------------------------------------------------------
1 | page,.container{
2 | padding: 0;
3 | }
4 | /*用户信息*/
5 | .user{
6 | width: 100%;
7 | height: 300rpx;
8 | margin-top: 60rpx;
9 | position: relative;
10 | }
11 | .user .firstUser,.lastUser{
12 | width:340rpx;
13 | height: 215rpx;
14 | }
15 | .user .firstUser .time,.lastUser .time{
16 | width: 142rpx;
17 | height: 142rpx;
18 | position: absolute;
19 | top:50%;
20 | line-height: 142rpx;
21 | transform: translateY(-50%);
22 | font-size: 70rpx;
23 | text-align: center;
24 | background-color: rgba(0,0,0,.3);
25 | border-radius: 50%;
26 | }
27 | .user .firstUser .time{
28 | right: 20rpx;
29 | }
30 | .lastUser .time{
31 | left: 20rpx;
32 | }
33 | .user .firstUser{
34 | background-color: #d34685;
35 | border-radius: 0 150rpx 150rpx 0;
36 | position: absolute;
37 | }
38 | .user .firstUser .userInfo{
39 | text-align: center;
40 | position: absolute;
41 | top:50%;
42 | transform: translateY(-50%);
43 | margin-left:55rpx;
44 | }
45 | .user .firstUser .userInfo image{
46 | width: 25rpx;
47 | height: 25rpx;
48 | }
49 | .user .pic{
50 | width: 142rpx;
51 | height: 142rpx;
52 | border-radius: 50%;
53 | position: absolute;
54 | top:50%;
55 | transform: translateY(-50%);
56 | border: 10rpx solid #fff;
57 | box-sizing: border-box;
58 | }
59 | .user .firstUser image{
60 | right: 20rpx;
61 | }
62 | .user .lastUser{
63 | position: absolute;
64 | background-color: #5c89e8;
65 | border-radius: 150rpx 0 0 150rpx;
66 | right: 0;
67 | }
68 | .user .lastUser image{
69 | left: 20rpx;
70 | }
71 | .user .lastUser .userInfo image{
72 | width: 25rpx;
73 | height: 25rpx;
74 | }
75 | .user .lastUser .userInfo{
76 | text-align: center;
77 | position: absolute;
78 | top:50%;
79 | transform: translateY(-50%);
80 | margin-left: 190rpx;
81 | }
82 |
83 | .user .progress{
84 | width: 100%;
85 | position: absolute;
86 | bottom: -10rpx;
87 | }
88 | .user .progress view{
89 | position: absolute;
90 | width: 260rpx;
91 | height: 16rpx;
92 | background-color: rgb(50,40,140);
93 | border: 2rpx solid rgb(188,181,255);
94 | border-radius: 8rpx;
95 | box-sizing: border-box;
96 | }
97 | /*左边*/
98 | .user .progress .fl>.bar{
99 | height: 100%;
100 | background-color: rgb(251,108,74);
101 | border: none;
102 | }
103 | .user .progress view.fl{
104 | left: 10rpx;
105 | }
106 |
107 | /*右边*/
108 | .user .progress .fr>.bar{
109 | width: 100%;
110 | height: 100%;
111 | background-color: rgb(251,108,74);
112 | border: none;
113 | }
114 |
115 | .user .progress view.fr{
116 | right: 10rpx;
117 | }
118 | .user .progress text{
119 | position: absolute;
120 | top: -10rpx;
121 | }
122 | .user .progress text.fl{
123 | left: 0;
124 | }
125 | .user .progress text.fr{
126 | right: 0;
127 | }
128 | /*提示*/
129 | .hint{
130 | width: 100%;
131 | text-align: center;
132 | font-size: 34rpx;
133 | font-weight: 700;
134 | }
135 | /*题目*/
136 | .topic{
137 | margin: 50rpx 0;
138 | box-sizing: border-box;
139 | }
140 | .topic label{
141 | width: 100%;
142 | display: block;
143 | font-size: 34rpx;
144 | font-weight: 700;
145 | text-align: center;
146 | margin-bottom: 35rpx;
147 | }
148 | .answer{
149 | margin: 0 auto;
150 | width: 500rpx;
151 | }
152 | .answer button{
153 | margin-bottom: 20rpx;
154 | color: white;
155 | border: 1px solid #fff;
156 | border-radius: 10rpx;
157 | }
158 | .bg{
159 | background-color:transparent;
160 | }
161 | .result{
162 | margin: 0 auto;
163 | margin-top: 100rpx;
164 | width: 500rpx;
165 | }
166 | .result button{
167 | margin-bottom: 20rpx;
168 | color: white;
169 | position: relative;
170 | border-radius: 10rpx;
171 | }
172 | .result button image{
173 | width: 45rpx;
174 | height: 45rpx;
175 | position: absolute;
176 | left: 20rpx;
177 | top: 35rpx
178 | }
179 | /*正确*/
180 | .correct{
181 | background-color: #a3d238;
182 | }
183 | /*错误*/
184 | .error{
185 | background-color:#fb6c4a ;
186 | }
187 |
--------------------------------------------------------------------------------
/pages/answerResult/answerResult.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data:{
3 | userName:"",//用户名字
4 | userPic:"",//用户头像
5 | myGrade:'', //自己的总分
6 | myGr:"", //另外一人的总分
7 | victory:"", //胜利或者失败
8 | win:"", //胜利或者失败
9 | user_id:'',//用户id
10 | name:"", //好友名称
11 | pic:"", //好友头像
12 | match_id:"",
13 | nav:["他们都来了,你呢?","你敢来智商比试么,谁输就真心话大冒险","智慧担当在此,你能超过我吗?","点识成金,答题赢奖,点击进入,和我一起..."]
14 | },
15 | onLoad: function (options) {
16 | this.setData({
17 | myGrade:options.myGrade,
18 | user_id:options.user_id,
19 | myGr:options.myGr,
20 | name:options.name,
21 | pic:options.pic,
22 | match_id:options.match_id
23 | });
24 | wx.setNavigationBarTitle({
25 | title: '对战结果'
26 | });
27 |
28 | let that = this;
29 | //关闭房间
30 | wx.request({
31 | url: "https://dati.51laiding.com/?r=friend/close",
32 | data: {
33 | match_id:that.data.match_id
34 | },
35 | method: "GET",
36 | success:function (res) {
37 | console.log(res.data);
38 | }
39 | });
40 |
41 |
42 | //判断谁胜谁败
43 | let nav = ["胜","败"];
44 | if(+this.data.myGrade > +this.data.myGr){
45 | this.setData({
46 | victory:nav[0],
47 | win:nav[1]
48 | })
49 | }else {
50 | this.setData({
51 | victory:nav[1],
52 | win:nav[0]
53 | })
54 | }
55 |
56 | //获取用户的头像与名字
57 | wx.getUserInfo({
58 | success: function(res) {
59 | let userInfo = res.userInfo;
60 | let nickName = userInfo.nickName ; //用户名
61 | let avatarUrl = userInfo.avatarUrl; //头像链接
62 | that.setData({
63 | userName: nickName,
64 | userPic:avatarUrl
65 | })
66 | }
67 | });
68 | },
69 | getClose:function () {
70 | wx.redirectTo({
71 | url:'../index/index'
72 | })
73 | },
74 | getAgain:function () {
75 | wx.redirectTo({
76 | url: '../friend/friend?user_id='+this.data.user_id
77 | })
78 | },
79 | onShareAppMessage: function (res) {
80 | let num = Math.round(Math.random(0,1)*3);
81 | return{
82 | title:this.data.nav[num],
83 | path:"/pages/index/index"
84 | }
85 | }
86 | });
--------------------------------------------------------------------------------
/pages/answerResult/answerResult.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{userName}}
7 |
8 |
9 | 1400
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | {{name}}
21 |
22 |
23 | 1400
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | {{myGrade}}分{{victory}}
33 |
34 |
35 | {{myGr}}分{{win}}
36 |
37 |
38 |
39 |
40 |
41 |
42 | 继续挑战
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/pages/answerResult/answerResult.wxss:
--------------------------------------------------------------------------------
1 | page,.container{
2 | padding: 0;
3 | }
4 | /*用户信息*/
5 | .user{
6 | width: 100%;
7 | height: 171rpx;
8 | margin-top: 150rpx;
9 | position: relative;
10 | }
11 | .user .firstUser .hg{
12 | width:150rpx;
13 | height:92rpx;
14 | position:absolute;
15 | left:175rpx;
16 | top:-31rpx;
17 | transform:rotate(18deg)
18 | }
19 | .user .lastUser .hg{
20 | width:150rpx;
21 | height:92rpx;
22 | position:absolute;
23 | left:-10rpx;
24 | top:-31rpx;
25 | transform:rotate(-27deg)
26 | }
27 | .user .firstUser,.lastUser{
28 | width:310rpx;
29 | height: 171rpx;
30 | }
31 | .user .firstUser .time,.lastUser .time{
32 | position: absolute;
33 | top:50%;
34 | transform: translateY(-50%);
35 | font-size: 70rpx;
36 | font-weight: 700;
37 | }
38 | .user .firstUser .time{
39 | right: 45rpx;
40 | }
41 | .lastUser .time{
42 | left: 45rpx;
43 | }
44 | .user .firstUser{
45 | background-color: #d34685;
46 | border-radius: 0 150rpx 150rpx 0;
47 | position: absolute;
48 | }
49 | .user .firstUser .userInfo{
50 | text-align: center;
51 | position: absolute;
52 | top:50%;
53 | transform: translateY(-50%);
54 | margin-left:35rpx;
55 | }
56 | .user .firstUser .userInfo image{
57 | width: 25rpx;
58 | height: 25rpx;
59 | }
60 | .user .pic{
61 | width: 144rpx;
62 | height: 144rpx;
63 | border-radius: 50%;
64 | position: absolute;
65 | top:50%;
66 | transform: translateY(-50%);
67 | border: 10rpx solid #fff;
68 | box-sizing: border-box;
69 | }
70 | .user .firstUser image{
71 | right: 20rpx;
72 | }
73 | .user .lastUser{
74 | position: absolute;
75 | background-color: #5c89e8;
76 | border-radius: 150rpx 0 0 150rpx;
77 | right: 0;
78 | }
79 | .user .lastUser image{
80 | left: 20rpx;
81 | }
82 | .user .lastUser .userInfo image{
83 | width: 25rpx;
84 | height: 25rpx;
85 | }
86 | .user .lastUser .userInfo{
87 | text-align: center;
88 | position: absolute;
89 | top:50%;
90 | transform: translateY(-50%);
91 | margin-left: 190rpx;
92 | }
93 | .progress{
94 | height: 100rpx;
95 | width: 100%;
96 | display: flex;
97 | }
98 | .progress view{
99 | flex: 1;
100 | width: 100%;
101 | height: 100rpx;
102 | line-height: 100rpx;
103 | position: relative;
104 | font-size: 40rpx;
105 | padding: 0 50rpx;
106 | }
107 | .progress .fl{
108 | background-color: #d34685;
109 | border-radius: 0 100rpx 100rpx 0;
110 | }
111 | .progress .fr{
112 | background-color: #5c89e8;
113 | border-radius: 100rpx 0 0 100rpx;
114 | }
115 | .progress .fr .toRight{
116 | margin-left: 150rpx;
117 | }
118 | .progress .victory,.defeated{
119 | position: absolute;
120 | top: 50%;
121 | transform: translateY(-50%);
122 | font-size: 60rpx;
123 | }
124 | .progress .victory{
125 | right: 40rpx;
126 | }
127 | .progress .defeated{
128 | left: 40rpx;
129 | }
130 |
131 | .again{
132 | width: 100%;
133 | height: 100%;
134 | margin-top: 200rpx;
135 | text-align: center;
136 | position: relative;
137 | }
138 | .again image{
139 | width: 239rpx;
140 | height: 239rpx;
141 | }
142 | .again text{
143 | position: absolute;
144 | top: 50%;
145 | left: 50%;
146 | transform: translate(-50%,-50%);
147 | color: rgb(77,68,163);
148 | font-size: 34rpx;
149 | }
150 |
151 | .btn{
152 | margin-top: 20rpx;
153 | padding: 0 100rpx;
154 | text-align: center;
155 | }
156 | .btn .bey,.next{
157 | float: left;
158 | width: 260rpx;
159 | height: 80rpx;
160 | border-radius: 10rpx;
161 | font-size: 40rpx;
162 | line-height: 80rpx;
163 | }
164 | .btn .bey{
165 | background-color: rgb(244,170,0);
166 | color: #fff;
167 | }
168 | .btn .next{
169 | background-color: rgb(165,207,36);
170 | margin-left: 28rpx;
171 | color: #fff;
172 | }
173 | .btn .tex{
174 | margin-top: 28rpx;
175 | color: rgb(216,204,255);
176 | }
--------------------------------------------------------------------------------
/pages/challenge/challenge.js:
--------------------------------------------------------------------------------
1 | //index.js
2 | //获取应用实例
3 | Page({
4 | data:{
5 | userName:"",//用户名字
6 | userPic:"", //用户头像
7 | nav:["他们都来了,你呢?","你敢来智商比试么,谁输就真心话大冒险","智慧担当在此,你能超过我吗?","点识成金,答题赢奖,点击进入,和我一起..."]
8 | },
9 | onLoad:function () {
10 | wx.setNavigationBarTitle({
11 | title: '挑战赛'
12 | });
13 |
14 | //获取用户的头像与名字
15 | let that = this;
16 | wx.getUserInfo({
17 | success: function(res) {
18 | var userInfo = res.userInfo
19 | var nickName = userInfo.nickName //用户名
20 | var avatarUrl = userInfo.avatarUrl //头像链接
21 | that.setData({
22 | userName: nickName,
23 | userPic:avatarUrl
24 | })
25 | }
26 | });
27 |
28 | setTimeout(function () {
29 | wx.navigateTo({
30 | url:'../answer/answer'
31 | })
32 | },1000)
33 | },
34 | onShareAppMessage: function (res) {
35 | let num = Math.round(Math.random(0,1)*3);
36 | return{
37 | title:this.data.nav[num],
38 | path:"/pages/index/index"
39 | }
40 | }
41 | });
--------------------------------------------------------------------------------
/pages/challenge/challenge.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{userName}}
6 |
7 |
8 |
9 |
10 | ?
11 | ...
12 |
13 |
14 |
15 | 对方扭扭捏捏还没到,可能是个姑娘,再等等...
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/pages/challenge/challenge.wxss:
--------------------------------------------------------------------------------
1 | page{
2 | padding: 60rpx 0 0 0;
3 | }
4 | .container{
5 | padding: 0;
6 | }
7 | /*用户信息*/
8 | .user{
9 | width: 100%;
10 | height: 350rpx;
11 | display: flex;
12 | text-align: center;
13 | position: relative;
14 | }
15 | .user>image{
16 | width: 80rpx;
17 | height: 80rpx;
18 | position: absolute;
19 | left: 50%;
20 | top: 50%;
21 | transform: translate(-50%,-50%);
22 | }
23 | .user view{
24 | flex: 1;
25 | }
26 | .user .firstUser,.lastUser{
27 | width:306rpx;
28 | height: 150rpx;
29 | background-color: #d34685;
30 | border-radius: 0 150rpx 150rpx 0;
31 | position: relative;
32 | text-align: center;
33 | line-height: 150rpx;
34 | }
35 | .user .firstUser image{
36 | width: 124rpx;
37 | height: 124rpx;
38 | border-radius: 50%;
39 | position: absolute;
40 | right: 20rpx;
41 | top:50%;
42 | transform: translateY(-50%);
43 | border: 10rpx solid #fff;
44 | box-sizing: border-box;
45 | }
46 | .user .lastUser{
47 | margin-top: 200rpx;
48 | background-color: #5c89e8;
49 | border-radius: 150rpx 0 0 150rpx;
50 | }
51 | .user .lastUser .pic{
52 | width: 124rpx;
53 | height: 124rpx;
54 | border: 10rpx solid #fff;
55 | border-radius: 50%;
56 | position: absolute;
57 | left: 20rpx;
58 | top:50%;
59 | transform: translateY(-50%);
60 | font-size: 80rpx;
61 | box-sizing: border-box;
62 | text-align: center;
63 | line-height: 100rpx;
64 | }
65 | /*文字*/
66 | .container>text{
67 | width: 100%;
68 | display: block;
69 | font-size: 32rpx;
70 | text-align: center;
71 | font-weight: 700;
72 | margin-top: 53rpx;
73 | }
74 | /*邀请*/
75 | .btn{
76 | margin-top: 165rpx;
77 | padding: 0 100rpx;
78 | }
79 | .btn .bey,.next{
80 | float: left;
81 | width: 260rpx;
82 | height: 80rpx;
83 | border-radius: 10rpx;
84 | font-size: 36rpx;
85 | text-align: center;
86 | line-height: 80rpx;
87 | }
88 | .btn .bey{
89 | color: rgb(77,68,163);
90 | background-color: #fff;
91 | }
92 | .btn .next{
93 | background-color: rgb(244,172,0);
94 | margin-left: 28rpx;
95 | color: #fff;
96 | }
--------------------------------------------------------------------------------
/pages/friend/friend.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | userName: "",//用户名字
4 | userPic: "", //用户头像
5 | nav: ["他们都来了,你呢?", "你敢来智商比试么,谁输就真心话大冒险", "智慧担当在此,你能超过我吗?", "点识成金,答题赢奖,点击进入,和我一起..."],
6 | user_id: '', //用户id
7 | items: '', //拿到的题目
8 | match_id: '', //房间id
9 | name: "...",//等待好友进入时显示的名字
10 | pic: "http://47.97.185.141/xcx-images/dengdai.png",//等待好友进入时显示的头像
11 | code: "",//好友code码
12 | yId:""//用户id
13 | },
14 | onLoad: function (options) {
15 | wx.setNavigationBarTitle({
16 | title: '好友对战'
17 | });
18 | this.setData({
19 | user_id: options.user_id,
20 | });
21 |
22 | let that = this;
23 | //判断是否创建房间
24 | if (options.match_id) {
25 | this.setData({
26 | match_id: options.match_id
27 | });
28 | } else {
29 | wx.request({
30 | url: "https://dati.51laiding.com/?r=friend/join",
31 | data: {
32 | user_id: that.data.user_id
33 | },
34 | method: "GET",
35 | success: function (res) {
36 | that.setData({
37 | match_id: res.data
38 | });
39 | }
40 | });
41 | }
42 |
43 |
44 | //获取用户的头像与名字
45 | wx.login({
46 | success: function (e) {
47 | wx.getUserInfo({
48 | success: function (res) {
49 | let userInfo = res.userInfo;
50 | let nickName = userInfo.nickName; //用户名
51 | let avatarUrl = userInfo.avatarUrl; //头像链接
52 | that.setData({
53 | userName: nickName,
54 | userPic: avatarUrl,
55 | code: e.code,
56 | });
57 |
58 | let timer;
59 | timer = setInterval(function () {
60 | wx.request({
61 | url: "https://dati.51laiding.com/?r=friend/build",
62 | data: {
63 | user_id: that.data.user_id || "",
64 | nickName: that.data.userName,
65 | avatarUrl: that.data.userPic,
66 | code: that.data.code,
67 | match_id: that.data.match_id
68 | },
69 | method: "GET",
70 | success: function (res) {
71 | that.setData({
72 | name: res.data.user_name,
73 | pic: res.data.user_photo,
74 | yId:res.data.user_id
75 | });
76 |
77 | //获取到好友信息后跳转页面
78 | if (res.data != "") {
79 | clearInterval(timer);
80 | wx.navigateTo({
81 | url: '../answer/answer?name=' + that.data.name + "&pic=" + that.data.pic + "&user_id=" + that.data.user_id + "&match_id=" + that.data.match_id + "&yId=" + that.data.yId
82 | });
83 | }
84 | }
85 | });
86 | }, 2000);
87 | }
88 | });
89 | }
90 | });
91 | },
92 | goodBey: function () {
93 | wx.redirectTo({
94 | url: '../index/index'
95 | })
96 | },
97 | onShareAppMessage: function (res) {
98 | let num = Math.round(Math.random(0, 1) * 3);
99 | return {
100 | title: this.data.nav[num],
101 | path: "/pages/friend/friend?match_id=" + this.data.match_id,
102 | };
103 | }
104 | });
--------------------------------------------------------------------------------
/pages/friend/friend.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{userName}}
6 |
7 |
8 |
9 |
10 |
11 | {{name}}
12 |
13 |
14 |
15 | 对方扭扭捏捏还没到,可能是个姑娘,再等等...
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/pages/friend/friend.wxss:
--------------------------------------------------------------------------------
1 | page{
2 | padding: 60rpx 0 0 0;
3 | }
4 | .container{
5 | padding: 0;
6 | }
7 | /*用户信息*/
8 | .user{
9 | width: 100%;
10 | height: 350rpx;
11 | display: flex;
12 | text-align: center;
13 | position: relative;
14 | }
15 | .user>image{
16 | width: 80rpx;
17 | height: 80rpx;
18 | position: absolute;
19 | left: 50%;
20 | top: 50%;
21 | transform: translate(-50%,-50%);
22 | }
23 | .user view{
24 | flex: 1;
25 | }
26 | .user .firstUser,.lastUser{
27 | width:306rpx;
28 | height: 150rpx;
29 | background-color: #d34685;
30 | border-radius: 0 150rpx 150rpx 0;
31 | position: relative;
32 | text-align: center;
33 | line-height: 150rpx;
34 | }
35 | .user .firstUser image{
36 | width: 124rpx;
37 | height: 124rpx;
38 | border-radius: 50%;
39 | position: absolute;
40 | right: 20rpx;
41 | top:50%;
42 | transform: translateY(-50%);
43 | box-sizing: border-box;
44 | }
45 | .user .lastUser{
46 | margin-top: 200rpx;
47 | background-color: #5c89e8;
48 | border-radius: 150rpx 0 0 150rpx;
49 | }
50 | .user .lastUser image{
51 | width: 124rpx;
52 | height: 124rpx;
53 | border-radius: 50%;
54 | position: absolute;
55 | left: 20rpx;
56 | top:50%;
57 | transform: translateY(-50%);
58 | box-sizing: border-box;
59 | }
60 | /*文字*/
61 | .container>text{
62 | width: 100%;
63 | display: block;
64 | font-size: 32rpx;
65 | text-align: center;
66 | font-weight: 700;
67 | margin-top: 53rpx;
68 | }
69 | /*邀请*/
70 | .btn{
71 | margin-top: 165rpx;
72 | padding: 0 100rpx;
73 | }
74 | .btn .bey,.next{
75 | float: left;
76 | width: 260rpx;
77 | height: 80rpx;
78 | border-radius: 10rpx;
79 | font-size: 36rpx;
80 | text-align: center;
81 | line-height: 80rpx;
82 | }
83 | .btn .bey{
84 | color: rgb(77,68,163);
85 | background-color: #fff;
86 | }
87 | .btn .next{
88 | background-color: rgb(244,172,0);
89 | margin-left: 28rpx;
90 | color: #fff;
91 | }
92 |
--------------------------------------------------------------------------------
/pages/index/index.js:
--------------------------------------------------------------------------------
1 | //index.js
2 | //获取应用实例
3 | const app = getApp();
4 |
5 | Page({
6 | data: {
7 | userName: "",//用户名字
8 | userPic: "",//用户头像
9 | msg: "欢迎进入“点识成金丨答题”快快发挥你的才智,进入答题吧! ", //公告里第一行字
10 | msgT:"“迎新春,点识成金”", //公告里第二行字
11 | timer: 0,
12 | money: "",//用户金币
13 | wisdom: '', //智豪榜
14 | rank:'',//奖池赛排名
15 | user_id:'', //用户id
16 | OPEN_ID:"",
17 | image:""
18 | },
19 | onShow: function () {
20 | wx.setNavigationBarTitle({
21 | title: '首页'
22 | });
23 |
24 | //让公告里的字动起来
25 | this.setData({
26 | timer: setInterval(_ => {
27 | this.setData({
28 | msg: this.data.msg.slice(1) + this.data.msg.slice(0, 1),
29 | })
30 | }, 500)
31 | });
32 | // 获取用户信息
33 | let that = this;
34 | wx.getUserInfo({
35 | success: function (res) {
36 | let userInfo = res.userInfo;
37 | let nickName = userInfo.nickName; //用户名
38 | let avatarUrl = userInfo.avatarUrl; //头像链接
39 | that.setData({
40 | userName: nickName,
41 | userPic: avatarUrl
42 | });
43 |
44 | wx.login({
45 | success: function (e) {
46 | wx.request({
47 | url: "https://dati.51laiding.com/?r=index/index",
48 | data: {
49 | username: that.data.userName,
50 | photo: that.data.userPic,
51 | code: e.code,
52 | },
53 | method: "GET",
54 | success: function (res) {
55 | if(res.data.领奖状态 === "1"){
56 | that.setData({
57 | image:"http://47.97.185.141/xcx-images/lingjiang_@3x.png"
58 | })
59 | }else {
60 | that.setData({
61 | image:"http://47.97.185.141/xcx-images/lingjiangchenggong.png"
62 | })
63 | }
64 | that.setData({
65 | money: res.data.用户金币,
66 | wisdom: res.data.智豪榜,
67 | rank:res.data.奖池排名,
68 | user_id:res.data.用户ID,
69 | OPEN_ID:res.data.OPEN_ID
70 | })
71 | }
72 | });
73 | }
74 | });
75 | }
76 | });
77 | },
78 | prize:function () {
79 | let that = this;
80 | wx.request({
81 | url: "https://dati.51laiding.com/?r=index/award",
82 | data: {
83 | user_id:that.data.user_id
84 | },
85 | method: "GET",
86 | success: function (res) {
87 | that.setData({
88 | image:"http://47.97.185.141/xcx-images/lingjiangchenggong.png"
89 | });
90 | }
91 | });
92 | },
93 |
94 | getChallenge: function () {
95 | // wx.navigateTo({
96 | // url: '../challenge/challenge?user_id='+this.data.user_id
97 | // })
98 | wx.showToast({
99 | title:"暂无开放,敬请期待",
100 | duration:2000,
101 | icon:"none"
102 | });
103 | },
104 | getRecharge: function () {
105 | wx.navigateTo({
106 | url: '../recharge/recharge?user_id='+this.data.user_id+"&OPEN_ID="+this.data.OPEN_ID
107 | })
108 | },
109 | getFriend: function () {
110 | wx.navigateTo({
111 | url: '../friend/friend?user_id='+this.data.user_id
112 | })
113 | //微信自带的模态框,告诉用户充值成功
114 | // wx.showToast({
115 | // title:"暂无开放,敬请期待",
116 | // duration:2000,
117 | // icon:"none"
118 | // });
119 | },
120 | // getStore: function () {
121 | // // wx.navigateTo({
122 | // // // url: '../store/store?user_id='+this.data.user_id+"&total_money="+this.data.money
123 | // // })
124 | // },
125 | getJackpot: function () {
126 | wx.navigateTo({
127 | url: '../jackpot/jackpot?user_id='+this.data.user_id+"&user_money="+this.data.money
128 | })
129 | }
130 | });
131 |
--------------------------------------------------------------------------------
/pages/index/index.json:
--------------------------------------------------------------------------------
1 |
2 | {
3 | "backgroundTextStyle":"light",
4 | "navigationBarBackgroundColor": "#137dd7",
5 | "navigationBarTitleText": "WeChat",
6 | "navigationBarTextStyle":"#ffffff"
7 | }
8 |
--------------------------------------------------------------------------------
/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | {{userName}}
9 |
10 |
11 | {{money}}
12 |
13 |
14 |
15 |
16 | 奖池赛排名 {{rank}}
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | 公告:
25 |
26 |
27 |
28 | {{msg}}
29 |
30 |
31 | {{msgT}}
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | 奖池赛
45 |
46 |
47 | 200,000
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 好友对战
62 |
63 |
64 |
65 |
66 | 充值礼包
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | 挑战赛
75 |
76 |
77 |
78 |
79 | 暂未开放
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | 智豪榜
89 |
90 |
91 |
92 | {{wisdom[index].user_name}}
93 |
94 |
95 |
96 | {{wisdom[index].user_account}}
97 |
98 |
99 |
100 |
101 |
102 |
--------------------------------------------------------------------------------
/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | page{
3 | padding: 0;
4 | background-image: url("http://47.97.185.141/xcx-images/shouyebeijing.jpg");
5 | }
6 | .container{
7 | padding-bottom: 50rpx;
8 | }
9 | /*顶部*/
10 | .head{
11 | width: 710rpx;
12 | height: 280rpx;
13 | position: relative;
14 | box-sizing: border-box;
15 | }
16 | .head>image{
17 | width: 710rpx;
18 | height: 280rpx;
19 | border-radius: 10rpx;
20 | }
21 | .head .pic{
22 | width: 124rpx;
23 | height: 124rpx;
24 | position: absolute;
25 | top: 30rpx;
26 | left: 50%;
27 | transform: translateX(-50%);
28 | text-align: center;
29 | }
30 | .head .pic>image{
31 | width: 124rpx;
32 | height: 124rpx;
33 | border-radius: 50%;
34 | }
35 | .head .pic .money{
36 | display: inline-block;
37 | position: relative;
38 | text-align: center;
39 | width: 100%;
40 | }
41 | .head .pic .money>image{
42 | width: 30rpx;
43 | height: 30rpx;
44 | vertical-align: bottom;
45 | position: absolute;
46 | left: 0;
47 | bottom: 0;
48 | }
49 | .head .pic .money text{
50 | text-align: center;
51 | margin-left: 35rpx;
52 | }
53 |
54 | .head .accept{
55 | height: 35rpx;
56 | position: absolute;
57 | right: 23rpx;
58 | bottom: 70rpx;
59 | }
60 | .head .accept text{
61 | color: #ff3030;
62 | }
63 | .head .accept>image{
64 | width: 160rpx;
65 | height: 35rpx;
66 | margin-top: 10rpx;
67 | position: absolute;
68 | right: 0;
69 | }
70 |
71 |
72 | /*公告*/
73 | .affiche{
74 | margin-top: 20rpx;
75 | background-color: #2286de;
76 | width: 710rpx;
77 | height: 128rpx;
78 | border-radius: 10rpx;
79 | box-sizing: border-box;
80 | position: relative;
81 | }
82 | .affiche .title{
83 | position: absolute;
84 | left: 25rpx;
85 | top: 25rpx;
86 | font-size: 32rpx;
87 | font-weight: 700;
88 | }
89 | .affiche .afficheInfo{
90 | width: 505rpx;
91 | position: absolute;
92 | top: 20rpx;
93 | left: 137rpx;
94 | }
95 | .affiche .numberOne{
96 | height: 50rpx;
97 | overflow: hidden;
98 | margin-bottom: 10rpx;
99 | }
100 | .affiche .numberOne>image{
101 | width: 74rpx;
102 | height: 48rpx;
103 | vertical-align: middle;
104 | }
105 | .affiche .afficheInfo .ranking{
106 | position: absolute;
107 | left: 43rpx;
108 | display: flex;
109 | width: 400rpx;
110 | }
111 | .affiche .afficheInfo .ranking view{
112 | height: 45rpx;
113 | overflow: hidden;
114 | }
115 |
116 |
117 | /*内容*/
118 | .info{
119 | margin-top: 20rpx;
120 | box-sizing: border-box;
121 | margin-bottom: 22rpx;
122 | }
123 | .info .left{
124 | float: left;
125 | width: 468rpx;
126 | }
127 | /*奖池赛*/
128 | .info .left .prize{
129 | height: 264rpx;
130 | width: 468rpx;
131 | background-color: #f2b309;
132 | border-radius: 10rpx;
133 | display: flex;
134 | padding: 20rpx;
135 | position: relative;
136 | box-sizing: border-box;
137 | }
138 | .info .prize .title{
139 | font-size: 40rpx;
140 | font-weight: 700;
141 | }
142 | .info .left .prize view{
143 | flex: 1;
144 | }
145 | .info .prize .money{
146 | position: absolute;
147 | bottom: 34rpx;
148 | left: 20rpx;
149 | color: #fff000;
150 | }
151 | .info .left .prize .money>image{
152 | width: 30rpx;
153 | height: 30rpx;
154 | vertical-align: middle;
155 | margin-right: 10rpx;
156 | }
157 | .info .left .prize .pic image{
158 | width: 190rpx;
159 | height: 153rpx;
160 | margin-top: 43rpx;
161 | }
162 |
163 | .info .left .other{
164 | width: 468rpx;
165 | height: 450rpx;
166 | margin-top: 20rpx;
167 | }
168 | .info .other .otherLeft{
169 | float: left;
170 | width: 219rpx;
171 | height: 450rpx;
172 | }
173 | /*好友对战*/
174 | .info .otherLeft .friend{
175 | width: 219rpx;
176 | height: 272rpx;
177 | background-color: #2b51bd;
178 | border-radius: 10rpx;
179 | padding: 20rpx;
180 | box-sizing: border-box;
181 | }
182 | .info .otherLeft .friend text{
183 | font-size: 40rpx;
184 | font-weight: 700;
185 | }
186 | .info .otherLeft .friend image{
187 | width: 170rpx;
188 | height: 170rpx;
189 | margin-top: 10rpx;
190 | margin-left: 5rpx;
191 | }
192 | /*充值礼包*/
193 | .info .otherLeft .recharge{
194 | width: 219rpx;
195 | height:156rpx;
196 | background-color: #8009e9;
197 | margin-top: 20rpx;
198 | border-radius: 10rpx;
199 | padding: 20rpx;
200 | box-sizing: border-box;
201 | position: relative;
202 | }
203 | .info .otherLeft .recharge text{
204 | font-weight: 700;
205 | }
206 | .info .otherLeft .recharge image{
207 | width: 80rpx;
208 | height: 80rpx;
209 | position: absolute;
210 | right: 20rpx;
211 | bottom: 15rpx;
212 | vertical-align: bottom;
213 | }
214 | .info .other .otherRight{
215 | float: left;
216 | width: 219rpx;
217 | height: 450rpx;
218 | margin-left: 30rpx;
219 | }
220 | /*挑战赛*/
221 | .info .otherRight .challenge{
222 | width: 219rpx;
223 | height: 272rpx;
224 | background-color: #1be0f2;
225 | border-radius: 10rpx;
226 | padding: 20rpx;
227 | box-sizing: border-box;
228 | }
229 | .info .otherRight .challenge text{
230 | font-size: 40rpx;
231 | font-weight: 700;
232 | }
233 | .info .otherRight .challenge image{
234 | width: 170rpx;
235 | height: 170rpx;
236 | margin-top: 10rpx;
237 | margin-left: 5rpx;
238 | }
239 | /*积分商城*/
240 | .info .otherRight .store{
241 | width: 219rpx;
242 | height:156rpx;
243 | /*background-color: #ad12ab;*/
244 | background-color: rgba(0,0,0,0.5);
245 | margin-top: 20rpx;
246 | border-radius: 10rpx;
247 | padding: 20rpx;
248 | box-sizing: border-box;
249 | position: relative;
250 | }
251 | .info .otherRight .store text{
252 | font-weight: 700;
253 | }
254 | .info .otherRight .store image{
255 | width: 80rpx;
256 | height: 80rpx;
257 | position: absolute;
258 | right: 20rpx;
259 | bottom: 15rpx;
260 | vertical-align: bottom;
261 | }
262 | /*排名*/
263 | .info .right{
264 | float: left;
265 | width: 212rpx;
266 | height: 730rpx;
267 | background-color: #2286de;
268 | margin-left: 30rpx;
269 | border-radius: 10rpx;
270 | padding: 18rpx 12rpx;
271 | box-sizing: border-box;
272 | }
273 | .info .right>text{
274 | width: 100%;
275 | display: block;
276 | font-size: 35rpx;
277 | text-align: center;
278 | font-weight: 700;
279 | }
280 | .info .item{
281 | margin-bottom: 14rpx;
282 | margin-top: 35rpx;
283 | }
284 | .info .item .user .money {
285 | overflow: hidden;
286 | text-overflow:ellipsis;
287 | white-space: nowrap;
288 | }
289 | .info .item .user text{
290 | display: inline-block;
291 | width: 120rpx;
292 | height: 40rpx;
293 | overflow: hidden;
294 | /*text-overflow:ellipsis;*/
295 | /*white-space: nowrap;*/
296 | }
297 | .info .item .user image{
298 | width: 51rpx;
299 | height: 50rpx;
300 | border-radius: 50%;
301 | vertical-align: bottom;
302 | margin-right: 7rpx;
303 | border: 1px solid salmon;
304 | }
305 | .info .item .money image{
306 | width: 30rpx;
307 | height: 30rpx;
308 | vertical-align: middle;
309 | margin-right: 7rpx;
310 | }
311 | .info .item .money{
312 | color: #fff000;
313 | font-size: 28rpx;
314 | }
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
--------------------------------------------------------------------------------
/pages/info/info.js:
--------------------------------------------------------------------------------
1 | let tcity = require("../../utils/citys.js");
2 |
3 | Page({
4 | data: {
5 | provinces: [],
6 | province: "",
7 | citys: [],
8 | city: "",
9 | countys: [],
10 | county: '',
11 | value: [0, 0, 0],
12 | values: [0, 0, 0],
13 | condition: false,
14 | hint:true,
15 | goods_id:"",
16 | user_id:"",
17 | prize:"",
18 | user:"",
19 | number:"",
20 | detailAdd:""
21 | },
22 | bindChange: function(e) {
23 | let val = e.detail.value;
24 | let t = this.data.values;
25 | let cityData = this.data.cityData;
26 |
27 | if(val[0] != t[0]){
28 | const citys = [];
29 | const countys = [];
30 |
31 | for (let i = 0 ; i < cityData[val[0]].sub.length; i++) {
32 | citys.push(cityData[val[0]].sub[i].name)
33 | }
34 | for (let i = 0 ; i < cityData[val[0]].sub[0].sub.length; i++) {
35 | countys.push(cityData[val[0]].sub[0].sub[i].name)
36 | }
37 |
38 | this.setData({
39 | province: this.data.provinces[val[0]],
40 | city: cityData[val[0]].sub[0].name,
41 | citys:citys,
42 | county: cityData[val[0]].sub[0].sub[0].name,
43 | countys:countys,
44 | values: val,
45 | value:[val[0],0,0]
46 | });
47 |
48 | return;
49 | }
50 | if(val[1] != t[1]){
51 | console.log('city');
52 | const countys = [];
53 |
54 | for (let i = 0 ; i < cityData[val[0]].sub[val[1]].sub.length; i++) {
55 | countys.push(cityData[val[0]].sub[val[1]].sub[i].name)
56 | }
57 |
58 | this.setData({
59 | city: this.data.citys[val[1]],
60 | county: cityData[val[0]].sub[val[1]].sub[0].name,
61 | countys:countys,
62 | values: val,
63 | value:[val[0],val[1],0]
64 | })
65 | return;
66 | }
67 | if(val[2] != t[2]){
68 | console.log('county');
69 | this.setData({
70 | county: this.data.countys[val[2]],
71 | values: val
72 | })
73 | return;
74 | }
75 | },
76 | open:function(){
77 | this.setData({
78 | condition:!this.data.condition
79 | })
80 | },
81 | onLoad: function (options) {
82 | // 获取用户id与产品id
83 | this.setData({
84 | goods_id:options.goods_id,
85 | user_id:options.user_id,
86 | prize:options.prize
87 | });
88 |
89 | let that = this;
90 | tcity.init(that);
91 |
92 | let cityData = that.data.cityData;
93 |
94 | const provinces = [];
95 | const citys = [];
96 | const countys = [];
97 |
98 | for(let i=0;i
2 |
41 |
42 |
43 | 200以内车票需3W智币兑换,可多次提交
44 | 客服将会在20天之内联系您请您耐心等待
45 | 确定
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/pages/info/info.wxss:
--------------------------------------------------------------------------------
1 | page{
2 | background-image: none;
3 | padding: 0;
4 | }
5 | .container{
6 | padding: 0;
7 | color: #111;
8 | }
9 |
10 |
11 | .item{
12 | height: 99rpx;
13 | line-height: 99rpx;
14 | width: 100%;
15 | position: relative;
16 | border-bottom: 1rpx solid rgb(153,153,153);
17 | }
18 | .item text{
19 | position: absolute;
20 | left: 20rpx;
21 | }
22 | .item input{
23 | display: block;
24 | line-height: 99rpx;
25 | height: 99rpx;
26 | position: absolute;
27 | left: 0;
28 | margin-left: 150rpx;
29 | }
30 | .item .itemAdd{
31 | width: 100%;
32 | position: absolute;
33 | right: 20rpx;
34 | top: 50%;
35 | transform: translateY(-50%);
36 | }
37 | .item .itemAdd input{
38 | display: block;
39 | color: rgb(153,153,153);
40 | position: absolute;
41 | top: 50%;
42 | right: 30rpx;
43 | transform: translateY(-50%);
44 | text-align: right;
45 | }
46 | .item .itemAdd image{
47 | width: 16rpx;
48 | height: 31rpx;
49 | position: absolute;
50 | right: 0;
51 | top: 50%;
52 | transform: translateY(-50%);
53 | }
54 | .citypicker{
55 | width: 100%;
56 | height: 500rpx;
57 | position: fixed;
58 | bottom: 0;
59 | left: 0;
60 | }
61 | .city-cancel,.city-true{
62 | position: absolute;
63 | z-index: 999;
64 | top: 80rpx;
65 | }
66 | .city-cancel{
67 | left: 50rpx;
68 | }
69 | .city-true{
70 | right: 50rpx;
71 | }
72 | picker-view{
73 | background-color: #fff;
74 | width: 100%;
75 | height: 380rpx;
76 | bottom: 0;
77 | position:fixed;
78 | }
79 |
80 | picker-view-column view{
81 | width: 100%;
82 | vertical-align:middle;
83 | line-height: 28rpx;
84 | height: 100%;
85 | display: flex;
86 | align-items: center;
87 | justify-content: center;
88 | }
89 |
90 | .item:nth-last-child(2){
91 | border-bottom: none;
92 | }
93 | .item:nth-last-child(2) input{
94 |
95 | width: 98%;
96 | display: block;
97 | margin-left: 20rpx;
98 | }
99 |
100 | button{
101 | box-sizing: border-box;
102 | display: block;
103 | width: 690rpx;
104 | height: 80rpx;
105 | line-height: 80rpx;
106 | background-color: rgb(253,137,0);
107 | color: #fff;
108 | font-size: 36rpx;
109 | margin-top: 70rpx;
110 | }
111 |
112 | /*弹框*/
113 | .mode{
114 | width: 100%;
115 | height: 100%;
116 | background-color: rgba(0,0,0,.2);
117 | position: fixed;
118 | top: 50%;
119 | left: 50%;
120 | transform: translate(-50%,-50%);
121 | z-index: 9;
122 | }
123 | .mode .modeBox{
124 | width: 550rpx;
125 | height: 250rpx;
126 | background-color: #fff;
127 | margin: 400rpx auto;
128 | color: #666;
129 | padding: 40rpx 0;
130 | box-sizing: border-box;
131 | text-align: center;
132 | border-radius: 10rpx;
133 | }
134 | .mode .modeBox text{
135 | display: block;
136 | margin-bottom: 20rpx;
137 | }
138 | .mode .modeBox>view{
139 | margin: auto;
140 | width: 100rpx;
141 | height: 50rpx;
142 | margin-top: 40rpx;
143 | background-color: rgb(253,137,0);
144 | border-radius: 10rpx;
145 | color: #fff;
146 | line-height: 50rpx;
147 | }
--------------------------------------------------------------------------------
/pages/jackpot/jackpot.js:
--------------------------------------------------------------------------------
1 | const app = getApp();
2 |
3 | Page({
4 | data: {
5 | hidden:false,
6 | nav:["他们都来了,你呢?","你敢来智商比试么,谁输就真心话大冒险","智慧担当在此,你能超过我吗?","点识成金,答题赢奖,点击进入,和我一起..."],
7 | user_id:"",
8 | user_money:""
9 | },
10 | onLoad: function (options) {
11 | // 获取用户id
12 | this.setData({
13 | user_id:options.user_id,
14 | user_money:options.user_money
15 | });
16 |
17 |
18 | wx.setNavigationBarTitle({
19 | title: '奖池赛'
20 | });
21 |
22 |
23 | },
24 | toGame:function () {
25 | if(this.data.user_money >= 200){
26 | //一开始进入页面获取用户id
27 | wx.navigateTo({
28 | url: '../prize/prize?user_id='+this.data.user_id
29 | })
30 | }else {
31 | wx.showToast({
32 | title:"您的金币不足",
33 | duration: 2000
34 | })
35 | }
36 |
37 | },
38 |
39 | modalHide:function () {
40 | this.setData({
41 | hidden:true
42 | })
43 | },
44 |
45 | onShareAppMessage: function (res) {
46 | let num = Math.round(Math.random(0,1)*3);
47 | return{
48 | title:this.data.nav[num],
49 | path:"/pages/index/index"
50 | }
51 | }
52 | });
53 |
--------------------------------------------------------------------------------
/pages/jackpot/jackpot.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 手速快 知识广 就能赢大奖
4 |
5 |
6 |
7 |
8 |
9 | 奖池已累积:
10 | 90,000
11 |
12 |
13 |
14 | 参赛消耗200智币
15 |
16 |
17 |
18 | 立即参赛
19 |
20 |
21 |
22 |
23 |
24 | 奖池赛规程:
25 | 1、报名参赛者,入场答题需贡献200智币
26 | 2、每轮奖池累计至100,000智币即开启奖池
27 | 3、每轮答题共10题,用时最少者为胜
28 | 4、第一名将获得50,000智币,第二名将获得30,000智币,第三名将获得20,000智币,4到15名分别获得1,000智币
29 |
30 |
--------------------------------------------------------------------------------
/pages/jackpot/jackpot.wxss:
--------------------------------------------------------------------------------
1 | .container{
2 | position: relative;
3 | }
4 | .head{
5 | font-family:"PingFang-SC-Regular";
6 | font-size: 30rpx;
7 | color: white;
8 | margin-top: 30rpx;
9 | text-align: center;
10 | }
11 | .banner{
12 | text-align: center;
13 | margin-top: 50rpx;
14 | }
15 | .accumulate{
16 | font-family:"PingFang-SC-Regular";
17 | font-size: 30rpx;
18 | color: white;
19 | text-align: center;
20 | width: 276rpx;
21 | height: 30rpx;
22 | margin: 30rpx auto;
23 | margin-bottom: 13rpx;
24 | }
25 | .news {
26 | text-align: center;
27 | font-size: 20rpx;
28 | color: rgb(255,125,46);
29 | font-family: "PingFang-SC-Light";
30 | }
31 | .news image{
32 | height: 20rpx;
33 | width: 20rpx;
34 | vertical-align: middle;
35 | }
36 | .news text{
37 | padding-left: 13rpx;
38 | }
39 | .game{
40 | width: 240rpx;
41 | height: 240rpx;
42 | margin: 50rpx auto;
43 | margin-bottom: 15rpx;
44 | position: relative;
45 | line-height: 240rpx;
46 | text-align: center;
47 | color: #4d44a3;
48 | font-size: 34rpx;
49 |
50 | }
51 | .game image{
52 | width: 100%;
53 | height: 100%;
54 | position: absolute;
55 | top: 0;
56 | left: 0;
57 | z-index: -1;
58 | }
59 | .invite button{
60 | background-color: #fb6c4a;
61 | width: 280rpx;
62 | height: 80rpx;
63 | border-radius: 10rpx;
64 | margin: 0 auto;
65 | text-align: center;
66 | line-height: 80rpx;
67 | color: white;
68 | margin-bottom: 10rpx;
69 | font-size: 34rpx;
70 | }
71 | .good{
72 | font-family: "PingFang-SC-Regular";
73 | font-size: 24rpx;
74 | margin: 0 auto;
75 | width: 280rpx;
76 | height: 50rpx;
77 | color: white;
78 | text-align: center;
79 | margin-bottom: 50rpx;
80 | }
81 | .modal{
82 | width: 574rpx;
83 | height: 320rpx;
84 | background-color: white;
85 | font-size: 24rpx;
86 | color: rgb(251,108,74);
87 | box-sizing: border-box;
88 | padding-left: 50rpx;
89 | padding-top: 30rpx;
90 | border-radius: 10rpx;
91 | position: absolute;
92 | top: 50%;
93 | left: 50%;
94 | transform: translateX(-50%) translateY(-50%);
95 | padding-right: 30rpx;
96 | }
97 | .modal text{
98 | display: block;
99 | line-height: 40rpx;
100 | }
101 | .modal .title{
102 | font-size: 30rpx;
103 | font-weight: 700;
104 | }
--------------------------------------------------------------------------------
/pages/jackpotTime/jackpotTime.js:
--------------------------------------------------------------------------------
1 | const app = getApp()
2 |
3 | Page({
4 | data: {
5 | time: 5,
6 | userName: "",//用户名
7 | userPic: "" ,//头像链接
8 | user_id:''
9 | },
10 | onLoad:function (options) {
11 | this.setData({
12 | user_id:options.user_id
13 | })
14 | },
15 |
16 | onShow: function () {
17 | // 获取用户信息
18 | let that = this;
19 | wx.getUserInfo({
20 | success: function (res) {
21 | let userInfo = res.userInfo;
22 | let nickName = userInfo.nickName; //用户名
23 | let avatarUrl = userInfo.avatarUrl; //头像链接
24 | that.setData({
25 | userName: nickName,
26 | userPic: avatarUrl
27 | })
28 | }
29 | });
30 |
31 | wx.setNavigationBarTitle({
32 | title: '答题'
33 | });
34 |
35 | let num = 0;
36 | let context = wx.createContext();
37 | let timer = setInterval(_ => {
38 | context.setLineWidth(6);
39 | num = num + 0.004;
40 | context.setStrokeStyle("#DB0EE2");
41 | context.beginPath();
42 | context.arc(36, 36, 32, -2 * Math.PI, num * Math.PI, true);
43 | context.stroke();
44 | wx.drawCanvas({
45 | canvasId: 'wxCanvasTest1',
46 | actions: context.getActions()
47 | });
48 | context.setLineWidth(6);
49 | if (num > 2) {
50 | clearInterval(timer);
51 | this.setData({
52 | time: 0
53 | });
54 | context.beginPath();
55 | context.arc(36, 36, 32, 0, 0, false);
56 | context.stroke();
57 | wx.drawCanvas({
58 | canvasId: 'wxCanvasTest1',
59 | actions: context.getActions()
60 | });
61 | }
62 | }, 9);
63 | let time = setInterval(_ => {
64 | this.setData({
65 | time: this.data.time - 1
66 | });
67 | if (this.data.time <=1) {
68 | clearInterval(time);
69 | }
70 | }, 999);
71 | setTimeout(_ => {
72 | wx.navigateTo({
73 | url: '../prize/prize?user_id='+this.data.user_id
74 | });
75 | setTimeout(_=>{
76 | this.setData({
77 | time: 5
78 | });
79 | },5000)
80 | }, 5000)
81 |
82 | },
83 | onShareAppMessage: function (res) {
84 | return{
85 | title:"发起挑战,你一定会错,不信你试试",
86 | path:"/pages/index/index"
87 | }
88 | }
89 |
90 | });
91 |
--------------------------------------------------------------------------------
/pages/jackpotTime/jackpotTime.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{userName}}
5 |
6 |
7 | 100.000
8 |
9 | 唾手可得!撸起柚子开始答题(共10题)
10 |
11 |
12 | {{time}}
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/pages/jackpotTime/jackpotTime.wxss:
--------------------------------------------------------------------------------
1 |
2 | .portrait{
3 | width: 189rpx;
4 | height: 188rpx;
5 | margin:170rpx auto;
6 | text-align: center;
7 | margin-bottom:100rpx;
8 | }
9 | .portrait image{
10 | width: 100%;
11 | height: 100%;
12 | border-radius: 50%;
13 | border: 8rpx solid #fff;
14 | }
15 | .portrait .name{
16 | display: inline-block;
17 | width: 120rpx;
18 | height: 75rpx;
19 | overflow: hidden;
20 | font-size: 30rpx;
21 | color: rgb(251,108,74);
22 | font-family: "PingFang-SC-Regular";
23 | }
24 | .money{
25 | width: 750rpx;
26 | height: 35rpx;
27 | font-size: 32rpx;
28 | color:rgb(254,254,254);
29 | line-height: 35rpx;
30 | }
31 | .money image{
32 | height: 30rpx;
33 | width: 30rpx;
34 | vertical-align: middle;
35 | }
36 | .box{
37 | margin: 130rpx auto;
38 | width: 56px;
39 | height: 56px;
40 | position: relative;
41 | font-size: 30px;
42 | font-family: "PingFang-SC-Medium";
43 | color: white;
44 | text-align: center;
45 | line-height: 56px;
46 | border: 8px solid #ffffff;
47 | border-radius: 50%;
48 | }
49 | .box canvas{
50 | width: 75px;
51 | height: 75px;
52 | position: absolute;
53 | top: -8px;
54 | left:-8px;
55 | }
56 |
--------------------------------------------------------------------------------
/pages/prize/prize.js:
--------------------------------------------------------------------------------
1 | const app = getApp();
2 |
3 |
4 | let timer;
5 | Page({
6 | data: {
7 | userName:"",//用户名
8 | userPic:"", //头像链接
9 | items: "", //题目数据
10 | subject: "",
11 | errorIcon: false,
12 | result: true, /*结果*/
13 | answer: true, /*全部选项*/
14 | choose: "", /*选择项*/
15 | right: "", /*正确选项*/
16 | count: '',
17 | bg: 'error', /*背景颜色*/
18 | falg: true, /*节流阀*/
19 | record: "", /*遍历题目*/
20 | number: 0, /*题目*/
21 | titleShow: false,
22 | title: "第一题",
23 | hours: '00',
24 | minutes: '00',
25 | seconds: "00",
26 | success: true,
27 | defeated: true,
28 | user_id:'',
29 | match_id:"",
30 | error:"",//正确或失败的控制
31 | ranking:"",//全答对时名次
32 | prize:"",//用户所省余的金额
33 | navT:["无敌是多么寂寞,轻轻松松拿金币,你敢来挑战我么?","搏一搏,单车变摩托,摩托变汽车~","点识成金,答题赢奖,点击进入,和我一起..."],//成功时分享的内容
34 | navF:["哎呀,宝宝输了,求求你帮我赢金币,给你一个","我都金币都去哪了,还给我...","点识成金,答题赢奖,点击进入,和我一起..."],//失败时分享的内容
35 | },
36 | onLoad: function (options) {
37 | this.setData({
38 | user_id:options.user_id,
39 | });
40 |
41 | let that = this;
42 | wx.request({
43 | url:"https://dati.51laiding.com/?r=rank/start",
44 | method:"GET",
45 | data:{
46 | user_id:that.data.user_id
47 | },
48 | success:function (res) {
49 | that.setData({
50 | items:res.data.问题,
51 | match_id:res.data.奖池ID
52 | });
53 | that.setData({
54 | subject: that.data.items[that.data.number][0].content,
55 | record: that.data.items[that.data.number][1]
56 | });
57 | }
58 | });
59 |
60 | //获取用户实时金额
61 | wx.login({
62 | success: function (e) {
63 | wx.request({
64 | url: "https://dati.51laiding.com/?r=index/index",
65 | data: {
66 | username: that.data.userName,
67 | photo: that.data.userPic,
68 | code: e.code,
69 | },
70 | method: "GET",
71 | success: function (res) {
72 | that.setData({
73 | prize:res.data.用户金币
74 | })
75 | }
76 | });
77 | }
78 | });
79 |
80 |
81 | // 获取用户信息
82 | wx.getUserInfo({
83 | success: function(res) {
84 | let userInfo = res.userInfo;
85 | let nickName = userInfo.nickName; //用户名
86 | let avatarUrl = userInfo.avatarUrl; //头像链接
87 | that.setData({
88 | userName: nickName,
89 | userPic:avatarUrl
90 | })
91 | }
92 | });
93 |
94 | wx.setNavigationBarTitle({
95 | title: '奖池赛'
96 | });
97 | // 初始渲染题目
98 | let second = 0;
99 | let minute = 0;
100 | let hour = 0;
101 |
102 | setTimeout(_ => {
103 | this.setData({
104 | answer: false,
105 | titleShow: true
106 | });
107 | // 计时
108 | timer = setInterval(_ => {
109 | second = +second + 1;
110 | second = second > 9 ? second : '0' + second;
111 | this.setData({
112 | seconds: second
113 | });
114 |
115 | if (second > 99) {
116 | second = '00';
117 | this.setData({
118 | seconds: second
119 | });
120 | minute = +minute + 1;
121 | minute = minute > 9 ? minute : '0' + minute;
122 | this.setData({
123 | minutes: minute
124 | });
125 | }
126 | if (minute > 59) {
127 | minute = "00";
128 | this.setData({
129 | minutes: minute
130 | });
131 |
132 | hour = +hour + 1;
133 | hour = hour > 9 ? hour : '0' + hour;
134 | this.setData({
135 | hours: hour
136 | });
137 | }
138 | if (this.data.success === false || this.data.defeated === false) {
139 | clearInterval(timer)
140 | }
141 | }, 10);
142 | }, 1000);
143 |
144 | },
145 | // 答题
146 | affirm: function (e) {
147 | let that = this;
148 |
149 | if (this.data.falg) {
150 | // 节流阀
151 | this.setData({
152 | falg: false
153 | });
154 |
155 | let id = e.currentTarget.dataset.id;
156 | this.setData({
157 | count: id
158 | });
159 | for (let i = 0; i < this.data.record.length; i++) {
160 | if (this.data.record[i].name === 'shh') {
161 | this.setData({
162 | right: this.data.record[i].value,
163 | });
164 |
165 | if (this.data.count === i) {
166 | this.setData({
167 | bg: 'correct'
168 | })
169 | }
170 | if (this.data.count !== i) {
171 | this.setData({
172 | bg: 'error'
173 | });
174 | this.setData({
175 | error:this.data.bg
176 | })
177 | }
178 | }
179 | }
180 |
181 | setTimeout(_ => {
182 | this.setData({
183 | result: false,
184 | answer: true,
185 | choose: this.data.record[id].value
186 | });
187 | if (this.data.choose === this.data.right) {
188 | this.setData({
189 | errorIcon: true
190 | })
191 | }
192 | if (this.data.number < that.data.items.length-1) {
193 | // 新一题开始
194 | setTimeout(_ => {
195 | this.setData({
196 | number: this.data.number + 1,
197 | result: true,
198 | titleShow: false,
199 | errorIcon: false
200 | });
201 | // 题号对应的中文
202 | switch (this.data.number) {
203 | case 1:
204 | this.setData({
205 | title: "第二题",
206 | });
207 | break;
208 | case 2:
209 | this.setData({
210 | title: "第三题",
211 | });
212 | break;
213 | case 3:
214 | this.setData({
215 | title: "第四题",
216 | });
217 | break;
218 | case 4:
219 | this.setData({
220 | title: "第五题",
221 | });
222 | break;
223 | case 5:
224 | this.setData({
225 | title: "第六题",
226 | });
227 | break;
228 | case 6:
229 | this.setData({
230 | title: "第七题",
231 | });
232 | break;
233 | case 7:
234 | this.setData({
235 | title: "第八题",
236 | });
237 | break;
238 | case 8:
239 | this.setData({
240 | title: "第九题",
241 | });
242 | break;
243 | case 9:
244 | this.setData({
245 | title: "最后一题",
246 | });
247 | break;
248 | }
249 | // 题号对应的中文
250 | this.setData({
251 | subject: this.data.items[this.data.number][0].content,
252 | record: this.data.items[this.data.number][1],
253 | bg: '',
254 | falg: true
255 | });
256 | // 题目出现
257 | setTimeout(_ => {
258 | this.setData({
259 | answer: false,
260 | titleShow: true
261 | });
262 | }, 1000)
263 |
264 | }, 2000);
265 | } else {
266 | setTimeout(_=>{
267 | if (this.data.error === 'error') {
268 | //失败时
269 | this.setData({
270 | defeated: false
271 | });
272 |
273 | } else {
274 | //成功时
275 | this.setData({
276 | success: false
277 | });
278 | wx.request({
279 | url: "https://dati.51laiding.com/?r=rank/end",
280 | data: {
281 | user_id:that.data.user_id,
282 | use_time: that.data.hours + that.data.minutes + that.data.seconds,
283 | match_id:that.data.match_id
284 | },
285 | method: "GET",
286 | success: function (res) {
287 | that.setData({
288 | ranking:res.data
289 | })
290 | }
291 | });
292 | }
293 | },1000)
294 |
295 | }
296 | }, 1000)
297 | }
298 | },
299 |
300 | again:function () {
301 | if(this.data.prize >= 200){
302 | wx.navigateTo({
303 | url: '../prize/prize?user_id='+this.data.user_id
304 | })
305 | }else {
306 | wx.showToast({
307 | title:"您的金币不足",
308 | duration: 2000
309 | })
310 | }
311 | },
312 | close:function () {
313 | wx.navigateTo({
314 | url: '../index/index'
315 | })
316 | },
317 | onShareAppMessage: function (res) {
318 | let num = Math.round(Math.random(0,1)*2);
319 | if (this.data.error === 'error'){
320 | return{
321 | title:this.data.navF[num],
322 | path:"/pages/index/index"
323 | }
324 | }else {
325 | return{
326 | title:this.data.navT[num],
327 | path:"/pages/index/index"
328 | }
329 | }
330 | }
331 | });
332 |
333 |
334 |
335 |
--------------------------------------------------------------------------------
/pages/prize/prize.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{hours}}
6 | :
7 | {{minutes}}
8 | :
9 | {{seconds}}
10 |
11 |
12 | {{userName}}
13 |
14 | {{title}}
15 |
16 | {{subject}}
17 |
18 |
19 |
20 |
24 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | 挑战成功
35 |
36 |
37 | 总答题数
38 | 10
39 |
40 |
41 | 总用时
42 | {{hours}}
43 | 分
44 | {{minutes}}
45 | 秒
46 | {{seconds}}
47 |
48 |
49 | 当前排名
50 | {{ranking}}
51 |
52 |
53 | 第一名将获得50,000
54 |
55 | 奖励
56 |
57 | 第二名将获得30,000
58 |
59 | 奖励
60 |
61 | 第三名将获得20,000
62 |
63 | 奖励
64 |
65 | 4-15名各获得1,000
66 |
67 | 奖励
68 |
69 | 排名以最终名次为准
70 |
71 |
72 |
73 |
74 | 继续挑战
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 | 惜败
88 |
89 |
90 | 第一名将获得50,000
91 |
92 | 奖励
93 |
94 | 第二名将获得30,000
95 |
96 | 奖励
97 |
98 | 第三名将获得20,000
99 |
100 | 奖励
101 |
102 | 4-15名各获得1,000
103 |
104 | 奖励
105 |
106 |
107 | (很遗憾您没有入围奖励名单)
108 |
109 |
110 |
111 | 继续挑战
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/pages/prize/prize.wxss:
--------------------------------------------------------------------------------
1 | .head{
2 | width: 257rpx;
3 | height: 124rpx;
4 | background-color: rgb(211,70,133);
5 | border-radius: 54rpx;
6 | margin: 55rpx auto;
7 | position: relative;
8 | padding-left: 120rpx;
9 | box-sizing: border-box;
10 | line-height: 124rpx;
11 | }
12 | .head image{
13 | position: absolute;
14 | width: 125rpx;
15 | height: 125rpx;
16 | border-radius: 50%;
17 | border: 8rpx solid #fff;
18 | top: -7rpx;
19 | left: -40rpx;
20 | }
21 | .head .name{
22 | position: absolute;
23 | font-family: "PingFang-SC-Medium";
24 | font-size: 30rpx;
25 | color: white;
26 | width: 150rpx;
27 | height: 120rpx;
28 | overflow: hidden;
29 | top: 50%;
30 | transform: translateY(-50%);
31 | }
32 | .head image .time{
33 | position: absolute;
34 | width: 125rpx;
35 | height: 125rpx;
36 | border-radius: 50%;
37 | top: 0rpx;
38 | left: 0rpx;
39 | background: rgba(0,0,0,.4);
40 | box-sizing: border-box;
41 | text-align: center;
42 | }
43 | .head .time text{
44 | font-family: "PingFang-SC-Regular";
45 | font-size: 24rpx;
46 | color: white;
47 | }
48 | .number{
49 | font-size: 40rpx;
50 | color: white;
51 | font-family: "PingFang-SC-Regular";
52 | text-align: center;
53 | }
54 |
55 | .answer{
56 | margin: 0 auto;
57 | margin-top: 69rpx;
58 | width: 500rpx;
59 | position: relative;
60 | }
61 | .answer .problem{
62 | width: 680rpx;
63 | margin-left: -80rpx;
64 | margin-bottom: 100rpx;
65 | font-size: 36rpx;
66 | color: white;
67 | font-family: "PingFang-SC-Regular";
68 | text-align:center;
69 | }
70 | .answer button{
71 | margin-bottom: 20rpx;
72 | color: white;
73 | border: 1px solid #fff;
74 | border-radius: 10rpx;
75 | }
76 | .bg{
77 | background-color:transparent;
78 | }
79 | .result{
80 | margin: 0 auto;
81 | margin-top: 100rpx;
82 | width: 500rpx;
83 | }
84 | .result button{
85 | margin-bottom: 20rpx;
86 | color: white;
87 | position: relative;
88 | border-radius: 10rpx;
89 | }
90 | .result button image{
91 | width: 45rpx;
92 | height: 45rpx;
93 | position: absolute;
94 | left: 20rpx;
95 | top:20rpx
96 | }
97 | /*正确*/
98 | .correct{
99 | background-color: #a3d238;
100 | }
101 | /*错误*/
102 | .error{
103 | background-color:#fb6c4a ;
104 | }
105 |
106 | /*挑战成功*/
107 | .success{
108 | position: absolute;
109 | top: 0;
110 | left: 50%;
111 | transform: translateX(-50%);
112 | height: 100%;
113 | width: 100%;
114 | background-color: rgba(0,0,0,.7);
115 | }
116 | .success .box{
117 | margin-top: 180rpx;
118 | }
119 | .success .top{
120 | margin: 0 auto;
121 | width: 398rpx;
122 | height: 640rpx;
123 | background-color: white;
124 | border-radius: 10rpx;
125 | }
126 | .success .s_head{
127 | width: 120rpx;
128 | height: 120rpx;
129 | margin-left: 50%;
130 | transform: translateX(-50%) translateY(-50%);
131 | position: relative;
132 | }
133 | .success .s_head image{
134 | width: 100%;
135 | height: 100%;
136 | position: absolute;
137 | top: 0rpx;
138 | left:0rpx;
139 | z-index: -1;
140 | }
141 | .success .s_head text{
142 | display: inline-block;
143 | width: 60rpx;
144 | color: white;
145 | font-family: "PingFang-SC-Bold";
146 | font-size: 30rpx;
147 | margin-left: 50%;
148 | margin-top: 50%;
149 | transform: translateX(-50%) translateY(-50%);
150 | }
151 | .success .s_number{
152 | margin: 0 auto;
153 | width: 109rpx;
154 | font-family: "PingFang-SC-Regular";
155 | font-size: 28rpx;
156 | color: rgb(51,51,51);
157 | text-align: center;
158 | }
159 | .red{
160 | font-family: "PingFang-SC-Medium";
161 | font-size: 34rpx;
162 | color: rgb(251,108,74);
163 | }
164 | .success .s_time{
165 | margin:20rpx auto;
166 | text-align: center;
167 | font-family: "PingFang-SC-Regular";
168 | font-size: 28rpx;
169 | color: rgb(51,51,51);
170 | }
171 | .success .s_ranking{
172 | margin: 0 auto;
173 | width: 115rpx;
174 | font-family: "PingFang-SC-Regular";
175 | font-size: 28rpx;
176 | color: rgb(51,51,51);
177 | text-align: center;
178 | }
179 | .success .s_info{
180 | margin-top: 50rpx;
181 | }
182 | .success .s_info view{
183 | margin: 0 auto;
184 | height: 30rpx;
185 | font-family: "PingFang-SC-Regular";
186 | font-size: 24rpx;
187 | color: rgb(153,153,153);
188 | line-height: 30rpx;
189 | text-align: center;
190 | }
191 | .success .s_info view image{
192 | height: 20rpx;
193 | width: 20rpx;
194 | }
195 | .success .continue{
196 | width: 239rpx;
197 | height: 239rpx;
198 | margin: 12rpx auto;
199 | position: relative;
200 | }
201 | .success .continue image{
202 | width: 100%;
203 | height: 100%;
204 | position: absolute;
205 | top: 0;
206 | left: 0;
207 | z-index: -1;
208 | }
209 | .success .continue text{
210 | width: 180rpx;
211 | position: absolute;
212 | top:50%;
213 | left: 57%;
214 | transform: translateX(-50%) translateY(-50%);
215 | font-size: 36rpx;
216 | color: #615995;
217 | }
218 | .success .button{
219 | width: 600rpx;
220 | height: 80rpx;
221 | margin: 0 auto;
222 | }
223 | .success .button button{
224 | width: 278rpx;
225 | height: 80rpx;
226 | color: white;
227 | font-size: 50rpx;
228 | line-height: 80rpx;
229 | }
230 | .success .button button:first-child{
231 | float: left;
232 | background-color: #f4ac00;
233 | }
234 | .success .button button:last-child{
235 | float: right;
236 | background-color: #a5cf25;
237 | }
238 |
239 | .last{
240 | padding-top: 20rpx;
241 | }
242 |
243 | /*挑战失败*/
244 | .defeated{
245 | position: absolute;
246 | top: 0;
247 | left: 50%;
248 | transform: translateX(-50%);
249 | height: 100%;
250 | width: 100%;
251 | background-color: rgba(0,0,0,.7);
252 | }
253 | .defeated .box{
254 | margin-top: 200rpx;
255 | }
256 | .defeated .top{
257 | margin: 0 auto;
258 | width: 398rpx;
259 | height: 330rpx;
260 | background-color: white;
261 | border-radius: 10rpx;
262 | }
263 | .defeated .s_head{
264 | width: 120rpx;
265 | height: 120rpx;
266 | margin-left: 50%;
267 | transform: translateX(-50%) translateY(-50%);
268 | position: relative;
269 | }
270 | .defeated .s_head image{
271 | width: 100%;
272 | height: 100%;
273 | position: absolute;
274 | top: 0rpx;
275 | left:0rpx;
276 | z-index: -1;
277 | }
278 | .defeated .s_head text{
279 | display: inline-block;
280 | width: 60rpx;
281 | color: white;
282 | font-family: "PingFang-SC-Bold";
283 | font-size: 30rpx;
284 | margin-left: 50%;
285 | margin-top: 50%;
286 | transform: translateX(-50%) translateY(-50%);
287 | }
288 |
289 | .defeated .s_info view{
290 | margin: 0 auto;
291 | height: 30rpx;
292 | font-family: "PingFang-SC-Regular";
293 | font-size: 24rpx;
294 | color: rgb(153,153,153);
295 | line-height: 30rpx;
296 | text-align: center;
297 | }
298 | .defeated .s_info view image{
299 | height: 20rpx;
300 | width: 20rpx;
301 | }
302 | .defeated .continue{
303 | width: 239rpx;
304 | height: 239rpx;
305 | margin: 12rpx auto;
306 | position: relative;
307 | box-sizing: border-box;
308 | }
309 | .defeated .continue image{
310 | width: 100%;
311 | height: 100%;
312 | position: absolute;
313 | top: 0;
314 | left: 0;
315 | z-index: -1;
316 | }
317 | .defeated .continue text{
318 | width: 180rpx;
319 | position: absolute;
320 | top:50%;
321 | left: 57%;
322 | font-size: 36rpx;
323 | color: #615995;
324 | transform: translateX(-50%) translateY(-50%);
325 | }
326 | .defeated .button{
327 | width: 600rpx;
328 | height: 80rpx;
329 | margin: 0 auto;
330 | }
331 | .defeated .button button{
332 | width: 278rpx;
333 | height: 80rpx;
334 | color: white;
335 | font-size: 50rpx;
336 | line-height: 80rpx;
337 | }
338 | .defeated .button button:first-child{
339 | float: left;
340 | background-color: #f4ac00;
341 | }
342 | .defeated .button button:last-child{
343 | float: right;
344 | background-color: #a5cf25;
345 | }
346 | .defeated .sorry{
347 | font-family: "PingFang-SC-Regular";
348 | font-size: 22rpx;
349 | color: rgb(51,51,51);
350 | text-align: center;
351 | margin-top: 30rpx;
352 | }
--------------------------------------------------------------------------------
/pages/recharge/recharge.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data:{
3 | hidden:true,
4 | jinbi:"",
5 | money:"",
6 | open_id:"",
7 | user_id:""
8 | },
9 | onLoad: function (options) {
10 | //获取用户OPEN_ID
11 | this.setData({
12 | open_id:options.OPEN_ID,
13 | user_id:options.user_id
14 | });
15 |
16 | wx.setNavigationBarTitle({
17 | title: '充值礼包'
18 | })
19 | },
20 | //点击对应的充值弹出对应的模态框
21 | getModule:function (e) {
22 | this.setData({
23 | hidden: false,
24 | jinbi:e.target.dataset.jb,
25 | money:e.target.dataset.money
26 | });
27 | },
28 | //点击关闭充值的模态框
29 | getClose:function () {
30 | this.setData({
31 | hidden: true
32 | });
33 | },
34 | //支付功能
35 | getShopping:function () {
36 | let that = this;
37 | wx.request({
38 | url:"https://dati.51laiding.com/?r=recharge/zhifu&openid="+that.data.open_id+"&total_fee="+that.data.money,//后台地址
39 | method:"POST",
40 | success:function (res) {
41 | if(res.data){
42 | wx.requestPayment({
43 | 'timeStamp': res.data.timeStamp, //时间戳
44 | 'nonceStr': res.data.nonceStr, //商户号(随机数,长度为32位以下,字符串)
45 | 'package': res.data.package, //后台返回的prepay_id
46 | 'signType': res.data.signType, //写死MD5,现只支持这个
47 | 'paySign': res.data.sign, //签名
48 | 'success':function(res){
49 | //支付成功时的回调
50 | wx.request({
51 | url:"https://dati.51laiding.com/?r=recharge/payok",
52 | data:{
53 | jinbi:that.data.jinbi,
54 | user_id:that.data.user_id
55 | },
56 | method:"GET",
57 | success:function () {
58 | //充值成功后关闭模态框
59 | that.setData({
60 | hidden:true
61 | });
62 | //微信自带的模态框,告诉用户充值成功
63 | wx.showToast({
64 | title:"充值成功",
65 | duration:2000
66 | });
67 | //充值成功后重定向到首页
68 | setTimeout(function () {
69 | wx.redirectTo({
70 | url:"../index/index"
71 | })
72 | },2000)
73 | }
74 | });
75 | },
76 | 'fail':function(res){
77 | //失败时的回调
78 | wx.showToast({
79 | title:"您已取消充值",
80 | duration:2000
81 | })
82 | }
83 | })
84 | }
85 | }
86 | })
87 | }
88 | });
--------------------------------------------------------------------------------
/pages/recharge/recharge.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | {{jinbi}}
33 |
34 |
35 | ¥{{money}}购买
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/pages/recharge/recharge.wxss:
--------------------------------------------------------------------------------
1 | page{
2 | padding: 0 20rpx;
3 | padding-bottom: 100rpx;
4 | }
5 | .container{
6 | background-color: #fff;
7 | padding:5rpx 10rpx;
8 | border-radius: 10rpx;
9 | }
10 | /*顶部*/
11 | .head{
12 | width: 690rpx;
13 | height: 280rpx;
14 | box-sizing: border-box;
15 | }
16 | .head>image{
17 | width: 690rpx;
18 | height: 280rpx;
19 | border-radius: 10rpx;
20 | }
21 |
22 | /*内容*/
23 | .main{
24 | width: 100%;
25 | margin-top: 24rpx;
26 | text-align: center;
27 | }
28 | .main .firstMain image{
29 | width: 210rpx;
30 | height: 255rpx;
31 | }
32 | .main .firstMain image:nth-child(2) {
33 | margin: 0 28rpx;
34 | }
35 | .main .secondMain image{
36 | width: 232rpx;
37 | height: 293rpx;
38 | margin-top: 28rpx;
39 | }
40 | .main .secondMain image:first-child{
41 | margin-right: 28rpx;
42 | }
43 | .main .lastMain image{
44 | width: 277rpx;
45 | height: 350rpx;
46 | margin-top: 25rpx;
47 | margin-bottom: 30rpx;
48 | }
49 |
50 | /*模态框*/
51 | .module{
52 | position: fixed;
53 | top: 0;
54 | left: 0;
55 | width: 100%;
56 | height: 100%;
57 | background-color: rgba(251,251,251,0.2);
58 | }
59 | .module .mode{
60 | position: absolute;
61 | top:50%;
62 | left: 50%;
63 | transform: translate(-50%,-50%);
64 | width: 397rpx;
65 | height: 467rpx;
66 | background-color: #fff;
67 | border-radius: 10rpx;
68 | }
69 | .module .mode .ball{
70 | width: 120rpx;
71 | height: 120rpx;
72 | position: absolute;
73 | left: 50%;
74 | transform: translateX(-50%);
75 | top: -60rpx;
76 | }
77 | .module .mode .close{
78 | width: 24rpx;
79 | height: 24rpx;
80 | position: absolute;
81 | top:18rpx;
82 | right: 17rpx;
83 | }
84 | .module .mode .money{
85 | text-align: center;
86 | width: 100%;
87 | position: absolute;
88 | top:50%;
89 | left: 50%;
90 | transform: translate(-50%,-50%);
91 | }
92 | .module .mode .money image{
93 | width: 38rpx;
94 | height: 38rpx;
95 | margin-right:22rpx;
96 | }
97 | .module .mode .money text{
98 | color: rgb(255,168,0);
99 | font-size: 50rpx;
100 | font-weight: 700;
101 | }
102 | .module .mode .btn{
103 | position: absolute;
104 | left: 50rpx;
105 | bottom: 42rpx;
106 | width: 300rpx;
107 | height: 60rpx;
108 | background-color: rgb(255,168,0);
109 | font-size: 36rpx;
110 | border-radius: 10rpx;
111 | text-align: center;
112 | line-height: 60rpx;
113 | }
--------------------------------------------------------------------------------
/pages/store/store.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data:{
3 | list:"",
4 | user_id:"",
5 | total_money:""
6 | },
7 | onLoad: function (options) {
8 | // 获取用户id
9 | this.setData({
10 | user_id:options.user_id,
11 | total_money:options.total_money
12 | });
13 |
14 | wx.setNavigationBarTitle({
15 | title: '积分商城'
16 | });
17 | let that = this;
18 | wx.request({
19 | url:"https://dati.51laiding.com/?r=goods",
20 | method:"GET",
21 | success:function (res) {
22 | that.setData({
23 | list:res.data
24 | });
25 | }
26 | });
27 | },
28 | //点击兑换
29 | getInfo:function (e) {
30 | if(this.data.total_money > e.target.dataset.prize){
31 | wx.navigateTo({
32 | url:'../info/info?goods_id='+e.currentTarget.id+"&user_id="+this.data.user_id+"&prize="+e.target.dataset.prize
33 | })
34 | }else {
35 | wx.showToast({
36 | title:"您的智币不足",
37 | duration:2000
38 | })
39 | }
40 |
41 | },
42 | //我所兑换的商品
43 | getRecord:function () {
44 | wx.navigateTo({
45 | url:'../storeRecord/storeRecord?user_id='+this.data.user_id
46 | })
47 | }
48 | });
--------------------------------------------------------------------------------
/pages/store/store.wxml:
--------------------------------------------------------------------------------
1 |
2 | 我的兑换
3 |
4 |
5 |
6 |
7 |
8 | {{list[index].goods_name}}
9 |
10 | 智币:{{list[index].goods_price}}
11 | 兑换
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/pages/store/store.wxss:
--------------------------------------------------------------------------------
1 | page{
2 | background-image: none;
3 | padding: 0;
4 | }
5 | .container{
6 | padding: 0;
7 | }
8 | .exchange{
9 | color: #111;
10 | position: absolute;
11 | top: 0;
12 | right: 20rpx;
13 | }
14 | /*商品*/
15 | .goods{
16 | margin-top: 60rpx;
17 | }
18 | .goods .item{
19 | box-sizing: border-box;
20 | padding-left: 6rpx;
21 | }
22 | .goods .itemInfo image{
23 | width: 275rpx;
24 | height: 273rpx;
25 | }
26 | .goods .item .itemInfo:nth-child(even){
27 | border-left: none;
28 | }
29 | .goods .item .itemInfo{
30 | float: left;
31 | border: 1rpx solid #eee;
32 | /*border-top: none;*/
33 | width: 370rpx;
34 | height: 550rpx;
35 | box-sizing: border-box;
36 | position: relative;
37 | text-align: center;
38 | padding: 30rpx 20rpx;
39 | }
40 | .goods .itemInfo .title{
41 | margin-top: 30rpx;
42 | width: 100%;
43 | color: #333;
44 | display: -webkit-box;
45 | -webkit-box-orient: vertical;
46 | -webkit-line-clamp: 3;
47 | overflow: hidden;
48 | }
49 | .goods .itemInfo .money{
50 | width: 100%;
51 | color: #ff0000;
52 | position: absolute;
53 | bottom: 70rpx;
54 | left: 50%;
55 | transform: translateX(-50%);
56 | }
57 | .goods .itemInfo .money .zb{
58 | position: absolute;
59 | left: 10rpx;
60 |
61 | }
62 | .goods .money .zb text{
63 | font-size: 32rpx;
64 | }
65 | .goods .itemInfo .money .exBtn{
66 | width: 115rpx;
67 | height: 50rpx;
68 | background-color: #ff0000;
69 | border-radius: 50rpx;
70 | position: absolute;
71 | right: 10rpx;
72 | line-height: 50rpx;
73 | color: #fff;
74 | }
75 |
--------------------------------------------------------------------------------
/pages/storeRecord/storeRecord.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data:{
3 | infoList:"",
4 | count:""
5 | },
6 | onLoad: function (options) {
7 |
8 | wx.setNavigationBarTitle({
9 | title: '我的兑换'
10 | });
11 |
12 | let that = this;
13 | wx.request({
14 | url: "https://dati.51laiding.com/?r=goods/order",
15 | data: {
16 | user_id:options.user_id
17 | },
18 | method: "GET",
19 | success: function (res) {
20 | that.setData({
21 | infoList:res.data
22 | })
23 | }
24 | });
25 | },
26 | getUser:function (e) {
27 | let id = e.currentTarget.dataset.id;
28 | this.setData({
29 | count:id
30 | })
31 | }
32 | });
--------------------------------------------------------------------------------
/pages/storeRecord/storeRecord.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {{infoList[index].goods_name}}
8 | {{infoList[index].order_time}}
9 |
10 | {{infoList[index].goods_price}}智币
11 | {{infoList[index].msg}}
12 |
13 |
14 |
15 |
16 | 收货人:{{infoList[index].receiver}}
17 | 所在地:{{infoList[index].location+infoList[index].address}}
18 | 联系电话:{{infoList[index].telephone}}
19 | 物流号:{{infoList[index].order_id}}
20 | 物流公司:{{infoList[index].order_no}}
21 | 发货时间:{{infoList[index].time}}
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/pages/storeRecord/storeRecord.wxss:
--------------------------------------------------------------------------------
1 | page{
2 | background-image: none;
3 | padding: 0;
4 | background-color: #eee;
5 | }
6 | .container{
7 | padding: 0;
8 | }
9 |
10 | .item{
11 | background-color: #fff;
12 | border-top: 1rpx solid #eee;
13 | margin-bottom: 5rpx;
14 | }
15 | .item .goods{
16 | width: 100%;
17 | height: 180rpx;
18 | position: relative;
19 | color: #111;
20 | }
21 | .item .goods image{
22 | width: 145rpx;
23 | height: 145rpx;
24 | position: absolute;
25 | left: 15rpx;
26 | top: 50%;
27 | transform: translateY(-50%);
28 | }
29 | .item .goods>view{
30 | width: 530rpx;
31 | position: absolute;
32 | left: 200rpx;
33 | margin-top: 15rpx;
34 | }
35 | .item .time{
36 | float: left;
37 | }
38 | .item .time:first-child{
39 | width: 370rpx;
40 | }
41 | .item .time:last-child{
42 | color: #eee;
43 | }
44 | .item .money{
45 | position: absolute;
46 | right: 0;
47 | color: rgb(153,153,153);
48 | }
49 | .item .user{
50 | margin-top: 20rpx;
51 | background-color: #fff;
52 | color: rgb(153,153,153);
53 | margin-left: 200rpx;
54 | padding-bottom: 10rpx;
55 | }
56 | .item .state{
57 | position: absolute;
58 | right: 0;
59 | top: 40rpx;
60 | color:red;
61 | }
62 | .none{
63 | display: none;
64 | }
--------------------------------------------------------------------------------
/pages/succeed/succeed.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data:{
3 | nav:["更多意想不到【礼品】,尽在点识成金!","重磅消息!一筐金币,一箱金币,一车金币,带回家~","哇!我的知识竟然能换到大礼品","点识成金,答题赢奖,点击进入,和我一起..."]
4 | },
5 | onShareAppMessage: function (res) {
6 | let num = Math.round(Math.random(0,1)*3);
7 | return{
8 | title:this.data.nav[num],
9 | path:"/pages/index/index"
10 | }
11 | },
12 | getClose:function () {
13 | wx.navigateTo({
14 | url:'../index/index'
15 | })
16 | }
17 | })
--------------------------------------------------------------------------------
/pages/succeed/succeed.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 商品兑换成功
5 |
6 |
7 | 春节期间,2月12日到2月26日,暂停发货,兑换成功的宝宝,我们将在节假日之后与您联系,第一时间给您寄出礼品
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/pages/succeed/succeed.wxss:
--------------------------------------------------------------------------------
1 | page{
2 | background-image: none;
3 | }
4 | .container{
5 | padding: 0;
6 | }
7 |
8 | .pic image{
9 | width: 82rpx;
10 | height: 82rpx;
11 | margin:auto;
12 | margin-top: 118rpx;
13 | display: block;
14 | }
15 | .pic view{
16 | color: rgb(102,102,102);
17 | font-size: 33rpx;
18 | text-align: center;
19 | margin-top: 18rpx;
20 | }
21 |
22 | .tex{
23 | margin-top: 63rpx;
24 | color: rgb(153,153,153);
25 | padding: 20rpx;
26 | }
27 |
28 | .btn{
29 | padding: 0 100rpx;
30 | margin-top: 108rpx;
31 | }
32 | .btn .share,.close{
33 | width: 250rpx;
34 | height: 70rpx;
35 | float: left;
36 | line-height: 70rpx;
37 | text-align: center;
38 | border-radius: 10rpx;
39 | color: #fff;
40 | }
41 | .btn .share{
42 | background-color: #fb6c4a;
43 | margin-right: 45rpx;
44 | }
45 | .btn .close{
46 | background-color: #a3b238;
47 | }
48 |
--------------------------------------------------------------------------------
/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件。",
3 | "setting": {
4 | "urlCheck": true,
5 | "es6": true,
6 | "postcss": true,
7 | "minified": true,
8 | "newFeature": true
9 | },
10 | "compileType": "miniprogram",
11 | "libVersion": "1.6.6",
12 | "appid": "wxf5da491cbf99e1e4",
13 | "projectname": "%E7%AD%94%E9%A2%98%E7%A8%8B%E5%BA%8F",
14 | "condition": {
15 | "search": {
16 | "current": -1,
17 | "list": []
18 | },
19 | "conversation": {
20 | "current": -1,
21 | "list": []
22 | },
23 | "miniprogram": {
24 | "current": -1,
25 | "list": []
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/utils/util.js:
--------------------------------------------------------------------------------
1 | const formatTime = date => {
2 | const year = date.getFullYear()
3 | const month = date.getMonth() + 1
4 | const day = date.getDate()
5 | const hour = date.getHours()
6 | const minute = date.getMinutes()
7 | const second = date.getSeconds()
8 |
9 | return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
10 | }
11 |
12 | const formatNumber = n => {
13 | n = n.toString()
14 | return n[1] ? n : '0' + n
15 | }
16 |
17 | module.exports = {
18 | formatTime: formatTime
19 | }
20 |
--------------------------------------------------------------------------------