rankList.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991
  1. <!--
  2. [报名] 样式3 - 排名列表
  3. http://localhost:5173/card/#/pages/bm/style3/rankList
  4. https://oss-mbh5.colormaprun.com/card/#/pages/bm/style3/rankList
  5. -->
  6. <template>
  7. <view class="body">
  8. <view v-if="pageReady" class="content uni-column">
  9. <view class="uni-column" :class="cssTop">
  10. <my-topbar :mcName="mcName" :class="cssTopbarColor" :showMessage="popupMessageList.length > 0"
  11. @btnBackClick="btnBack" @btnInfoClick="btnInfo" @btnMessageClick="btnMessage"></my-topbar>
  12. <!-- <view class="topbar uni-row" :class="cssTopbarColor">
  13. <uni-icons type="left" class="topbar-back" @click="btnBack"></uni-icons>
  14. <text class="mcName">{{mcName}}</text>
  15. <text class="topbar-rule" @click="btnInfo">规则</text>
  16. </view> -->
  17. <view class="topbtm uni-row">
  18. <!-- <view class="topbtm-null"></view> -->
  19. <view class="topbtm-egg" @click="btnMyEgg">蛋叔券</view>
  20. <text class="topbtm-name">{{nickName}}</text>
  21. <view class="topbtm-egg" @click="btnExchg">兑换地址</view>
  22. </view>
  23. </view>
  24. <view class="main uni-column">
  25. <view class="main-bar uni-row uni-jcse">
  26. <text>总里程:{{fmtDistanct(all_totalDistance)}}km</text>
  27. <text>总打点数:{{all_totalCp}}个</text>
  28. <text>总百味豆数:{{all_totalSysPoint}}个</text>
  29. </view>
  30. <uni-segmented-control class="main-tab" :current="tabCurrent" :values="tabItems"
  31. @clickItem="onClickTabItem" styleType="button" :activeColor="tabActiveColor"></uni-segmented-control>
  32. <view class="tab-view uni-column">
  33. <!-- 里程 -->
  34. <my-ranklist v-show="tabCurrent === 0" :rankRs="rankList.totalDistanceRs" rank-type="totalDistance"></my-ranklist>
  35. <!-- 打点数 -->
  36. <my-ranklist v-show="tabCurrent === 1" :rankRs="rankList.totalCpRs" rank-type="totalCp"></my-ranklist>
  37. <!-- 百味豆 -->
  38. <my-ranklist v-show="tabCurrent === 2" :rankRs="rankList.totalSysPointRs" rank-type="totalSysPoint"></my-ranklist>
  39. <!-- 配速 -->
  40. <my-ranklist v-show="tabCurrent === 3" :rankRs="rankList.fastPaceRs" rank-type="fastPace"></my-ranklist>
  41. </view>
  42. <button class="btnBack" @click="btnStartGame">{{btnStartGameText}}</button>
  43. <!-- <button class="btnBack" @click="btnBack">返回</button> -->
  44. </view>
  45. <my-popup ref="mypopup" :config="popupRuleConfig" :dataList="popupDataList" :acttime="acttime"></my-popup>
  46. <my-popup ref="mypopupExchg" :config="popupExchgConfig" :dataList="popupExchgList"></my-popup>
  47. <my-popup ref="mypopupMessage" :config="popupMessageConfig" :dataList="popupMessageList" @noMoreRemindersClick="onNoMoreRemindersClick"></my-popup>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import tools from '/common/tools';
  53. import { teamName, defaultPopUpDataList } from '/common/define';
  54. import {
  55. token,
  56. apiMatchRsDetailQuery,
  57. apiCardRankDetailQuery,
  58. apiCardConfigQuery,
  59. apiUserCurrentRankNumQuery,
  60. apiCompStatisticQuery,
  61. apiIsAllowMcSignUp,
  62. apiUserJoinCardQuery,
  63. apiUnReadMessageQuery,
  64. apiReadMessage,
  65. checkResCode
  66. } from '/common/api';
  67. export default {
  68. data() {
  69. return {
  70. pageReady: false,
  71. pageName: "rankList",
  72. firstEnterKey: 'firstEnter-bm-style3',
  73. rankKey: "rank-bm-style3",
  74. messageKey: "message-bm-style3",
  75. queryObj: {},
  76. queryString: "",
  77. token: "",
  78. ovtype: "",
  79. ecId: 0, // 卡片id
  80. mcId: 0, // 赛事id
  81. mcType: 0, // 赛事类型 1 普通活动 2 线下赛 3 线上赛
  82. mcName: "", // 赛事名称
  83. acttime: "", // 活动时间
  84. beginSecond: null, // 活动或赛事开始时间戳,单位秒
  85. endSecond: null, // 活动或赛事结束时间戳,单位秒
  86. ocaId: 0, // 关联id,带入到App活动详情页面
  87. nickName: "", // 昵称
  88. totalNum: null, // 总场次
  89. totalDistanct: null, // 总距离,单位米
  90. totalDistanctRankNum: null, // 总距离排名
  91. totalCp: null, // 总打点数
  92. totalCpRankNum: null, // 总打点数排名
  93. totalSysPoint: null, // 总百味豆
  94. totalSysPointRankNum: null, // 总百味豆排名
  95. fastPace: null, // 个人最快配速
  96. fastPaceRankNum: null, // 个人最快配速排名
  97. // ocaRs: [], // 卡片对应活动集合
  98. isJoin: null, // 是否报名
  99. btnStartGameText: "",
  100. all_totalDistance: 0, // 赛事所有人累计里程,单位米
  101. all_totalRightAnswerNum: 0, // 赛事所有人正确答题数(校园文化输出)
  102. all_totalAnswerNum: 0, // 赛事所有人答题数(校园文化输出)
  103. all_totalCp: 0, // 赛事中所有人打点数
  104. all_totalSysPoint: 0, // 赛事中所有人百味豆
  105. mcState: 0 , // 赛事/活动状态 0: 未开始 1: 进行中 2: 已结束
  106. allowMcSignUp: false, // 是否允许重新分组
  107. countdown: "", // 倒计时
  108. rankList: { // 排名列表
  109. totalDistanceRs: [],
  110. totalCpRs: [],
  111. totalSysPointRs: [],
  112. fastPaceRs: []
  113. },
  114. interval: null,
  115. teamType: 0, // 队伍类型
  116. dispArrStr: "totalDistance,totalCp,totalSysPoint,fastPace", // 要显示的集合范围
  117. tabItems: ["里程", "打点数", "百味豆", "配速"],
  118. tabCurrent: 0,
  119. tabActiveColor: "#81cd00",
  120. cssTop: "",
  121. cssTopbarColor: "",
  122. popupRuleConfig: {}, // 规则弹窗配置
  123. popupExchgConfig: {}, // 兑换地址弹窗配置
  124. popupMessageConfig: {}, // 通知弹窗配置
  125. popupDataList: [],
  126. popupExchgList: [],
  127. popupMessageList: [],
  128. /* popupMessageList: [
  129. {
  130. type: 6, // 6: 通知
  131. data: {
  132. mqType: 3,
  133. title: "赛事续期通知",
  134. message: `因为感受到了各位小伙伴的热情,结合即将来临的国庆假期,当然,小飞龙强力出击~“挟持”蛋叔继续赞助鸡蛋………
  135. 1. 现决定,将本次小飞龙定向赛延期至<text style="color:red">10月8日</text>,希望各位在漫步秋日的同时,放松心情,好好享受定向运动的奇妙历程。
  136. 2. 最后的领蛋截止日,顺延至<text style="color:red">10月20日</text>~
  137. 最后总结一句:
  138. 蛋叔!我们都爱你!
  139. everybody,加油!`
  140. }
  141. },
  142. {
  143. type: 6, // 6: 通知
  144. data: {
  145. mqType: 2,
  146. title: "赛事续期通知",
  147. message: "/static/common/jiangli.png"
  148. }
  149. }
  150. ], */
  151. // mqIdListStr: "", // 已读消息id列表 逗号分隔
  152. }
  153. },
  154. computed: {},
  155. onLoad(query) { // 类型非必填,可自动推导
  156. // console.log(query);
  157. this.queryObj = query;
  158. this.queryString = tools.objectToQueryString(this.queryObj);
  159. // console.log(queryString);
  160. this.token = query["token"] ?? token;
  161. this.ecId = query["id"] ?? 0;
  162. this.ovtype = query["ovtype"] ?? "";
  163. this.firstEnterKey += "-" + this.ecId;
  164. console.log("firstEnterKey:", this.firstEnterKey);
  165. this.rankKey += "-" + this.ecId;
  166. console.log("rankKey:", this.rankKey);
  167. this.messageKey += "-" + this.ecId;
  168. console.log("messageKey:", this.messageKey);
  169. tools.removeCssCode();
  170. this.getCardConfigQuery();
  171. this.dealOvtype();
  172. },
  173. // 页面初次渲染完成,此时组件已挂载完成,DOM 树($el)已可用
  174. onReady() {
  175. // this.dealFirstEnter();
  176. // this.$refs.mypopupMessage.popupOpen();
  177. },
  178. onShow() {
  179. this.getUserJoinCardQuery();
  180. },
  181. onUnload() {
  182. this.clear();
  183. },
  184. methods: {
  185. dealOvtype() {
  186. if (this.ovtype == "totalDistance") {
  187. this.tabCurrent = 0;
  188. } else if (this.ovtype == "totalCp") {
  189. this.tabCurrent = 1;
  190. } else if (this.ovtype == "totalSysPoint") {
  191. this.tabCurrent = 2;
  192. } else if (this.ovtype == "fastPace") {
  193. this.tabCurrent = 3;
  194. }
  195. console.log(`dealOvtype: ${this.ovtype} tabCurrent: ${this.tabCurrent}`);
  196. },
  197. dealNotice(rank) {
  198. // console.log('[dealFirstEnter]');
  199. let that = this;
  200. uni.getStorage({
  201. key: that.rankKey,
  202. success: (res) => {
  203. console.log('[getStorage]', that.rankKey, res.data);
  204. const oldRank = res.data;
  205. if (oldRank != rank) {
  206. // that.notice = true;
  207. that.setRankValue(rank);
  208. }
  209. },
  210. fail: (e) => {
  211. console.log('[getStorage] fail', that.rankKey, e);
  212. // that.notice = false;
  213. that.setRankValue(rank);
  214. },
  215. })
  216. },
  217. setRankValue(data) {
  218. let that = this;
  219. uni.setStorage({
  220. key: that.rankKey,
  221. data: data,
  222. success: () => {
  223. console.log('[setStorage] success', that.rankKey, data);
  224. },
  225. fail: (e) => {
  226. console.log('[setStorage] fail', that.rankKey, e);
  227. },
  228. })
  229. },
  230. dealFirstEnter() {
  231. // console.log('[dealFirstEnter]');
  232. let that = this;
  233. uni.getStorage({
  234. key: that.firstEnterKey,
  235. success: (res) => {
  236. console.log('[getStorage]', that.firstEnterKey, res.data);
  237. },
  238. fail: (e) => {
  239. console.log('[getStorage] fail', that.firstEnterKey, e);
  240. that.btnInfo();
  241. that.setFirstEnterValue(true);
  242. },
  243. })
  244. },
  245. setFirstEnterValue(data) {
  246. let that = this;
  247. uni.setStorage({
  248. key: that.firstEnterKey,
  249. data: data,
  250. success: () => {
  251. console.log('[setStorage] success', that.firstEnterKey, data);
  252. },
  253. fail: (e) => {
  254. console.log('[setStorage] fail', that.firstEnterKey, e);
  255. },
  256. })
  257. },
  258. clear() {
  259. if (this.interval != null) {
  260. clearInterval(this.interval);
  261. this.interval = null;
  262. }
  263. },
  264. loadConfig(config) {
  265. // console.log("config", config);
  266. // 加载CSS样式
  267. const css = config.css;
  268. if (css != undefined && css.length > 0) {
  269. tools.loadCssCode(css);
  270. if (css.indexOf(".top{") >= 0) {
  271. this.cssTop = "top";
  272. }
  273. if (css.indexOf(".topbar-color{") >= 0) {
  274. this.cssTopbarColor = "topbar-color";
  275. }
  276. }
  277. if (this.cssTop == "") {
  278. this.cssTop = "top-default";
  279. }
  280. if (this.cssTopbarColor == "") {
  281. this.cssTopbarColor = "topbar-color-default";
  282. }
  283. console.log("[loadConfig] cssTop:", this.cssTop);
  284. console.log("[loadConfig] cssTopbarColor:", this.cssTopbarColor);
  285. const tabActiveColor = config.tabActiveColor;
  286. if (tabActiveColor != undefined && tabActiveColor.length > 0) {
  287. this.tabActiveColor = tabActiveColor;
  288. }
  289. // 加载规则弹窗配置
  290. const popupRuleConfig = config.popupRuleConfig;
  291. if (popupRuleConfig != undefined) {
  292. this.popupRuleConfig = popupRuleConfig;
  293. }
  294. // console.log("[loadConfig] popupRuleConfig:", this.popupRuleConfig);
  295. // 加载兑换地址弹窗配置
  296. const popupExchgConfig = config.popupExchgConfig;
  297. if (popupExchgConfig != undefined) {
  298. this.popupExchgConfig = popupExchgConfig;
  299. }
  300. // console.log("[loadConfig] popupExchgConfig:", this.popupExchgConfig);
  301. // 加载通知弹窗配置
  302. const popupMessageConfig = config.popupMessageConfig;
  303. if (popupMessageConfig != undefined) {
  304. this.popupMessageConfig = popupMessageConfig;
  305. }
  306. // console.log("[loadConfig] popupMessageConfig:", this.popupMessageConfig);
  307. // 加载弹窗数据
  308. const popupDataList = config.popupDataList;
  309. // console.log("[loadConfig] popupDataList:", popupDataList);
  310. if (popupDataList != undefined && popupDataList.length > 0) {
  311. for (var i = 0; i < popupDataList.length; i++) {
  312. // console.log("[loadConfig] popupDataList", i, popupDataList[i]);
  313. if (popupDataList[i] == 'default') {
  314. for (var j = 0; j < defaultPopUpDataList.length; j++) {
  315. this.popupDataList.push(defaultPopUpDataList[j]);
  316. }
  317. } else {
  318. this.popupDataList.push(popupDataList[i]);
  319. }
  320. }
  321. } else {
  322. this.popupDataList = defaultPopUpDataList;
  323. console.log("[loadConfig] popupDataList 加载默认列表");
  324. }
  325. // console.log("[loadConfig] popupDataList:", this.popupDataList);
  326. // 加载弹窗(兑换地点)数据
  327. const popupExchgList = config.popupExchgList;
  328. if (popupExchgList != undefined && popupExchgList.length > 0) {
  329. for (var i = 0; i < popupExchgList.length; i++) {
  330. // console.log("[loadConfig] popupExchgList", i, popupExchgList[i]);
  331. this.popupExchgList.push(popupExchgList[i]);
  332. }
  333. }
  334. // console.log("[loadConfig] popupExchgList:", this.popupExchgList);
  335. this.pageReady = true;
  336. },
  337. // 获取倒计时
  338. getCountdown() {
  339. // console.log(this.endSecond)
  340. if (this.endSecond > 0) {
  341. const now = Date.now() / 1000;
  342. const dif = this.endSecond - now;
  343. // const dif = 3600*24 - 60;
  344. if (dif > 0) {
  345. this.countdown = '距结束 ' + tools.convertSecondsToDHM(dif);
  346. } else {
  347. this.countdown = "活动已结束";
  348. }
  349. // this.countdown = tools.convertSecondsToHMS(dif);
  350. } else {
  351. this.countdown = "距结束 --天--小时";
  352. }
  353. },
  354. // 格式化 距离
  355. fmtDistanct(val) {
  356. return Math.round(val * 100 / 1000) / 100;
  357. /* if (val < 10000)
  358. return Math.round(val * 10 / 1000) / 10;
  359. else
  360. return Math.round(val / 1000); */
  361. },
  362. fmtMcTime(timestamp) {
  363. return tools.fmtMcTime(timestamp);
  364. },
  365. // 获取活动时间
  366. getActtime() {
  367. this.acttime = tools.getActtime(this.beginSecond, this.endSecond);
  368. },
  369. getTeamName(teamType, teamIndex) {
  370. return teamName[teamType][teamIndex];
  371. },
  372. getCardConfigQuery() {
  373. uni.request({
  374. url: apiCardConfigQuery,
  375. header: {
  376. "Content-Type": "application/x-www-form-urlencoded",
  377. "token": this.token,
  378. },
  379. method: "POST",
  380. data: {
  381. ecId: this.ecId,
  382. pageName: this.pageName
  383. },
  384. success: (res) => {
  385. // console.log("getCardConfigQuery", res)
  386. const data = res.data.data;
  387. // console.log("configJson", data.configJson);
  388. const config = data.configJson != "" ? JSON.parse(data.configJson) : "";
  389. // console.log("configJson", data.configJson);
  390. /* const config = {
  391. "css": `
  392. .top{
  393. width: 100%;
  394. height: 170px;
  395. padding-top: 36px;
  396. justify-content: space-between;
  397. background-image: url('static/backgroud/top_bg_guoqing.png');
  398. background-repeat: no-repeat;
  399. background-position-y: 20%;
  400. background-size: cover;
  401. }
  402. .topbar-color{
  403. color: #ffffff;
  404. }
  405. .topbtm-name{
  406. background-color: #e68328 !important;
  407. color: #ffffff !important;
  408. opacity: 0.9;
  409. }
  410. .topbtm-egg{
  411. background-color: #e68328 !important;
  412. color: #ffffff !important;
  413. opacity: 0.9;
  414. }
  415. .btnBack{
  416. background-color: #ff0000 !important;
  417. }
  418. .main-bar{
  419. background-color: #ffd1d1 !important;
  420. color: #C40000 !important;
  421. }
  422. .swiper-item-button {
  423. background-color: #C40000 !important;
  424. }
  425. .uni-swiper-dot-active {
  426. background: #C40000 !important;
  427. }
  428. `,
  429. "tabActiveColor": "#ff0000",
  430. "popupDataList": [
  431. {
  432. "type": 2,
  433. "data": {
  434. "title": "基本图例",
  435. "img": "/static/common/jbtl.png"
  436. }
  437. }, {
  438. "type": 2,
  439. "data": {
  440. "title": "基本标识",
  441. "img": "/static/common/jbbs2.png"
  442. }
  443. },
  444. {
  445. "type": 7,
  446. "data": {
  447. "title": "活动规则",
  448. "content": "<li>赛期内随时参赛、不限完赛次数、起点任选、实时排名 <li>起点-各途经点-结束点完整打卡为1次有效完赛 <li>赛事如有疑问,请咨询微信客服",
  449. "imageList": [
  450. {
  451. "src": "/static/common/qrcode_wxkf.png",
  452. "width": "100px",
  453. "height": "100px"
  454. }
  455. ]
  456. }
  457. },
  458. {
  459. "type": 7,
  460. "data": {
  461. "title": "活动奖励",
  462. "content": "<li>途经点打卡1次,获1个百味豆<br><li>每次正确答题,再获1个百味豆<br><li>20个百味豆兑换1个鸡蛋<br><li>上不封顶!随时兑换!<br><text style='font-size:12px;color:#999999;'>(限本次活动百味豆,兑换以“蛋叔券”为准)</text><br><li>健身又能“薅羊毛”~",
  463. "imageList": [
  464. {
  465. "src": "/static/common/jidanquan.png",
  466. "width": "80px",
  467. "height": "80px"
  468. }
  469. ]
  470. }
  471. },
  472. {
  473. "type": 5,
  474. "data": {
  475. "title": "兑换地点",
  476. "img": "/static/common/wslgwcs.png",
  477. "point": {
  478. "longitude": 117.022194,
  479. "latitude": 36.661612,
  480. "name": "万盛隆购物超市"
  481. }
  482. }
  483. }
  484. ],
  485. "popupExchgList": [
  486. {
  487. "type": 5,
  488. "data": {
  489. "title": "兑换地点",
  490. "img": "/static/common/wslgwcs.png",
  491. "point": {
  492. "longitude": 117.022194,
  493. "latitude": 36.661612,
  494. "name": "万盛隆购物超市"
  495. }
  496. }
  497. }
  498. ]
  499. }; */
  500. this.loadConfig(config);
  501. this.getUnReadMessageQuery();
  502. this.matchRsDetailQuery();
  503. setTimeout(this.dealFirstEnter, 500);
  504. },
  505. fail: (err) => {
  506. console.log("getCardConfigQuery err", err)
  507. },
  508. });
  509. },
  510. // 卡片对应活动或赛事详情查询
  511. // getCardDetailQuery() {
  512. // uni.request({
  513. // url: apiCardDetailQuery,
  514. // header: {
  515. // "Content-Type": "application/x-www-form-urlencoded",
  516. // "token": this.token,
  517. // },
  518. // method: "POST",
  519. // data: {
  520. // ecId: this.ecId
  521. // },
  522. // success: (res) => {
  523. // // console.log("getCardDetailQuery", res)
  524. // const data = res.data.data;
  525. // this.mcType = data.mcType;
  526. // this.mcId = data.mcId;
  527. // this.mcName = data.mcName;
  528. // this.beginSecond = data.beginSecond;
  529. // this.endSecond = data.endSecond;
  530. // this.coiName = data.coiName;
  531. // this.teamNum = data.teamNum;
  532. // this.mcState = tools.checkMcState(this.beginSecond, this.endSecond);
  533. // this.getCountdown();
  534. // this.getActtime();
  535. // this.getCardRankDetailQuery();
  536. // this.clear();
  537. // this.interval = setInterval(this.getCountdown, 60000);
  538. // },
  539. // fail: (err) => {
  540. // console.log("getCardDetailQuery err", err)
  541. // },
  542. // });
  543. // },
  544. // 卡片对应线上赛多个活动查询
  545. matchRsDetailQuery() {
  546. uni.request({
  547. url: apiMatchRsDetailQuery,
  548. header: {
  549. "Content-Type": "application/x-www-form-urlencoded",
  550. "token": this.token,
  551. },
  552. method: "POST",
  553. data: {
  554. ecId: this.ecId
  555. },
  556. success: (res) => {
  557. // console.log("matchRsDetailQuery", res);
  558. if (checkResCode(res)) {
  559. const data = res.data.data;
  560. this.mcType = data.mcType;
  561. this.mcId = data.mcId;
  562. this.mcName = data.mcName;
  563. this.beginSecond = data.beginSecond;
  564. this.endSecond = data.endSecond;
  565. this.nickName = data.nickName;
  566. this.totalNum = data.totalNum;
  567. this.totalDistanct = data.totalDistanct;
  568. this.totalDistanctRankNum = data.totalDistanctRankNum;
  569. this.totalCp = data.totalCp;
  570. this.totalCpRankNum = data.totalCpRankNum;
  571. this.totalSysPoint = data.totalSysPoint;
  572. this.totalSysPointRankNum = data.totalSysPointRankNum;
  573. this.fastPace = data.fastPace;
  574. this.fastPaceRankNum = data.fastPaceRankNum;
  575. // this.ocaRs = data.ocaRs;
  576. this.mcState = tools.checkMcState(this.beginSecond, this.endSecond);
  577. this.getCountdown();
  578. this.getActtime();
  579. this.compStatisticQuery();
  580. this.getCardRankDetailQuery();
  581. this.clear();
  582. this.interval = setInterval(this.getCountdown, 60000);
  583. }
  584. },
  585. fail: (err) => {
  586. console.log("matchRsDetailQuery err", err)
  587. },
  588. });
  589. },
  590. // 排名查询
  591. getCardRankDetailQuery() {
  592. uni.request({
  593. url: apiCardRankDetailQuery,
  594. header: {
  595. "Content-Type": "application/x-www-form-urlencoded",
  596. "token": this.token,
  597. },
  598. method: "POST",
  599. data: {
  600. mcIdListStr: this.mcId,
  601. mcType: this.mcType,
  602. dispArrStr: this.dispArrStr
  603. },
  604. success: (res) => {
  605. // console.log("getCardRankDetailQuery", res);
  606. const rankdata = res.data.data;
  607. this.rankList.totalDistanceRs = rankdata.totalDistanceRs;
  608. this.rankList.totalCpRs = rankdata.totalCpRs;
  609. this.rankList.totalSysPointRs = rankdata.totalSysPointRs;
  610. this.rankList.fastPaceRs = rankdata.fastPaceRs;
  611. },
  612. fail: (err) => {
  613. console.log("getCardRankDetailQuery err", err);
  614. },
  615. });
  616. },
  617. // 赛事总成绩统计查询
  618. compStatisticQuery() {
  619. uni.request({
  620. url: apiCompStatisticQuery,
  621. header: {
  622. "Content-Type": "application/x-www-form-urlencoded",
  623. "token": this.token,
  624. },
  625. method: "POST",
  626. data: {
  627. mcId: this.mcId
  628. },
  629. success: (res) => {
  630. // console.log("compStatisticQuery", res);
  631. if (res.data.code == 0) {
  632. const data = res.data.data;
  633. this.all_totalDistance = data.totalDistance;
  634. this.all_totalRightAnswerNum = data.totalRightAnswerNum;
  635. this.all_totalAnswerNum = data.totalAnswerNum;
  636. this.all_totalCp = data.totalCp;
  637. this.all_totalSysPoint = data.totalSysPoint;
  638. }
  639. },
  640. fail: (err) => {
  641. console.log("compStatisticQuery err", err);
  642. },
  643. });
  644. },
  645. // 卡片用户当前排名查询
  646. // getUserCurrentRankNumQuery() {
  647. // uni.request({
  648. // url: apiUserCurrentRankNumQuery,
  649. // header: {
  650. // "Content-Type": "application/x-www-form-urlencoded",
  651. // "token": this.token,
  652. // },
  653. // method: "POST",
  654. // data: {
  655. // ecId: this.ecId
  656. // },
  657. // success: (res) => {
  658. // // console.log("getUserCurrentRankNumQuery", res)
  659. // if (res.data.code == 0) {
  660. // const data = res.data.data;
  661. // const rankNum = data.rankNum;
  662. // this.dealNotice(rankNum);
  663. // }
  664. // },
  665. // fail: (err) => {
  666. // console.log("getUserCurrentRankNumQuery err", err)
  667. // },
  668. // });
  669. // },
  670. // 是否允许重新分组(报名)
  671. isAllowMcSignUp() {
  672. uni.request({
  673. url: apiIsAllowMcSignUp,
  674. header: {
  675. "Content-Type": "application/x-www-form-urlencoded",
  676. "token": this.token,
  677. },
  678. method: "POST",
  679. data: {
  680. ecId: this.ecId
  681. },
  682. success: (res) => {
  683. // console.log("isAllowMcSignUp", res)
  684. if (res.data.code == 0) {
  685. const data = res.data.data;
  686. this.allowMcSignUp = data.allowSignUp;
  687. }
  688. },
  689. fail: (err) => {
  690. console.log("isAllowMcSignUp err", err)
  691. },
  692. });
  693. },
  694. // 用户是否已经报名卡片对应赛事查询
  695. getUserJoinCardQuery() {
  696. uni.request({
  697. url: apiUserJoinCardQuery,
  698. header: {
  699. "Content-Type": "application/x-www-form-urlencoded",
  700. "token": this.token
  701. },
  702. method: "POST",
  703. data: {
  704. ecId: this.ecId
  705. },
  706. success: (res) => {
  707. // console.log("getUserJoinCardQuery", res)
  708. const code = res.data.code;
  709. const data = res.data.data;
  710. if (code == 0) {
  711. this.isJoin = data.isJoin;
  712. if (this.isJoin) { // 已报名
  713. this.btnStartGameText = "我要比赛";
  714. } else { // 未报名
  715. this.btnStartGameText = "我要报名";
  716. }
  717. }
  718. },
  719. fail: (err) => {
  720. console.log("getUserJoinCardQuery err", err)
  721. },
  722. });
  723. },
  724. // 未读消息列表查询
  725. getUnReadMessageQuery() {
  726. uni.request({
  727. url: apiUnReadMessageQuery,
  728. header: {
  729. "Content-Type": "application/x-www-form-urlencoded",
  730. "token": this.token,
  731. },
  732. method: "POST",
  733. data: {
  734. relationType: 2, // 类型 1 成就 2 卡片
  735. relationId: this.ecId
  736. },
  737. success: (res) => {
  738. // console.log("getUnReadMessageQuery", res);
  739. if (checkResCode(res)) {
  740. const unReadMessageRs = res.data.data;
  741. this.popupMessageList.length = 0;
  742. this.mqIdListStr = "";
  743. for (var i = 0; i < unReadMessageRs.length; i++) {
  744. let popupData = {
  745. type: 6, // 6: 通知
  746. data: {}
  747. };
  748. this.messageKey += "-" + unReadMessageRs[i].mqId;
  749. popupData.data.mqType = unReadMessageRs[i].mqType;
  750. popupData.data.title = unReadMessageRs[i].mqTitle;
  751. popupData.data.message = unReadMessageRs[i].mqMessage;
  752. this.popupMessageList.push(popupData);
  753. // this.mqIdListStr += this.unReadMessageRs[i].mqId;
  754. // if (i < this.unReadMessageRs.length - 1) {
  755. // this.mqIdListStr += ",";
  756. // }
  757. }
  758. if (this.popupMessageList.length > 0) {
  759. const messageValue = uni.getStorageSync(this.messageKey);
  760. console.log("messageValue:", messageValue);
  761. if (!messageValue) {
  762. this.$refs.mypopupMessage.popupOpen();
  763. // uni.setStorageSync(this.messageKey, true);
  764. }
  765. }
  766. }
  767. },
  768. fail: (err) => {
  769. console.log("getUnReadMessageQuery err", err);
  770. },
  771. });
  772. },
  773. onNoMoreRemindersClick() {
  774. this.$refs.mypopupMessage.popupClose();
  775. uni.setStorageSync(this.messageKey, true);
  776. },
  777. // 标记消息已读
  778. readMessage() {
  779. uni.request({
  780. url: apiReadMessage,
  781. header: {
  782. "Content-Type": "application/x-www-form-urlencoded",
  783. "token": this.token,
  784. },
  785. method: "POST",
  786. data: {
  787. "mqIdListStr": this.mqIdListStr
  788. },
  789. success: (res) => {
  790. // console.log("readMessage", res);
  791. },
  792. fail: (err) => {
  793. console.log("readMessage err", err);
  794. },
  795. });
  796. },
  797. btnBack() {
  798. // window.history.back();
  799. /* uni.navigateTo({
  800. url: "/pages/bm/style3/rankOverview?" + this.queryString
  801. }); */
  802. const url = `action://to_home/`;
  803. tools.appAction(url);
  804. },
  805. btnStartGame() {
  806. if (this.isJoin) { // 已报名
  807. const url = "/pages/bm/style3/rankOverview?" + this.queryString;
  808. tools.appAction(url, "uni.navigateTo");
  809. } else { // 未报名
  810. const url = "/pages/bm/style3/signup?" + this.queryString;
  811. tools.appAction(url, "uni.navigateTo");
  812. }
  813. },
  814. btnInfo() {
  815. // console.log(this.$refs.mypopup);
  816. this.$refs.mypopup.popupOpen();
  817. },
  818. btnMessage() {
  819. // console.log(this.$refs.mypopup);
  820. this.$refs.mypopupMessage.popupOpen();
  821. },
  822. btnMyEgg() {
  823. // uni.navigateTo({
  824. // url: "/pages/achievement/index2?tabCurrent=2&" + this.queryString
  825. // });
  826. const url = "/pages/achievement/index2?tabCurrent=2&" + this.queryString;
  827. tools.appAction(url, "uni.navigateTo");
  828. },
  829. btnExchg() {
  830. this.$refs.mypopupExchg.popupOpen();
  831. },
  832. onClickTabItem(e) {
  833. if (this.tabCurrent != e.currentIndex) {
  834. this.tabCurrent = e.currentIndex;
  835. }
  836. }
  837. }
  838. }
  839. </script>
  840. <style scoped>
  841. .content {
  842. width: 100vw;
  843. height: 100vh;
  844. }
  845. .top-default {
  846. width: 100%;
  847. height: 170px;
  848. padding-top: 36px;
  849. justify-content: space-between;
  850. background-image: url("/static/backgroud/top_bg2.png");
  851. background-repeat: no-repeat;
  852. background-position: center;
  853. background-size: cover;
  854. }
  855. .topbar-color-default {
  856. color: #5b9100;
  857. }
  858. .topbtm {
  859. width: 100%;
  860. margin-bottom: 5px;
  861. justify-content: space-around;
  862. }
  863. .topbtm-name {
  864. max-width: 300rpx;
  865. padding: 3px 12px;
  866. background-color: #9fda39;
  867. border-radius: 5px;
  868. text-align: center;
  869. font-weight: 500;
  870. color: #497400;
  871. font-size: 14px;
  872. white-space: nowrap;
  873. overflow: hidden;
  874. text-overflow: ellipsis;
  875. }
  876. .topbtm-egg {
  877. width: 60px;
  878. padding: 3px 12px;
  879. background-color: #9fda39;
  880. border-radius: 50px;
  881. text-align: center;
  882. color: #497400;
  883. font-size: 14px;
  884. }
  885. .topbtm-null {
  886. width: 60px;
  887. padding: 3px 12px;
  888. }
  889. .cal {
  890. width: 46rpx;
  891. height: 46rpx;
  892. margin-right: 20rpx;
  893. }
  894. .main {
  895. width: 100%;
  896. /* height: 70vh; */
  897. flex-grow: 1;
  898. justify-content: space-around;
  899. /* justify-content: space-between; */
  900. }
  901. .main-bar {
  902. width: 100%;
  903. height: 21px;
  904. background-color: #d8e8c6;
  905. font-size: 10px;
  906. font-weight: 500;
  907. color: #3d6706;
  908. }
  909. .main-tab {
  910. width: 90%;
  911. margin-top: 20rpx;
  912. }
  913. .tab-view {
  914. width: 100%;
  915. /* height: 69vh; */
  916. flex-grow: 1;
  917. }
  918. .btnBack {
  919. width: 70%;
  920. /* height: 6vh; */
  921. height: 80rpx;
  922. /* margin-bottom: 1vh; */
  923. margin-bottom: 20rpx;
  924. /* font-weight: bold; */
  925. color: white;
  926. font-size: 32rpx;
  927. line-height: 80rpx;
  928. border-radius: 27px;
  929. background-color: #81cd00;
  930. }
  931. </style>