detail.uvue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <script setup lang='ts'>
  2. import { ref, onMounted, watchEffect } from 'vue'
  3. import Loading from '@/components/loading.uvue'
  4. import { router } from '@/.cool'
  5. const progress = ref(1)
  6. const webviewSrc = ref('')
  7. var isLoading = ref(true)
  8. onMounted(() => {
  9. const unitType = router.query().unitType
  10. switch (unitType) {
  11. case 'course_unit':
  12. webviewSrc.value = 'https://oss.xiaoxiongcode.com/physics-unit-practice/index.html?num=' + router.query().num
  13. break;
  14. case 'high_exam_view':
  15. webviewSrc.value = 'https://oss.xiaoxiongcode.com/gaokao/index.html?num=' + router.query().num
  16. break;
  17. case 'middle_exam_view':
  18. webviewSrc.value = 'https://oss.xiaoxiongcode.com/zhongkao/index.html?num=' + router.query().num
  19. break;
  20. }
  21. })
  22. function handleMessage(e) {
  23. var pages = getCurrentPages();
  24. const prevPage = pages[pages.length - 2];
  25. (prevPage as any).status = "success"
  26. }
  27. function handleLoad() {
  28. isLoading.value = false
  29. console.log('handleLoad')
  30. }
  31. onShow(() => {
  32. var pages = getCurrentPages();
  33. const prevPage = pages[pages.length - 2];
  34. (prevPage as any).status = "test"
  35. })
  36. </script>
  37. <template>
  38. <Loading v-show="isLoading" />
  39. <web-view :src="webviewSrc" class="w-full h-full" @message="handleMessage" @load="handleLoad"></web-view>
  40. </template>
  41. <style lang="less" scoped></style>