index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. <template>
  2. <view class="school_report">
  3. <custom-nav title="成绩单"></custom-nav>
  4. <view class="header">
  5. <view class="top">
  6. <text class="season">大卫博士学位争霸赛第{{ info.season }}季</text>
  7. <!-- <picker class="toggle" :range="seasonList" range-key="name" :value="season_index" @change="changeSeason">切换赛季</picker> -->
  8. <view class="toggle" @click="toShare">分享成绩单</view>
  9. </view>
  10. <view class="bottom">赛季时间:{{ info.season_time }}</view>
  11. </view>
  12. <view class="nav">
  13. <view class="nav_main">
  14. <view class="item" :class="navActive === 0 ? 'active' : ''" @click="navActive = 0">成长</view>
  15. <view class="item" :class="navActive === 1 ? 'active' : ''" @click="navActive = 1">荣誉</view>
  16. </view>
  17. <image :src="userWxInfo.avatarUrl" class="header_img"></image>
  18. </view>
  19. <view class="container" v-if="navActive === 0">
  20. <view class="all_link">
  21. <view class="left">
  22. <view>总学分:{{ infoBody.integral || '' }}</view>
  23. <view class="speed_item_name level" v-if="infoBody.integral >= 300">{{ infoBody.integral | userXueWei }}</view>
  24. </view>
  25. <view class="link" @click="toRankLink">查看排行榜</view>
  26. </view>
  27. <view class="achievement_list">
  28. <view class="achievement_item">
  29. <view class="title">
  30. <view class="left">
  31. <view class="index">01</view>
  32. <view clas>销售数量</view>
  33. </view>
  34. </view>
  35. <view class="body">
  36. <view class="bot_box"><view class="bot"></view></view>
  37. <view class="info info_flex">
  38. <view class="speed_item_name name">本届总销售:{{ infoBody.sale_num.total || 0 }}套</view>
  39. <view class="text" v-if="infoBody.sale_num.total_up_num > 0">同比上季多卖了{{ infoBody.sale_num.total_up_num || 0 }}套</view>
  40. </view>
  41. </view>
  42. <view class="body">
  43. <view class="bot_box"><view class="bot"></view></view>
  44. <view class="info info_flex">
  45. <view class="speed_item_name name">简约版:{{ infoBody.sale_num.simple || 0 }}套</view>
  46. <view class="text" v-if="infoBody.sale_num.simple_up_num > 0">同比上季多卖了{{ infoBody.sale_num.simple_up_num || 0 }}套</view>
  47. </view>
  48. </view>
  49. <view class="body">
  50. <view class="bot_box"><view class="bot"></view></view>
  51. <view class="info info_flex">
  52. <view class="speed_item_name name">高腰版:{{ infoBody.sale_num.old || 0 }}套</view>
  53. <view class="text" v-if="infoBody.sale_num.old_up_num > 0">同比上季多卖了{{ infoBody.sale_num.old_up_num || 0 }}套</view>
  54. </view>
  55. </view>
  56. <view class="body">
  57. <view class="bot_box"><view class="bot"></view></view>
  58. <view class="info info_flex">
  59. <view class="speed_item_name name">青春版:{{ infoBody.sale_num.youth || 0 }}套</view>
  60. <view class="text" v-if="infoBody.sale_num.youth_up_num > 0">同比上季多卖了{{ infoBody.sale_num.youth_up_num || 0 }}套</view>
  61. </view>
  62. </view>
  63. <view class="body">
  64. <view class="bot_box"><view class="bot"></view></view>
  65. <view class="info info_flex">
  66. <view class="speed_item_name name">精装版:{{ infoBody.sale_num.hard || 0 }}套</view>
  67. <view class="text" v-if="infoBody.sale_num.hard_up_num > 0">同比上季多卖了{{ infoBody.sale_num.hard_up_num || 0 }}套</view>
  68. </view>
  69. </view>
  70. <view class="body">
  71. <view class="bot_box"><view class="bot"></view></view>
  72. <view class="info info_flex">
  73. <view class="speed_item_name name">棉老版:{{ infoBody.sale_num.cot_old || 0 }}套</view>
  74. <view class="text" v-if="infoBody.sale_num.cot_old_up_num > 0">同比上季多卖了{{ infoBody.sale_num.cot_old_up_num || 0 }}套</view>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="achievement_item">
  79. <view class="title">
  80. <view class="left">
  81. <view class="index">02</view>
  82. <view clas>学分挑战</view>
  83. </view>
  84. </view>
  85. <view class="body">
  86. <view class="bot_box"><view class="bot"></view></view>
  87. <view class="info info_flex">
  88. <view class="speed_item_name name">挑战成功:{{ infoBody.challenge.challenge_success || 0 }}次</view>
  89. <view class="text" v-if="infoBody.challenge.challenge_inte > 0">赢得{{ infoBody.challenge.challenge_inte || 0 }}奖学金</view>
  90. </view>
  91. </view>
  92. <view class="body">
  93. <view class="bot_box"><view class="bot"></view></view>
  94. <view class="info info_flex">
  95. <view class="speed_item_name name">挑战失败:{{ infoBody.challenge.challenge_fail || 0 }}次</view>
  96. </view>
  97. </view>
  98. <view class="body" v-if="infoBody.challenge.guessing_total > 0">
  99. <view class="bot_box"><view class="bot"></view></view>
  100. <view class="info info_flex">
  101. <view class="speed_item_name name">参与竞猜:{{ infoBody.challenge.guessing_total || 0 }}次</view>
  102. </view>
  103. </view>
  104. <view class="body">
  105. <view class="bot_box"><view class="bot"></view></view>
  106. <view class="info info_flex">
  107. <view class="speed_item_name name">竞猜赢了:{{ infoBody.challenge.guessing_success || 0 }}次</view>
  108. <view class="text" v-if="infoBody.challenge.guessing_inte">赢得{{ infoBody.challenge.guessing_inte || 0 }}奖学金</view>
  109. </view>
  110. </view>
  111. <view class="body">
  112. <view class="bot_box"><view class="bot"></view></view>
  113. <view class="info info_flex">
  114. <view class="speed_item_name name">竞猜输了:{{ infoBody.challenge.guessing_fail || 0 }}次</view>
  115. </view>
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. <view class="container" v-else>
  121. <view class="all_link">
  122. <view class="left">
  123. <view>奖励金:{{ infoBody.bonus || 0 }}</view>
  124. </view>
  125. <!-- <view class="link" @click="toDuiHuan">兑换礼品</view> -->
  126. </view>
  127. <view class="achievement_list">
  128. <view class="achievement_item">
  129. <view class="title">
  130. <view class="left">
  131. <view class="index">01</view>
  132. <view clas>赛季成就</view>
  133. </view>
  134. </view>
  135. <view v-if="infoBody.season_data && infoBody.season_data.length > 0">
  136. <view class="body" v-for="(item, index) in infoBody.season_data" :key="index">
  137. <view class="bot_box"><view class="bot"></view></view>
  138. <view class="info">
  139. <view class="speed_item_name name">{{ item.type | deg }}</view>
  140. <view class="text">
  141. <view>获得时间</view>
  142. <view>{{ item.time }}</view>
  143. </view>
  144. </view>
  145. </view>
  146. </view>
  147. <view v-else>
  148. <view class="body">
  149. <view class="bot_box"><view class="bot"></view></view>
  150. <view class="info"><view class="speed_item_name name">未获得任何成就</view></view>
  151. </view>
  152. </view>
  153. </view>
  154. <view class="achievement_item">
  155. <view class="title">
  156. <view class="left">
  157. <view class="index">02</view>
  158. <view clas>荣誉证书</view>
  159. </view>
  160. <view class="right" @click="toHonorList">全部证书</view>
  161. </view>
  162. <view v-if="infoBody.season_data && infoBody.season_data.length > 0">
  163. <view class="body" v-for="(item, index) in infoBody.season_data" :key="index">
  164. <view class="bot_box"><view class="bot"></view></view>
  165. <view class="info">
  166. <view class="speed_item_name name">{{ item.type | deg }}</view>
  167. <view class="text">
  168. <view>获得时间</view>
  169. <view>{{ item.time }}</view>
  170. </view>
  171. </view>
  172. </view>
  173. </view>
  174. <view v-else>
  175. <view class="body">
  176. <view class="bot_box"><view class="bot"></view></view>
  177. <view class="info"><view class="speed_item_name name">未获得任何证书</view></view>
  178. </view>
  179. </view>
  180. </view>
  181. <view class="achievement_item">
  182. <view class="title">
  183. <view class="left">
  184. <view class="index">03</view>
  185. <view clas>荣誉奖章</view>
  186. </view>
  187. <view class="right" @click="showJiangPai">查看奖章</view>
  188. </view>
  189. <view class="body">
  190. <view class="bot_box"><view class="bot"></view></view>
  191. <view class="info">
  192. <view class="speed_item_name name">{{ jiangpaiShow(infoBody.season_data).name }}</view>
  193. <view class="text" v-if="jiangpaiShow(infoBody.season_data).time">
  194. <view>获得时间</view>
  195. <view>{{ jiangpaiShow(infoBody.season_data).time }}</view>
  196. </view>
  197. </view>
  198. </view>
  199. </view>
  200. </view>
  201. </view>
  202. <page-toast :is-show="seeJiangPai" :before-close="resetjpToast">
  203. <view class="medal_container">
  204. <view>{{ jiangpaiShow(infoBody.season_data).name }}</view>
  205. <image class="medal_img" :src="`https://api.jiuweiyun.cn/public/uploads/icon/jp${jiangpaiShow(infoBody.season_data).type}.png`"></image>
  206. </view>
  207. </page-toast>
  208. </view>
  209. </template>
  210. <script>
  211. import { get_season_list, school_report } from '../../api.js';
  212. import { numToZh } from '../../common/js/filters.js';
  213. export default {
  214. data() {
  215. return {
  216. userWxInfo: this.$store.state.userWeixinInfo,
  217. seasonList: [],
  218. season_index: 0,
  219. season_id: '',
  220. info: {},
  221. navActive: 0,
  222. infoBody: [],
  223. seeJiangPai: false
  224. };
  225. },
  226. watch: {
  227. navActive(a, b) {
  228. this.infoBody = (a === 0 ? this.info.list1 : this.info.list2) || [];
  229. }
  230. },
  231. onLoad() {
  232. this.getInfo();
  233. // this.getSeasonList()
  234. },
  235. methods: {
  236. toShare() {
  237. uni.navigateTo({
  238. url: '../cjdshare/index'
  239. });
  240. },
  241. toHonorList() {
  242. uni.navigateTo({
  243. url: '../honorList/index'
  244. });
  245. },
  246. toDuiHuan() {
  247. uni.navigateTo({
  248. url: '../exchange/exchange'
  249. });
  250. },
  251. toRankLink() {
  252. uni.navigateTo({
  253. url: '../ranking/ranking'
  254. });
  255. },
  256. resetjpToast() {
  257. this.seeJiangPai = false;
  258. },
  259. showJiangPai() {
  260. if (!this.infoBody.season_data || this.infoBody.season_data.length < 0 || this.jiangpaiShow(this.infoBody.season_data).type === -1) {
  261. uni.showModal({
  262. content: '您还未获得奖牌',
  263. showCancel: false
  264. });
  265. } else {
  266. this.seeJiangPai = true;
  267. }
  268. },
  269. getInfo() {
  270. uni.showLoading({
  271. title: '加载中',
  272. mask: true
  273. });
  274. this.$ajax.get(`${school_report}`).then(([, { data: res }]) => {
  275. uni.hideLoading();
  276. if (res.code === 200) {
  277. this.info = res.data;
  278. this.infoBody = (this.navActive === 0 ? res.data.list1 : res.data.list2) || [];
  279. }
  280. });
  281. },
  282. getSeasonList() {
  283. uni.showLoading({
  284. title: '加载中',
  285. mask: true
  286. });
  287. this.$ajax.get(`${get_season_list}`).then(([, { data: res }]) => {
  288. uni.hideLoading();
  289. if (res.code === 200) {
  290. this.seasonList = res.data.list.map(item => ({
  291. season: item.season,
  292. name: `大卫博士学位争霸赛第${item.season}季`
  293. }));
  294. }
  295. });
  296. },
  297. changeSeason(e) {
  298. this.season_id = this.seasonList[e.target.value].season;
  299. console.log(this.season_id);
  300. },
  301. jiangpaiShow(arr) {
  302. let out = {
  303. name: '未获得奖牌',
  304. time: '',
  305. type: -1
  306. };
  307. if (!arr || arr.length < 1) return out;
  308. let typeArr = arr.map(i => i.type);
  309. let maxType = Math.max.apply(Math, typeArr);
  310. let maxIndex = arr.findIndex(i => i.type === maxType);
  311. out.time = arr[maxIndex].time;
  312. switch (arr[maxIndex].type) {
  313. case 4:
  314. out.name = '金牌奖章';
  315. out.type = 4;
  316. break;
  317. case 3:
  318. out.name = '银牌奖章';
  319. out.type = 3;
  320. break;
  321. case 2:
  322. out.name = '铜牌奖章';
  323. out.type = 2;
  324. break;
  325. }
  326. return out;
  327. }
  328. }
  329. };
  330. </script>
  331. <style lang="scss" scoped>
  332. .school_report {
  333. border-top: 128rpx solid #ffffff;
  334. .medal_container {
  335. margin: 0 auto;
  336. width: 450rpx;
  337. height: 500rpx;
  338. padding: 30rpx 0 50rpx 0;
  339. border-radius: 6rpx;
  340. display: flex;
  341. justify-content: space-between;
  342. flex-direction: column;
  343. color: #333333;
  344. font-size: 36rpx;
  345. background-color: #ffffff;
  346. align-items: center;
  347. .medal_img {
  348. width: 300rpx;
  349. height: 336rpx;
  350. }
  351. }
  352. .speed_item_name {
  353. padding: 10rpx 15rpx;
  354. color: #f7a351;
  355. font-size: 28rpx;
  356. border: 1px solid #fa6342;
  357. border-radius: 4rpx;
  358. background-color: rgba(250, 99, 66, 0.1);
  359. position: relative;
  360. margin-bottom: 10rpx;
  361. &::before {
  362. content: '';
  363. display: block;
  364. width: 0;
  365. height: 0;
  366. border-width: 8rpx;
  367. border-style: solid;
  368. border-color: transparent #ffc7bb transparent transparent;
  369. position: absolute;
  370. top: 20rpx;
  371. left: -16rpx;
  372. z-index: 3;
  373. }
  374. &::after {
  375. content: '';
  376. display: block;
  377. width: 0;
  378. height: 0;
  379. border-width: 12rpx;
  380. border-style: solid;
  381. border-color: transparent #fa6342 transparent transparent;
  382. position: absolute;
  383. top: 16rpx;
  384. left: -24rpx;
  385. z-index: 2;
  386. }
  387. }
  388. .header {
  389. background-color: #fa6342;
  390. padding: 56rpx 32rpx;
  391. padding-bottom: 36rpx;
  392. .top {
  393. display: flex;
  394. justify-content: space-between;
  395. align-items: center;
  396. margin-bottom: 23rpx;
  397. .season {
  398. font-size: 36rpx;
  399. color: #ffffff;
  400. }
  401. .toggle {
  402. color: #fa6342;
  403. background-color: #f2f4f5;
  404. font-size: 24rpx;
  405. height: 48rpx;
  406. line-height: 48rpx;
  407. width: 148rpx;
  408. border-radius: 24rpx;
  409. text-align: center;
  410. }
  411. }
  412. .bottom {
  413. font-size: 26rpx;
  414. color: #ffffff;
  415. }
  416. }
  417. .nav {
  418. color: #333333;
  419. font-size: 32rpx;
  420. width: 100%;
  421. height: 128rpx;
  422. background-image: url(../../static/icon/cjd_bg.png);
  423. background-size: 100% 100%;
  424. position: relative;
  425. .header_img {
  426. display: block;
  427. width: 128rpx;
  428. height: 128rpx;
  429. border-radius: 50%;
  430. position: absolute;
  431. top: 0;
  432. bottom: 0;
  433. right: 30rpx;
  434. }
  435. .nav_main {
  436. padding: 0 60rpx;
  437. height: 128rpx;
  438. display: flex;
  439. align-items: flex-end;
  440. .item {
  441. line-height: 64rpx;
  442. border-bottom: 2px solid #ffffff;
  443. &:nth-of-type(1) {
  444. margin-right: 100rpx;
  445. }
  446. }
  447. .active {
  448. border-bottom-color: #fa6342 !important;
  449. color: #fa6342 !important;
  450. }
  451. }
  452. }
  453. .container {
  454. padding: 24rpx 30rpx;
  455. .all_link {
  456. display: flex;
  457. justify-content: space-between;
  458. align-items: center;
  459. height: 70rpx;
  460. background-color: #f2f4f5;
  461. padding: 0 24rpx;
  462. color: #333333;
  463. font-size: 26rpx;
  464. .left {
  465. display: flex;
  466. align-items: center;
  467. .level {
  468. margin-left: 22rpx;
  469. font-size: 22rpx;
  470. padding-top: 4rpx;
  471. padding-bottom: 4rpx;
  472. margin-bottom: 0;
  473. &::before {
  474. top: 10rpx;
  475. }
  476. &::after {
  477. top: 6rpx;
  478. }
  479. }
  480. }
  481. .link {
  482. display: flex;
  483. align-items: center;
  484. color: #999999;
  485. font-size: 24rpx;
  486. &::after {
  487. content: '';
  488. display: block;
  489. width: 0;
  490. height: 0;
  491. margin-left: 17rpx;
  492. border-width: 6rpx;
  493. border-style: solid;
  494. border-color: transparent transparent transparent #000000;
  495. }
  496. }
  497. }
  498. .achievement_list {
  499. position: relative;
  500. &::after {
  501. content: '';
  502. display: block;
  503. width: 1px;
  504. height: 100%;
  505. background: #d2d2d2;
  506. position: absolute;
  507. top: 0;
  508. left: 41rpx;
  509. z-index: -1;
  510. }
  511. }
  512. .achievement_item {
  513. .title {
  514. display: flex;
  515. justify-content: space-between;
  516. align-items: center;
  517. margin: 20rpx 0;
  518. .left {
  519. display: flex;
  520. align-items: center;
  521. .index {
  522. width: 82rpx;
  523. height: 82rpx;
  524. background-image: url(../../static/icon/cjd_bg2.png);
  525. background-size: 100% 100%;
  526. color: #ffffff;
  527. font-size: 28rpx;
  528. line-height: 82rpx;
  529. text-align: center;
  530. margin-right: 35rpx;
  531. }
  532. }
  533. .right {
  534. color: #999999;
  535. font-size: 24rpx;
  536. display: flex;
  537. align-items: center;
  538. &::after {
  539. content: '';
  540. display: block;
  541. width: 0;
  542. height: 0;
  543. margin-left: 17rpx;
  544. border-width: 6rpx;
  545. border-style: solid;
  546. border-color: transparent transparent transparent #000000;
  547. }
  548. }
  549. }
  550. .body {
  551. display: flex;
  552. align-items: flex-start;
  553. justify-content: flex-start;
  554. margin-bottom: 40rpx;
  555. .bot_box {
  556. height: 60rpx;
  557. display: flex;
  558. align-items: center;
  559. }
  560. .bot {
  561. width: 22rpx;
  562. height: 22rpx;
  563. border-radius: 50%;
  564. background-color: #ffc7bb;
  565. margin: 0 30rpx;
  566. }
  567. .info_flex {
  568. display: flex;
  569. justify-content: flex-start;
  570. align-items: center;
  571. .name {
  572. margin-right: 36rpx;
  573. }
  574. }
  575. .info {
  576. .text {
  577. text-align: center;
  578. color: #333333;
  579. font-size: 24rpx;
  580. line-height: 40rpx;
  581. }
  582. }
  583. }
  584. }
  585. }
  586. }
  587. </style>