Преглед изворни кода

言语康复训练 - 听 - 65%

JutarryWu пре 1 недеља
родитељ
комит
a358258fa8

+ 1 - 1
.env.development

@@ -12,7 +12,7 @@ VITE_APP_BASE_API = '/dev-api'
 # VITE_APP_API_URL = 'http://192.168.1.8:8001'
 
 # 公司本地
-VITE_APP_API_URL = 'http://192.168.1.4:8107'
+VITE_APP_API_URL = 'http://192.168.1.10:8107'
 
 # 家里本地
 # VITE_APP_API_URL = 'http://192.168.1.11:8107'

BIN
public/static/voice/cognitiveAbility/SpeechTraining/Auditory/WordImgMatching/1.mp3


+ 28 - 24
src/views/tester/components/RehabilitationEvaluation/CognitiveAbilityTask/CognitiveAbilityTaskAuditoryTraining/CATAuditoryTrainingRecognition/index.vue

@@ -2,33 +2,35 @@
   <section class="auditory-recognition-container flex-center flex-col wh-full relative">
     <water-title title="语音辨识" />
     <div v-if="isMainWin" class="text-[42px] text-[#0F308C]">
-      接下来会给你听一些声音,请在这些声音中选择出屏幕中呈现的词语
+      {{ Topics.question }}
     </div>
 
     <div v-if="!isMainWin && showTopics" class="flex-center flex-col text-100px text-[#0F308C]">
       {{ TopicsVal[currentIndex].correct }}
     </div>
-    <div class="w-80% h-60% my-20px flex-center flex-col">
+    <div class="w-80% h-60% my-30px flex-center flex-col">
       <template v-if="showTopics">
         <el-image
           v-if="isMainWin"
           src="/static/image/cognitiveAbility/SpeechTraining/Auditory/play.png"
           fit="contain"
-          class="w-[300px] h-[160px] my-60px cursor-pointer hover:scale-101"
+          class="w-[300px] h-[160px] mb-40px cursor-pointer hover:scale-101"
           @click="handlePlay"
         />
         <div class="w-full flex flex-row justify-between">
-          <div
-            v-for="(item, index) in TopicsVal[currentIndex].choices"
-            :key="index"
-            class="w-320px h-240px flex-center rounded-58px text-86px cursor-pointer bg-[#F9F9F9] border-[#E7E7E7] border-1px text-[#0F308C]"
-            :class="{
-              '!bg-[#0F308C] !text-white': useClickIndex === index || item === TopicsVal[currentIndex].userAnswer
-            }"
-            @click="handleItemClick(item, index)"
-          >
-            <div v-if="isMainWin">{{ item }}</div>
-            <div v-else>{{ index + 1 }}</div>
+          <div v-for="(item, index) in TopicsVal[currentIndex].choices" :key="index" class="flex flex-col items-center">
+            <div
+              class="w-360px h-180px flex-center rounded-58px text-96px cursor-pointer bg-[#F9F9F9] border-[#E7E7E7] border-1px text-[#0F308C]"
+              @click="handleItemClick(item, index)"
+            >
+              <div v-if="isMainWin">{{ item }}</div>
+              <div v-else>{{ index + 1 }}</div>
+            </div>
+            <el-image
+              :src="`/static/image/cognitiveAbility/SpeechTraining/${useClickIndex === index || item === TopicsVal[currentIndex].userAnswer ? 'Options-right' : 'Options-Blank'}.png`"
+              fit="contain"
+              class="w-[120px] h-[120px] cursor-pointer mt-30px"
+            />
           </div>
         </div>
       </template>
@@ -74,7 +76,6 @@ defineOptions({
 import Topics from './topics.json'
 
 interface TopicsType {
-  question: string
   choices: string[]
   correct: string
   userAnswer: string
@@ -118,6 +119,7 @@ const handlePlay = () => {
 const handleItemClick = (item: string, index: number) => {
   if (isSubmitting) return // 如果再提交进程中,不响应点击事件
   if (!isMainWin.value) {
+    VoiceImpRef.value.videoPlay()
     TopicsVal.value[currentIndex.value].userAnswer = item
     useClickIndex.value = index
     showSubmitBtn.value = true
@@ -140,10 +142,12 @@ const handleSubmit = () => {
 async function exec() {
   isMainWin.value = window.location.href.includes('win=main')
   if (isMainWin.value) {
-    TopicsVal.value = Topics.map((item) => {
-      item.choices = item.choices.sort(() => Math.random() - 0.5)
-      return item
-    })
+    TopicsVal.value = Topics.topics
+      .map((item) => {
+        item.choices = item.choices.sort(() => Math.random() - 0.5)
+        return item
+      })
+      .sort(() => Math.random() - 0.5)
     localStorage.setItem('two-win-auditory-recognition-init-data', JSON.stringify(TopicsVal.value))
     setTimeout(() => {
       showNextBtn.value = true
@@ -199,7 +203,10 @@ onMounted(() => {
         isSubmitting = true
         emits('gameOver', {
           min: formatSeconds(Date.now() - taskBeginTime),
-          content: JSON.stringify(TopicsVal.value),
+          content: JSON.stringify({
+            question: Topics.question,
+            topics: TopicsVal.value
+          }),
           score: TopicsVal.value.filter((item) => item.userAnswer === item.correct).length + ''
         })
         localStorage.removeItem('tow-win-auditory-recognition-isSubmitting')
@@ -209,7 +216,4 @@ onMounted(() => {
 })
 </script>
 
-<style scoped lang="scss">
-.auditory-recognition-container {
-}
-</style>
+<style scoped lang="scss"></style>

+ 11 - 8
src/views/tester/components/RehabilitationEvaluation/CognitiveAbilityTask/CognitiveAbilityTaskAuditoryTraining/CATAuditoryTrainingRecognition/topics.json

@@ -1,9 +1,12 @@
-[
-  {
-    "question": "接下来会给你听一些声音,请在这些声音中选择出屏幕中呈现的词语",
-    "choices": ["雷声", "狗叫", "葡萄"],
-    "correct": "葡萄",
-    "userAnswer": ""
-  }
-]
+{
+  "question": "接下来会给你听一些声音,请在这些声音中选择出屏幕中呈现的词语",
+  "topics":
+  [
+    {
+      "choices": ["雷声", "狗叫", "葡萄"],
+      "correct": "葡萄",
+      "userAnswer": ""
+    }
+  ]
+}
 

+ 73 - 19
src/views/tester/components/RehabilitationEvaluation/CognitiveAbilityTask/CognitiveAbilityTaskAuditoryTraining/CATAuditoryTrainingWordImgMatching/index.vue

@@ -1,6 +1,58 @@
 <template>
   <section class="auditory-recognition-container flex-center flex-col wh-full relative">
     <water-title title="词图匹配" />
+    <div v-if="isMainWin" class="text-[42px] text-[#0F308C]">
+      {{ Topics.question }}
+    </div>
+
+    <div v-if="!isMainWin && showTopics" class="flex-center flex-col text-100px text-[#0F308C]">
+      {{ TopicsVal[currentIndex].correct }}
+    </div>
+    <div class="w-80% h-60% my-30px flex-center flex-col">
+      <template v-if="showTopics">
+        <el-image
+          v-if="isMainWin"
+          src="/static/image/cognitiveAbility/SpeechTraining/Auditory/play.png"
+          fit="contain"
+          class="w-[300px] h-[160px] mb-40px cursor-pointer hover:scale-101"
+          @click="handlePlay"
+        />
+        <div class="w-full flex flex-row justify-between">
+          <div v-for="(item, index) in TopicsVal[currentIndex].choices" :key="index" class="flex flex-col items-center">
+            <div
+              class="w-360px h-180px flex-center rounded-58px text-96px cursor-pointer bg-[#F9F9F9] border-[#E7E7E7] border-1px text-[#0F308C]"
+              @click="handleItemClick(item, index)"
+            >
+              <div v-if="isMainWin">{{ item }}</div>
+              <div v-else>{{ index + 1 }}</div>
+            </div>
+            <el-image
+              :src="`/static/image/cognitiveAbility/SpeechTraining/${useClickIndex === index || item === TopicsVal[currentIndex].userAnswer ? 'Options-right' : 'Options-Blank'}.png`"
+              fit="contain"
+              class="w-[120px] h-[120px] cursor-pointer mt-30px"
+            />
+          </div>
+        </div>
+      </template>
+    </div>
+
+    <div v-if="!isMainWin" class="w-[300px] h-[140px]">
+      <el-image
+        v-if="showSubmitBtn"
+        src="/static/image/cognitiveAbility/SpeechTraining/verify-bg.png"
+        fit="contain"
+        class="w-[300px] h-[140px] cursor-pointer hover:scale-101"
+        @click="handleSubmit"
+      />
+    </div>
+
+    <el-image
+      v-if="showNextBtn"
+      src="/static/image/cognitiveAbility/SpeechTraining/next.png"
+      fit="contain"
+      class="!absolute bottom-[24px] right-[140px] w-[300px] h-[140px] cursor-pointer hover:scale-101"
+      @click="handleNext()"
+    />
 
     <VoiceImp ref="VoiceImpRef" />
   </section>
@@ -10,7 +62,7 @@
 /*
  * 组件名: CATAuditoryTrainingWordImgMatching
  * 组件用途: 常规听康复训练 - 词图匹配
- * 创建日期: 2024/11/14
+ * 创建日期: 2024/11/12
  * 编写者: JutarryWu
  */
 
@@ -24,7 +76,6 @@ defineOptions({
 import Topics from './topics.json'
 
 interface TopicsType {
-  question: string
   choices: string[]
   correct: string
   userAnswer: string
@@ -68,6 +119,7 @@ const handlePlay = () => {
 const handleItemClick = (item: string, index: number) => {
   if (isSubmitting) return // 如果再提交进程中,不响应点击事件
   if (!isMainWin.value) {
+    VoiceImpRef.value.videoPlay()
     TopicsVal.value[currentIndex.value].userAnswer = item
     useClickIndex.value = index
     showSubmitBtn.value = true
@@ -90,20 +142,22 @@ const handleSubmit = () => {
 async function exec() {
   isMainWin.value = window.location.href.includes('win=main')
   if (isMainWin.value) {
-    // TopicsVal.value = Topics.map((item) => {
-    //   item.choices = item.choices.sort(() => Math.random() - 0.5)
-    //   return item
-    // })
-    // localStorage.setItem('two-win-auditory-recognition-init-data', JSON.stringify(TopicsVal.value))
-    // setTimeout(() => {
-    //   showNextBtn.value = true
-    // }, 6600)
+    TopicsVal.value = Topics.topics
+      .map((item) => {
+        item.choices = item.choices.sort(() => Math.random() - 0.5)
+        return item
+      })
+      .sort(() => Math.random() - 0.5)
+    localStorage.setItem('two-win-auditory-recognition-init-data', JSON.stringify(TopicsVal.value))
+    setTimeout(() => {
+      showNextBtn.value = true
+    }, 6600)
   } else {
     taskBeginTime = Date.now()
-    // VoiceImpRef.value.videoPlay(
-    //   'Speech-Auditory',
-    //   'static/voice/cognitiveAbility/SpeechTraining/Auditory/Recognition/1.mp3'
-    // )
+    VoiceImpRef.value.videoPlay(
+      'Speech-Auditory',
+      'static/voice/cognitiveAbility/SpeechTraining/Auditory/Recognition/1.mp3'
+    )
   }
 }
 
@@ -149,7 +203,10 @@ onMounted(() => {
         isSubmitting = true
         emits('gameOver', {
           min: formatSeconds(Date.now() - taskBeginTime),
-          content: JSON.stringify(TopicsVal.value),
+          content: JSON.stringify({
+            question: Topics.question,
+            topics: TopicsVal.value
+          }),
           score: TopicsVal.value.filter((item) => item.userAnswer === item.correct).length + ''
         })
         localStorage.removeItem('tow-win-auditory-recognition-isSubmitting')
@@ -159,7 +216,4 @@ onMounted(() => {
 })
 </script>
 
-<style scoped lang="scss">
-.auditory-recognition-container {
-}
-</style>
+<style scoped lang="scss"></style>

+ 30 - 9
src/views/tester/components/RehabilitationEvaluation/CognitiveAbilityTask/CognitiveAbilityTaskAuditoryTraining/CATAuditoryTrainingWordImgMatching/topics.json

@@ -1,9 +1,30 @@
-[
-  {
-    "question": "接下来会给你听一些声音,请在这些声音中选择出屏幕中呈现的词语",
-    "choices": ["雷声", "狗叫", "葡萄"],
-    "correct": "葡萄",
-    "userAnswer": ""
-  }
-]
-
+{
+  "question": "接下来会给你听一些声音,请在这些声音中选择出屏幕中呈现的词语",
+  "topics": [
+    {
+      "choices": ["杯子", "小碗"],
+      "correct": "杯子",
+      "userAnswer": ""
+    },
+    {
+      "choices": ["勺子", "筷子", "叉子"],
+      "correct": "筷子",
+      "userAnswer": ""
+    },
+    {
+      "choices": ["笔", "橡皮", "书包", "书"],
+      "correct": "书",
+      "userAnswer": ""
+    },
+    {
+      "choices": ["冰箱", "茶桌", "电视", "衣柜", "床"],
+      "correct": "电视",
+      "userAnswer": ""
+    },
+    {
+      "choices": ["小草", "松树", "玫瑰", "向日葵", "苹果", "花花"],
+      "correct": "松树",
+      "userAnswer": ""
+    }
+  ]
+}