408249787@qq.com hace 2 semanas
padre
commit
dade84d893
Se han modificado 3 ficheros con 135 adiciones y 22 borrados
  1. 7 0
      pages.json
  2. 87 0
      pages/programming/code.uvue
  3. 41 22
      pages/programming/progress.uvue

+ 7 - 0
pages.json

@@ -148,6 +148,13 @@
 				"navigationStyle": "custom",
 				"disableScroll": true
 			}
+		},
+		{
+			"path": "pages/programming/code",
+			"style": {
+				"navigationStyle": "custom",
+				"disableScroll": true
+			}
 		}
 	],
 	"globalStyle": {

+ 87 - 0
pages/programming/code.uvue

@@ -0,0 +1,87 @@
+<script setup lang="ts">
+import Back from '@/components/back.uvue'
+import Loading from '@/components/loading.uvue'
+import { ref, onMounted, watch, nextTick, onUnmounted } from 'vue'
+import { type SubjectCourseResult, fetchSubjectCourseApp, updateSubjectProgress } from '@/services/subject/course'
+import { router, user } from '@/.cool'
+
+const course = ref<SubjectCourseResult>()
+const isLoading = ref(false)
+const courseSummary = ref([])
+const codeImage = ref([])
+const type = ref(0)
+//通过路由参数获取课程id
+async function fetchCatalog() {
+    course.value = await fetchSubjectCourseApp({ id: router.query().id })
+    type.value = parseInt(router.query().type) || 0
+    courseSummary.value = JSON.parse(course.value?.courseSummary as string)
+    codeImage.value = JSON.parse(course.value?.codeImage as string)
+}
+onMounted(async () => {
+    isLoading.value = true
+    await fetchCatalog()
+    isLoading.value = false
+})
+
+
+</script>
+<template>
+    <Loading v-show="isLoading" />
+    <cl-page>
+        <Back />
+        <view class="main">
+            <!-- <image class="absolute top-0 left-0 z-[1] w-full h-full "  mode="aspectFill"  src="https://oss.xiaoxiongcode.com/static/home/641.png"   /> -->
+
+            <view class="text-[20px] font-bold text-[#333333] absolute top-6 left-20">
+                {{ course?.mainTitle }}
+            </view>
+            <scroll-view class="courseSummary" :show-scrollbar="false" v-if="type === 2">
+                <view class="text-[20px] font-bold mb-3 text-[#fff]" v-for="(item, index) in courseSummary"
+                    :key="index">
+                    {{ index + 1 }}. {{ item }}
+                </view>
+            </scroll-view>
+            <scroll-view class="codeImage" v-else :show-scrollbar="false">
+                <cl-row :gutter="12">
+                    <cl-col :span="8" v-for="item in codeImage" :key="item">
+                        <cl-image showMenuByLongpress lazy-load preview :src="item" mode="scaleToFill"
+                            class="!w-full !h-[40vh] mb-[12px] rounded-xl">
+                        </cl-image>
+                    </cl-col>
+                </cl-row>
+
+            </scroll-view>
+        </view>
+    </cl-page>
+</template>
+<style lang="scss" scoped>
+.main {
+    background: linear-gradient(0deg, #88C5F0, #D0ECFF);
+    width: 100vw;
+    height: 100vh;
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+
+    .progress {
+        position: relative;
+        z-index: 2;
+    }
+}
+
+.box-shadow {
+    box-shadow: 4px 7px 10px 0px rgba(62, 166, 238, 0.44);
+}
+
+.courseSummary {
+    @apply absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 max-w-[1000px] w-[60vw] max-h-[620px] rounded-[30px] p-[20px] text-white;
+
+}
+
+.codeImage {
+    @apply absolute max-w-[1000px] w-[80vw] text-white;
+    top: 70px;
+    height: calc(100vh - 80px);
+}
+</style>

+ 41 - 22
pages/programming/progress.uvue

@@ -1,39 +1,24 @@
 <script setup lang="ts">
 import Back from '@/components/back.uvue'
 import Loading from '@/components/loading.uvue'
-import { ref, onMounted, watch, nextTick, onUnmounted } from 'vue'
+import { ref, onMounted, computed, watch, nextTick, onUnmounted } from 'vue'
 import { type SubjectCourseResult, fetchSubjectCourseApp, updateSubjectProgress } from '@/services/subject/course'
 import { router, user } from '@/.cool'
 
+const userInfo = computed(() => user.info.value?.userInfo)
 const course = ref<SubjectCourseResult>()
 const progress = ref(0)
 const isLoading = ref(false)
-const progressStatus = ref(0)
 //通过路由参数获取课程id
 async function fetchCatalog() {
   course.value = await fetchSubjectCourseApp({ id: router.query().id })
-  if (!course.value?.courseUserProgress) {
-    await updateSubjectProgress({
-      courseId: course.value?.id,
-      mainProgress: 1,
-      assistantProgress: 1,
-      status: 0
-    })
-    progress.value = 1
-  } else if (course.value?.courseUserProgress.status == 0) {
-    progressStatus.value = course.value?.courseUserProgress.status
-    progress.value = course.value?.courseUserProgress.assistantProgress
-  } else {
-    progress.value = 6
-    progressStatus.value = course.value?.courseUserProgress.status
-  }
 }
-onShow(async () => {
+onMounted(async () => {
   isLoading.value = true
   await fetchCatalog()
   isLoading.value = false
 })
-
+const visible = ref(false)
 const menuItems = [
   { id: 1, name: '视频学习', icon: 'https://oss.xiaoxiongcode.com/static/home/6419.png', x: 0, y: 21 },
   { id: 2, name: '实战指导', icon: 'https://oss.xiaoxiongcode.com/static/home/6418.png', x: 27, y: 19 },
@@ -52,17 +37,35 @@ function handleClick(id: number) {
       });
       break
     case 2:
-      progress.value = 2
+      router.push({
+        path: "/pages/programming/code",
+        query: {
+          id: router.query().id,
+          type: 2,
+        }
+      });
       break
     case 3:
-      progress.value = 3
+      router.push({
+        path: "/pages/programming/code",
+        query: {
+          id: router.query().id,
+          type: 3,
+        }
+      });
       break
     case 4:
-      progress.value = 4
+      visible.value = true
       break
   }
 
 }
+function copyUrl() {
+  uni.setClipboardData({
+    data: 'www.xiaoxiongcode.com',
+    showToast: true
+  });
+}
 </script>
 <template>
   <Loading v-show="isLoading" />
@@ -91,6 +94,22 @@ function handleClick(id: number) {
         </view>
       </view>
     </view>
+    <cl-popup v-model="visible" :size="400" :show-header="false" direction="center">
+      <view class="flex flex-col items-center justify-center gap-4 py-7 bg-slate-50">
+        <image src="https://oss.xiaoxiongcode.com/static/home/coding.png" class="w-32 h-32" />
+        <view class="text-center " v-if="userInfo && userInfo?.memberLevel !== 'default'">
+          <cl-text class="text-center" color="#999" :size="14">账号:小程序登录手机账号 </cl-text>
+          <cl-text class="text-center" color="#999" :size="14"> 密码:初始密码为123456 </cl-text>
+          <cl-text class="text-center" v-if="userInfo && !userInfo.roleCodes?.includes('show_time')" color="#999"
+            :size="14">少儿编程网址: www.xiaoxiongcode.com </cl-text>
+          <cl-text class="text-center" v-else color="#999" :size="14">少儿编程网址: ************* </cl-text>
+          <cl-button type="primary" size="small" @tap="copyUrl"> 复制网址 </cl-button>
+        </view>
+        <view class="text-center " v-else>
+          <cl-text class="text-center" color="#999" :size="14"> 您不是会员,无法使用会员福利 </cl-text>
+        </view>
+      </view>
+    </cl-popup>
   </cl-page>
 </template>
 <style lang="scss" scoped>