index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <view>
  3. <view @click="goBack">{{gradeTerm.text}}</view>
  4. <view>缓存数据1:{{routeParams}}</view>
  5. <view>
  6. <view v-for="item in data.list" :key="item.index" @click="listClick"> {{item.index}} {{item.label}} </view>
  7. </view>
  8. <view>
  9. <uni-button @click="handleCheckCatalogue">go catalogue</uni-button>
  10. <uni-button @click="goKaoshi">goKaoshi</uni-button>
  11. <navigator :url="`/pages/study/catalogue?gradeId=1&termId=1&text=一年级上册`" hover-class="navigator-hover">
  12. <button type="default">学习计划</button>
  13. </navigator>
  14. <navigator url="/pages/unitTest/index" hover-class="navigator-hover">
  15. <button type="default">成长</button>
  16. </navigator>
  17. <navigator url="navigate/navigate?title=navigate" hover-class="navigator-hover">
  18. <button type="default">伙伴</button>
  19. </navigator>
  20. <navigator url="navigate/navigate?title=navigate" hover-class="navigator-hover">
  21. <button type="default">我的</button>
  22. </navigator>
  23. </view>
  24. <!-- 蛋 -->
  25. <view class="ezy-popup">蛋</view>
  26. <catalogue ref="catalogueRef" :nianji="routeParams.nianji" :xueqi="routeParams.xueqi" @change-zhang="handleChangeZhang"></catalogue>
  27. </view>
  28. </template>
  29. <script setup>
  30. import {
  31. reactive,
  32. ref,
  33. onMounted
  34. } from "vue";
  35. import {
  36. onLoad,
  37. onReady,
  38. onShow,
  39. } from '@dcloudio/uni-app';
  40. import catalogue from "@/components/catalogue/catalogue.vue";
  41. import {
  42. useStudyRouteParams
  43. } from "@/utils/emitEvents.js"
  44. // 缓存操作
  45. const {getStudyStorage,removeStudyStorage} = useStudyRouteParams();
  46. const catalogueRef = ref(null);
  47. const gradeTerm = ref('');
  48. const selectZhang = ref(null);
  49. // 来自单元测试的路由参数缓存
  50. const routeParams = ref(null);
  51. onShow(() => {
  52. console.log('show')
  53. // 获取路由参数
  54. routeParams.value = getStudyStorage();
  55. // 移除缓存
  56. removeStudyStorage();
  57. // 赋值
  58. gradeTerm.value = routeParams.value;
  59. })
  60. const data = reactive({
  61. list: [{
  62. label: '长度中的隐含条件问题',
  63. id: 1,
  64. },
  65. {
  66. label: '解决重叠问题',
  67. id: 2,
  68. },
  69. {
  70. label: '列表法解决方案问题',
  71. id: 3,
  72. },
  73. {
  74. label: '真题测试',
  75. id: 4,
  76. },
  77. ]
  78. })
  79. function handleChangeZhang(data) {
  80. console.log("章", data);
  81. selectZhang.value = data;
  82. }
  83. function goKaoshi() {
  84. uni.navigateTo({
  85. url: `/pages/unitTest/index?jieId=1&nextZhangId=${selectZhang.value.nextZhang.zhangId}&zhangId=${selectZhang.value.zhangId}`
  86. })
  87. }
  88. function listClick(data) {
  89. uni.navigateTo({
  90. url: '/pages/study/lookShipin'
  91. })
  92. }
  93. function handleCheckCatalogue() {
  94. catalogueRef.value.showPopup();
  95. }
  96. function goBack() {
  97. uni.navigateBack()
  98. }
  99. </script>
  100. <style>
  101. </style>