From 0a01d54bc1c4cc8d3a2c7aab5b90343b734c4049 Mon Sep 17 00:00:00 2001
From: Flex <q1406482700@163.com>
Date: 星期四, 05 六月 2025 17:25:31 +0800
Subject: [PATCH] 修改声音选择,添加状态保存

---
 easegen-front/src/views/chooseTemplate/index.vue |  115 +++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 83 insertions(+), 32 deletions(-)

diff --git a/easegen-front/src/views/chooseTemplate/index.vue b/easegen-front/src/views/chooseTemplate/index.vue
index 95833b3..5818b41 100644
--- a/easegen-front/src/views/chooseTemplate/index.vue
+++ b/easegen-front/src/views/chooseTemplate/index.vue
@@ -540,6 +540,7 @@
                 v-model="selectLanguage.value"
                 placeholder="璇烽�夋嫨璇"
                 @change="LanguageChange"
+                size="small"
               >
                 <el-option
                   v-for="item in languageList"
@@ -551,7 +552,12 @@
             </div>
             <!-- 鎬у埆 -->
             <div>
-              <el-select v-model="changeAudio" placeholder="璇烽�夋嫨鎬у埆" @change="AudioChange()">
+              <el-select
+                v-model="changeAudio"
+                placeholder="璇烽�夋嫨鎬у埆"
+                @change="AudioChange()"
+                size="small"
+              >
                 <el-option
                   v-for="item in audioType"
                   :key="item.value"
@@ -566,6 +572,7 @@
                 v-model="ChangeSoundTypeList.value"
                 placeholder="璇烽�夋嫨澹伴煶绫诲瀷"
                 @change="SoundTypeChange"
+                size="small"
               >
                 <el-option
                   v-for="item in SoundTypeList"
@@ -732,6 +739,7 @@
 import { ElMessage, ElMessageBox } from 'element-plus'
 import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
 import { measureMemory } from 'vm'
+import { any } from 'vue-types'
 
 const editorHtml = useEditorHtml()
 const router = useRouter()
@@ -986,16 +994,27 @@
     getList1()
   } else if (item.name == t('courseCenter.sound')) {
     // 澹伴煶鐨勫鐞�       selectAudio
-    // 鑾峰彇璇█绉嶇被
-    getLanguageList()
-    //鑾峰彇鎬у埆绉嶇被
-    getAudioType()
-    // 鑾峰彇澹伴煶绫诲埆
-    getVoiceType()
-    // 鑾峰彇妯″瀷鍒楄〃
-    getSoundModelList()
-    // 鑾峰彇鍙�夌殑澹伴煶绫诲瀷鍒楄〃
-    GetSoundTypeList()
+    
+    if (selectLanguage.value === undefined) {
+      // 鑾峰彇璇█绉嶇被
+      getLanguageList()
+    }
+    if (changeAudio.value === undefined) {
+      //鑾峰彇鎬у埆绉嶇被
+      getAudioType()
+    }
+    if (activeSoundType.value === undefined) {
+      // 鑾峰彇澹伴煶绫诲埆
+      getVoiceType()
+    }
+    if( selectList.value === undefined ){
+      // 鑾峰彇妯″瀷鍒楄〃
+      getSoundModelList()
+    }
+    if( ChangeSoundTypeList.value === undefined ){
+      // 鑾峰彇鍙�夌殑澹伴煶绫诲瀷鍒楄〃
+      GetSoundTypeList()
+    }
   }
   showHeadImageTool.value = item.name === t('courseCenter.background')
   showTemplateTool.value = item.name === t('courseCenter.template')
@@ -1016,7 +1035,7 @@
 // 鍙�夌殑鎬у埆鍒楄〃
 const audioType = ref()
 // 褰撳墠閫夋嫨鐨勬�у埆
-const changeAudio = ref<any>({ value: '' })
+const changeAudio = ref<any>()
 //鑾峰彇鎬у埆瀛楀吀
 const getAudioType = () => {
   const list = getIntDictOptions(DICT_TYPE.SYSTEM_USER_SEX)
@@ -1030,7 +1049,7 @@
 const ChangeSoundTypeList = ref()
 // 鑾峰彇鍙�夌殑澹伴煶绫诲瀷鍒楄〃
 const GetSoundTypeList = () => {
-  const res = getIntDictOptions(DICT_TYPE.DIGITALCOURSE_VOICES_TYPE)
+  const res = getIntDictOptions(DICT_TYPE.CHANGE_SOUND_TYPE_LIST)
   SoundTypeList.value = res
   ChangeSoundTypeList.value = { ...res[0] }
 }
@@ -1038,7 +1057,7 @@
 //鍙�夌殑澹伴煶妯″瀷鐨勫0闊崇被鍒垪琛�
 const SoundvoiceTypeList = ref()
 // 褰撳墠閫夋嫨鐨勫0闊虫ā鍨嬬殑澹伴煶绫诲埆
-const activeSoundType = ref<any>({ value: '' })
+const activeSoundType = ref<any>()
 //鑾峰彇鐨勫0闊虫ā鍨嬬殑澹伴煶绫诲埆
 const getVoiceType = () => {
   const list1 = getIntDictOptions(DICT_TYPE.DIGITALCOURSE_VOICES_TYPE)
@@ -1114,11 +1133,20 @@
     }
   })
 }
+// 鐢ㄤ簬瀛樿串鐢ㄦ埛閫夋嫨鐨勫0闊充俊鎭�
+const AudioDetail = ref({
+  language: any, //璇█
+  sex: any, //鎬у埆
+  type: any, //绫诲瀷
+  model: any //澹伴煶妯″瀷
+})
 // 纭畾鎸夐挳鐐瑰嚮澶勭悊鍑芥暟
 const submitForm = () => {
+  console.log(ChangeSoundTypeList.value.value)
   if (ChangeSoundTypeList.value.value === 2) {
     //姝ゆ椂涓洪�氱敤
-    if (activeSoundType.value === 1 && selectList.value.length === 0) {
+    console.log(selectList.value)
+    if (selectList.value === undefined) {
       message.warning('璇烽�夋嫨澹伴煶妯″瀷')
       return false
     }
@@ -1127,12 +1155,12 @@
   } else if (ChangeSoundTypeList.value.value === 1) {
     // 娓呴櫎閫変腑鐨勯煶棰�
     selectList.value = null
-    // 娓呴櫎鍒楄〃涓墍鏈夐�変腑鐘舵��
-    if (audioList.value) {
-      audioList.value.forEach((item) => {
-        item.isSelect = false
-      })
-    }
+    // // 娓呴櫎鍒楄〃涓墍鏈夐�変腑鐘舵��
+    // if (audioList.value) {
+    //   audioList.value.forEach((item) => {
+    //     item.isSelect = false
+    //   })
+    // }
 
     // 鍋滄褰撳墠鎾斁鐨勯煶棰�
     if (SoundcurrentAudio.value) {
@@ -1148,6 +1176,20 @@
 
     selectAudio(undefined)
   }
+  // 璁板綍鐢ㄦ埛閫夋嫨鐨勫0闊充俊鎭�
+  AudioDetail.value = {
+    language: selectLanguage.value, //璇█
+    sex: changeAudio.value, //鎬у埆
+    type: ChangeSoundTypeList.value, //绫诲瀷
+    model: selectList.value !== undefined ? selectList.value : '' //澹伴煶妯″瀷
+  }
+
+  SoundTool.value = false
+  rightTools.forEach((child) => {
+    if (child.name == '澹伴煶' || child.name == 'sound') {
+      child.isActive = false
+    }
+  })
 }
 // 榧犳爣绉诲叆涓庣Щ鍑�
 const handleMouseenter = (item) => {
@@ -1868,7 +1910,10 @@
     }
   } else {
     try {
-      if (ChangeSoundTypeList.value?.value === undefined || selectLanguage.value?.value === undefined) {
+      if (
+        ChangeSoundTypeList.value?.value === undefined ||
+        selectLanguage.value?.value === undefined
+      ) {
         message.error('璇峰厛閫夋嫨璇涓庡0闊崇被鍨�')
         return
       }
@@ -1882,9 +1927,6 @@
       let warningStrArr = []
       for (let i = 0; i < PPTArr.value.length; i++) {
         const item = PPTArr.value[i]
-        console.log(item)
-        console.log('瀹藉害', item.width)
-        console.log('楂樺害', item.height)
         // 鏍¢獙鑳屾櫙瀹介珮
         if (!item.width || !item.height) {
           message.warning('鑳屾櫙灏哄鏃犳晥锛岃妫�鏌ュ楂樿缃紝鎴栬�呴噸鏂伴�夋嫨妯℃澘')
@@ -2807,15 +2849,20 @@
 
 // 澹伴煶閮ㄥ垎
 .SoundArea {
-  margin-top: 10px;
+  margin-top: 16px;
   height: 100%;
   .SoundClassArea {
     width: 100%;
     display: flex;
-    justify-content: space-around;
+    justify-content: center;
     align-items: center;
     > div {
-      width: 30%;
+      width: 20%;
+      margin: 0 8px;
+      ::v-deep .el-select--small .el-select__wrapper {
+        height: 28px;
+        line-height: 28px;
+      }
     }
   }
   .SoundModelArea {
@@ -2827,20 +2874,24 @@
     flex-wrap: wrap;
     align-content: flex-start;
     > .ModealBox {
-      width: 30%;
+      width: 47%;
       margin: 10px 1%;
+      display: flex;
+      justify-content: space-around;
+      align-items: center;
       position: relative;
       > .ImgBox {
-        width: 70%;
+        width: 26%;
         margin: 0 auto;
         img {
           width: 100%;
         }
       }
       > .TextArea {
-        width: 100%;
+        width: 48%;
         p {
-          margin: 3px 0;
+          font-size: 12px;
+          margin: 4px 0;
           padding-left: 6px;
           box-sizing: border-box;
           text-align: left;

--
Gitblit v1.9.3