Browse Source

具体游戏文件优化

JutarryWu 5 months ago
parent
commit
492f9578fe
6 changed files with 87 additions and 15 deletions
  1. 1 1
      .env.development
  2. 1 1
      .env.production
  3. 1 1
      .env.test
  4. 30 8
      .idea/workspace.xml
  5. 50 0
      src/types/type.d.ts
  6. 4 4
      src/views/cognitiveTasks/PicturePuzzle/index.vue

+ 1 - 1
.env.development

@@ -1,7 +1,7 @@
 # 应用配置面板
 VITE_APP_SETTING = true
 # 页面标题
-VITE_APP_TITLE = Fantastic-mobile 基础版
+VITE_APP_TITLE = InsomniaCognitionH5
 # 接口请求地址,会设置到 axios 的 baseURL 参数上
 VITE_APP_API_BASE_URL = https://byly.jue-ming.com:8112/
 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空

+ 1 - 1
.env.production

@@ -1,7 +1,7 @@
 # 应用配置面板
 VITE_APP_SETTING = false
 # 页面标题
-VITE_APP_TITLE = Fantastic-mobile 基础版
+VITE_APP_TITLE = InsomniaCognitionH5
 # 接口请求地址,会设置到 axios 的 baseURL 参数上
 VITE_APP_API_BASE_URL = https://byly.jue-ming.com:8112/
 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空

+ 1 - 1
.env.test

@@ -1,7 +1,7 @@
 # 应用配置面板
 VITE_APP_SETTING = false
 # 页面标题
-VITE_APP_TITLE = Fantastic-mobile 基础版
+VITE_APP_TITLE = InsomniaCognitionH5
 # 接口请求地址,会设置到 axios 的 baseURL 参数上
 VITE_APP_API_BASE_URL = /
 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空

+ 30 - 8
.idea/workspace.xml

@@ -4,9 +4,14 @@
     <option name="autoReloadType" value="SELECTIVE" />
   </component>
   <component name="ChangeListManager">
-    <list default="true" id="b9dc0b93-aea2-4509-84d8-c1e57bc059b1" name="更改" comment="">
+    <list default="true" id="b9dc0b93-aea2-4509-84d8-c1e57bc059b1" name="更改" comment="具体游戏文件优化">
+      <change afterPath="$PROJECT_DIR$/src/types/type.d.ts" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.env.development" beforeDir="false" afterPath="$PROJECT_DIR$/.env.development" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.env.production" beforeDir="false" afterPath="$PROJECT_DIR$/.env.production" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.env.test" beforeDir="false" afterPath="$PROJECT_DIR$/.env.test" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/utils/index.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/utils/index.ts" 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" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -79,7 +84,7 @@
     &quot;git-widget-placeholder&quot;: &quot;dev&quot;,
     &quot;javascript.nodejs.core.library.configured.version&quot;: &quot;20.13.1&quot;,
     &quot;javascript.nodejs.core.library.typings.version&quot;: &quot;20.13.0&quot;,
-    &quot;last_opened_file_path&quot;: &quot;E:/WorkSpace/Web/insomnia-cognition-h5/src/utils&quot;,
+    &quot;last_opened_file_path&quot;: &quot;E:/WorkSpace/Web/insomnia-cognition-h5/src/types&quot;,
     &quot;list.type.of.created.stylesheet&quot;: &quot;Less&quot;,
     &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
     &quot;node.js.detected.package.standard&quot;: &quot;true&quot;,
@@ -100,13 +105,14 @@
 }</component>
   <component name="RecentsManager">
     <key name="CopyFile.RECENT_KEYS">
+      <recent name="E:\WorkSpace\Web\insomnia-cognition-h5\src\types" />
       <recent name="E:\WorkSpace\Web\insomnia-cognition-h5\src\utils" />
       <recent name="E:\WorkSpace\Web\insomnia-cognition-h5\src\store" />
       <recent name="E:\WorkSpace\Web\insomnia-cognition-h5\src\api" />
       <recent name="E:\WorkSpace\Web\insomnia-cognition-h5\src\api\modules" />
-      <recent name="E:\WorkSpace\Web\insomnia-cognition-h5\src\components" />
     </key>
     <key name="MoveFile.RECENT_KEYS">
+      <recent name="E:\WorkSpace\Web\insomnia-cognition-h5\src\views\cognitiveTasks\BreadthTraining\components" />
       <recent name="E:\WorkSpace\Web\insomnia-cognition-h5\src\assets\images" />
       <recent name="E:\WorkSpace\Web\insomnia-cognition-h5\src\assets\icons" />
       <recent name="E:\WorkSpace\Web\insomnia-cognition-h5\src\styles" />
@@ -397,7 +403,23 @@
       <option name="project" value="LOCAL" />
       <updated>1726738052902</updated>
     </task>
-    <option name="localTasksCounter" value="32" />
+    <task id="LOCAL-00032" summary="utils方法迁移">
+      <option name="closed" value="true" />
+      <created>1726738380003</created>
+      <option name="number" value="00032" />
+      <option name="presentableId" value="LOCAL-00032" />
+      <option name="project" value="LOCAL" />
+      <updated>1726738380003</updated>
+    </task>
+    <task id="LOCAL-00033" summary="具体游戏文件优化">
+      <option name="closed" value="true" />
+      <created>1726740487871</created>
+      <option name="number" value="00033" />
+      <option name="presentableId" value="LOCAL-00033" />
+      <option name="project" value="LOCAL" />
+      <updated>1726740487871</updated>
+    </task>
+    <option name="localTasksCounter" value="34" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
@@ -462,8 +484,6 @@
     </option>
   </component>
   <component name="VcsManagerConfiguration">
-    <MESSAGE value="feat(组件类): 新增倒计时组件" />
-    <MESSAGE value="feat(图片): 新增空间定位训练图片" />
     <MESSAGE value="feat(路由及样式): 新增空间定位训练框架" />
     <MESSAGE value="feat(认知任务): 新增空间定位训练框架" />
     <MESSAGE value="feat(认知任务): 新增广度训练框架" />
@@ -487,6 +507,8 @@
     <MESSAGE value="修改基础配置1" />
     <MESSAGE value="修改后台请求接口路径" />
     <MESSAGE value="修改后台请求接口路径及全局样式" />
-    <option name="LAST_COMMIT_MESSAGE" value="修改后台请求接口路径及全局样式" />
+    <MESSAGE value="utils方法迁移" />
+    <MESSAGE value="具体游戏文件优化" />
+    <option name="LAST_COMMIT_MESSAGE" value="具体游戏文件优化" />
   </component>
 </project>

+ 50 - 0
src/types/type.d.ts

@@ -0,0 +1,50 @@
+export interface ITransferTrainingBaseData {
+  totalScore: number // 总分
+  correctNumber: number // 正确数量
+  data: any[]
+}
+
+export interface ITransferTrainingBaseChildData {
+  consistent?: number // 0: 一致,1: 不一致,2: 中心
+  direction?: number // 靶心位置: 0: 上  1:下  2:左  3:右
+  rotate?: number // 旋转角度
+  excludeDirection?: number // 靶心位置: 0: 上  1:下  2:左  3:右
+  choice?: string // 0: 正确  1:错误  2:中心, 3:漏报
+  beginTime?: number // 开始时间
+  endTime?: number // 结束时间
+  reactionTime?: number // 反应时间
+  score?: number // 得分
+  extraScore?: number // 额外得分
+}
+
+export interface IGameBaseData {
+  totalScore: number
+  beginTime?: number // 开始时间
+  endTime?: number // 结束时间
+  reactionTime?: number // 反应时间
+  maxLevel?: number // 最大难度等级
+  dataList: any[]
+}
+
+interface IGameBaseChildData {
+  title: string // 题目
+  level?: number // 难度等级
+  correctValue: string // 正确答案
+  choices?: string[] // 选项
+  answer?: string // 用户答案
+  score?: number // 得分
+  correct?: boolean // 是否正确
+  accuracy?: number // 正确率
+  choiceClickFlag?: boolean // 是否点击过选项 false表示未点击,true表示点击过
+  startTime?: number // 开始答题时间
+  endTime?: number // 结束答题时间
+  [key: string]: any
+}
+
+export interface IComputationBaseChildData extends IGameBaseChildData {
+  analysis: string[] // 解析
+}
+
+export interface IDigitalUnderstandingBaseChildData extends IGameBaseChildData {
+  titleImages?: string[] // 题目
+}

+ 4 - 4
src/views/cognitiveTasks/PicturePuzzle/index.vue

@@ -9,7 +9,7 @@ import { shuffle } from 'lodash-es'
 import { showSuccessToast } from 'vant'
 import Topics from './Topics.json'
 import PicturePuzzleChild from './components/PicturePuzzleChild/index.vue'
-import type { IGameBaseData } from '@/typing'
+import type { IGameBaseData } from '@/types/type'
 import { formatSeconds, isAndroidOrIos } from '@/utils'
 import GameAPI, { type GameResultVO, type GameVO } from '@/api/game'
 
@@ -20,7 +20,7 @@ const TopicsArr = Topics.map((item) => {
   item = shuffle(item)
   return item
 })
-let gameStartTime = null // 游戏开始时间
+let gameStartTime: number | null = null // 游戏开始时间
 const currentLevel = ref(0) // 当前难度
 const tempIndex = ref(0) // 当前难度下的次序
 const baseData: IGameBaseData = reactive({
@@ -36,7 +36,7 @@ const scoreList = [10, 30, 60, 100]
 function endGame() {
   // 计算游戏得分
   const totalScore = baseData.totalScore
-  const gameTime = formatSeconds(Math.ceil(performance.now() - gameStartTime))
+  const gameTime = formatSeconds(Math.ceil(performance.now() - gameStartTime!))
 
   const data: GameResultVO = {
     finish: '1',
@@ -59,7 +59,7 @@ function endGame() {
         value: currentLevel.value + 1,
       },
     ],
-    userId: sessionStorage.getItem('userId'),
+    userId: sessionStorage.getItem('userId')!,
   }
   GameAPI.add(data).then(() => {
     showSuccessToast({