index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <view class="ezy-study-page">
  3. <view class="study-school-year">{{gradeTerm}}</view>
  4. <view class="ezy-study-wrap">
  5. <view class="chapter-box" @click="handleCheckCatalogue">
  6. {{infoData.numberStr}}
  7. </view>
  8. <view class="chapter-title-box">
  9. {{infoData.zhangName}}
  10. </view>
  11. <!-- :class= index ==1?'亮+无锁头':'暗+锁头' -->
  12. <view class="brand" v-for="(item,index) in infoData.jieList" :key="index" @click="listClick(item)">
  13. {{item.jieName}}</view>
  14. </view>
  15. <!-- <uni-button style="margin-top: 200px;display: block;" @click="goKaoshi">goKaoshi</uni-button>
  16. -->
  17. <!-- <uni-button @click="handleCheckCatalogue">go catalogue</uni-button>
  18. <uni-button @click="goKaoshi">goKaoshi</uni-button>
  19. <!-- 蛋 -->
  20. <egg-dialog ref="eggDialogRef" @eggBtn="eggBtn"></egg-dialog>
  21. <catalogue ref="catalogueRef" :nianji="routeParams.nianji" :xueqi="routeParams.xueqi"
  22. @change-zhang="handleChangeZhang"></catalogue>
  23. <CustomTabBar></CustomTabBar>
  24. </view>
  25. </template>
  26. <script setup>
  27. import {
  28. userZhangFirstInfo,
  29. userZhangInfo,
  30. userLocate
  31. } from "@/api/learnPlan.js"
  32. import {
  33. reactive,
  34. ref,
  35. onMounted
  36. } from "vue";
  37. import {
  38. onLoad,
  39. } from '@dcloudio/uni-app';
  40. import catalogue from "@/components/catalogue/catalogue.vue";
  41. import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
  42. import {
  43. getAuth
  44. } from '@/utils/auth.js';
  45. import eggDialog from './eggDialog.vue'
  46. const eggDialogRef = ref(null);
  47. const catalogueRef = ref(null);
  48. let gradeTerm = ref('');
  49. const selectZhang = ref(null);
  50. let infoData = reactive({
  51. jieList: [],
  52. haveFlag: '',
  53. nianji: '',
  54. number: '',
  55. xueqi: '',
  56. zhangId: '',
  57. zhangName: '',
  58. numberStr: '',
  59. });
  60. // 来自单元测试的路由参数缓存
  61. const gradeMapping = {
  62. 1: '一年级',
  63. 2: '二年级',
  64. 3: '三年级',
  65. 4: '四年级',
  66. 5: '五年级',
  67. 6: '六年级'
  68. };
  69. const termMapping = {
  70. 1: '上',
  71. 2: '下'
  72. };
  73. const routeParams = ref(null);
  74. onLoad((options) => {
  75. console.log(options)
  76. // 获取路由参数
  77. routeParams.value = options;
  78. // 选择年级进入调用此接口
  79. if (options.flag == 'selectGrades') {
  80. getZhangFirst()
  81. } else {
  82. }
  83. // 调用定位章节 (后台记录)
  84. // 蛋
  85. // eggDialogRef.value.eggShow();
  86. })
  87. function recordZhangJie() {
  88. let req = {
  89. nianji: routeParams.value.nianji,
  90. userId: JSON.parse(getAuth()).userId,
  91. zhangId: infoData.zhangId,
  92. xueqi: routeParams.value.xueqi,
  93. }
  94. userLocate(req).then(res => {
  95. })
  96. }
  97. function getZhangFirst() {
  98. let req = {
  99. nianji: routeParams.value.nianji,
  100. xueqi: routeParams.value.xueqi,
  101. }
  102. userZhangFirstInfo(req).then(res => {
  103. infoData.jieList = res.data.jieList
  104. infoData.haveFlag = res.data.haveFlag
  105. infoData.nianji = res.data.nianji
  106. infoData.number = res.data.number
  107. infoData.numberStr = res.data.numberStr
  108. infoData.xueqi = res.data.xueqi
  109. infoData.zhangId = res.data.zhangId
  110. infoData.zhangName = res.data.zhangName
  111. gradeTerm.value = translateData(res.data);
  112. recordZhangJie()
  113. })
  114. }
  115. function translateData(data) {
  116. return gradeMapping[data.nianji] + termMapping[data.xueqi]
  117. }
  118. function handleChangeZhang(data) {
  119. console.log("章", data);
  120. selectZhang.value = data;
  121. }
  122. function goKaoshi() {
  123. let zhangId = selectZhang.value.zhangId;
  124. let nianji = routeParams.value.nianji;
  125. let xueqi = routeParams.value.xueqi;
  126. uni.navigateTo({
  127. url: `/pages/unitTest/index?jieId=1&zhangId=${zhangId}&nianji=${nianji}&xueqi=${xueqi}`
  128. })
  129. }
  130. function listClick(data) {
  131. console.log(data);
  132. return
  133. const pageData = {
  134. // videoId:data.videoId,
  135. videoId: 'b997f16cb9cb474cb93526cff77d8801',
  136. progressMarkers: [{
  137. offset: 30,
  138. isCustomized: true,
  139. coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/9A3F562E595E4764AD1DD546FA52C6E5-6-2.png',
  140. title: 'test title',
  141. describe: 'test string',
  142. }, {
  143. offset: 150,
  144. isCustomized: true,
  145. coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/1E7F402241CD4C0F94AD2BBB5CCC3EC7-6-2.png',
  146. title: 'test title',
  147. describe: 'test string',
  148. }, {
  149. offset: 250,
  150. isCustomized: true,
  151. coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
  152. title: 'test title',
  153. describe: 'test string',
  154. }, {
  155. offset: 550,
  156. isCustomized: true,
  157. coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
  158. title: 'test title',
  159. describe: 'test string',
  160. }, {
  161. offset: 320,
  162. isCustomized: true,
  163. coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
  164. title: 'test title',
  165. describe: 'test string',
  166. }, {
  167. offset: 650,
  168. isCustomized: true,
  169. coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
  170. title: 'test title',
  171. describe: 'test string',
  172. }],
  173. }
  174. uni.navigateTo({
  175. url: '/pages/study/lookShipin?studyData=' + JSON.stringify(pageData)
  176. })
  177. }
  178. function handleCheckCatalogue() {
  179. catalogueRef.value.showPopup();
  180. }
  181. function goBack() {
  182. uni.navigateBack()
  183. }
  184. function eggBtn() {
  185. console.log('点击:开启提分之旅');
  186. }
  187. </script>
  188. <style>
  189. </style>