index.vue 40 KB

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