From c73a2c380aca7ac4ef16e76388b1a52356df8634 Mon Sep 17 00:00:00 2001
From: WXL <1785969728@qq.com>
Date: 星期五, 30 八月 2024 19:01:04 +0800
Subject: [PATCH] 测试完成

---
 src/views/knowledge/education/index.vue |   49 ++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 38 insertions(+), 11 deletions(-)

diff --git a/src/views/knowledge/education/index.vue b/src/views/knowledge/education/index.vue
index c70696b..9216623 100644
--- a/src/views/knowledge/education/index.vue
+++ b/src/views/knowledge/education/index.vue
@@ -312,15 +312,15 @@
                       ><i class="el-icon-edit"></i>浜岀淮鐮�</span
                     ></el-button
                   > -->
-                  <!-- <el-button
+                  <el-button
                     size="medium"
                     type="text"
                     @click="Vieweducation(scope.row)"
                     v-hasPermi="['system:user:edit']"
                     ><span class="button-textck"
-                      ><i class="el-icon-edit"></i>鏌ョ湅</span
+                      ><i class="el-icon-edit"></i>棰勮</span
                     ></el-button
-                  > -->
+                  >
                   <el-button
                     size="medium"
                     type="text"
@@ -444,6 +444,16 @@
         <div class="qrcode-img"></div>
       </div>
     </el-dialog>
+    <el-dialog title="妯$増棰勮" :visible.sync="previewtf" width="60%">
+      <div class="preview-left">
+        <!-- 鍗曢�� -->
+        <div v-html="richText"></div>
+      </div>
+      <!-- <span slot="footer" class="dialog-footer">
+        <el-button @click="previewGo">鍓嶅線妯$増璇︽儏淇敼</el-button>
+        <el-button type="primary" @click="previewFn">纭浣跨敤</el-button>
+      </span> -->
+    </el-dialog>
   </div>
 </template>
 
@@ -465,7 +475,7 @@
 import { listDept } from "@/api/system/dept";
 import { getToken } from "@/utils/auth";
 import store from "@/store";
-
+import axios from "axios";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 export default {
@@ -491,8 +501,10 @@
       haoeducation: "",
       indexid: null,
       inputValue: "",
+      richText: "",
       radio: "涓诲垎绫�",
       inputVisible: false,
+      previewtf: false,
       illnessVisible: false, //鎸囨爣鐤剧梾寮规
       deptOptions: [],
       courtyardlist: [],
@@ -628,22 +640,37 @@
     /** 鏂板鎸夐挳鎿嶄綔 */
     handleAdd() {
       this.$router.push({
-        path: "/knowledge/education/compilequer/",
+        path: "/knowledge/educationinfo/",
       });
     },
     /** 淇敼鎸夐挳鎿嶄綔 */
     handleUpdate(row) {
       this.$router.push({
-        path: "/knowledge/education/compilequer/",
+        path: "/knowledge/educationinfo/",
         query: { id: row.id },
       });
     },
     // 鏌ョ湅瀹f暀
-    Vieweducation() {
-      this.$router.push({
-        path: "/knowledge/education/examine/",
-        query: { id: row.id },
-      });
+    Vieweducation(row) {
+      this.richText = null;
+      this.previewtf = true;
+      axios
+        .get(row.richText)
+        .then((response) => {
+          console.log(response.data, "鏁版嵁"); // 杈撳嚭鑾峰彇鍒扮殑鏂囦欢鍐呭
+          this.richText = response.data;
+          this.richText = this.addStyleToImages(this.richText);
+        })
+        .catch((error) => {
+          this.$modal.msgError("鑾峰彇瀵屾枃鏈け璐�");
+          console.error("Failed to fetch file:", error);
+        });
+    },
+    addStyleToImages(html) {
+      return html.replace(
+        /<img([^>]*)style=(['"])(?:(?!\2).)*\2([^>]*)>/g,
+        '<img$1style="width:100%;height:auto;"$3>'
+      );
     },
 
     /** 鍒犻櫎鎸夐挳鎿嶄綔 */

--
Gitblit v1.9.3