408249787@qq.com 1 周之前
父节点
当前提交
810fd58798
共有 4 个文件被更改,包括 46 次插入24 次删除
  1. 4 1
      .cool/service/index.ts
  2. 24 21
      pages/catalog/detail.uvue
  3. 15 2
      pages/user/login.uvue
  4. 3 0
      services/user.ts

+ 4 - 1
.cool/service/index.ts

@@ -126,7 +126,10 @@ export function request(options: RequestOptions): Promise<any | null> {
 							)!;
 							if (code == 200 || code == 0) {
 								resolve(data);
-							} else {
+							}else if(code==1){
+								reject(res.data);
+							}
+							 else {
 								ui.showToast({
 									message: message ?? t("服务异常"),
 									type: "warn",

+ 24 - 21
pages/catalog/detail.uvue

@@ -20,14 +20,14 @@ const data = ref({
 // ]
 const menu2Items = [
   { id: '1', name: '观察', icon: 'https://oss.xiaoxiongcode.com/static/home/观察.png' },
-  { id: '2', name: '思考', icon: 'https://oss.xiaoxiongcode.com/static/home/假设.png' },
-  { id: '3', name: '假设', icon: 'https://oss.xiaoxiongcode.com/static/home/卡通扁平化功能图标设计.png' },
-  { id: '4', name: '交互', icon: 'https://oss.xiaoxiongcode.com/static/home/总结.png' },
+  { id: '2', name: '交互', icon: 'https://oss.xiaoxiongcode.com/static/home/总结.png' },
+  { id: '3', name: '思考', icon: 'https://oss.xiaoxiongcode.com/static/home/假设.png' },
+  { id: '4', name: '假设', icon: 'https://oss.xiaoxiongcode.com/static/home/卡通扁平化功能图标设计.png' },
   { id: '5', name: '总结', icon: 'https://oss.xiaoxiongcode.com/static/home/拓展.png' },
   { id: '6', name: '实验', icon: 'https://oss.xiaoxiongcode.com/static/home/shiyan.png' },
 ]
 //当前进度
-const progress = ref(0)
+const progress = ref(1)
 const progress2 = ref(0)
 const progressStatus = ref(0)
 const recorderManager = ref<any>()
@@ -62,10 +62,12 @@ async function fetchCatalog() {
     })
     progress.value = 1
     progress2.value = 1
-  } else {
+  } else if (course.value?.courseUserProgress.status == 0) {
     progressStatus.value = course.value?.courseUserProgress.status
-    progress.value = course.value?.courseUserProgress.mainProgress
     progress2.value = course.value?.courseUserProgress.assistantProgress
+  } else {
+    progressStatus.value = course.value?.courseUserProgress.status
+    progress2.value = 1
   }
 }
 onMounted(async () => {
@@ -85,6 +87,7 @@ onShow(async () => {
   var pages = getCurrentPages();
   const prevPage = pages[pages.length - 1];
   status.value = (prevPage as any)?.status || 'wait'
+  console.log(status.value);
   if (status.value === 'success') {
     if (progress2.value === 6) {
       if (progressStatus.value === 0) {
@@ -110,10 +113,10 @@ function handleControlsToggle(e) {
 
 watch(() => progress2.value, (newVal, oldVal) => {
   isLoading.value = true
-  if (course.value?.id) {
+  if (course.value?.id && progressStatus.value == 0) {
     updateSubjectProgress({
       courseId: course.value?.id,
-      mainProgress: progress.value,
+      mainProgress: 1,
       assistantProgress: progress2.value,
       status: progressStatus.value
     })
@@ -127,27 +130,27 @@ watch(() => progress2.value, (newVal, oldVal) => {
       }, 2000)
       break
     case 2:
+      data.value.webviewSrc = course.value?.detailItem?.summaryVideoPath
+      router.push({
+        path: "/pages/catalog/web-view",
+        query: {
+          src: data.value.webviewSrc,
+          progress: progress2.value,
+        }
+      });
+      break
+    case 3:
       setTimeout(() => {
         isLoading.value = false
         data.value.videoSrc = course.value?.detailItem?.questionVideoPath
       }, 2000)
       break
-    case 3:
+    case 4:
       setTimeout(() => {
         isLoading.value = false
         playVoice(course.value?.detailItem?.assumeAnimationPath)
       }, 2000)
       break
-    case 4:
-      data.value.webviewSrc = course.value?.detailItem?.summaryVideoPath
-      router.push({
-        path: "/pages/catalog/web-view",
-        query: {
-          src: data.value.webviewSrc,
-          progress: progress2.value,
-        }
-      });
-      break
     case 5:
       setTimeout(() => {
         isLoading.value = false
@@ -171,7 +174,7 @@ const timers = ref(100)
 const timer = ref<any>()
 
 function handleTop() {
-  progress2.value = 4
+  progress2.value = 5
 }
 function startRecord() {
   console.log('开始录音');
@@ -204,7 +207,7 @@ onUnmounted(() => {
   <cl-page v-show="!isLoading">
     <Back />
     <view class="video-container">
-      <video v-if="progress2 !== 3" id="video1" class="w-full h-full " :src="data.videoSrc"
+      <video v-if="progress2 !== 4" id="video1" class="w-full h-full " :src="data.videoSrc"
         :show-center-play-btn="false" :show-background-playback-button="false" :show-fullscreen-btn="false"
         :show-casting-button="false" autoplay @controlstoggle="handleControlsToggle" @ended="handleEnded">
       </video>

+ 15 - 2
pages/user/login.uvue

@@ -92,7 +92,7 @@ import password from './components/password.uvue';
 import { ref } from 'vue'
 import type { ClTabsItem } from "@/uni_modules/cool-ui";
 import { encryptPassword, user, router } from '@/.cool';
-import { loginApi, wechatLogin } from "@/services/user";
+import { loginApi, wechatLogin,quicklyRegister } from "@/services/user";
 import type { ClActionSheetOptions } from "@/uni_modules/cool-ui";
 
 const actionSheetRef = ref<ClActionSheetComponentPublicInstance | null>(null);
@@ -145,8 +145,21 @@ function toLogin() {
 			icon: 'success'
 		})
 		router.nextLogin();
+	}).catch(err => {
+		if(err.message=='手机号不存在'&&val.value==='quickly_login'){
+			quicklyRegister({
+				username: formData.value.username,
+				password: 'ba3253876aed6bc22d4a6ff53d8406c6ad864195ed144ab5c87621b6c233b548baeae6956df346ec8c17f5ea10f35ee3cbc514797ed7ddd3145464e2a0bab413',
+			}).then(res => {
+			  handleSelect(formData.value.username)
+			})
+		}else{
+			uni.showToast({
+				title: err.message,
+				icon: 'none'
+			})
+		}
 	})
-
 }
 function toWechatLogin() {
 	uni.login({

+ 3 - 0
services/user.ts

@@ -78,4 +78,7 @@ export function wechatPayQuery(parameter: any) {
 }
 export function wechatPayCancel(parameter: any) {
   return usePut(`/wechat/pay/user/cancel/pay/${parameter.outTradeNo}`, parameter) as Promise<any>
+}
+export function quicklyRegister(params) {
+  return usePost(`/upms/users/register/quickly`, params) as Promise<any>
 }