|
@@ -84,7 +84,7 @@
|
|
|
<span @click="activeMenu = 2" :class="{active: activeMenu === 2}"><span :class="['history_icon',{active: activeMenu === 2}]"></span></span>
|
|
|
</div>
|
|
|
<div class="fold_btn">
|
|
|
- <span class="more_icon" @click="openLeft=!openLeft"></span>
|
|
|
+ <span class="more_icon" :style="`transform: rotate(${openLeft?0:180}deg);`" @click="openLeft=!openLeft"></span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div v-show="activeMenu == 1" style="width:100%;display: flex;">
|
|
@@ -119,7 +119,10 @@
|
|
|
</div>
|
|
|
<div v-show="fileMenu == 2" style="width: 100%;height: calc(100% - 40px)">
|
|
|
<div class="bianji_area">
|
|
|
- <Editor style="width: 100%;height: 100%;" :value="userAsk"/>
|
|
|
+ <span>
|
|
|
+ <img @click="downUserAsk" src="../../../assets/icon/test/down_icon.svg">
|
|
|
+ </span>
|
|
|
+ <Editor @change="(value)=>userAsk = value" style="width: 100%;height: 100%;" :value="userAsk"/>
|
|
|
<!-- <span contenteditable="true" class="userAsk">{{ userAsk }}</span> -->
|
|
|
<!-- <span class="aiText" contenteditable="true" v-html="bianjiText"></span>
|
|
|
<span v-if="!userAsk" style="display: flex;justify-content: center;">暂无数据</span> -->
|
|
@@ -231,7 +234,8 @@ import Cascader from "./dataCom/cascader.vue";
|
|
|
// import smartMenu from "./smartBox/smartMenu.vue";
|
|
|
import csvTableView from "./choseCheck/csvTableView.vue";
|
|
|
import Editor from './checkAi/wangEnduit.vue';
|
|
|
-
|
|
|
+import htmlDocx from "html-docx-js/dist/html-docx";
|
|
|
+import { saveAs } from "file-saver";
|
|
|
export default {
|
|
|
name: 'smarter',
|
|
|
components: {
|
|
@@ -549,7 +553,167 @@ export default {
|
|
|
});
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
+ async downUserAsk(){
|
|
|
+ // console.log(this.userAsk)
|
|
|
+ // console.log(this.userAsk)
|
|
|
+ await this.generateDocx("文案编辑",this.userAsk);
|
|
|
+ this.$message.success("下载成功")
|
|
|
+ },
|
|
|
+ // 导出docx
|
|
|
+ async generateDocx(name, html) {
|
|
|
+ // 将html文件中需要用到的数据挂载到store上
|
|
|
+ const content = `<!DOCTYPE html>
|
|
|
+ <html xmlns:v='urn:schemas-microsoft-com
|
|
|
+ :vml'xmlns:o='urn:schemas-microsoft-com:office
|
|
|
+ :office'xmlns:w='urn:schemas-microsoft-com:office
|
|
|
+ :word'xmlns:m='http://schemas.microsoft.com/office/2004/12/omml'
|
|
|
+ xmlns='http://www.w3.org/TR/REC-html40'
|
|
|
+ xmlns='http://www.w3.org/1999/xhtml'>
|
|
|
+ <head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
+ <title>${name}</title>
|
|
|
+ <style>
|
|
|
+ *{
|
|
|
+ font-family: '宋体';
|
|
|
+ margin:0;
|
|
|
+ padding:0;
|
|
|
+ line-height:1;
|
|
|
+ }
|
|
|
+ table {
|
|
|
+ border-collapse: collapse; /* 折叠边框 */
|
|
|
+ width: 100%;
|
|
|
+ font-size:10.5pt;
|
|
|
+ }
|
|
|
+ th, td {
|
|
|
+ border: 1px solid black; /* 线条样式 */
|
|
|
+ padding: 8px;
|
|
|
+ text-align: left;
|
|
|
+ font-size:10.5pt;
|
|
|
+ }
|
|
|
+ ol,ul{
|
|
|
+ margin:0;
|
|
|
+ padding:0;
|
|
|
+ margin-right:-1in;
|
|
|
+ }
|
|
|
+ li{
|
|
|
+ margin-bottom:0.1in
|
|
|
+ margin-right:-1in;
|
|
|
+ }
|
|
|
+ p{
|
|
|
+ line-height:1;
|
|
|
+ margin:0;
|
|
|
+ padding:0
|
|
|
+ }
|
|
|
+ .vue-office-docx{height:100%;overflow-y:auto}
|
|
|
+ .vue-office-docx .docx-wrapper>section.docx{margin-bottom:5px}
|
|
|
+ @media screen and (max-width: 800px){
|
|
|
+ .vue-office-docx .docx-wrapper{padding:10px}
|
|
|
+ .vue-office-docx .docx-wrapper>section.docx{padding:10px!important;width:100%!important}
|
|
|
+ }
|
|
|
+
|
|
|
+.docx-wrapper { background: gray; padding: 30px; padding-bottom: 0px; display: flex; flex-flow: column; align-items: center; }
|
|
|
+.docx-wrapper>section.docx { background: white; box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); margin-bottom: 30px; }
|
|
|
+.docx { color: black; hyphens: auto; text-underline-position: from-font; }
|
|
|
+section.docx { box-sizing: border-box; display: flex; flex-flow: column nowrap; position: relative; overflow: hidden; }
|
|
|
+section.docx>article { margin-bottom: auto; z-index: 1; }
|
|
|
+section.docx>footer { z-index: 1; }
|
|
|
+.docx table { border-collapse: collapse; }
|
|
|
+.docx table td, .docx table th { vertical-align: top; }
|
|
|
+.docx p { margin: 0pt; min-height: 1em; }
|
|
|
+.docx span { white-space: pre-wrap; overflow-wrap: break-word; }
|
|
|
+.docx a { color: inherit; text-decoration: inherit; }
|
|
|
+.docx svg { fill: transparent; }
|
|
|
+.docx {
|
|
|
+ --docx-majorHAnsi-font: Calibri Light;
|
|
|
+ --docx-minorHAnsi-font: Calibri;
|
|
|
+ --docx-dk1-color: #000000;
|
|
|
+ --docx-lt1-color: #FFFFFF;
|
|
|
+ --docx-dk2-color: #44546A;
|
|
|
+ --docx-lt2-color: #E7E6E6;
|
|
|
+ --docx-accent1-color: #5B9BD5;
|
|
|
+ --docx-accent2-color: #ED7D31;
|
|
|
+ --docx-accent3-color: #A5A5A5;
|
|
|
+ --docx-accent4-color: #FFC000;
|
|
|
+ --docx-accent5-color: #4472C4;
|
|
|
+ --docx-accent6-color: #70AD47;
|
|
|
+ --docx-hlink-color: #0563C1;
|
|
|
+ --docx-folHlink-color: #954F72;
|
|
|
+}
|
|
|
+.docx span {
|
|
|
+ font-family: Times New Roman;
|
|
|
+}
|
|
|
+.docx p, p.docx_1 {
|
|
|
+ text-align: justify;
|
|
|
+}
|
|
|
+.docx p, p.docx_1 span {
|
|
|
+ font-family: var(--docx-minorHAnsi-font);
|
|
|
+ min-height: 10.50pt;
|
|
|
+ font-size: 10.50pt;
|
|
|
+}
|
|
|
+.docx table, table.docx_2 td {
|
|
|
+ padding-top: 0.00pt;
|
|
|
+ padding-left: 5.40pt;
|
|
|
+ padding-bottom: 0.00pt;
|
|
|
+ padding-right: 5.40pt;
|
|
|
+}
|
|
|
+table.docx_3 p {
|
|
|
+ text-align: justify;
|
|
|
+}
|
|
|
+table.docx_3 td {
|
|
|
+ border-top: 0.50pt solid black;
|
|
|
+ border-left: 0.50pt solid black;
|
|
|
+ border-bottom: 0.50pt solid black;
|
|
|
+ border-right: 0.50pt solid black;
|
|
|
+ padding-top: 0.00pt;
|
|
|
+ padding-left: 5.40pt;
|
|
|
+ padding-bottom: 0.00pt;
|
|
|
+ padding-right: 5.40pt;
|
|
|
+}
|
|
|
+ p.docx-num-2-0:before {
|
|
|
+ content: ""counter(docx-num-2-0, decimal)"、";
|
|
|
+ counter-increment: docx-num-2-0;
|
|
|
+}
|
|
|
+p.docx-num-2-0 {
|
|
|
+ display: list-item;
|
|
|
+ list-style-position: inside;
|
|
|
+ list-style-type: none;
|
|
|
+}
|
|
|
+p.docx-num-1-0:before {
|
|
|
+ content: ""counter(docx-num-1-0, decimal)"、";
|
|
|
+ counter-increment: docx-num-1-0;
|
|
|
+}
|
|
|
+p.docx-num-1-0 {
|
|
|
+ display: list-item;
|
|
|
+ list-style-position: inside;
|
|
|
+ list-style-type: none;
|
|
|
+}
|
|
|
+.docx-wrapper {
|
|
|
+ counter-reset: docx-num-2-0 4 docx-num-1-0 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ </style>
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ ${html}
|
|
|
+ </body>
|
|
|
+ </html>`;
|
|
|
+ // console.log(content)
|
|
|
+ // return console.log(content)
|
|
|
+ // debugger
|
|
|
+ let blob = htmlDocx.asBlob(content);
|
|
|
+
|
|
|
+ // const uploadFile = new File([blob], `${name}.docx`, {
|
|
|
+ // type:
|
|
|
+ // "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
|
+ // });
|
|
|
+ saveAs(blob, `${name}.docx`);
|
|
|
+ return true;
|
|
|
+ // this.beforeUploadHtml(uploadFile);
|
|
|
+ },
|
|
|
},
|
|
|
computed: {
|
|
|
showFileUrl() {
|
|
@@ -978,13 +1142,14 @@ export default {
|
|
|
}
|
|
|
|
|
|
.more_icon {
|
|
|
- background: url('../../../assets/icon/test/test_more.png') no-repeat;
|
|
|
- background-size: 60%;
|
|
|
- width: 16px;
|
|
|
- height: 16px;
|
|
|
+ background: url('../../../assets/icon/test/test_fold.svg') no-repeat;
|
|
|
+ background-size: 100%;
|
|
|
+ width: 18px;
|
|
|
+ height: 18px;
|
|
|
display: inline-block;
|
|
|
background-size: contain;
|
|
|
cursor: pointer;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
.cc_b_right {
|
|
@@ -1017,6 +1182,23 @@ export default {
|
|
|
margin: 0;
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
+ position: relative;
|
|
|
+}
|
|
|
+
|
|
|
+.bianji_area>span{
|
|
|
+ width: 25px;
|
|
|
+ height: 25px;
|
|
|
+ position: absolute;
|
|
|
+ right: 15px;
|
|
|
+ top: 8px;
|
|
|
+ z-index: 999;
|
|
|
+ /* background-color: red; */
|
|
|
+}
|
|
|
+
|
|
|
+.bianji_area>span>img{
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ cursor: pointer;
|
|
|
}
|
|
|
.aiText{
|
|
|
margin-top:10px;
|