408249787@qq.com 1 неделя назад
Родитель
Сommit
439521553b
4 измененных файлов с 97 добавлено и 42 удалено
  1. 7 0
      pages.json
  2. 35 31
      pages/index/home.uvue
  3. 36 11
      pages/programming/progress.uvue
  4. 19 0
      pages/programming/web-view.uvue

+ 7 - 0
pages.json

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

+ 35 - 31
pages/index/home.uvue

@@ -146,27 +146,11 @@ const handleBind = async () => {
 const code = ref<string>('')
 
 async function handleExchange() {
-	if (!code.value) {
-		uni.showToast({
-			title: '请输入兑换码',
-			icon: 'none'
-		})
-		return
-	}
-	try {
-		await exchangeCode({
-			exchangeCode: code.value,
-			subjectId: dict.getValueByLabelMapByType('index_subject_id')['物理'],
-		})
-		await user.get()
-		visible3.value = false
-		visible5.value = true
-	} catch (err: any) {
-		uni.showToast({
-			title: err.message,
-			icon: 'error'
-		})
-	}
+	selected.value = 'exchange'
+	visible3.value = false
+}
+function handleExchangeHide() {
+	visible3.value = false
 }
 function handleViewAnnouncement() {
 	router.push({ path: '/pages/user/info', query: { type: 'notice' } })
@@ -207,6 +191,9 @@ function handleViewAnnouncement() {
 		</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">
+				<view class="absolute top-2 right-2" @tap="visible = false">
+					<cl-icon name="close-circle-fill" color="info" :size="20"></cl-icon>
+				</view>
 				<cl-text class="text-center " color="#09ba07" :size="30"> ——专属服务内容—— </cl-text>
 				<image src="https://oss.xiaoxiongcode.com/static/home/qr.png" show-menu-by-longpress
 					class="w-32 h-32" />
@@ -217,6 +204,9 @@ function handleViewAnnouncement() {
 		</cl-popup>
 		<cl-popup v-model="visible2" :size="400" :show-header="false" direction="center">
 			<view class="flex flex-col items-center justify-center gap-4 py-7 bg-slate-50">
+				<view class="absolute top-2 right-2" @tap="visible2 = false">
+					<cl-icon name="close-circle-fill" color="info" :size="20"></cl-icon>
+				</view>
 				<cl-text class="text-center " color="#09ba07" :size="30"> ——会员福利—— </cl-text>
 				<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'">
@@ -232,16 +222,24 @@ function handleViewAnnouncement() {
 				</view>
 			</view>
 		</cl-popup>
-		<cl-popup v-model="visible3" showClose :size="400" :show-header="false" direction="center">
-			<view class="flex flex-col items-center justify-center gap-4 py-7 bg-slate-50">
-				<cl-text class="text-center " color="#333" :size="25"> ——激活会员—— </cl-text>
-
-				<input
-					class="w-[200px] h-[40px] bg-[#F5F5F5] border-[1px] border-[#333] border-solid rounded-[20px] px-[10px]"
-					v-model="code" placeholder="请输入兑换码"></input>
-
-				<cl-button class="mt-4" size="large" type="primary" block @tap="handleExchange"> 兑换 </cl-button>
-
+		<cl-popup v-model="visible3" showClose :size="400" :show-header="false" direction="center" :pt="{
+			inner: {
+				className: '!bg-transparent'
+			}
+		}">
+			<view class="w-[300rpx]  relative">
+				<image src="https://oss.xiaoxiongcode.com/static/home/6171.png" mode="widthFix"
+					class="w-[300rpx]  relative ">
+				</image>
+				<text class=" wz-1  ">
+					当前账号尚未兑换会员
+				</text>
+				<text class="wz-2  " @tap="handleExchange">
+					去兑换
+				</text>
+				<text class="wz-3  " @tap="handleExchangeHide">
+					取消
+				</text>
 			</view>
 		</cl-popup>
 		<cl-popup v-model="visible4" showClose :show-header="false" direction="center" :pt="{
@@ -250,6 +248,9 @@ function handleViewAnnouncement() {
 			}
 		}">
 			<view class="w-[360px]  relative">
+				<view class="absolute top-2 right-2" @tap="visible4 = false">
+					<cl-icon name="close-circle-fill" color="info" :size="20"></cl-icon>
+				</view>
 				<image src="https://oss.xiaoxiongcode.com/static/home/6171.png" mode="widthFix"
 					class="w-[360px]  relative ">
 				</image>
@@ -276,6 +277,9 @@ function handleViewAnnouncement() {
 			}
 		}">
 			<view class="w-[360px]  relative">
+				<view class="absolute top-2 right-2" @tap="visible6 = false">
+					<cl-icon name="close-circle-fill" color="info" :size="20"></cl-icon>
+				</view>
 				<image src="https://oss.xiaoxiongcode.com/static/home/721.png" mode="widthFix"
 					class="w-[360px]  relative ">
 				</image>

+ 36 - 11
pages/programming/progress.uvue

@@ -55,7 +55,18 @@ function handleClick(id: number) {
       });
       break
     case 4:
-      visible.value = true
+      const res = uni.getDeviceInfo()
+      console.log(res)
+      if (res.deviceType === 'pad') {
+        router.push({
+          path: "/pages/programming/web-view",
+          query: {
+            id: router.query().id,
+          }
+        });
+      } else {
+        visible.value = true
+      }
       break
   }
 
@@ -66,6 +77,14 @@ function copyUrl() {
     showToast: true
   });
 }
+function handleExchange() {
+  router.push({
+    path: "/pages/programming/web-view",
+    query: {
+      id: router.query().id,
+    }
+  });
+}
 </script>
 <template>
   <Loading v-show="isLoading" />
@@ -96,18 +115,24 @@ function copyUrl() {
       </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'">
+      <view class="flex flex-col items-center justify-center gap-4 py-5 bg-slate-50">
+        <view class="absolute top-2 right-2" @tap="visible = false">
+          <cl-icon name="close-circle-fill" color="info" :size="20"></cl-icon>
+        </view>
+        <image mode="heightFix" src="https://oss.xiaoxiongcode.com/static/home/coding.png" class="h-[70rpx]" />
+        <view class="text-center w-[300rpx]">
+          <cl-text class="text-center" color="#fb923c" :size="16">非平板显示效果较差,建议使用平板或者电脑端操作!</cl-text>
           <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>
+          <cl-text class="text-center" color="#999" :size="14">少儿编程网址: www.xiaoxiongcode.com </cl-text>
+          <cl-row :gutter="20">
+            <cl-col :span="12">
+              <cl-button type="primary" @tap="copyUrl"> 复制网址 </cl-button>
+            </cl-col>
+            <cl-col :span="12">
+              <cl-button type="warn" @tap="handleExchange"> 继续前往 </cl-button>
+            </cl-col>
+          </cl-row>
         </view>
       </view>
     </cl-popup>

+ 19 - 0
pages/programming/web-view.uvue

@@ -0,0 +1,19 @@
+<script setup lang='ts'>
+import { ref, onMounted, watchEffect } from 'vue'
+import Loading from '@/components/loading.uvue'
+import { router } from '@/.cool'
+import Back from '@/components/back.uvue'
+const webviewSrc = ref('')
+var isLoading = ref(true)
+
+function handleLoad() {
+  isLoading.value = false
+}
+
+</script>
+<template>
+  <Loading v-show="isLoading" />
+  <web-view src="https://oss.xiaoxiongcode.com/scratch-gui/index.html" class="w-full h-full"
+    @load="handleLoad"></web-view>
+</template>
+<style lang="less" scoped></style>