张涛 1 anno fa
parent
commit
8e18c6a1dd
2 ha cambiato i file con 18 aggiunte e 5 eliminazioni
  1. 17 4
      src/components/DialogWrap.vue
  2. 1 1
      src/views/Home.vue

+ 17 - 4
src/components/DialogWrap.vue

@@ -79,7 +79,7 @@
                     <span>
                       <em v-for="(item, documentIndex) in document.list" :key="documentIndex">{{
                         item.title
-                      }}</em>
+                        }}</em>
                     </span>
                     <icon-caret-down size="12" v-if="documentKey === menuList[key].documentOpenIndex" />
                     <icon-caret-right size="12" v-else />
@@ -90,7 +90,7 @@
                       <a-typography-paragraph :ellipsis="{ rows: 3, css: true }" :style="{ flex: 1, margin: '0' }">
                         <span style="color: rgba(153, 153, 153, 1); font-size: 12px">{{
                           item.content
-                        }}</span>
+                          }}</span>
                       </a-typography-paragraph>
                     </p>
                   </div>
@@ -160,8 +160,8 @@
           </div>
 
           <div v-if="item.file" class="paper-wrap" @click="downloadFile(item.file.file_url)">
-            <img src="@/assets/question/excel.svg" />
-            <!-- <img src="@/assets/question/word.svg" v-else /> -->
+            <img v-if="item.file.file_type === 'excel'" src="@/assets/question/excel.svg" />
+            <img v-if="item.file.file_type === 'word'" src="@/assets/question/word.svg" />
             <span>
               <b>{{ item.file.file_name }}</b>
             </span>
@@ -460,6 +460,7 @@ export default defineComponent({
             }
             if (excel_url) {
               const file = {
+                file_type: 'excel',
                 file_url: `http://${window.location.hostname}${port}${excel_url}`,
                 file_name: `${excel_name}.xlsx` || '点击下载',
               }
@@ -469,6 +470,18 @@ export default defineComponent({
             if (sql) answerSql.value = getHTML(sql);
 
           }
+          if (props.type == 'question') {
+            const { file_url, filename, excel_name } = JSON.parse(event.data);
+
+            if (file_url) {
+              const file = {
+                file_type: 'word',
+                file_url: `http://${window.location.hostname}${port}${excel_url}`,
+                file_name: `${excel_name}.docx` || '点击下载',
+              }
+              answerFile.value = file
+            }
+          }
 
           if (answerData.value && !isLoaded.value) {
             answerLoaded();

+ 1 - 1
src/views/Home.vue

@@ -178,7 +178,7 @@ export default defineComponent({
   },
   setup() {
     // NOTE: 先把4文库问答的类型改成report类型,后续再改回来
-    const dialogType = ["report", "excel", "knowledgeQuiz", "report", "normal", "smartData", "normal", "normal"];
+    const dialogType = ["report", "excel", "knowledgeQuiz", "report", "normal", "smartData", "normal", "question", "question"];
     const { config, helper, ajax } = inject("$global");
 
     const SYSTEM_NAME = config.defaultTitle