progress.uvue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <script setup lang="ts">
  2. import Back from '@/components/back.uvue'
  3. import Loading from '@/components/loading.uvue'
  4. import { ref, onMounted, computed, watch, nextTick, onUnmounted } from 'vue'
  5. import { type SubjectCourseResult, fetchSubjectCourseApp, updateSubjectProgress } from '@/services/subject/course'
  6. import { router, user } from '@/.cool'
  7. const userInfo = computed(() => user.info.value?.userInfo)
  8. const course = ref<SubjectCourseResult>()
  9. const progress = ref(0)
  10. const isLoading = ref(false)
  11. //通过路由参数获取课程id
  12. async function fetchCatalog() {
  13. course.value = await fetchSubjectCourseApp({ id: router.query().id })
  14. }
  15. onMounted(async () => {
  16. isLoading.value = true
  17. await fetchCatalog()
  18. isLoading.value = false
  19. })
  20. const visible = ref(false)
  21. const menuItems = [
  22. { id: 1, name: '视频学习', icon: 'https://oss.xiaoxiongcode.com/static/home/6419.png', x: 0, y: 21 },
  23. { id: 2, name: '实战指导', icon: 'https://oss.xiaoxiongcode.com/static/home/6418.png', x: 27, y: 19 },
  24. { id: 3, name: '核心代码', icon: 'https://oss.xiaoxiongcode.com/static/home/6416.png', x: 80, y: 16 },
  25. { id: 4, name: '开始编程', icon: 'https://oss.xiaoxiongcode.com/static/home/6417.png', x: 55, y: 7 },
  26. ]
  27. //点击事件
  28. function handleClick(id: number) {
  29. switch (id) {
  30. case 1:
  31. router.push({
  32. path: "/pages/programming/detail",
  33. query: {
  34. id: router.query().id,
  35. }
  36. });
  37. break
  38. case 2:
  39. router.push({
  40. path: "/pages/programming/code",
  41. query: {
  42. id: router.query().id,
  43. type: 2,
  44. }
  45. });
  46. break
  47. case 3:
  48. router.push({
  49. path: "/pages/programming/code",
  50. query: {
  51. id: router.query().id,
  52. type: 3,
  53. }
  54. });
  55. break
  56. case 4:
  57. visible.value = true
  58. break
  59. }
  60. }
  61. function copyUrl() {
  62. uni.setClipboardData({
  63. data: 'www.xiaoxiongcode.com',
  64. showToast: true
  65. });
  66. }
  67. </script>
  68. <template>
  69. <Loading v-show="isLoading" />
  70. <cl-page>
  71. <Back />
  72. <image class="absolute top-0 left-0 z-[1] w-full h-full " mode="aspectFill"
  73. src="https://oss.xiaoxiongcode.com/static/scratch/5.jpg" />
  74. <view class="main relative z-[2]">
  75. <view class="text-[20px] font-bold text-[#333333] absolute top-6 left-20">
  76. {{ course?.mainTitle }}
  77. </view>
  78. <view class="progress w-[90vw] h-[45vw] pb-[5vw] flex items-center justify-end ">
  79. <image class="w-[80vw]" mode="widthFix" src="https://oss.xiaoxiongcode.com/static/scratch/6.png" />
  80. <view v-for="item in menuItems" :key="item.id"
  81. class="w-[10vw] h-[13vw] absolute flex items-center justify-between z-[2]" :style="{
  82. top: `${item.y}vw`,
  83. left: `${item.x}vw`
  84. }" @click="handleClick(item.id)">
  85. <view class="w-[9vw] h-[9vw] flex items-center justify-center bg-[#fff] rounded-[2vw] box-shadow">
  86. <image :src="item.icon" class="w-[4vw] " mode="widthFix" />
  87. <text class="text-[2vw] text-[#000]">{{ item.name }}</text>
  88. </view>
  89. <view class="flex items-center justify-between gap-[1vw]">
  90. <image src="https://oss.xiaoxiongcode.com/static/home/6415.png" class="w-[4vw] " mode="widthFix" />
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. <cl-popup v-model="visible" :size="400" :show-header="false" direction="center">
  96. <view class="flex flex-col items-center justify-center gap-4 py-7 bg-slate-50">
  97. <image src="https://oss.xiaoxiongcode.com/static/home/coding.png" class="w-32 h-32" />
  98. <view class="text-center " v-if="userInfo && userInfo?.memberLevel !== 'default'">
  99. <cl-text class="text-center" color="#999" :size="14">账号:小程序登录手机账号 </cl-text>
  100. <cl-text class="text-center" color="#999" :size="14"> 密码:初始密码为123456 </cl-text>
  101. <cl-text class="text-center" v-if="userInfo && !userInfo.roleCodes?.includes('show_time')" color="#999"
  102. :size="14">少儿编程网址: www.xiaoxiongcode.com </cl-text>
  103. <cl-text class="text-center" v-else color="#999" :size="14">少儿编程网址: ************* </cl-text>
  104. <cl-button type="primary" size="small" @tap="copyUrl"> 复制网址 </cl-button>
  105. </view>
  106. <view class="text-center " v-else>
  107. <cl-text class="text-center" color="#999" :size="14"> 您不是会员,无法使用会员福利 </cl-text>
  108. </view>
  109. </view>
  110. </cl-popup>
  111. </cl-page>
  112. </template>
  113. <style lang="scss" scoped>
  114. .main {
  115. // background: linear-gradient(0deg, #88C5F0, #D0ECFF);
  116. width: 100vw;
  117. height: 100vh;
  118. display: flex;
  119. flex-direction: column;
  120. justify-content: center;
  121. align-items: center;
  122. .progress {
  123. position: relative;
  124. z-index: 2;
  125. }
  126. }
  127. .box-shadow {
  128. box-shadow: 4px 7px 10px 0px rgba(62, 166, 238, 0.44);
  129. }
  130. </style>