index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. <CustomTabBar></CustomTabBar>
  28. </view>
  29. </template>
  30. <script setup>
  31. import {
  32. reactive,
  33. ref,
  34. onMounted
  35. } from "vue";
  36. import {
  37. onLoad,
  38. onReady,
  39. onShow,
  40. } from '@dcloudio/uni-app';
  41. import catalogue from "@/components/catalogue/catalogue.vue";
  42. import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
  43. import {
  44. useStudyRouteParams
  45. } from "@/utils/emitEvents.js"
  46. // 缓存操作
  47. const {getStudyStorage,removeStudyStorage} = useStudyRouteParams();
  48. const catalogueRef = ref(null);
  49. const gradeTerm = ref('');
  50. const selectZhang = ref(null);
  51. // 来自单元测试的路由参数缓存
  52. const routeParams = ref(null);
  53. onLoad((options) => {
  54. console.log(options)
  55. })
  56. onShow(() => {
  57. console.log('show')
  58. // 获取路由参数
  59. routeParams.value = getStudyStorage();
  60. // 移除缓存
  61. removeStudyStorage();
  62. // 赋值
  63. gradeTerm.value = routeParams.value;
  64. })
  65. const data = reactive({
  66. list: [{
  67. label: '长度中的隐含条件问题',
  68. id: 1,
  69. },
  70. {
  71. label: '解决重叠问题',
  72. id: 2,
  73. },
  74. {
  75. label: '列表法解决方案问题',
  76. id: 3,
  77. },
  78. {
  79. label: '真题测试',
  80. id: 4,
  81. },
  82. ]
  83. })
  84. function handleChangeZhang(data) {
  85. console.log("章", data);
  86. selectZhang.value = data;
  87. }
  88. function goKaoshi() {
  89. let nextZhangId = selectZhang.value.nextZhang.zhangId;
  90. let zhangId = selectZhang.value.zhangId;
  91. let nianji = routeParams.value.nianji;
  92. let xueqi = routeParams.value.xueqi;
  93. uni.navigateTo({
  94. url: `/pages/unitTest/index?jieId=1&nextZhangId=${nextZhangId}&zhangId=${zhangId}&nianji=${nianji}&xueqi=${xueqi}`
  95. })
  96. }
  97. function listClick(data) {
  98. uni.navigateTo({
  99. url: '/pages/study/lookShipin'
  100. })
  101. }
  102. function handleCheckCatalogue() {
  103. catalogueRef.value.showPopup();
  104. }
  105. function goBack() {
  106. uni.navigateBack()
  107. }
  108. </script>
  109. <style>
  110. </style>