web-view.uvue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <script setup lang='ts'>
  2. import { ref, onMounted, watchEffect } from 'vue'
  3. import { router } from '@/.cool'
  4. const menu2Items = [
  5. { id: '1', name: '观察', icon: 'https://oss.xiaoxiongcode.com/static/home/kanke.png' },
  6. { id: '2', name: '提问', icon: 'https://oss.xiaoxiongcode.com/static/home/lianxi.png' },
  7. { id: '3', name: '假设', icon: 'https://oss.xiaoxiongcode.com/static/home/shiyan.png' },
  8. { id: '4', name: '实验', icon: 'https://oss.xiaoxiongcode.com/static/home/riji.png' },
  9. { id: '5', name: '总结', icon: 'https://oss.xiaoxiongcode.com/static/home/riji.png' },
  10. { id: '6', name: '拓展', icon: 'https://oss.xiaoxiongcode.com/static/home/riji.png' },
  11. ]
  12. const progress = ref(1)
  13. const webviewSrc = ref('')
  14. onMounted(() => {
  15. webviewSrc.value = router.query().src
  16. progress.value = router.query().progress
  17. })
  18. function handleMessage(e) {
  19. var pages = getCurrentPages();
  20. const prevPage = pages[pages.length - 2];
  21. prevPage.status = "success"
  22. }
  23. </script>
  24. <template>
  25. <view class="w-full h-full absolute top-0 left-0 z-[11]">
  26. <view class="video-fullscreen_title">
  27. <Back />
  28. <view class="control-progress">
  29. <view class="before"></view>
  30. <view v-for="(item, i) in menu2Items" :key="item.id"
  31. class="px-0 py-3 flex items-center justify-center gap-[5px] relative z-[1]"
  32. :class="{ '!bg-[#fff] rounded-full': progress == i + 1 }">
  33. <cl-image :src="item.icon" mode="heightFix" class="!h-[30px]"></cl-image>
  34. <text class="text-[14px] font-bold" :class="{ '!text-[#2BA0F3]': progress == i + 1 }">{{ item.name
  35. }}</text>
  36. </view>
  37. </view>
  38. </view>
  39. <web-view :src="webviewSrc + '?' + Math.random()" class="w-full h-full" @message="handleMessage"></web-view>
  40. </view>
  41. </template>
  42. <style lang="less" scoped></style>