Explorar el Código

fix(login): 添加微信登录后的账号绑定检查逻辑

当微信登录返回空结果时提示绑定账号,单结果时自动选择
同时调整目录详情页的进度逻辑和菜单项
whj hace 6 horas
padre
commit
0fbfef426d
Se han modificado 2 ficheros con 22 adiciones y 8 borrados
  1. 12 8
      pages/catalog/detail.uvue
  2. 10 0
      pages/user/login.uvue

+ 12 - 8
pages/catalog/detail.uvue

@@ -24,8 +24,8 @@ const menu2Items = [
   { 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/拓展.png' },
+  { id: '5', name: '总结', icon: 'https://oss.xiaoxiongcode.com/static/home/拓展.png' },
+  // { id: '6', name: '拓展', icon: 'https://oss.xiaoxiongcode.com/static/home/拓展.png' },
 ]
 //当前进度
 const progress = ref(1)
@@ -82,14 +82,18 @@ onMounted(async () => {
   }, 1000)
 })
 async function handleEnded() {
-  if (progress.value === 2) {
-    return
-  }
-  if (progress2.value === 6) {
+
+  if (progress2.value === 5) {
+    if (progress.value === 2) {
+      return
+    }
     progress.value++
   } else {
     progress2.value++
   }
+  if (progress.value === 2) {
+    return
+  }
   await updateSubjectProgress({
     courseId: course.value?.id,
     mainProgress: progress.value,
@@ -110,7 +114,7 @@ async function handleEnded() {
   //   case 2:
   //   case 4:
   //   case 5:
-  //   case 6:
+  //   case 5:
   //     progress2.value++
   //     break
   // }
@@ -124,7 +128,7 @@ onShow(() => {
   status.value = (prevPage as any)?.status || 'wait'
   if (status.value === 'test') {
     if (progress.value === 2) {
-      router.back()
+      progress2.value = 1
     }
     (prevPage as any).status = 'wait'
   }

+ 10 - 0
pages/user/login.uvue

@@ -115,6 +115,16 @@ function toWechatLogin() {
 				code: res.code,
 			}).then(res => {
 				console.log(res);
+				if (res.length === 0) {
+					uni.showToast({
+						title: '请先绑定账号',
+						icon: 'none'
+					})
+					return
+				} else if (res.length === 1) {
+					handleSelect(res[0])
+					return
+				}
 				const list = res.map(item => ({
 					label: item,
 					icon: "user-line",