WXL
2024-07-04 a46f2000f85c91b0e118a0af1bc6022a16feadcb
src/views/outsideChainxj.vue
@@ -4,34 +4,7 @@
      <div class="title">暑期一号宣教</div>
      <div class="preview-left">
        <!-- 单选 -->
        <div
          class="topic-dev"
          v-for="(item, index) in questionList"
          :key="item.aaa"
        >
          <div class="dev-text">
            {{ index + 1 }}、<span>{{ item.questionText }}</span>
          </div>
          <div class="dev-xx" v-if="item.valueType == 1">
            <el-radio-group v-model="item.asrtext">
              <el-radio
                v-for="(items, index) in item.ivrLibaScriptTargetoptionList"
                :key="items.id"
                :label="items.targetvalue"
                >{{ items.targetvalue }}</el-radio
              >
            </el-radio-group>
          </div>
          <div v-else>
            <el-input
              type="textarea"
              placeholder="请输入内容"
              v-model.sync="item.asrtext"
              :rows="2"
            />
          </div>
        </div>
        <div v-html="richText"></div>
      </div>
      <el-form :model="formData" label-width="80px">
        <el-form-item>
@@ -47,6 +20,8 @@
  getExternalfollowup,
  SetsaveQuestionAnswer,
} from "@/api/AiCentre/index";
import { getToken } from "@/utils/auth";
import axios from "axios";
import JSEncrypt from "jsencrypt";
export default {
  data() {
@@ -65,6 +40,7 @@
        question2: "",
        question3: "",
      },
      richText: "<p>Hello, <strong>world</strong>!</p>",
    };
  },
@@ -92,6 +68,26 @@
          this.questionList = res.rows;
        }
      });
      // 临时获取数据
      axios
        .get("http://localhost:8089/profile/upload/show/测试/测试.html")
        .then((response) => {
          console.log(response.data, "数据"); // 输出获取到的文件内容
          this.richText = response.data;
          //   this.richText =
          //     '<p>This is an image: <img src="https://example.com/image.jpg"></p>';
          // })
          this.richText = this.addStyleToImages(this.richText);
        })
        .catch((error) => {
          console.error("Failed to fetch file:", error);
        });
    },
    addStyleToImages(html) {
      return html.replace(
        /<img([^>]*)style=(['"])(?:(?!\2).)*\2([^>]*)>/g,
        '<img$1style="width:100%;height:auto;"$3>'
      );
    },
    // 加密函数
    encrypt(txt) {
@@ -181,5 +177,9 @@
      margin-bottom: 10px;
    }
  }
  img {
    width: 80vw !important;
    height: 20vh !important;
  }
}
</style>