ExamRecord.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <div class="appRecord">
  3. <!-- <m-header v-if="headerStatus" /> -->
  4. <div class="container">
  5. <div v-if="dataShow" key="data">
  6. <van-list v-model="loading" :finished="finished" finished-text=" " @load="getList">
  7. <van-cell-group class="section" v-for="(item, index) in dataList" :key="index">
  8. <van-cell :value="item.examBaseName" title="考级名称" />
  9. <van-cell :value="item.actualExamStartTime" title="考试日期" />
  10. <van-cell title="专业等级" >
  11. <template #default>
  12. {{ item.subjectName }}({{ item.level | formatLevel }})
  13. </template>
  14. </van-cell>
  15. <!-- <transition name="fade"> -->
  16. <div v-if="item.isShow" class="van-hairline--bottom">
  17. <van-cell :value="item.cardNo ? item.cardNo : '暂无'" title="准考证号" />
  18. <!-- <van-cell :value="item.orderNo" title="专业等级" /> -->
  19. <van-cell :value="item.examMusicTheoryLevel | formatLevel" title="乐理等级" >
  20. </van-cell>
  21. <van-cell :value="item.level" title="考试地点" >
  22. <span v-if="item.examAddress">
  23. {{ item.examAddress }}
  24. </span>
  25. <span v-else>
  26. 线上网络教室
  27. </span>
  28. </van-cell>
  29. </div>
  30. <!-- </transition> -->
  31. <van-cell title="考试状态" >
  32. <template #default>
  33. <!-- <span class="error" v-if="item.isFinishedExam == 3">未参与</span>
  34. <span class="success" v-else>参与</span> -->
  35. {{ item.isFinishedExam | resultStatus }}
  36. </template>
  37. </van-cell>
  38. <van-cell title="考试结果" :border="!item.isShow" >
  39. <span v-if="item.result && item.examStatus === 'RESULT_CONFIRM'" :class="item.result == 'FAIL' ? 'error' : 'success'">{{ item.result | resultType }}</span>
  40. <span v-else>暂无</span>
  41. </van-cell>
  42. <!-- <transition name="fade"> -->
  43. <div v-if="item.isShow && item.videoUrl">
  44. <van-button type="default" @click="onVideoLook(item.videoUrl)" class="van-hairline--top-bottom" block>考级回看</van-button>
  45. </div>
  46. <!-- </transition> -->
  47. <van-button type="default" v-if="item.isShow" @click="onDetail(item)" block>
  48. 点击收起
  49. <van-icon class="arrow" name="arrow-up" />
  50. </van-button>
  51. <van-button type="default" v-else @click="onDetail(item)" block>
  52. 展开全部
  53. <van-icon class="arrow" name="arrow-down" />
  54. </van-button>
  55. </van-cell-group>
  56. </van-list>
  57. </div>
  58. <van-empty v-else key="data" :image="noDataImg" class="custom-image" description="暂无考试记录"></van-empty>
  59. </div>
  60. </div>
  61. </template>
  62. <script>
  63. import { browser } from '@/utils/common'
  64. import {
  65. examList
  66. } from "./appApi";
  67. export default {
  68. name: "appRecord",
  69. data() {
  70. return {
  71. headerStatus: false,
  72. noDataImg: require('../../assets/images/level/noData.png'),
  73. dataShow: true, // 是否有数据
  74. loading: false,
  75. finished: false,
  76. dataList: [],
  77. params: {
  78. page: 1,
  79. rows: 20
  80. },
  81. show: false
  82. };
  83. },
  84. mounted() {
  85. // 插入token
  86. let params = this.$route.query
  87. if(params.Authorization) {
  88. localStorage.setItem('Authorization', decodeURI(params.Authorization))
  89. }
  90. // 判断是否在app里面
  91. if(!browser().android && !browser().iPhone) {
  92. this.headerStatus = true
  93. } else {
  94. document.title = '考试记录'
  95. }
  96. },
  97. methods: {
  98. getList() {
  99. // this.finished = true
  100. let params = this.params;
  101. examList(params).then(res => {
  102. let result = res.data;
  103. this.loading = false;
  104. if (result.code == 200) {
  105. let pageInfo = result.data
  106. params.page = pageInfo.pageNo
  107. pageInfo.rows.forEach(item => {
  108. item.isShow = false
  109. })
  110. this.dataList = this.dataList.concat(pageInfo.rows)
  111. if (params.page >= pageInfo.totalPage) {
  112. this.finished = true;
  113. }
  114. this.params.page++;
  115. } else {
  116. this.finished = true;
  117. }
  118. // 判断是否有数据
  119. if (this.dataList.length <= 0) {
  120. this.dataShow = false;
  121. }
  122. }).catch(() => {
  123. this.finished = true
  124. this.dataShow = false
  125. })
  126. },
  127. onVideoLook(videoUrl) { // 查看视频
  128. if(browser().android) {
  129. // eslint-disable-next-line
  130. EXAM.postMessage(JSON.stringify({
  131. api: 'lookVideo',
  132. url: encodeURIComponent(videoUrl)
  133. }))
  134. } else {
  135. this.$router.push({
  136. path: '/lookVideo',
  137. query: {
  138. url: encodeURIComponent(videoUrl)
  139. }
  140. })
  141. }
  142. },
  143. onDetail(item) {
  144. item.isShow = !item.isShow;
  145. }
  146. }
  147. };
  148. </script>
  149. <style lang="less" scoped>
  150. @import url("../../assets/commonLess/variable");
  151. .appRecord {
  152. height: 100vh;
  153. overflow-y: auto;
  154. overflow-x: hidden;
  155. .container {
  156. margin-bottom: 20px;
  157. }
  158. }
  159. /deep/.van-cell {
  160. padding: 14px 16px;
  161. font-size: 16px;
  162. color: @--font-main-color;
  163. .van-cell__value {
  164. width: 40%;
  165. text-align: left;
  166. flex: auto;
  167. color: @--font-second-color;
  168. }
  169. .error {
  170. color: @--red-color;
  171. }
  172. .success {
  173. color: @--main-color;
  174. }
  175. }
  176. .section {
  177. margin-top: 10px;
  178. }
  179. .van-button--default {
  180. border: 0;
  181. color: @--main-color;
  182. font-size: 15px;
  183. height: 0.5rem;
  184. line-height: 0.52rem;
  185. }
  186. /deep/.van-button__text {
  187. display: flex;
  188. }
  189. .arrow {
  190. min-width: 1em;
  191. font-size: 1.2em;
  192. line-height: inherit;
  193. margin-left: 5px;
  194. }
  195. .custom-image {
  196. padding-top: .8rem;
  197. /deep/.van-empty__image {
  198. width: 1.8rem;
  199. height: 1.88rem;
  200. }
  201. /deep/.van-empty__description {
  202. color: @--font-second-color;
  203. }
  204. }
  205. </style>