WXL (wul)
20 小时以前 d93ed5c5aadcf3d49f824339c26ebfac911be06d
src/views/knowledge/education/compilequer/index.vue
@@ -206,9 +206,20 @@
            </el-select>
          </el-form-item>
          <el-form-item label="适用疾病" prop="region">
            <el-button type="warning" @click="$refs.child.handleAddpatient()"
              >添加疾病</el-button
            <div style="margin-bottom: 10px">
              <el-button type="warning" @click="$refs.child.handleAddpatient()"
                >添加疾病诊断</el-button
              >
            </div>
            <el-tag
              v-for="tag in displayedTags"
              :key="tag.icdid"
              type="warning"
              :disable-transitions="false"
            >
              {{ tag.icdname }}
            </el-tag>
            <el-tag v-if="hasMore" type="info">+{{ remaining }} more</el-tag>
          </el-form-item>
          <el-form-item label="适用院区" prop="region">
            <el-select
@@ -253,7 +264,7 @@
          </el-form-item>
        </el-form>
      </div>
    <!-- 宣教内容 -->
      <!-- 宣教内容 -->
      <div v-if="Editprogress == 2">
        <el-row :gutter="20">
          <el-col :span="4">
@@ -292,8 +303,12 @@
        <div>
          <el-button @click="laststep('ruleForm')">上一步</el-button>
          <el-button type="success" @click="Departmenttreatment('ruleForm')">保存</el-button>
          <el-button type="warning" @click="Departmenttreatment('ruleForm')">另存新版本</el-button>
          <el-button type="success" @click="Departmenttreatment('ruleForm')"
            >保存</el-button
          >
          <el-button type="warning" @click="Departmenttreatment('ruleForm')"
            >另存新版本</el-button
          >
          <el-button type="info" @click="closeFm('ruleForm')">关闭</el-button>
        </div>
      </div>
@@ -311,7 +326,7 @@
<script>
import { Editor, Toolbar } from "@wangeditor/editor-for-vue";
import '@wangeditor/editor/dist/css/style.css';
import "@wangeditor/editor/dist/css/style.css";
import axios from "axios";
import { getToken } from "@/utils/auth";
@@ -322,6 +337,7 @@
  addrichText,
  getlibraryinfo,
  getillnesslist,
  getillness,
} from "@/api/AiCentre/index";
import OptionalForm from "@/components/OptionalForm";
import { listDept } from "@/api/system/dept";
@@ -333,7 +349,7 @@
  components: { OptionalForm, Editor, Toolbar },
  data() {
    return {
 // 编辑器实例
      // 编辑器实例
      editorRef: null,
      // 编辑器内容
@@ -341,7 +357,7 @@
      // 编辑器模式
      mode: "default",
      fileList: [],
      // 工具栏配置
      toolbarConfig: {
        excludeKeys: [
@@ -350,7 +366,7 @@
          "uploadVideo",
          "emotion",
          "codeBlock",
        ]
        ],
      },
      // 编辑器配置
@@ -364,7 +380,7 @@
            maxNumberOfFiles: 1,
            allowedFileTypes: ["image/*"],
            headers: {
              Authorization: "Bearer " + getToken()
              Authorization: "Bearer " + getToken(),
            },
            customUpload: async (file, insertFn) => {
              try {
@@ -376,17 +392,21 @@
                  formData,
                  {
                    headers: {
                      "Content-Type": "multipart/form-data",
                      Authorization: "Bearer " + getToken()
                    }
                      // "Content-Type": "multipart/form-data",
                      Authorization: "Bearer " + getToken(),
                    },
                  }
                );
                if (response.data && response.data.url) {
                  let imgUrl = response.data.url;
                  // imgUrl = imgUrl.replace(
                  //   "http://218.108.11.22:8093/profile-api/upload",
                  //   "http://192.88.117.236:8090/prod-api/profile/upload"
                  // );
                  imgUrl = imgUrl.replace(
                    "http://218.108.11.22:8093/profile-api/upload",
                    "http://192.168.191.181:8095/profile/upload"
                    "http://m.zjtongde.com:13871/prod-api/profile/upload",
                    "http://192.88.117.236:8090/prod-api/profile/upload"
                  );
                  insertFn(imgUrl);
                }
@@ -394,13 +414,13 @@
                console.error("图片上传失败", error);
                this.$message.error("图片上传失败");
              }
            }
          }
        }
            },
          },
        },
      },
      // 上传配置
      headers: {
        Authorization: "Bearer " + getToken()
        Authorization: "Bearer " + getToken(),
      },
      uploadImgUrlword: process.env.VUE_APP_BASE_API + "/common/uploadShow",
@@ -417,7 +437,7 @@
        preachname: "",
        preachcontent: "",
        isAvailable: "",
        suitway: []
        suitway: [],
      },
      // 其他数据
@@ -430,13 +450,13 @@
      variablelist: [
        { variatename: "姓名", variate: "${name}", default: 1 },
        { variatename: "电话", variate: "${phone}", default: 1 },
        { variatename: "病情", variate: "${illness}", default: 1 }
        { variatename: "病情", variate: "${illness}", default: 1 },
      ],
      props: {
        multiple: true,
        value: "deptId",
        label: "deptName"
        label: "deptName",
      },
      fileName: "", //文件名
      inputVisible: false,
@@ -464,11 +484,13 @@
      options: [],
      optionstag: [],
      // 内网的部分(文件)
      oldPattern: "http://192.168.191.181:8095/profile/upload",
      // oldPattern: "http://192.168.191.181:8095/profile/upload",
      oldPattern: "http://192.88.117.236:8090/prod-api/profile/upload",
      // 内网的部分(文件)
      oldPatternhtml: "/http:\/\/192\.168\.191\.181:8095\/profile\/upload\//g",
      oldPatternhtml: "/http:\/\/192\.88\.117\.236:8095\/profile\/upload\//g",
      // 外网部分(文件)
      newPattern: "http://218.108.11.22:8093/profile-api/upload",
      // newPattern: "http://218.108.11.22:8093/profile-api/upload",、、新华
      newPattern: "http://m.zjtongde.com:13871/prod-api/profile/upload",
      xjxsoptions: [
        {
@@ -492,7 +514,6 @@
        },
      ],
      addvalue: "添加题目",
      // 查询参数
      queryParams: {
@@ -527,25 +548,39 @@
    // },
    content(newVal) {
      // 内容变化时触发,可以在这里处理自动保存等逻辑
      this.$emit('content-change', newVal)
    }
      this.$emit("content-change", newVal);
    },
  },
  beforeDestroy() {
    const editor = this.editor;
    if (editor == null) return;
    editor.destroy(); // 组件销毁时,及时销毁编辑器
  },
  computed: {
    displayedTags() {
      // 返回前10个tag
      return this.illnesslist.slice(0, 10);
    },
    hasMore() {
      // 判断是否有更多的tag
      return this.illnesslist.length > 10;
    },
    remaining() {
      // 计算剩余的tag数量
      return this.illnesslist.length - 10;
    },
  },
  methods: {
    onCreated(editor) {
      this.editor = Object.seal(editor); // 一定要用 Object.seal(),否则会报错
    },
    // 编辑器创建回调
   handleEditorCreated(editor) {
    handleEditorCreated(editor) {
      this.editorRef = editor;
      console.log("编辑器已创建", editor);
    },
   // 销毁编辑器
    // 销毁编辑器
    destroyEditor() {
      if (this.editorRef) {
        this.editorRef.destroy();
@@ -601,7 +636,7 @@
      // ------------------
      // let html =
      //   '<p>测试</p><video class="ql-video" controls="controls" controlslist="nofullscreen" type="video/mp4" style="object-fit:fill;width: 100%;" preload="auto" playsinline="true" x-webkit-airplay="allow" x5-video-orientation="portraint" x5-playsinline="true" x5-video-player-fullscreen="true" src="http://192.168.191.181:8095/profile/upload/vadio/营养泵介绍.mp4"></video><p>测试111</p><video class="ql-video" controls="controls" controlslist="nofullscreen" type="video/mp4" style="object-fit:fill;width: 100%;" preload="auto" playsinline="true" x-webkit-airplay="allow" x5-video-orientation="portraint" x5-playsinline="true" x5-video-player-fullscreen="true" src="http://192.168.191.181:8095/profile/upload/vadio/注射器推注.mp4"></video><p><br></p>';
      //   '<p>测试</p><video class="ql-video" controls="controls" controlslist="nofullscreen" type="video/mp4" style="object-fit:fill;width: 100%;" preload="auto" playsinline="true" x-webkit-airplay="allow" x5-video-orientation="portraint" x5-playsinline="true" x5-video-player-fullscreen="true" src="http://192.88.117.236:8090/prod-api/profile/upload/vadio/营养泵介绍.mp4"></video><p>测试111</p><video class="ql-video" controls="controls" controlslist="nofullscreen" type="video/mp4" style="object-fit:fill;width: 100%;" preload="auto" playsinline="true" x-webkit-airplay="allow" x5-video-orientation="portraint" x5-playsinline="true" x5-video-player-fullscreen="true" src="http://192.88.117.236:8090/prod-api/profile/upload/vadio/注射器推注.mp4"></video><p><br></p>';
      // // html = html.parserdom(this.oldPattern, this.newPattern);
      // html = this.parserdom(html);
      // console.log(html, "html");
@@ -616,17 +651,27 @@
      var doc = parser.parseFromString(html, "text/html");
      // 定义要替换的新旧URL
      var oldUrlBase = "http://192.168.191.181:8095/profile/upload";
      var newUrlBase = "http://218.108.11.22:8093/profile-api/upload";
      var oldUrlBase = this.oldPattern;
      // var newUrlBase = "http://218.108.11.22:8093/profile-api/upload";
      var newUrlBase = this.newPattern;
      // 获取所有的video元素
      var videos = doc.querySelectorAll("video");
      var images = doc.querySelectorAll("img");
      // 遍历所有的video元素并替换src属性
      videos.forEach(function (video) {
        var src = video.getAttribute("src");
        if (src.startsWith(oldUrlBase)) {
          video.setAttribute("src", src.replace(oldUrlBase, newUrlBase));
        }
      });
      console.log(images,'images');
       images.forEach(function (img) {
        var src = img.getAttribute("src");
        if (src.startsWith(oldUrlBase)) {
          img.setAttribute("src", src.replace(oldUrlBase, newUrlBase));
        }
      });
@@ -656,6 +701,10 @@
        fileName: this.generateRandomHtmlFilename(),
      }).then((res) => {
        this.ruleForm.richText = res.msg;
        this.ruleForm.richText = res.msg.replace(
            this.oldPattern,
            this.newPattern
          );
        console.log(this.ruleForm.richText, "this.ruleForm.richText");
        // 处理内网html
        addrichText({
@@ -1011,7 +1060,8 @@
    // },
    // 获取远程内容
    Getmissioncontent(url) {
      axios.get(url)
      axios
        .get(url)
        .then((response) => {
          this.content = response.data;
        })
@@ -1023,7 +1073,7 @@
  },
  // 生命周期钩子
  beforeUnmount() {
    this.destroyEditor()
    this.destroyEditor();
  },
};
</script>