index.vue 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510
  1. <template>
  2. <!-- 图片前缀 https://img.shuimuai.com/ -->
  3. <scroll-view
  4. id="index_container"
  5. @scroll="onListenScroll"
  6. scroll-y
  7. style="height: 100%;"
  8. :scroll-into-view="scroll_id"
  9. scroll-y
  10. >
  11. <!-- 死底部分-->
  12. <div class="index_container">
  13. <!-- 用户信息模块-->
  14. <van-row>
  15. <van-col :span="12">
  16. <div
  17. class="userinfo "
  18. :class="{not_show:!userinfo.user_id}"
  19. >
  20. <van-row>
  21. <van-col :span="5">
  22. <van-image
  23. :src="userinfo.portrait"
  24. width="32px"
  25. height="32px"
  26. ></van-image>
  27. </van-col>
  28. <van-col :span="10">
  29. <p>{{ userinfo.user_name }}</p>
  30. <p>{{ userinfo.phone }}</p>
  31. </van-col>
  32. </van-row>
  33. </div>
  34. </van-col>
  35. </van-row>
  36. <!-- 用户信息模块 -->
  37. <!-- 倒计时模块 -->
  38. <van-row>
  39. <div class="count_down_container">
  40. <van-count-down
  41. :time="complete_time"
  42. use-slot
  43. @change="onTimeChange"
  44. format="DD:HH:mm:ss"
  45. v-if="complete_time"
  46. >
  47. <span class="count_down_time">{{ timeData.days }}</span>
  48. <span class="count_down_time">{{ timeData.hours }}</span>
  49. <span class="count_down_time">{{ timeData.minutes }}</span>
  50. <span class="count_down_time">{{ timeData.seconds }}</span>
  51. </van-count-down>
  52. <div
  53. class="none_count_down"
  54. v-else
  55. >
  56. <span class="count_down_time">00</span>
  57. <span class="count_down_time">00</span>
  58. <span class="count_down_time">00</span>
  59. <span class="count_down_time">00</span>
  60. </div>
  61. </div>
  62. </van-row>
  63. <!-- 倒计时模块 -->
  64. <!-- 分享和参与比赛的按钮 -->
  65. <!-- gutter="7" -->
  66. <div :class="{'complete_btns':is_fixed == false,'complete_btns_fixed':is_fixed}">
  67. <!-- <van-col
  68. :span="11"
  69. :offset="1"
  70. > -->
  71. <!--分享按钮-->
  72. <van-image
  73. class="complete_btns_fixed_img"
  74. src="https://img.shuimuai.com/share_btn@2x.png"
  75. @click="show_share_window"
  76. width="160px"
  77. height="49px"
  78. ></van-image>
  79. <!-- </van-col> -->
  80. <!-- <van-col
  81. :span="10"
  82. :offset="1"
  83. > -->
  84. <!--参与按钮-->
  85. <van-image
  86. class="complete_btns_fixed_img"
  87. src="https://img.shuimuai.com/join_btn@2x.png"
  88. @click="to_info"
  89. width="160px"
  90. height="49px"
  91. v-if="joined == false"
  92. ></van-image>
  93. <van-image
  94. class="complete_btns_fixed_img"
  95. src="https://img.shuimuai.com/rank@2x.png"
  96. alt=""
  97. @click="to_rank"
  98. width="160px"
  99. height="49px"
  100. v-else
  101. ></van-image>
  102. <!-- </van-col> -->
  103. </div>
  104. <van-overlay
  105. :show="share_show"
  106. class="share_info"
  107. :z-index="99"
  108. >
  109. <img
  110. src="https://img.shuimuai.com/share_arrow.png"
  111. alt=""
  112. class="share_arrow"
  113. >
  114. <img
  115. src="https://img.shuimuai.com/share_content.png"
  116. alt=""
  117. class="share_content"
  118. >
  119. <img
  120. src="https://img.shuimuai.com/know_btn.png"
  121. alt=""
  122. @click="close_share_window"
  123. class="know_btn"
  124. >
  125. </van-overlay>
  126. <!-- 分享和参与比赛的按钮 -->
  127. </div>
  128. <div id="info"></div>
  129. <!-- 自创模块-->
  130. <div class="diy_container">
  131. <!-- 排行榜模块 -->
  132. <div
  133. class="rank_container"
  134. id="rank_container"
  135. >
  136. <div class="rank_title">
  137. <img
  138. src="https://img.shuimuai.com/rank_title@2x.png"
  139. alt=""
  140. class="rank_title_img"
  141. >
  142. </div>
  143. <div class="rank_main">
  144. <!-- 排行榜tabs -->
  145. <view class="rank_header">
  146. <van-row>
  147. <van-col span="8">
  148. <img
  149. src="https://img.shuimuai.com/yu_sai_rank_may_1.png"
  150. alt=""
  151. class="rank_card"
  152. @click="changeRankAction(1)"
  153. >
  154. <img
  155. src="https://img.shuimuai.com/yu_sai_tg@2x.png"
  156. alt=""
  157. class="rank_arrow"
  158. :class="{not_show:rank_action!=1}"
  159. >
  160. </van-col>
  161. <van-col span="8">
  162. <img
  163. src="https://img.shuimuai.com/raise_rank_may_1.png"
  164. alt=""
  165. class="rank_card"
  166. @click="changeRankAction(2)"
  167. >
  168. <img
  169. src="https://img.shuimuai.com/raise_tg@2x.png"
  170. alt=""
  171. class="rank_arrow"
  172. :class="{not_show:rank_action!=2}"
  173. >
  174. </van-col>
  175. <van-col span="8">
  176. <img
  177. src="https://img.shuimuai.com/final_rank_may_1.png"
  178. alt=""
  179. class="rank_card"
  180. @click="changeRankAction(3)"
  181. >
  182. <img
  183. src="https://img.shuimuai.com/final_tg@2x.png"
  184. alt=""
  185. class="rank_arrow"
  186. :class="{not_show:rank_action!=3}"
  187. >
  188. </van-col>
  189. </van-row>
  190. </view>
  191. <!-- 排行榜榜单 -->
  192. <!-- 预选赛榜单 -->
  193. <div
  194. class="rank_main_list"
  195. v-if="rank_action==1"
  196. >
  197. <!-- 我的成绩 -->
  198. <div
  199. class="my_score"
  200. v-if="my_report.user_id"
  201. >
  202. <span
  203. class="right_title"
  204. @click="to_report"
  205. >我的分数</span>
  206. <van-row class="rank_item">
  207. <van-col
  208. span="4"
  209. offset="1"
  210. >
  211. <span class="rank_num">第{{ my_report.ranking }}名</span>
  212. </van-col>
  213. <van-col
  214. span="2"
  215. offset="1"
  216. >
  217. <van-image
  218. :src="my_report.portrait"
  219. alt=""
  220. class="avatar"
  221. width="25px"
  222. height="25px"
  223. ></van-image>
  224. </van-col>
  225. <van-col span="5">
  226. <span class="rank_username">{{ my_report.user_name }}</span>
  227. </van-col>
  228. <van-col span="5">
  229. <div
  230. class="rank_user_status"
  231. v-if="!icon_show"
  232. >
  233. </div>
  234. <template v-if="icon_show">
  235. <van-image
  236. src="https://img.shuimuai.com/rise@2x.png"
  237. alt=""
  238. class=""
  239. width="19px"
  240. height="10px"
  241. v-if="my_report.promotion_status==1"
  242. ></van-image>
  243. <van-image
  244. src="https://img.shuimuai.com/luo_xuan@2x.png"
  245. alt=""
  246. class=""
  247. width="19px"
  248. height="10px"
  249. v-if="my_report.promotion_status==2"
  250. ></van-image>
  251. <van-image
  252. src="https://img.shuimuai.com/qi_quan@2x.png"
  253. alt=""
  254. class=""
  255. width="19px"
  256. height="10px"
  257. v-if="my_report.promotion_status==3"
  258. ></van-image>
  259. </template>
  260. </van-col>
  261. <van-col span="5">
  262. <span class="rank_score">{{ my_report.att_average }}分</span>
  263. </van-col>
  264. </van-row>
  265. </div>
  266. <!-- 排行榜列表 -->
  267. <div class="rank_list">
  268. <van-row>
  269. <van-col
  270. span="4"
  271. offset="1"
  272. >
  273. <span class="rank_list_title">排名</span>
  274. </van-col>
  275. <van-col
  276. span="2"
  277. offset="1"
  278. >
  279. <span class="rank_list_title">姓名</span>
  280. </van-col>
  281. <van-col
  282. span="5"
  283. offset="10"
  284. >
  285. <span class="rank_list_title">得分</span>
  286. </van-col>
  287. </van-row>
  288. <div
  289. v-for="(item,index) in promotion_rank"
  290. :key="index"
  291. >
  292. <view class="rank_item">
  293. <van-row>
  294. <van-col
  295. span="4"
  296. offset="1"
  297. class=" "
  298. >
  299. <span
  300. class="rank_num"
  301. v-if="index > 2"
  302. >第{{ index + 1 }}名</span>
  303. <van-image
  304. src="https://img.shuimuai.com/gold_award@2x.png"
  305. alt=""
  306. v-if="index == 0"
  307. width="16px"
  308. height="24px"
  309. ></van-image>
  310. <van-image
  311. src="https://img.shuimuai.com/second_award@2x.png"
  312. alt=""
  313. v-if="index == 1"
  314. width="16px"
  315. height="24px"
  316. ></van-image>
  317. <van-image
  318. src="https://img.shuimuai.com/third_btn@2x.png"
  319. alt=""
  320. v-if="index == 2"
  321. width="16px"
  322. height="24px"
  323. ></van-image>
  324. </van-col>
  325. <van-col
  326. span="2"
  327. offset="1"
  328. class=" "
  329. >
  330. <van-image
  331. :src="item.portrait"
  332. alt=""
  333. class="avatar"
  334. width="25px"
  335. height="25px"
  336. ></van-image>
  337. </van-col>
  338. <van-col span="5">
  339. <span class="rank_username">{{ item.user_name }}</span>
  340. </van-col>
  341. <van-col span="5">
  342. <div
  343. class="rank_user_status"
  344. v-if="!icon_show"
  345. >
  346. </div>
  347. <template v-if="icon_show">
  348. <van-image
  349. src="https://img.shuimuai.com/rise@2x.png"
  350. alt=""
  351. class=""
  352. width="19px"
  353. height="10px"
  354. v-if="item.promotion_status==1"
  355. ></van-image>
  356. <van-image
  357. src="https://img.shuimuai.com/luo_xuan@2x.png"
  358. alt=""
  359. class=""
  360. width="19px"
  361. height="10px"
  362. v-if="item.promotion_status==2"
  363. ></van-image>
  364. <van-image
  365. src="https://img.shuimuai.com/qi_quan@2x.png"
  366. alt=""
  367. class=""
  368. width="19px"
  369. height="10px"
  370. v-if="item.promotion_status==3"
  371. ></van-image>
  372. </template>
  373. </van-col>
  374. <van-col span="5">
  375. <span class="rank_score">{{ item.att_average }}分</span>
  376. </van-col>
  377. </van-row>
  378. </view>
  379. <div class="under_line"></div>
  380. </div>
  381. </div>
  382. </div>
  383. <!-- 晋级赛榜单 -->
  384. <div
  385. class="rank_main_list"
  386. v-if="rank_action==2"
  387. >
  388. <div
  389. class="my_score"
  390. v-if="my_report_2.user_id"
  391. >
  392. <span
  393. class="right_title"
  394. @click="to_report"
  395. >我的分数</span>
  396. <view class="rank_item">
  397. <van-row>
  398. <van-col
  399. span="4"
  400. offset="1"
  401. >
  402. <span class="rank_num">第{{ my_report_2.ranking }}名</span>
  403. </van-col>
  404. <van-col
  405. span="2"
  406. offset="1"
  407. >
  408. <van-image
  409. :src="my_report_2.portrait"
  410. alt=""
  411. class="avatar"
  412. width="25px"
  413. height="25px"
  414. ></van-image>
  415. </van-col>
  416. <van-col span="5">
  417. <span class="rank_username">{{ my_report_2.user_name }}</span>
  418. </van-col>
  419. <van-col
  420. span="5"
  421. class="not_show"
  422. >
  423. </van-col>
  424. <van-col
  425. span="5"
  426. offset='5'
  427. >
  428. <span class="rank_score">{{ my_report_2.att_average }}分</span>
  429. </van-col>
  430. </van-row>
  431. </view>
  432. </div>
  433. <!-- 排行榜列表 -->
  434. <div class="rank_list">
  435. <van-row>
  436. <van-col
  437. span="4"
  438. offset="1"
  439. >
  440. <span class="rank_list_title">排名</span>
  441. </van-col>
  442. <van-col
  443. span="2"
  444. offset="1"
  445. >
  446. <span class="rank_list_title">姓名</span>
  447. </van-col>
  448. <van-col
  449. span="5"
  450. offset="10"
  451. >
  452. <span class="rank_list_title">得分</span>
  453. </van-col>
  454. </van-row>
  455. <div
  456. v-for="(item,index) in final_rank"
  457. :key="index"
  458. >
  459. <view class="rank_item">
  460. <van-row>
  461. <van-col
  462. span="4"
  463. offset="1"
  464. class=""
  465. >
  466. <span
  467. class="rank_num"
  468. v-if="index > 2"
  469. >第{{ item.ranking }}名</span>
  470. <van-image
  471. src="https://img.shuimuai.com/gold_award@2x.png"
  472. alt=""
  473. v-if="index == 0"
  474. width="16px"
  475. height="24px"
  476. ></van-image>
  477. <van-image
  478. src="https://img.shuimuai.com/second_award@2x.png"
  479. alt=""
  480. v-if="index == 1"
  481. width="16px"
  482. height="24px"
  483. ></van-image>
  484. <van-image
  485. src="https://img.shuimuai.com/third_btn@2x.png"
  486. alt=""
  487. v-if="index == 2"
  488. width="16px"
  489. height="24px"
  490. ></van-image>
  491. </van-col>
  492. <van-col
  493. span="2"
  494. offset="1"
  495. class=""
  496. >
  497. <van-image
  498. :src="item.portrait"
  499. alt=""
  500. class="avatar"
  501. width="25px"
  502. height="25px"
  503. ></van-image>
  504. </van-col>
  505. <van-col span="5">
  506. <span class="rank_username">{{ item.user_name }}</span>
  507. </van-col>
  508. <van-col
  509. span="5"
  510. class="not_show"
  511. >
  512. <van-image
  513. src="https://img.shuimuai.com/rise@2x.png"
  514. alt=""
  515. class=""
  516. width="19px"
  517. height="10px"
  518. v-if="item.finals_status==1"
  519. ></van-image>
  520. <van-image
  521. src="https://img.shuimuai.com/luo_xuan@2x.png"
  522. alt=""
  523. class=""
  524. width="19px"
  525. height="10px"
  526. v-if="item.finals_status==2"
  527. ></van-image>
  528. <van-image
  529. src="https://img.shuimuai.com/qi_quan@2x.png"
  530. alt=""
  531. class=""
  532. width="19px"
  533. height="10px"
  534. v-if="item.finals_status==3"
  535. ></van-image>
  536. </van-col>
  537. <van-col span="5">
  538. <span class="rank_score">{{ item.att_average }}分</span>
  539. </van-col>
  540. </van-row>
  541. </view>
  542. <div class="under_line"></div>
  543. </div>
  544. </div>
  545. </div>
  546. <!-- 决赛榜单 -->
  547. <div
  548. class="rank_main_list"
  549. v-if="rank_action==3"
  550. >
  551. <!-- 排行榜列表 -->
  552. <div class="rank_list_ext">
  553. <div
  554. v-for="(item,index) in all_final_rank"
  555. :key="item"
  556. >
  557. <!-- 特等奖 -->
  558. <view
  559. class="gold_award_container last_sort"
  560. v-if="item.prize==0"
  561. >
  562. <van-row>
  563. <van-col
  564. span="2"
  565. offset="9"
  566. class=""
  567. >
  568. <van-image
  569. :src="item.portrait"
  570. alt=""
  571. class="avatar"
  572. width="25px"
  573. height="25px"
  574. ></van-image>
  575. </van-col>
  576. <van-col span="5">
  577. <span class="rank_username">{{ item.user_name }}</span>
  578. </van-col>
  579. <van-col span="4">
  580. <span class="slogen">总决赛积分</span>
  581. </van-col>
  582. <van-col span="2">
  583. <span class="rank_score">{{ item.att_average }}</span>
  584. </van-col>
  585. </van-row>
  586. </view>
  587. <!-- 一等奖 -->
  588. <van-row
  589. class="first_award_container "
  590. v-if="item.prize == 1"
  591. >
  592. <div class="first_award_bg last_sort_ext">
  593. <van-col>
  594. <van-image
  595. src="https://img.shuimuai.com/h5/first.png"
  596. alt=""
  597. width="87px"
  598. height="25px"
  599. ></van-image>
  600. </van-col>
  601. <van-col
  602. span="2"
  603. offset="1"
  604. class=""
  605. >
  606. <van-image
  607. :src="item.portrait"
  608. alt=""
  609. class="avatar"
  610. width="25px"
  611. height="25px"
  612. ></van-image>
  613. </van-col>
  614. <van-col span="5">
  615. <span class="rank_username">{{ item.user_name }}</span>
  616. </van-col>
  617. <van-col span="4">
  618. <span class="slogen">总决赛积分</span>
  619. </van-col>
  620. <van-col span="2">
  621. <span class="rank_score">{{ item.att_average }}</span>
  622. </van-col>
  623. </div>
  624. </van-row>
  625. <!-- 二等奖 -->
  626. <div
  627. class="second_award_container "
  628. v-if="item.prize == 2"
  629. >
  630. <div class="second_award_bg last_sort_ext">
  631. <van-col>
  632. <van-image
  633. src="https://img.shuimuai.com/h5/second.png"
  634. alt=""
  635. width="87px"
  636. height="25px"
  637. ></van-image>
  638. </van-col>
  639. <van-col
  640. span="2"
  641. offset="1"
  642. class=""
  643. >
  644. <van-image
  645. :src="item.portrait"
  646. alt=""
  647. class="avatar"
  648. width="25px"
  649. height="25px"
  650. ></van-image>
  651. </van-col>
  652. <van-col span="5">
  653. <span class="rank_username second_text">{{ item.user_name }}</span>
  654. </van-col>
  655. <van-col span="4">
  656. <span class="slogen second_text">晋级赛积分</span>
  657. </van-col>
  658. <van-col span="2">
  659. <span class="rank_score second_text">{{ item.att_average }}</span>
  660. </van-col>
  661. </div>
  662. </div>
  663. </div>
  664. </div>
  665. </div>
  666. </div>
  667. </div>
  668. <!-- 精彩时刻模块 -->
  669. <div class="wonderful_container">
  670. <img
  671. src="https://img.shuimuai.com/jing_cai_shi_ke@2x.png"
  672. alt=""
  673. class="wonderful_container_img"
  674. >
  675. </div>
  676. <!-- 扫码关注我们模块 -->
  677. <div class="qrcode_container">
  678. <img
  679. src="https://img.shuimuai.com/code_bottom.png"
  680. alt=""
  681. class="qrcode_container_img"
  682. >
  683. </div>
  684. </div>
  685. <van-toast id="van-toast" />
  686. </scroll-view>
  687. </template>
  688. <script>
  689. import store from "../../store/competition";
  690. import { cal_down_time } from "../../utils";
  691. import {
  692. checkJoined,
  693. doEnroll,
  694. get_user_by_code,
  695. getActivity,
  696. getAllFinalsRanking,
  697. getFinalsRanking,
  698. getJsSDK,
  699. getPromotionRanking,
  700. } from "../../requests/competition";
  701. import Toast from "../../../static/vant/toast/toast";
  702. import { reload_userinfo } from "../../utils/user";
  703. import { userDetail } from "../../requests/user";
  704. var $this;
  705. var $now = Math.round(new Date() / 1000);
  706. export default {
  707. name: "index",
  708. data() {
  709. return {
  710. //活动id
  711. activity_id: 0,
  712. //分享显示
  713. share_show: false,
  714. //结束时间
  715. complete_time: "",
  716. //排行榜
  717. rank_action: 1,
  718. joined: false,
  719. //预选赛排行
  720. promotion_rank: [],
  721. //晋级赛排行
  722. final_rank: [],
  723. //总决赛排行
  724. all_final_rank: [],
  725. //我的成绩
  726. my_report: {},
  727. my_report_2: {},
  728. timeData: {},
  729. //用户个人信息
  730. userinfo: {
  731. phone: 0,
  732. portrait: "",
  733. user_id: "",
  734. user_name: "",
  735. },
  736. icon_show: false,
  737. // 是否悬浮
  738. // is_fixed: false,
  739. is_fixed: true,
  740. scroll_id: "",
  741. };
  742. },
  743. // 监听
  744. watch: {
  745. rank_action($new, $old) {
  746. if ($new == 2) {
  747. if ($this.final_rank.length == 0) {
  748. $this.rank_action = $old;
  749. }
  750. }
  751. if ($new == 3) {
  752. if ($this.all_final_rank.length == 0) {
  753. $this.rank_action = $old;
  754. }
  755. }
  756. },
  757. },
  758. methods: {
  759. to_report() {
  760. // $this.$router.push({name: "Report"})
  761. },
  762. get_init() {},
  763. //打开分享窗口
  764. show_share_window() {
  765. $this.share_show = true;
  766. },
  767. //关闭分享窗口
  768. close_share_window() {
  769. $this.share_show = false;
  770. },
  771. //跳转比赛信息位置
  772. to_info() {
  773. if (!$this.userinfo.user_id) {
  774. Toast.fail({
  775. message: "请登录水母智脑小程序后进行参与比赛",
  776. onClose() {
  777. wx.navigateTo({
  778. url: "/pages/index/main",
  779. });
  780. },
  781. });
  782. return false;
  783. }
  784. //判断有用户id 就 参加比赛
  785. if ($this.userinfo.user_id && $this.joined == false) {
  786. doEnroll($this.activity_id, $this.userinfo.user_id)
  787. .then((res) => {
  788. let $res = res.data;
  789. if ($res.code == 0) {
  790. Toast.success("参加成功");
  791. $this.joined = true;
  792. } else {
  793. Toast.fail($res.errmsg);
  794. }
  795. })
  796. .catch((e) => {
  797. Toast.fail(e);
  798. });
  799. }
  800. if ($this.joined == true) {
  801. //没有则跳转到地址
  802. window.location.href = "#info";
  803. }
  804. },
  805. //跳转比赛信息位置
  806. to_rank() {
  807. $this.scroll_id = "rank_container";
  808. },
  809. //时间产生变化时
  810. onTimeChange($e) {
  811. let $datetime = ($this.timeData = $e.mp.detail);
  812. for (let $key in $datetime) {
  813. if ($datetime[$key].toString().length == 1) {
  814. $datetime[$key] = "0" + $datetime[$key];
  815. }
  816. }
  817. },
  818. //切换排行榜
  819. changeRankAction($action) {
  820. $this.rank_action = $action;
  821. },
  822. // 获取互动
  823. getActivity($activity_id) {
  824. getActivity($activity_id).then((res) => {
  825. let $res = res.data;
  826. let $data = $res.data;
  827. // 倒计时模块
  828. if (
  829. $now > $data["promotion_start_time"] &&
  830. $now < $data["promotion_end_time"]
  831. ) {
  832. //预选塞时间范围内
  833. $this.calDownTime($data["promotion_end_time"]);
  834. }
  835. //晋级赛时间范围内
  836. if (
  837. $now > $data["finals_start_time"] &&
  838. $now < $data["finals_end_time"]
  839. ) {
  840. $this.rank_action = 2;
  841. }
  842. //总决赛时间范围内
  843. if (
  844. $now > $data["all_finals_start_time"] &&
  845. $now < $data["all_finals_end_time"]
  846. ) {
  847. $this.rank_action = 3;
  848. }
  849. //显示预选赛排行
  850. if ($now > $data["promotion_start_time"]) {
  851. //获取预选赛排行榜
  852. $this.getPromotionRanking($activity_id);
  853. }
  854. //显示晋级赛排行
  855. if ($now > $data["finals_start_time"]) {
  856. //获取晋级赛排行榜
  857. $this.getFinalsRanking($activity_id);
  858. }
  859. // 显示总决赛排行榜
  860. if ($now > $data["all_finals_end_time"]) {
  861. $this.getAllFinalsRanking($activity_id);
  862. }
  863. if ($now > $data["promotion_end_time"]) {
  864. $this.icon_show = true;
  865. }
  866. });
  867. },
  868. //获取预选赛排行
  869. getPromotionRanking($activity_id) {
  870. getPromotionRanking($activity_id).then((res) => {
  871. let $res = res.data;
  872. let $data = $res.data;
  873. $data.forEach(($val, $index) => {
  874. if ($val["user_id"] == $this.userinfo.user_id) {
  875. $this.my_report = $val;
  876. }
  877. });
  878. $this.promotion_rank = $data;
  879. });
  880. },
  881. //获取晋级赛排行
  882. getFinalsRanking($activity_id) {
  883. getFinalsRanking($activity_id).then((res) => {
  884. let $res = res.data;
  885. let $data = $res.data;
  886. $data.forEach(($val, $index) => {
  887. if ($val["user_id"] == $this.userinfo.user_id) {
  888. $this.my_report_2 = $val;
  889. }
  890. });
  891. $this.final_rank = $res.data;
  892. });
  893. },
  894. //获取总决赛排行
  895. getAllFinalsRanking($activity_id) {
  896. getAllFinalsRanking($activity_id).then((res) => {
  897. let $res = res.data;
  898. $this.all_final_rank = $res.data;
  899. });
  900. },
  901. // 计算结束时间差
  902. calDownTime($time) {
  903. //计算倒计时
  904. // 获取比赛结束日
  905. let $time_result = cal_down_time($time);
  906. console.log($time_result);
  907. $this.complete_time = $time_result.differ;
  908. },
  909. //监听滚动
  910. onListenScroll(event) {
  911. let $scrollTop = event.mp.detail.scrollTop;
  912. $this.is_fixed = $scrollTop > -1;
  913. $this.scroll_id = "";
  914. },
  915. },
  916. mounted() {
  917. userDetail().then((res) => {
  918. let $data = res.data;
  919. $this.userinfo = $data.data;
  920. $this.userinfo["validity_time"] = formatTime(
  921. $this.userinfo["validity_time"]
  922. );
  923. $this.userinfo["level_name"] = utils.get_level_name(
  924. $this.userinfo["level"]
  925. );
  926. $this.userinfo["free_time"] = formatSeconds($this.userinfo["free_time"]);
  927. store.setters.set_userinfo($this.userinfo);
  928. });
  929. let $userinfo = wx.getStorageSync("userinfo");
  930. //检查用户是否参与比赛了
  931. checkJoined($this.activity_id, $userinfo.user_id).then((res) => {
  932. let $res = res.data;
  933. let $data = $res.data;
  934. $this.joined = $data["match_status"] == 1;
  935. });
  936. },
  937. created() {
  938. $this = this;
  939. //获取浏览器信息
  940. },
  941. onLoad($options) {
  942. $this.activity_id = $options.activity_id;
  943. $this.getActivity($this.activity_id);
  944. },
  945. onShareAppMessage() {
  946. return {
  947. title: "欢迎参加 “专注勇士PK赛”",
  948. imageUrl: "http://img.shuimuai.com/sharePkPahe_two.jpg",
  949. path: "/pages/competition/main?activity_id=" + $this.activity_id,
  950. };
  951. },
  952. };
  953. </script>
  954. <style>
  955. page {
  956. height: 100%;
  957. }
  958. </style>
  959. <style scoped>
  960. /*//死底模块*/
  961. #index_container {
  962. background-color: #2b2760;
  963. }
  964. .index_container {
  965. /* background: url("https://img.shuimuai.com//mp/pk/background_3%402x.png"); 小乌龟 */
  966. background: url("https://img.shuimuai.com/mppkbackground_May_7.png");
  967. background-size: 100% 100%;
  968. background-position: center;
  969. /* height: 2487px; */
  970. height: 2695px;
  971. width: 100%;
  972. }
  973. .userinfo {
  974. padding: 10px;
  975. }
  976. .userinfo p {
  977. font-size: 9px;
  978. font-family: Microsoft YaHei;
  979. font-weight: bold;
  980. color: #fff;
  981. line-height: 14px;
  982. }
  983. .complete_btns {
  984. position: absolute;
  985. top: 650px;
  986. display: flex;
  987. width: 100%;
  988. justify-content: space-around;
  989. }
  990. .complete_btns_fixed {
  991. position: fixed;
  992. bottom: 0px;
  993. z-index: 99;
  994. display: flex;
  995. width: 100%;
  996. justify-content: space-around;
  997. height: 80px;
  998. align-items: center;
  999. background: url(https://img.shuimuai.com/complete_bg.png);
  1000. background-size: 100% 100%;
  1001. }
  1002. .complete_btns_fixed_img {
  1003. margin-top: 7px;
  1004. }
  1005. .share_info {
  1006. text-align: center;
  1007. }
  1008. .share_info .share_arrow {
  1009. width: 84px;
  1010. height: 113px;
  1011. float: right;
  1012. margin-top: 18px;
  1013. margin-right: 33px;
  1014. }
  1015. .share_info .share_content {
  1016. width: 324px;
  1017. height: 116px;
  1018. margin: 0px auto;
  1019. }
  1020. .share_info .know_btn {
  1021. width: 189px;
  1022. height: 73px;
  1023. margin-top: 49px;
  1024. }
  1025. .count_down_container {
  1026. background-image: url("https://img.shuimuai.com/count_down_container@2x.png");
  1027. background-size: 100% 100%;
  1028. background-position: center;
  1029. width: 294px;
  1030. height: 49px;
  1031. position: absolute;
  1032. top: 408px;
  1033. left: 41px;
  1034. }
  1035. .count_down_container .count_down_time {
  1036. font-size: 24px;
  1037. font-family: zihun59hao-chuangcuhei;
  1038. font-weight: 400;
  1039. color: #ffffff;
  1040. position: relative;
  1041. }
  1042. .count_down_container .count_down_time:nth-child(1) {
  1043. left: 70px;
  1044. top: 15px;
  1045. bottom: 16px;
  1046. }
  1047. .count_down_container .count_down_time:nth-child(2) {
  1048. left: 90px;
  1049. top: 15px;
  1050. bottom: 16px;
  1051. }
  1052. .count_down_container .count_down_time:nth-child(3) {
  1053. left: 115px;
  1054. top: 15px;
  1055. bottom: 16px;
  1056. }
  1057. .count_down_container .count_down_time:nth-child(4) {
  1058. left: 145px;
  1059. top: 15px;
  1060. bottom: 16px;
  1061. }
  1062. .none_count_down .count_down_time {
  1063. top: 8px !important;
  1064. }
  1065. /*# sourceMappingURL=index.css.map */
  1066. /*//diy模块*/
  1067. .max_width_and_center {
  1068. width: 100%;
  1069. text-align: center;
  1070. margin-top: 30px;
  1071. }
  1072. .flex_center {
  1073. display: flex;
  1074. align-items: center;
  1075. justify-content: center;
  1076. }
  1077. .diy_container {
  1078. margin-top: 15px;
  1079. }
  1080. .diy_container .rank_container .rank_title {
  1081. width: 100%;
  1082. text-align: center;
  1083. margin-top: 30px;
  1084. }
  1085. .diy_container .rank_container .rank_title_img {
  1086. width: 352px;
  1087. height: 32px;
  1088. }
  1089. .diy_container .rank_container .rank_main {
  1090. margin-top: 20px;
  1091. text-align: center;
  1092. }
  1093. .diy_container .rank_container .rank_main .rank_card {
  1094. width: 105px;
  1095. height: 50px;
  1096. }
  1097. .diy_container .rank_container .rank_main .rank_arrow {
  1098. width: 67px;
  1099. height: 55px;
  1100. position: relative;
  1101. top: -28px;
  1102. left: 0px;
  1103. z-index: 2;
  1104. }
  1105. .diy_container .rank_container .rank_main .rank_main_list {
  1106. width: 322px;
  1107. height: 486px;
  1108. background: #1b1746;
  1109. border: 2px solid #585399;
  1110. border-radius: 9px;
  1111. margin: 0px auto;
  1112. position: relative;
  1113. bottom: 60px;
  1114. z-index: 1;
  1115. overflow-y: scroll;
  1116. }
  1117. .diy_container .rank_container .rank_main .rank_main_list .my_score {
  1118. background-image: url("https://img.shuimuai.com/my_score_bg@2x.png");
  1119. background-size: 100% 100%;
  1120. background-position: center;
  1121. width: 306px;
  1122. height: 48px;
  1123. margin: 10px auto;
  1124. }
  1125. .diy_container
  1126. .rank_container
  1127. .rank_main
  1128. .rank_main_list
  1129. .my_score
  1130. .right_title {
  1131. width: 55px;
  1132. height: 10px;
  1133. font-size: 9px;
  1134. font-family: zihun59hao-chuangcuhei;
  1135. font-weight: 400;
  1136. /* text-decoration: underline; */
  1137. /* color: #ffba00; */
  1138. color: #aeafff;
  1139. line-height: 12px;
  1140. position: relative;
  1141. left: 110px;
  1142. bottom: 4px;
  1143. }
  1144. .diy_container .rank_container .rank_main .rank_main_list .my_score .rank_item {
  1145. /*display: flex;*/
  1146. }
  1147. .diy_container
  1148. .rank_container
  1149. .rank_main
  1150. .rank_main_list
  1151. .my_score
  1152. .rank_item
  1153. .rank_num {
  1154. font-size: 10px;
  1155. font-family: Microsoft YaHei;
  1156. font-weight: bold;
  1157. color: #ffc600;
  1158. line-height: 14px;
  1159. }
  1160. .diy_container
  1161. .rank_container
  1162. .rank_main
  1163. .rank_main_list
  1164. .my_score
  1165. .rank_item
  1166. .rank_username {
  1167. font-size: 10px;
  1168. font-family: Microsoft YaHei;
  1169. font-weight: bold;
  1170. color: #e2e0ff;
  1171. line-height: 14px;
  1172. }
  1173. .rank_user_status {
  1174. display: inline-block;
  1175. }
  1176. .diy_container
  1177. .rank_container
  1178. .rank_main
  1179. .rank_main_list
  1180. .my_score
  1181. .rank_item
  1182. .avatar {
  1183. width: 24px;
  1184. height: 25px;
  1185. }
  1186. .diy_container
  1187. .rank_container
  1188. .rank_main
  1189. .rank_main_list
  1190. .my_score
  1191. .rank_item
  1192. .rank_score {
  1193. font-size: 10px;
  1194. font-family: Microsoft YaHei;
  1195. font-weight: bold;
  1196. color: #e2e0ff;
  1197. line-height: 14px;
  1198. }
  1199. .diy_container .rank_list_title {
  1200. font-size: 10px;
  1201. font-family: Microsoft YaHei;
  1202. font-weight: 400;
  1203. color: #8f8ac3;
  1204. line-height: 14px;
  1205. }
  1206. .diy_container .rank_list .avatar {
  1207. width: 24px;
  1208. height: 25px;
  1209. }
  1210. .diy_container .rank_list .rank_item {
  1211. /*display: flex;*/
  1212. height: 30px;
  1213. margin: 10px 0px;
  1214. /*align-items: center;*/
  1215. }
  1216. .diy_container .rank_list .rank_item .rank_num {
  1217. font-size: 10px;
  1218. font-family: Microsoft YaHei;
  1219. font-weight: bold;
  1220. color: #fff;
  1221. line-height: 14px;
  1222. }
  1223. .diy_container .rank_list .rank_item .yellow {
  1224. color: #ffc600;
  1225. }
  1226. .diy_container .rank_list .rank_item .avatar {
  1227. width: 24px;
  1228. height: 25px;
  1229. }
  1230. .diy_container .rank_list .rank_item .rank_username {
  1231. font-size: 10px;
  1232. font-family: Microsoft YaHei;
  1233. font-weight: bold;
  1234. color: #e2e0ff;
  1235. line-height: 14px;
  1236. }
  1237. .diy_container .rank_list .rank_item .rank_score {
  1238. font-size: 10px;
  1239. font-family: Microsoft YaHei;
  1240. font-weight: bold;
  1241. color: #e2e0ff;
  1242. line-height: 14px;
  1243. }
  1244. .diy_container .rank_list .under_line {
  1245. width: 281px;
  1246. height: 1px;
  1247. background: #474186;
  1248. margin: 0px auto;
  1249. }
  1250. .diy_container .rank_list .gold_award_container {
  1251. margin: 10px auto;
  1252. background-image: url("https://img.shuimuai.com/gold_award_bg.png");
  1253. background-size: 100% 100%;
  1254. background-position: center;
  1255. width: 299px;
  1256. height: 44px;
  1257. }
  1258. .diy_container .rank_list .first_award_bg {
  1259. margin: auto;
  1260. background-image: url("https://img.shuimuai.com/first_award_bg.png");
  1261. background-size: 100%;
  1262. background-position: center;
  1263. width: 299px;
  1264. height: 44px;
  1265. }
  1266. .diy_container .rank_list .first_award_container {
  1267. margin: 10px auto;
  1268. }
  1269. .diy_container .rank_list .second_award_bg {
  1270. margin: auto;
  1271. background-image: url("https://img.shuimuai.com/second_award_bg.png");
  1272. background-size: 100%;
  1273. background-position: center;
  1274. width: 299px;
  1275. height: 44px;
  1276. }
  1277. .diy_container .rank_list .second_award_container {
  1278. margin: 10px auto;
  1279. }
  1280. .diy_container .rank_list_ext_title {
  1281. font-size: 10px;
  1282. font-family: Microsoft YaHei;
  1283. font-weight: 400;
  1284. color: #8f8ac3;
  1285. line-height: 14px;
  1286. }
  1287. .diy_container .rank_list_ext .avatar {
  1288. width: 24px;
  1289. height: 25px;
  1290. }
  1291. .diy_container .rank_list_ext .rank_num {
  1292. font-size: 10px;
  1293. font-family: Microsoft YaHei;
  1294. font-weight: bold;
  1295. color: #fff;
  1296. line-height: 14px;
  1297. }
  1298. .diy_container .rank_list_ext .yellow {
  1299. color: #ffc600;
  1300. }
  1301. .diy_container .rank_list_ext .avatar {
  1302. width: 24px;
  1303. height: 25px;
  1304. }
  1305. .diy_container .rank_list_ext .rank_username {
  1306. font-size: 10px;
  1307. font-family: Microsoft YaHei;
  1308. font-weight: bold;
  1309. color: #392121;
  1310. line-height: 14px;
  1311. }
  1312. .diy_container .rank_list_ext .slogen {
  1313. font-size: 7px;
  1314. font-family: Microsoft YaHei;
  1315. font-weight: bold;
  1316. color: #392121;
  1317. line-height: 14px;
  1318. }
  1319. .diy_container .rank_list_ext .rank_score {
  1320. font-size: 10px;
  1321. font-family: Microsoft YaHei;
  1322. font-weight: bold;
  1323. color: #392121;
  1324. line-height: 14px;
  1325. }
  1326. .diy_container .rank_list_ext .under_line {
  1327. width: 281px;
  1328. height: 1px;
  1329. background: #474186;
  1330. margin: 0px auto;
  1331. }
  1332. .diy_container .rank_list_ext .gold_award_container {
  1333. margin: 10px auto;
  1334. background-image: url("https://img.shuimuai.com/h5/gold.png");
  1335. background-size: 100% 100%;
  1336. background-position: center;
  1337. width: 299px;
  1338. height: 44px;
  1339. }
  1340. .diy_container .rank_list_ext .first_award_bg {
  1341. margin: auto;
  1342. background-image: url("https://img.shuimuai.com/first_award_bg.png");
  1343. background-size: 100%;
  1344. background-position: center;
  1345. width: 299px;
  1346. height: 44px;
  1347. }
  1348. .diy_container .rank_list_ext .first_award_container {
  1349. margin: 10px auto;
  1350. }
  1351. .diy_container .rank_list_ext .second_award_bg {
  1352. margin: auto;
  1353. background-image: url("https://img.shuimuai.com/second_award_bg.png");
  1354. background-size: 100%;
  1355. background-position: center;
  1356. width: 299px;
  1357. height: 44px;
  1358. }
  1359. .diy_container .rank_list_ext .second_award_container {
  1360. margin: 10px auto;
  1361. }
  1362. .diy_container .rank_list_ext .second_text {
  1363. color: #c1a98e;
  1364. }
  1365. .diy_container .wonderful_container {
  1366. width: 100%;
  1367. text-align: center;
  1368. margin-top: 30px;
  1369. }
  1370. .diy_container .wonderful_container_img {
  1371. width: 366px;
  1372. height: 365px;
  1373. }
  1374. .diy_container .qrcode_container {
  1375. width: 100%;
  1376. text-align: center;
  1377. margin-top: 30px;
  1378. padding-bottom: 80px;
  1379. }
  1380. .diy_container .qrcode_container_img {
  1381. width: 352px;
  1382. height: 228px;
  1383. }
  1384. .not_show {
  1385. visibility: hidden;
  1386. }
  1387. #info {
  1388. position: relative;
  1389. bottom: 155px;
  1390. }
  1391. .rank_header {
  1392. padding: 0px 25px;
  1393. }
  1394. .last_sort {
  1395. padding: 10px 0px;
  1396. }
  1397. .last_sort_ext {
  1398. padding: 10px;
  1399. }
  1400. /*# sourceMappingURL=diy.css.map */
  1401. </style>