소스 검색

feat: save

gemercheung 9 달 전
부모
커밋
2663dd6b24

+ 0 - 7
src/App.vue

@@ -36,13 +36,6 @@
         >
           <n-menu
             class="menu-class"
-            style="
-              --n-item-color-hover: rgb(243, 243, 245, 0.5);
-              --n-item-text-color: white;
-              --n-font-size: 14px;
-              --n-item-icon-color: #fff;
-              --n-item-icon-color-active: #316c72;
-            "
             v-model:value="activeKey"
             :options="menuOptions"
             @update:value="handleUpdateValue"

+ 7 - 1
src/api/module/tts.ts

@@ -29,10 +29,16 @@ export const saveTOTTS = (params: SaveTOTTSParams) => {
   })
 }
 
-export const saveTOSTT = (params: { id?: string; num: string; file: File }) => {
+export const saveTOSTT = (params: {
+  id?: string
+  num: string
+  file: File
+  name: string
+}) => {
   const forms = new FormData()
   forms.append('file', params.file)
   forms.append('num', params.num)
+  forms.append('name', params.name)
   params.id && forms.append('id', params.id)
   return Alova.Post(url.sttSave, forms)
 }

+ 4 - 2
src/store/main.ts

@@ -29,7 +29,8 @@ export const useMainStore = defineStore('main', {
         age: 18
       },
       sceneInfo: {
-        boxVideos: ''
+        boxVideos: '',
+        boxModels: ''
       },
       aiSetting: [],
       navigation: []
@@ -92,10 +93,11 @@ export const useMainStore = defineStore('main', {
       console.log('data', data)
       this.sceneInfo = data as any as {
         boxVideos: string
+        boxModels: string
       }
     },
     syncNavigation(navigation: any[]) {
-      this.navigation = navigation
+      this.navigation = navigation as any as []
     }
   }
 })

+ 22 - 8
src/styles/theme.ts

@@ -6,20 +6,34 @@ export const themeOverrides: GlobalThemeOverrides = {
     primaryColor: '#0960bd',
     primaryColorHover: '#1478e3',
     primaryColorPressed: '#064282',
-    primaryColorSuppl: '#316C7263',
-    successColor: '#316C72FF',
-    successColorHover: '#316C72E3',
-    successColorPressed: '#2B4C59FF',
-    successColorSuppl: '#316C7263'
+    primaryColorSuppl: '#0960bd'
+    // successColor: '#0960bd',
+    // successColorHover: '#1478e3',
+    // successColorPressed: '#0960bd',
+    // successColorSuppl: '#0960bd'
   },
   Drawer: {
     color: 'rgb(24, 24, 28)'
   },
+  Select: {
+    optionColorActive: '#ffffff'
+  },
+
   Menu: {
     itemTextColor: '#ffffff',
-    itemTextColorActive: '#ffffff',
-    pressedColor: '#ffffff',
-    itemColorHoverInverted: 'rgb(24, 24, 28)'
+    itemColorHover: 'rgba(255,255,255,0.1)',
+    // pressedColor: '#ffffff',
+    // // itemColorHoverInverted: 'rgb(24, 24, 28)',
+    // itemTextColorHover: '#ffffff',
+    itemTextColorActive: '#0960bd',
+    itemColorActiveCollapsed: '#0960bd'
+    // itemIconColor: '#ffffff',
+    // itemIconColorHover: '#ffffff',
+    // itemIconColorActive: '#ffffff',
+    // itemIconColorChildActive: '#ffffff',
+    // itemTextColorActiveHover: 'rgba(255,255,255,0.2)'
+    // itemTextColorActiveHover: '#ffffff',
+    // itemTextColorChildActive: '#ffffff'
   },
 
   Button: {

+ 37 - 19
src/views/digitalHuman/index.vue

@@ -15,23 +15,22 @@
       <n-drawer-content title="数字人播报">
         <div class="drawerContent m-5">
           <!-- <div class="text-lg my-2.5">数字人播报</div>-->
-
           <n-list
-            hoverable
-            clickable
+            v-if="list && list.flat()"
             style="--n-color-modal: none"
             :show-divider="false"
           >
-            <n-list-item v-for="(vi, index) in list" :key="index">
-              当前空间视频ID:
-              <n-space></n-space>
-              <!--              {{ vi.url}}-->
-              {{ vi.sid }}
+            <!--            {{list}}-->
+            <n-list-item
+              v-for="(vi, index) in list.flat()"
+              :key="index"
+              style="width: 100%"
+            >
+              <div class="mb-5">
+                {{ `当前空间${vi.media ? '视频' : '模型'}` }} ID: {{ vi.sid }}
+              </div>
 
-              <n-select
-                v-model:value="bindAudioId"
-                :options="audioOptions"
-              ></n-select>
+              <n-select :options="audioOptions" ></n-select>
             </n-list-item>
           </n-list>
         </div>
@@ -47,7 +46,8 @@ import {
   onMounted,
   // reactive,
   onUnmounted,
-  watchEffect
+  watchEffect,
+  watch
 } from 'vue'
 
 import { useMainStore } from '@/store'
@@ -59,10 +59,12 @@ const main = useMainStore()
 const active = ref(true)
 
 const boxVideos = computed(() => main.sceneInfo.boxVideos)
+const boxModels = computed(() => main.sceneInfo.boxModels)
 
 const list = ref<any[]>([])
 
-const bindAudioId = ref()
+const bindAudioIds = ref<{ id: string }[]>([])
+const bindAudioFilePath = ref()
 const audioOptions = ref<any[]>([])
 
 onMounted(async () => {
@@ -73,7 +75,7 @@ onMounted(async () => {
       .filter((i) => i.type === 'tts')
       .map((item) => {
         return {
-          label: item.document,
+          label: item.name,
           value: item.id
         }
       })
@@ -82,17 +84,33 @@ onMounted(async () => {
   }
 
   watchEffect(() => {
-    if (boxVideos.value?.length) {
+    if (boxVideos.value?.length || boxModels.value?.length) {
       // debugger
-      const data = JSON.parse(boxVideos.value)
-      console.log('boxVideos', data)
-      list.value = data
+      const videoData = JSON.parse(boxVideos.value)
+      const boxData = JSON.parse(boxModels.value)
+      console.log('boxVideos', videoData)
+      videoData && list.value.push(videoData)
+      boxData && list.value.push(boxData)
     }
   })
 })
 onUnmounted(() => {
   // setWidthSceneRef(0)
 })
+watch(
+  bindAudioIds,
+  () => {
+    console.log('bindAudioIds', bindAudioIds.value)
+    // if (bindAudioId.value) {
+    //   const file = audioOptions.value.find((v) => v.value === bindAudioId.value)
+    //   console.log('file', file)
+    //   debugger
+    // }
+  },
+  {
+    deep: true
+  }
+)
 </script>
 
 <style lang="sass" scoped>

+ 13 - 4
src/views/textToaudio/index.vue

@@ -24,7 +24,7 @@
       :is-editing="showTTSModel.isEditing"
       :data="showTTSModel.data"
       @close="showTTSModel.show = false"
-      @submit="(showTTSModel.show = false) && refresh()"
+      @submit="noticeTTsModelDone"
     ></TtsModel>
 
     <SttModel
@@ -32,7 +32,7 @@
       :is-editing="showSTTModel.isEditing"
       :data="showSTTModel.data"
       @close="showSTTModel.show = false"
-      @submit="(showSTTModel.show = false) && refresh()"
+      @submit="noticeSTTModelDone"
     ></SttModel>
   </div>
 </template>
@@ -80,7 +80,7 @@ const paginationReactive = reactive({
 onMounted(async () => {
   watchEffect(async () => {
     if (main.sceneCode) {
-     await refresh()
+      await refresh()
     }
   })
 })
@@ -225,6 +225,15 @@ const openEdit = (row) => {
     showSTTModel.value.data = row
   }
 }
+
+const noticeTTsModelDone = async () => {
+  await refresh()
+  showTTSModel.value.show = false
+}
+const noticeSTTModelDone = async () => {
+  await refresh()
+  showSTTModel.value.show = false
+}
 </script>
 
 <style lang="sass" scoped>
@@ -243,5 +252,5 @@ code
 
 .textToaudio
   min-height: 100%
-  //border-left: 1px solid
+//border-left: 1px solid
 </style>

+ 30 - 5
src/views/textToaudio/sttModel.vue

@@ -24,6 +24,21 @@
         </n-icon>
       </template>
 
+      <n-form
+        ref="formRef"
+        :model="form"
+        label-placement="left"
+        label-width="auto"
+        require-mark-placement="right-hanging"
+        :style="{
+          maxWidth: '100%'
+        }"
+      >
+        <n-form-item label="名称" path="inputValue">
+          <n-input v-model:value="form.name" />
+        </n-form-item>
+      </n-form>
+
       <n-flex>
         <n-upload
           accept=".mp3,.wmv"
@@ -56,7 +71,15 @@
 
 <script setup lang="ts">
 import { ref, reactive, watchEffect } from 'vue'
-import { NUpload, NUploadDragger, NP, NText, useMessage } from 'naive-ui'
+import {
+  NUpload,
+  NUploadDragger,
+  NP,
+  NText,
+  useMessage,
+  NForm,
+  NFormItem
+} from 'naive-ui'
 import { saveTOSTT } from '@/api'
 import { useMainStore } from '@/store'
 import { ArchiveOutline as ArchiveIcon } from '@vicons/ionicons5'
@@ -66,11 +89,12 @@ const main = useMainStore()
 const showModal = ref(false)
 const message = useMessage()
 
-const form = reactive<{ file: File | null }>({
-  file: null
+const form = reactive<{ file: File | null; name: string }>({
+  file: null,
+  name: ''
 })
 
-const emits = defineEmits(['close','submit'])
+const emits = defineEmits(['close', 'submit'])
 
 const props = defineProps({
   show: {
@@ -96,11 +120,12 @@ const handleSave = async () => {
   if (form.file) {
     const data = {
       file: form.file,
+      name: form.name,
       num: main.sceneCode
     }
     await saveTOSTT(data)
+    message.success('新增成功!')
     emits('submit')
-
   } else {
     message.error('请上传语音文件')
   }

+ 6 - 5
src/views/textToaudio/ttsModel.vue

@@ -39,7 +39,7 @@
         <n-flex style="flex: 1" vertical>
           <div>选择人物</div>
 
-          <n-flex class="card-select mb-5" justify="center" >
+          <n-flex class="card-select mb-5" justify="center">
             <template v-for="(card, index) in cardList" :key="index">
               <n-card
                 style="flex: 1 1 48%"
@@ -108,7 +108,7 @@
 
 <script setup lang="ts">
 import { ref, reactive, watchEffect, computed } from 'vue'
-import { NSlider, NForm, NFormItem, NAvatar } from 'naive-ui'
+import { NSlider, NForm, NFormItem, NAvatar, useMessage } from 'naive-ui'
 import { saveTOTTS, SaveTOTTSParams } from '@/api'
 import { useMainStore } from '@/store'
 
@@ -123,7 +123,7 @@ const form = reactive({
   speed: 1,
   volume: 5
 })
-
+const message = useMessage()
 const emits = defineEmits(['close', 'submit'])
 
 const props = defineProps({
@@ -182,8 +182,9 @@ const handleSave = async () => {
     ...form,
     num: main.sceneCode
   }
-  const res = await saveTOTTS(data)
-  console.log(res)
+  await saveTOTTS(data)
+  // console.log(res)
+  message.success('新增成功!')
   emits('submit')
 }
 

+ 7 - 4
src/views/topicNavigation/index.vue

@@ -123,7 +123,7 @@
 </template>
 
 <script setup lang="ts">
-import { computed, ref, watch } from 'vue'
+import { computed, ref, watch, watchEffect } from 'vue'
 import { sdk, clearScreen } from '@/sdk'
 import { onMounted, onUnmounted } from 'vue'
 import {
@@ -144,6 +144,7 @@ const main = useMainStore()
 const currentEditing = ref(NaN)
 const currentPanoEditing = ref()
 const isPanoEditing = ref(false)
+const naviData = computed(() => main.getEditorData.navigation)
 const dataList = ref<
   {
     title: string
@@ -169,7 +170,11 @@ const handleAdd = () => {
     // message.warning('请先保存数据!')
   }
 }
-
+watchEffect(() => {
+  if (naviData.value) {
+    dataList.value = naviData.value
+  }
+})
 onMounted(() => {
   sdk.then((sdk) => {
     sdk.Scene.whenLoaded(() => {
@@ -237,8 +242,6 @@ const handleItem = (index: number) => {
 
 const handleItemSubmit = () => {
   isPanoEditing.value = false
-
-  sdk.then((sdk) => {})
   main.syncNavigation(dataList.value)
 }
 const handlePanoDel = (index: number) => {