Эх сурвалжийг харах

提交测试结果调用微信api

周玉佂 2 сар өмнө
parent
commit
1fd69a12ea

+ 35 - 31
.idea/workspace.xml

@@ -5,20 +5,14 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="b347610e-2e38-40df-8414-1dc079962726" name="更改" comment="提交">
-      <change afterPath="$PROJECT_DIR$/public/static/image/game/logo/7.png" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/public/static/image/game/logo/8.png" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/RouletteGame/Topics.json" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/RouletteGame/index.vue" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/SlotMachine/Topics.json" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/SlotMachine/index.vue" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/pnpm-lock.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/pnpm-lock.yaml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/main.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/main.ts" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/types/auto-imports.d.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/auto-imports.d.ts" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/types/components.d.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/components.d.ts" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/types/typed-router.d.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/typed-router.d.ts" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/views/cognitiveTasks/main/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/main/index.vue" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/index.html" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/views/cognitiveTasks/BreadthTraining/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/BreadthTraining/index.vue" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/views/cognitiveTasks/ContinueAddition/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/ContinueAddition/index.vue" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/views/cognitiveTasks/PictureNaming/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/PictureNaming/index.vue" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/views/cognitiveTasks/PicturePuzzle/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/PicturePuzzle/index.vue" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/views/cognitiveTasks/RouletteGame/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/RouletteGame/index.vue" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/views/cognitiveTasks/spatialOrientationAbility/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/spatialOrientationAbility/index.vue" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -44,24 +38,24 @@
     <option name="hideEmptyMiddlePackages" value="true" />
     <option name="showLibraryContents" value="true" />
   </component>
-  <component name="PropertiesComponent"><![CDATA[{
-  "keyToString": {
-    "ASKED_ADD_EXTERNAL_FILES": "true",
-    "RunOnceActivity.ShowReadmeOnStart": "true",
-    "RunOnceActivity.git.unshallow": "true",
-    "git-widget-placeholder": "dev",
-    "last_opened_file_path": "D:/word/word/insomnia-cognition-h5/src/views/cognitiveTasks/RouletteGame",
-    "node.js.detected.package.eslint": "true",
-    "node.js.detected.package.stylelint": "true",
-    "node.js.selected.package.eslint": "(autodetect)",
-    "node.js.selected.package.stylelint": "E:\\WorkSpace\\Web\\insomnia-cognition-h5\\node_modules\\stylelint",
-    "node.js.selected.package.tslint": "(autodetect)",
-    "nodejs_package_manager_path": "pnpm",
-    "settings.editor.selected.configurable": "preferences.pluginManager",
-    "ts.external.directory.path": "D:\\word\\word\\insomnia-cognition-h5\\node_modules\\typescript\\lib",
-    "vue.rearranger.settings.migration": "true"
+  <component name="PropertiesComponent">{
+  &quot;keyToString&quot;: {
+    &quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
+    &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
+    &quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
+    &quot;git-widget-placeholder&quot;: &quot;dev&quot;,
+    &quot;last_opened_file_path&quot;: &quot;D:/word/word/insomnia-cognition-h5/src/views/cognitiveTasks/RouletteGame&quot;,
+    &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
+    &quot;node.js.detected.package.stylelint&quot;: &quot;true&quot;,
+    &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
+    &quot;node.js.selected.package.stylelint&quot;: &quot;E:\\WorkSpace\\Web\\insomnia-cognition-h5\\node_modules\\stylelint&quot;,
+    &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
+    &quot;nodejs_package_manager_path&quot;: &quot;pnpm&quot;,
+    &quot;settings.editor.selected.configurable&quot;: &quot;preferences.pluginManager&quot;,
+    &quot;ts.external.directory.path&quot;: &quot;D:\\word\\word\\insomnia-cognition-h5\\node_modules\\typescript\\lib&quot;,
+    &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
   }
-}]]></component>
+}</component>
   <component name="RecentsManager">
     <key name="CopyFile.RECENT_KEYS">
       <recent name="D:\word\word\insomnia-cognition-h5\src\views\cognitiveTasks\RouletteGame" />
@@ -85,8 +79,18 @@
       <option name="presentableId" value="Default" />
       <updated>1734514599924</updated>
       <workItem from="1734514601970" duration="154000" />
-      <workItem from="1734571154985" duration="15689000" />
+      <workItem from="1734571154985" duration="23532000" />
+      <workItem from="1747192052253" duration="5220000" />
+    </task>
+    <task id="LOCAL-00001" summary="提交">
+      <option name="closed" value="true" />
+      <created>1734663799815</created>
+      <option name="number" value="00001" />
+      <option name="presentableId" value="LOCAL-00001" />
+      <option name="project" value="LOCAL" />
+      <updated>1734663799815</updated>
     </task>
+    <option name="localTasksCounter" value="2" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">

+ 7 - 0
global.d..ts

@@ -0,0 +1,7 @@
+declare global {
+  interface Window {
+    wx: any
+  }
+}
+
+export {}

+ 2 - 0
index.html

@@ -8,5 +8,7 @@
   <body>
     <div id="app"></div>
     <script type="module" src="/src/main.ts"></script>
+    <!-- 引入微信 JS-SDK -->
+    <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
   </body>
 </html>

+ 15 - 1
src/views/cognitiveTasks/BreadthTraining/index.vue

@@ -236,7 +236,21 @@ function sendData() {
   GameAPI.add(gameData).then(() => {
     showSuccessToast('本次训练已结束')
     setTimeout(() => {
-      router.go(-1)
+      // 判断是否在小程序环境中
+      const userAgent = navigator.userAgent.toLowerCase()
+      const isWechatEnvironment = userAgent.includes('micromessenger')
+      if (isWechatEnvironment) {
+        // 执行微信环境下的逻辑,如调用微信JS-SDK
+        if (wx && wx.miniProgram) {
+          wx.miniProgram.navigateTo({
+            url: '/pages/media/pages/feedbackTask/finish/finish',
+          })
+        }
+      }
+      else {
+        router.go(-1)
+        // 执行浏览器环境下的逻辑
+      }
     }, 1300)
   })
 }

+ 14 - 1
src/views/cognitiveTasks/ContinueAddition/index.vue

@@ -166,7 +166,20 @@ function sendData() {
   GameAPI.add(gameData).then(() => {
     showSuccessToast('本次训练已结束')
     setTimeout(() => {
-      router.go(-1)
+      const userAgent = navigator.userAgent.toLowerCase()
+      const isWechatEnvironment = userAgent.includes('micromessenger')
+      if (isWechatEnvironment) {
+        // 执行微信环境下的逻辑,如调用微信JS-SDK
+        if (wx && wx.miniProgram) {
+          wx.miniProgram.navigateTo({
+            url: '/pages/media/pages/feedbackTask/finish/finish',
+          })
+        }
+      }
+      else {
+        router.go(-1)
+        // 执行浏览器环境下的逻辑
+      }
     }, 1300)
   })
 }

+ 16 - 2
src/views/cognitiveTasks/PictureNaming/index.vue

@@ -191,7 +191,21 @@ function submit() {
       message: '本次训练已结束',
     })
     setTimeout(() => {
-      router.go(-1)
+      // 使用示例
+      const userAgent = navigator.userAgent.toLowerCase()
+      const isWechatEnvironment = userAgent.includes('micromessenger')
+      if (isWechatEnvironment) {
+        // 执行微信环境下的逻辑,如调用微信JS-SDK
+        if (wx && wx.miniProgram) {
+          wx.miniProgram.navigateTo({
+            url: '/pages/media/pages/feedbackTask/finish/finish',
+          })
+        }
+      }
+      else {
+        router.go(-1)
+        // 执行浏览器环境下的逻辑
+      }
     }, 1300)
   })
 }
@@ -229,7 +243,7 @@ onBeforeUnmount(() => {
     <VoiceImp ref="VoiceImpRef" />
 
     <div v-if="!showCountDown && currentIndex < showDataArr.length" class="absolute-center flex-column h-[78%] w-[100%]">
-      <div class="center-div flex-center ml-[4%] h-[390px] w-[92%]">
+      <div class="center-div ml-[4%] h-[390px] w-[92%] flex-center">
         <img v-if="showImg" :src="showDataArr[currentIndex].img" alt="" class="h-[50%] w-[58%]">
       </div>
       <div class="mt-[20px] h-[80px] w-[100%] flex-row justify-around text-center text-[42px] text-[#3A3A3AE2] line-height-[80px]">

+ 15 - 1
src/views/cognitiveTasks/PicturePuzzle/index.vue

@@ -67,7 +67,21 @@ function endGame() {
       message: '本次训练已结束',
     })
     setTimeout(() => {
-      router.go(-1)
+      const userAgent = navigator.userAgent.toLowerCase()
+      const isWechatEnvironment = userAgent.includes('micromessenger')
+      if (isWechatEnvironment) {
+        // 执行微信环境下的逻辑,如调用微信JS-SDK
+        if (wx && wx.miniProgram) {
+          wx.miniProgram.navigateTo({
+            url: '/pages/media/pages/feedbackTask/finish/finish',
+          })
+        }
+      }
+      else {
+        router.go(-1)
+        console.log('当前在浏览器环境中')
+        // 执行浏览器环境下的逻辑
+      }
     }, 1300)
   })
 }

+ 57 - 50
src/views/cognitiveTasks/RouletteGame/index.vue

@@ -1,57 +1,64 @@
 <script setup lang="ts">
-const myLucky = ref<any>(null)
-const prizes = [
-  { background: '#e9e8fe', fonts: [{ text: '0' }] },
-  { background: '#b8c5f2', fonts: [{ text: '1' }] },
-  { background: '#e9e8fe', fonts: [{ text: '2' }] },
-  { background: '#b8c5f2', fonts: [{ text: '3' }] },
-]
-const blocks = [{ padding: '10px', background: '#869cfa' }]
-const defaultConfig = {
-  gutter: '5px',
-  offsetDegree: 30,
-}
-const buttons = [
-  { radius: '40%', background: '#617df2' },
-  { radius: '35%', background: '#afc8ff' },
-  {
-    radius: '30%',
-    background: '#869cfa',
-    pointer: true,
-    fonts: [{ text: '开始', top: '-10px' }],
-  },
-]
-// 点击抽奖按钮会触发star回调
-function startCallback() {
-  console.log(myLucky?.value)
-  // 调用抽奖组件的play方法开始游戏
-  myLucky?.value?.play()
-  // 模拟调用接口异步抽奖
-  setTimeout(() => {
-    // 假设后端返回的中奖索引是0
-    const index = 0
-    // 调用stop停止旋转并传递中奖索引
-    myLucky?.value?.stop(index)
-  }, 3000)
-}
-// 抽奖结束会触发end回调
-function endCallback(prize: any) {
-  console.log(prize)
-}
+// const myLucky = ref<any>(null)
+// const prizes = [
+//   { background: '#e9e8fe', fonts: [{ text: '0' }] },
+//   { background: '#b8c5f2', fonts: [{ text: '1' }] },
+//   { background: '#e9e8fe', fonts: [{ text: '2' }] },
+//   { background: '#b8c5f2', fonts: [{ text: '3' }] },
+// ]
+// const blocks = [{ padding: '10px', background: '#869cfa' }]
+// const defaultConfig = ref<any>([{
+//   gutter: '5px',
+//   offsetDegree: 10,
+// }])
+// const buttons = [
+//   { radius: '40%', background: '#617df2' },
+//   { radius: '35%', background: '#afc8ff' },
+//   {
+//     radius: '30%',
+//     background: '#869cfa',
+//     pointer: true,
+//     fonts: [{ text: '开始', top: '-10px' }],
+//   },
+// ]
+// // 点击抽奖按钮会触发star回调
+// function startCallback() {
+//   console.log(myLucky?.value)
+//   // 调用抽奖组件的play方法开始游戏
+//   myLucky?.value?.play()
+//   // 模拟调用接口异步抽奖
+//   setTimeout(() => {
+//     // 假设后端返回的中奖索引是0
+//     const index = 1
+//     // 调用stop停止旋转并传递中奖索引
+//     defaultConfig.value = [{
+//       gutter: '5px',
+//       offsetDegree: 90,
+//     }]
+//     myLucky?.value?.stop(index)
+//   }, 3000)
+//   console.log(myLucky?.value?.stop, 'myLucky?.value?.stop')
+// }
+// // 抽奖结束会触发end回调
+// function endCallback(prize: any) {
+//   console.log(prize)
+// }
 </script>
 
 <template>
-  <LuckyWheel
-    ref="myLucky"
-    width="300px"
-    height="300px"
-    :prizes="prizes"
-    :blocks="blocks"
-    :buttons="buttons"
-    @start="startCallback"
-    @end="endCallback"
-    :default-config="defaultConfig"
-  />
+  <div>
+  <!--  <LuckyWheel -->
+  <!--    ref="myLucky" -->
+  <!--    width="300px" -->
+  <!--    height="300px" -->
+  <!--    :prizes="prizes" -->
+  <!--    :blocks="blocks" -->
+  <!--    :buttons="buttons" -->
+  <!--    @start="startCallback" -->
+  <!--    @end="endCallback" -->
+  <!--    :default-config="defaultConfig[0]" -->
+  <!--  /> -->
+  </div>
 </template>
 
 <style scoped lang="scss"></style>

+ 111 - 111
src/views/cognitiveTasks/SlotMachine/index.vue

@@ -1,119 +1,119 @@
 <script setup>
-import { onBeforeUnmount, onMounted, ref } from 'vue'
-
-// 自定义数据列表,可自行修改里面的元素
-const customData = ref(['苹果', '香蕉', '橙子', '葡萄', '西瓜'])
-
-// 用于存储随机生成的数据
-const randomData = ref('')
-const itemHeight = 20
-// 存储自定义列中每个元素的DOM引用
-const customItemRefs = ref([])
-// 存储随机列中每个元素的DOM引用
-const randomItemRefs = ref([])
-
-// 设置自定义列元素的DOM引用
-function setCustomItemRef(el) {
-  if (el) {
-    customItemRefs.value.push(el)
-  }
-}
-
-// 设置随机列元素的DOM引用
-function setRandomItemRef(el) {
-  if (el) {
-    randomItemRefs.value.push(el)
-  }
-}
-
-// 模拟老虎机转动的函数
-function startSpin() {
-  let startTime // 记录转动开始时间,用于计算已过去的时间
-  const spinDuration = 2000 // 转动持续时间(毫秒)
- // 每个滚动项的高度(px),与样式中.slot-item 的 height 对应
-  const totalItems = customData.value.length // 总数据项数量
-  const updateRandomData = () => {
-    const randomIndex = Math.floor(Math.random() * totalItems)
-    randomData.value = customData.value[randomIndex]
-  }
-
-  const animate = (timestamp) => {
-    if (!startTime) {
-      startTime = timestamp
-    }
-    const elapsedTime = timestamp - startTime
-    if (elapsedTime < spinDuration) {
-      // 移动每个随机列和自定义列的元素,实现滚动效果
-      moveItems(randomItemRefs.value)
-      moveItems(customItemRefs.value)
-      requestAnimationFrame(animate)
-    }
-    else {
-      // 重置随机列和自定义列元素的偏移量,使其停止在最终位置
-      resetItems(randomItemRefs.value)
-      resetItems(customItemRefs.value)
-      // 可以在这里添加停止转动后的逻辑,比如判断是否中奖等
-    }
-  }
-
-  requestAnimationFrame(animate)
-}
-
-// 移动元素的通用函数,同时强制触发重排
-function moveItems(itemRefs) {
-  itemRefs.forEach((el) => {
-    const currentOffset = Number.parseInt(el.style.transform?.split(' ')[5] || '0')
-    const newOffset = currentOffset - itemHeight
-    el.style.transform = `translateY(${newOffset}px)`
-    // 强制触发重排,让样式变化及时生效
-    void el.offsetHeight
-  })
-}
-
-// 重置元素偏移量的通用函数
-function resetItems(itemRefs) {
-  itemRefs.forEach((el) => {
-    el.style.transform = 'translateY(0)'
-  })
-}
-
-// 在组件挂载时初始化相关操作
-onMounted(() => {
-  // 为自定义列和随机列的每个元素设置初始的transform样式,使其处于起始位置
-  const initItems = (refs) => {
-    refs.forEach((el) => {
-      el.style.transform = 'translateY(0)'
-    })
-  }
-  initItems(customItemRefs.value)
-  initItems(randomItemRefs.value)
-})
-
-// 在组件卸载前清除相关定时器等资源
-onBeforeUnmount(() => {
-  // 确保清除可能存在的动画相关的循环调用,避免内存泄漏
-})
+// import { onBeforeUnmount, onMounted, ref } from 'vue'
+//
+// // 自定义数据列表,可自行修改里面的元素
+// const customData = ref(['苹果', '香蕉', '橙子', '葡萄', '西瓜'])
+//
+// // 用于存储随机生成的数据
+// const randomData = ref('')
+// const itemHeight = 20
+// // 存储自定义列中每个元素的DOM引用
+// const customItemRefs = ref([])
+// // 存储随机列中每个元素的DOM引用
+// const randomItemRefs = ref([])
+//
+// // 设置自定义列元素的DOM引用
+// function setCustomItemRef(el) {
+//   if (el) {
+//     customItemRefs.value.push(el)
+//   }
+// }
+//
+// // 设置随机列元素的DOM引用
+// function setRandomItemRef(el) {
+//   if (el) {
+//     randomItemRefs.value.push(el)
+//   }
+// }
+//
+// // 模拟老虎机转动的函数
+// function startSpin() {
+//   let startTime // 记录转动开始时间,用于计算已过去的时间
+//   const spinDuration = 2000 // 转动持续时间(毫秒)
+//  // 每个滚动项的高度(px),与样式中.slot-item 的 height 对应
+//   const totalItems = customData.value.length // 总数据项数量
+//   const updateRandomData = () => {
+//     const randomIndex = Math.floor(Math.random() * totalItems)
+//     randomData.value = customData.value[randomIndex]
+//   }
+//
+//   const animate = (timestamp) => {
+//     if (!startTime) {
+//       startTime = timestamp
+//     }
+//     const elapsedTime = timestamp - startTime
+//     if (elapsedTime < spinDuration) {
+//       // 移动每个随机列和自定义列的元素,实现滚动效果
+//       moveItems(randomItemRefs.value)
+//       moveItems(customItemRefs.value)
+//       requestAnimationFrame(animate)
+//     }
+//     else {
+//       // 重置随机列和自定义列元素的偏移量,使其停止在最终位置
+//       resetItems(randomItemRefs.value)
+//       resetItems(customItemRefs.value)
+//       // 可以在这里添加停止转动后的逻辑,比如判断是否中奖等
+//     }
+//   }
+//
+//   requestAnimationFrame(animate)
+// }
+//
+// // 移动元素的通用函数,同时强制触发重排
+// function moveItems(itemRefs) {
+//   itemRefs.forEach((el) => {
+//     const currentOffset = Number.parseInt(el.style.transform?.split(' ')[5] || '0')
+//     const newOffset = currentOffset - itemHeight
+//     el.style.transform = `translateY(${newOffset}px)`
+//     // 强制触发重排,让样式变化及时生效
+//     void el.offsetHeight
+//   })
+// }
+//
+// // 重置元素偏移量的通用函数
+// function resetItems(itemRefs) {
+//   itemRefs.forEach((el) => {
+//     el.style.transform = 'translateY(0)'
+//   })
+// }
+//
+// // 在组件挂载时初始化相关操作
+// onMounted(() => {
+//   // 为自定义列和随机列的每个元素设置初始的transform样式,使其处于起始位置
+//   const initItems = (refs) => {
+//     refs.forEach((el) => {
+//       el.style.transform = 'translateY(0)'
+//     })
+//   }
+//   initItems(customItemRefs.value)
+//   initItems(randomItemRefs.value)
+// })
+//
+// // 在组件卸载前清除相关定时器等资源
+// onBeforeUnmount(() => {
+//   // 确保清除可能存在的动画相关的循环调用,避免内存泄漏
+// })
 </script>
 
 <template>
   <div class="slot-machine">
-    <div class="slot-column custom-column">
-      <div v-for="item in customData" :key="item" class="slot-item">
-        <div :ref="setCustomItemRef" class="custom-item">
-          {{ item }}
-        </div>
-      </div>
-    </div>
-    <div class="slot-column random-column">
-      <div v-for="i in 5" :key="i" class="slot-item">
-        <div :ref="setRandomItemRef" class="random-item">
-          {{ randomData }}
-        </div>
-      </div>
-    </div>
-    <button @click="startSpin">
-      开始转动
-    </button>
+    <!--    <div class="slot-column custom-column"> -->
+    <!--      <div v-for="item in customData" :key="item" class="slot-item"> -->
+    <!--        <div :ref="setCustomItemRef" class="custom-item"> -->
+    <!--          {{ item }} -->
+    <!--        </div> -->
+    <!--      </div> -->
+    <!--    </div> -->
+    <!--    <div class="slot-column random-column"> -->
+    <!--      <div v-for="i in 5" :key="i" class="slot-item"> -->
+    <!--        <div :ref="setRandomItemRef" class="random-item"> -->
+    <!--          {{ randomData }} -->
+    <!--        </div> -->
+    <!--      </div> -->
+    <!--    </div> -->
+    <!--    <button @click="startSpin"> -->
+    <!--      开始转动 -->
+    <!--    </button> -->
   </div>
 </template>
 

+ 16 - 2
src/views/cognitiveTasks/spatialOrientationAbility/index.vue

@@ -275,7 +275,21 @@ submitAngle() {
     GameAPI.add(data).then(() => {
       showSuccessToast('本次训练已结束')
       setTimeout(() => {
-        router.go(-1)
+        // 使用示例
+        const userAgent = navigator.userAgent.toLowerCase()
+        const isWechatEnvironment = userAgent.includes('micromessenger')
+        if (isWechatEnvironment) {
+          // 执行微信环境下的逻辑,如调用微信JS-SDK
+          if (wx && wx.miniProgram) {
+            wx.miniProgram.navigateTo({
+              url: '/pages/media/pages/feedbackTask/finish/finish',
+            })
+          }
+        }
+        else {
+          router.go(-1)
+          // 执行浏览器环境下的逻辑
+        }
       }, 1300)
     })
   }
@@ -338,7 +352,7 @@ onMounted(() => {
       <div
         v-for="(arr, index) in showDataArr[currentIndex]"
         :key="index"
-        class="item flex-column absolute translate-[-50%] text-[15px] text-black items-center"
+        class="item flex-column absolute translate-[-50%] items-center text-[15px] text-black"
         :style="{ top: `${arr.yAxis}px`, left: `${arr.xAxis}px` }"
       >
         <img :src="arr.imgUrl" alt="" class="h-[24px] w-[24px]">

+ 7 - 7
vite/plugins.ts

@@ -4,7 +4,7 @@ import type { PluginOption } from 'vite'
 import VueRouter from 'unplugin-vue-router/vite'
 import vue from '@vitejs/plugin-vue'
 import vueJsx from '@vitejs/plugin-vue-jsx'
-import vueLegacy from '@vitejs/plugin-legacy'
+// import vueLegacy from '@vitejs/plugin-legacy'
 import VueDevTools from 'vite-plugin-vue-devtools'
 import autoImport from 'unplugin-auto-import/vite'
 import { VueRouterAutoImports } from 'unplugin-vue-router'
@@ -28,12 +28,12 @@ export default function createVitePlugins(viteEnv, isBuild = false) {
     }),
     vue(),
     vueJsx(),
-    vueLegacy({
-      renderLegacyChunks: false,
-      modernPolyfills: [
-        'es.array.at',
-      ],
-    }),
+    // vueLegacy({
+    //   renderLegacyChunks: false,
+    //   modernPolyfills: [
+    //     'es.array.at',
+    //   ],
+    // }),
 
     // https://github.com/vuejs/devtools-next
     viteEnv.VITE_OPEN_DEVTOOLS === 'true' && VueDevTools(),