rankList.vue 26 KB

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