index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. <template>
  2. <view>
  3. <custom-nav title="荣耀殿堂"></custom-nav>
  4. <view class="honor">
  5. <custom-toast ref='toast'></custom-toast>
  6. <!-- <view class="season_container">
  7. <view>学位争霸赛第{{ season_id ? season_id : userInfo.season }}季</view>
  8. <picker class="toggle" :range="seasonList" range-key="name" :value="season_index" @change="changeSeason">
  9. <text>切换赛季</text>
  10. <image src="../../static/icon/arrow.png" class="arrow"></image>
  11. </picker>
  12. </view> -->
  13. <view style="padding: 30rpx 0 40rpx 0;">
  14. <view class="honorTong" @click="toNotice">
  15. <view class="img">
  16. <image class="bg" src="https://api.jiuweiyun.cn/public/uploads/icon/new_tzs.png"></image>
  17. </view>
  18. <image class="bot" src="https://api.jiuweiyun.cn/public/uploads/weapp/icon/honor/honour_bot.png">
  19. </image>
  20. <view class="name">通知书</view>
  21. <view class="honorTong_mask" v-if="!userInfo.signuped">暂未获取</view>
  22. </view>
  23. <view class="honorBox" v-for="(item, index) in certificateList" :key="index">
  24. <view class="honorBox_top">
  25. <image v-if="item.graduate" class="bg"
  26. src="https://api.jiuweiyun.cn/public/uploads/weapp/icon/honor_bg.png" @click="toDetail(item)">
  27. </image>
  28. <image v-else class="bg" src="https://api.jiuweiyun.cn/public/uploads/weapp/icon/honor_bg2.png"
  29. @click="toDetail(item)"></image>
  30. <image class="pai" :src="item.pai" @click="_previewImage(item.pai)"></image>
  31. </view>
  32. <image class="bot" src="https://api.jiuweiyun.cn/public/uploads/weapp/icon/honor/honour_bot.png">
  33. </image>
  34. <view class="honorBox_flex">
  35. <view class="name">{{item.name}}</view>
  36. <view class="name">{{item.tip}}</view>
  37. </view>
  38. <view class="honorBox_mask" v-if="item.is">差{{item.is}}学分</view>
  39. </view>
  40. </view>
  41. <!-- <view class="honor_list">
  42. <view class="item" v-for="(item, index) in certificateList" :key="index" @click="toDetail(item)">
  43. <view class="honor_img">
  44. <image v-if="index === 0" class="bg" src="https://api.jiuweiyun.cn/public/uploads/weapp/icon/honor_bg.png"></image>
  45. <image v-else class="bg" src="https://api.jiuweiyun.cn/public/uploads/weapp/icon/honor_bg2.png"></image>
  46. <view class="mask" v-if="item.is">差{{item.is}}学分</view>
  47. </view>
  48. <view class="name">{{item.name}}</view>
  49. </view>
  50. <view class="item" @click="toNotice">
  51. <view class="honor_img">
  52. <image class="bg" src="https://api.jiuweiyun.cn/public/uploads/icon/new_tzs.png"></image>
  53. <view class="mask" v-if="!userInfo.signuped">暂未获取</view>
  54. </view>
  55. <view class="name">通知书</view>
  56. </view>
  57. </view> -->
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. import {
  63. get_season_list,
  64. api_getHistoryHonourList
  65. } from '../../api.js'
  66. import {
  67. numToZh
  68. } from '../../common/js/filters.js'
  69. export default {
  70. data() {
  71. return {
  72. certificateList: [],
  73. seasonList: [],
  74. season_index: 0,
  75. season_id: '',
  76. userInfo: this.$store.state.userServerInfo,
  77. seasonInfo: {},
  78. list: [
  79. 'https://api.jiuweiyun.cn/public/uploads/weapp/icon/honor/1honor_pai1@x.png',
  80. 'https://api.jiuweiyun.cn/public/uploads/weapp/icon/honor/honor_pai2@x.png',
  81. 'https://api.jiuweiyun.cn/public/uploads/weapp/icon/honor/honor_pai3@x.png',
  82. 'https://api.jiuweiyun.cn/public/uploads/weapp/icon/honor/honor_pai4@x.png'
  83. ]
  84. }
  85. },
  86. watch: {
  87. seasonInfo: {
  88. handler(a) {
  89. this.certificateList = this.getCertificateList(a.integral)
  90. }
  91. }
  92. },
  93. onLoad() {
  94. this.getSeasonList()
  95. this.getImageList()
  96. // this.certificateList = this.getCertificateList(this.userInfo.score)
  97. // console.log(this.certificateList)
  98. },
  99. methods: {
  100. getImageList() {
  101. let arr = this.getCertificateList(this.userInfo.score)
  102. arr[0].graduate = true
  103. let that = this
  104. that.certificateList = []
  105. arr.map((item, i) => {
  106. item.pai = that.list[i]
  107. if (item.is > 0 && i == 0) { // 未报名或者已报名学分不满200
  108. that.certificateList.push(item)
  109. console.log(1)
  110. } else if (item.is > 0 && i == 1 && arr[0].is == 0) { // 大学毕业,未获得学士学位
  111. that.certificateList = arr.slice(0, 2)
  112. console.log(2)
  113. } else if (item.is > 0 && i == 2 && arr[1].is == 0) { // 学士学位,未获得硕士学位
  114. that.certificateList = arr.slice(1, 3)
  115. console.log(3)
  116. } else if (item.is > 0 && i == 3 && arr[2].is == 0) { // 硕士学位,未获得博士学位
  117. that.certificateList = arr.slice(2, 4)
  118. console.log(4)
  119. } else if (item.is == 0 && i == 3 && arr[3].is == 0) { // 博士学位
  120. that.certificateList.push(item)
  121. console.log(5, that.certificateList)
  122. }
  123. })
  124. },
  125. // 胸牌预览
  126. _previewImage(url) {
  127. uni.previewImage({
  128. urls: [url],
  129. current: url
  130. })
  131. },
  132. toNotice() {
  133. if (this.userInfo.signuped) {
  134. uni.navigateTo({
  135. url: "../certificate/notice"
  136. })
  137. } else {
  138. uni.showModal({
  139. content: "未获得",
  140. showCancel: false
  141. })
  142. }
  143. },
  144. getSeasonList() {
  145. uni.showLoading({
  146. title: '加载中',
  147. mask: true
  148. })
  149. this.$ajax.get(`${get_season_list}`).then(([, {
  150. data: res
  151. }]) => {
  152. uni.hideLoading()
  153. if (res.code === 200) {
  154. this.seasonList = res.data.list.map(item => ({
  155. season: item.season,
  156. name: `大卫博士学位争霸赛第${item.season}季`
  157. }))
  158. }
  159. })
  160. },
  161. changeSeason(e) {
  162. this.season_id = this.seasonList[e.target.value].season
  163. uni.showLoading({
  164. title: '加载中',
  165. mask: true
  166. })
  167. this.$ajax.get(`${api_getHistoryHonourList}?season=${this.season_id}`).then(([, {
  168. data: res
  169. }]) => {
  170. uni.hideLoading()
  171. if (res.code === 200) {
  172. this.seasonInfo = res.data
  173. }
  174. })
  175. },
  176. toDetail(item) {
  177. if (item.is) {
  178. uni.showModal({
  179. content: `还差${item.is}学分,即可获得证书`,
  180. showCancel: false,
  181. confirmText: '确定'
  182. })
  183. } else {
  184. let time = this.seasonInfo && this.seasonInfo.time ? `&time=${this.seasonInfo.time}` : ''
  185. uni.navigateTo({
  186. url: `../honour/honour?score=${item.is}&grade=${item.name.slice(0,4)}${time}`
  187. })
  188. }
  189. },
  190. getCertificateList(score) {
  191. if (!score && score !== 0) return []
  192. try {
  193. let arr = [{
  194. name: '大学毕业证书',
  195. tip: '大学毕业胸牌',
  196. score: 100
  197. }, {
  198. name: '学士学位证书',
  199. tip: '学士学位胸牌',
  200. score: 200
  201. }, {
  202. name: '硕士学位证书',
  203. tip: '硕士学位胸牌',
  204. score: 600
  205. }, {
  206. name: '博士学位证书',
  207. tip: '博士学位胸牌',
  208. score: 1000
  209. }]
  210. let index = -1
  211. let len = arr.length
  212. for (let i = 0; i < len; i++) {
  213. let max = arr[i].score
  214. if (i < len - 1) {
  215. let nextScore = arr[i + 1].score
  216. if (score >= max && score < nextScore) {
  217. index = i
  218. break
  219. }
  220. } else if (i === len - 1) {
  221. index = score >= arr[len - 1].score ? len - 1 : -1
  222. }
  223. }
  224. return arr.map((item, i) => ({
  225. name: item.name,
  226. tip: item.tip,
  227. is: i <= index ? 0 : item.score - score,
  228. }))
  229. } catch (e) {
  230. console.log(e)
  231. return []
  232. }
  233. }
  234. }
  235. }
  236. </script>
  237. <style scoped lang="scss">
  238. .honorTong {
  239. padding: 30rpx 30rpx 20rpx 30rpx;
  240. display: flex;
  241. align-items: center;
  242. flex-direction: column;
  243. position: relative;
  244. .img {
  245. margin-bottom: -15rpx;
  246. z-index: 5;
  247. .bg {
  248. width: 247rpx;
  249. height: 375rpx;
  250. z-index: 5;
  251. }
  252. }
  253. .name {
  254. font-size: 28rpx;
  255. color: #707070;
  256. margin-top: 22rpx;
  257. }
  258. .bot {
  259. z-index: 1;
  260. width: 100%;
  261. height: 28rpx;
  262. }
  263. &_mask {
  264. position: absolute;
  265. top: 0;
  266. left: 0;
  267. bottom: 0;
  268. right: 0;
  269. background: rgba(255, 255, 255, 0.5);
  270. width: 100%;
  271. height: 100%;
  272. color: #DF3614;
  273. font-size: 48rpx;
  274. font-weight: bold;
  275. text-align: center;
  276. padding-top: 156rpx;
  277. z-index: 9;
  278. }
  279. }
  280. .honorBox {
  281. position: relative;
  282. // margin-top: 20rpx;
  283. // padding: 15rpx 30rpx;
  284. padding: 40rpx 30rpx;
  285. &_mask {
  286. position: absolute;
  287. top: 0;
  288. left: 0;
  289. bottom: 0;
  290. right: 0;
  291. background: rgba(255, 255, 255, 0.5);
  292. width: 100%;
  293. height: 100%;
  294. color: #DF3614;
  295. font-size: 48rpx;
  296. font-weight: bold;
  297. text-align: center;
  298. padding-top: 156rpx;
  299. z-index: 9;
  300. }
  301. &_flex {
  302. display: flex;
  303. justify-content: space-between;
  304. padding: 0 78rpx 0 90rpx;
  305. margin-top: 22rpx;
  306. font-size: 28rpx;
  307. color: #707070;
  308. }
  309. &_top {
  310. display: flex;
  311. align-items: flex-end;
  312. justify-content: center;
  313. margin-bottom: -10rpx;
  314. z-index: 5;
  315. .bg {
  316. width: 247rpx;
  317. height: 375rpx;
  318. z-index: 5;
  319. }
  320. .pai {
  321. margin-left: 112rpx;
  322. width: 240rpx;
  323. height: 330rpx;
  324. z-index: 5;
  325. }
  326. }
  327. .bot {
  328. z-index: 1;
  329. width: 100%;
  330. height: 28rpx;
  331. }
  332. }
  333. .honor {
  334. min-height: 100%;
  335. background-color: #fff;
  336. // border-top: 128rpx solid #FFFFFF;
  337. .season_container {
  338. position: fixed;
  339. z-index: 999;
  340. top: 120rpx;
  341. left: 0;
  342. right: 0;
  343. flex: 1;
  344. height: 72rpx;
  345. line-height: 72rpx;
  346. color: #F96341;
  347. font-size: 32rpx;
  348. padding: 0 32rpx;
  349. display: flex;
  350. justify-content: space-between;
  351. align-items: center;
  352. background-color: #FFFFFF;
  353. border-top: 1px solid #EEEEEE;
  354. .toggle {
  355. color: #656565;
  356. font-size: 26rpx;
  357. display: flex;
  358. align-items: center;
  359. .arrow {
  360. width: 30rpx;
  361. height: 30rpx;
  362. }
  363. }
  364. }
  365. .honor_list {
  366. padding: 30rpx;
  367. padding-top: 102rpx;
  368. display: flex;
  369. justify-content: flex-start;
  370. flex-wrap: wrap;
  371. .item {
  372. width: calc(100% / 2);
  373. margin-bottom: 50rpx;
  374. &:nth-of-type(3n) {
  375. margin-right: 0;
  376. font-size: 28rpx;
  377. color: #333333;
  378. }
  379. .name {
  380. width: 100%;
  381. overflow: hidden;
  382. text-align: center;
  383. }
  384. .honor_img {
  385. width: 301rpx;
  386. height: 470rpx;
  387. display: block;
  388. margin: 0 auto;
  389. margin-bottom: 20rpx;
  390. position: relative;
  391. .mask {
  392. position: absolute;
  393. top: 0;
  394. left: 0;
  395. bottom: 0;
  396. right: 0;
  397. background: rgba(0, 0, 0, .6);
  398. width: 100%;
  399. height: 100%;
  400. color: #FFFFFF;
  401. font-size: 40rpx;
  402. display: flex;
  403. align-items: center;
  404. justify-content: center;
  405. }
  406. .bg {
  407. width: 100%;
  408. height: 100%;
  409. }
  410. }
  411. }
  412. }
  413. }
  414. </style>
  415. https://api.jiuweiyun.cn/public/uploads/weapp/icon/tel_logon_bg.png
  416. https://api.jiuweiyun.cn/public/uploads/icon/warn.png
  417. https://api.jiuweiyun.cn/public/uploads/icon/new_tzs.png
  418. https://api.jiuweiyun.cn/public/uploads/weapp/icon/vs.png
  419. https://api.jiuweiyun.cn/public/uploads/weapp/icon/cjd_bg1.png
  420. https://api.jiuweiyun.cn/public/uploads/weapp/icon/cjd_bg3.png
  421. https://api.jiuweiyun.cn/public/uploads/weapp/icon/cjd_bg4.png
  422. https://api.jiuweiyun.cn/public/uploads/weapp/icon/honor_bg.png
  423. https://api.jiuweiyun.cn/public/uploads/weapp/icon/honor_bg_no.png
  424. https://api.jiuweiyun.cn/public/uploads/weapp/icon/honor_bg2.png
  425. https://api.jiuweiyun.cn/public/uploads/weapp/icon/honor_bg2_no.png
  426. https://api.jiuweiyun.cn/public/uploads/weapp/icon/2.png
  427. https://api.jiuweiyun.cn/public/uploads/weapp/icon/cancel.png
  428. https://api.jiuweiyun.cn/public/uploads/icon/how-signup.png
  429. https://api.jiuweiyun.cn/public/uploads/icon/how-share.png
  430. https://api.jiuweiyun.cn/public/uploads/icon/how-upload.png
  431. https://api.jiuweiyun.cn/public/uploads/weapp/icon/honor_bg.png
  432. https://api.jiuweiyun.cn/public/uploads/weapp/icon/honor_bg2.png
  433. https://api.jiuweiyun.cn/public/uploads/icon/new_tzs.png
  434. https://api.jiuweiyun.cn/public/uploads/hotList-bg.png
  435. https://api.jiuweiyun.cn/public/uploads/icon/helpshare.png
  436. https://api.jiuweiyun.cn/public/uploads/weapp/icon/33.png
  437. https://api.jiuweiyun.cn/public/uploads/icon/helpupload.png
  438. https://api.jiuweiyun.cn/public/uploads/weapp/icon/index_bg1.png
  439. https://api.jiuweiyun.cn/public/uploads/weapp/icon/index_bg2.png
  440. https://api.jiuweiyun.cn/public/uploads/weapp/icon/index_bg3.png
  441. https://api.jiuweiyun.cn/public/uploads/weapp/icon/index_bg4.png
  442. https://api.jiuweiyun.cn/public/uploads/icon/toast8.png
  443. https://api.jiuweiyun.cn/public/uploads/icon/toast7.png
  444. https://api.jiuweiyun.cn/public/uploads/weapp/icon/logo.png
  445. https://api.jiuweiyun.cn/public/uploads/weapp/icon/cancel.png
  446. https://api.jiuweiyun.cn/public/uploads/weapp/icon/index_bg1.png
  447. https://api.jiuweiyun.cn/public/uploads/weapp/icon/index_bg2.png
  448. https://api.jiuweiyun.cn/public/uploads/weapp/icon/index_bg3.png
  449. https://api.jiuweiyun.cn/public/uploads/weapp/icon/index_bg4.png
  450. https://api.jiuweiyun.cn/public/uploads/icon/toast7.png
  451. https://api.jiuweiyun.cn/public/uploads/icon/toast8.png
  452. https://api.jiuweiyun.cn/public/uploads/icon/toast9.png
  453. https://api.jiuweiyun.cn/public/uploads/weapp/icon/phb_bg.png
  454. https://api.jiuweiyun.cn/public/uploads/icon/self.png
  455. https://api.jiuweiyun.cn/public/uploads/icon/sold.png
  456. https://api.jiuweiyun.cn/public/uploads/icon/num.png
  457. https://api.jiuweiyun.cn/public/uploads/icon/cjd.png
  458. https://api.jiuweiyun.cn/public/uploads/weapp/icon/loading.png
  459. https://api.jiuweiyun.cn/public/uploads/icon/gold_new.gif
  460. https://api.jiuweiyun.cn/public/uploads/weapp/icon/repair.png
  461. https://api.jiuweiyun.cn/public/uploads/icon/poster_new.png
  462. https://api.jiuweiyun.cn/public/uploads/icon/light.png