|
@@ -1,39 +1,24 @@
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import Back from '@/components/back.uvue'
|
|
import Back from '@/components/back.uvue'
|
|
|
import Loading from '@/components/loading.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 { type SubjectCourseResult, fetchSubjectCourseApp, updateSubjectProgress } from '@/services/subject/course'
|
|
|
import { router, user } from '@/.cool'
|
|
import { router, user } from '@/.cool'
|
|
|
|
|
|
|
|
|
|
+const userInfo = computed(() => user.info.value?.userInfo)
|
|
|
const course = ref<SubjectCourseResult>()
|
|
const course = ref<SubjectCourseResult>()
|
|
|
const progress = ref(0)
|
|
const progress = ref(0)
|
|
|
const isLoading = ref(false)
|
|
const isLoading = ref(false)
|
|
|
-const progressStatus = ref(0)
|
|
|
|
|
//通过路由参数获取课程id
|
|
//通过路由参数获取课程id
|
|
|
async function fetchCatalog() {
|
|
async function fetchCatalog() {
|
|
|
course.value = await fetchSubjectCourseApp({ id: router.query().id })
|
|
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
|
|
isLoading.value = true
|
|
|
await fetchCatalog()
|
|
await fetchCatalog()
|
|
|
isLoading.value = false
|
|
isLoading.value = false
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
|
|
+const visible = ref(false)
|
|
|
const menuItems = [
|
|
const menuItems = [
|
|
|
{ id: 1, name: '视频学习', icon: 'https://oss.xiaoxiongcode.com/static/home/6419.png', x: 0, y: 21 },
|
|
{ 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 },
|
|
{ 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
|
|
break
|
|
|
case 2:
|
|
case 2:
|
|
|
- progress.value = 2
|
|
|
|
|
|
|
+ router.push({
|
|
|
|
|
+ path: "/pages/programming/code",
|
|
|
|
|
+ query: {
|
|
|
|
|
+ id: router.query().id,
|
|
|
|
|
+ type: 2,
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
break
|
|
break
|
|
|
case 3:
|
|
case 3:
|
|
|
- progress.value = 3
|
|
|
|
|
|
|
+ router.push({
|
|
|
|
|
+ path: "/pages/programming/code",
|
|
|
|
|
+ query: {
|
|
|
|
|
+ id: router.query().id,
|
|
|
|
|
+ type: 3,
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
break
|
|
break
|
|
|
case 4:
|
|
case 4:
|
|
|
- progress.value = 4
|
|
|
|
|
|
|
+ visible.value = true
|
|
|
break
|
|
break
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+function copyUrl() {
|
|
|
|
|
+ uni.setClipboardData({
|
|
|
|
|
+ data: 'www.xiaoxiongcode.com',
|
|
|
|
|
+ showToast: true
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
</script>
|
|
</script>
|
|
|
<template>
|
|
<template>
|
|
|
<Loading v-show="isLoading" />
|
|
<Loading v-show="isLoading" />
|
|
@@ -91,6 +94,22 @@ function handleClick(id: number) {
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</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>
|
|
</cl-page>
|
|
|
</template>
|
|
</template>
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|