feat: ✨ 商家端富文本改为本地引入
parent
3ec0e9d997
commit
4429227665
|
@ -88,6 +88,9 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
confirmUrl(){
|
||||||
|
|
||||||
|
},
|
||||||
handleClickUploadImage(){
|
handleClickUploadImage(){
|
||||||
this.show = true
|
this.show = true
|
||||||
},
|
},
|
||||||
|
@ -100,7 +103,6 @@ export default {
|
||||||
// 移除商品图片
|
// 移除商品图片
|
||||||
handleRemoveGoodsPicture(__index) {
|
handleRemoveGoodsPicture(__index) {
|
||||||
this.images.splice(__index, 1);
|
this.images.splice(__index, 1);
|
||||||
// this.images = this.images.filter((i) => i.url !== file.url);
|
|
||||||
},
|
},
|
||||||
// 图片大小不正确
|
// 图片大小不正确
|
||||||
handleMaxSize(file) {
|
handleMaxSize(file) {
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
"-": "0.0.1",
|
"-": "0.0.1",
|
||||||
"@amap/amap-jsapi-loader": "0.0.7",
|
"@amap/amap-jsapi-loader": "0.0.7",
|
||||||
"@antv/g2": "^4.1.14",
|
"@antv/g2": "^4.1.14",
|
||||||
"@tinymce/tinymce-vue": "^3.2.0",
|
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"dplayer": "^1.27.1",
|
"dplayer": "^1.27.1",
|
||||||
"js-cookie": "^2.2.1",
|
"js-cookie": "^2.2.1",
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
<link rel="stylesheet" href="<%=css%>" />
|
<link rel="stylesheet" href="<%=css%>" />
|
||||||
<% } %>
|
<% } %>
|
||||||
<style>
|
<style>
|
||||||
|
.tox-promotion {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
.page-loading-wrap {
|
.page-loading-wrap {
|
||||||
padding: 120px;
|
padding: 120px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -69,6 +72,7 @@
|
||||||
<script src="<%=js%>"></script>
|
<script src="<%=js%>"></script>
|
||||||
<% } %>
|
<% } %>
|
||||||
<script src="/config.js"></script>
|
<script src="/config.js"></script>
|
||||||
|
<script src="./tinymce/tinymce.min.js"></script>
|
||||||
<noscript>
|
<noscript>
|
||||||
<strong
|
<strong
|
||||||
>We're sorry doesn't work properly without JavaScript
|
>We're sorry doesn't work properly without JavaScript
|
||||||
|
|
|
@ -312,9 +312,12 @@
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</div>
|
</div>
|
||||||
<FormItem class="form-item-view-el" label="PC商品描述" prop="intro" style="width: 100%">
|
<FormItem class="form-item-view-el" label="PC商品描述" prop="intro" style="width: 100%">
|
||||||
<Alert class='editor-alert' type="warning">将文件夹下的图片进行拖拽到文本框内,即可完成单/多图片上传。</Alert>
|
<editor
|
||||||
<editor ref="editor" v-model="baseInfoForm.intro" :init="{ ...initEditor, height: '800px' }" openXss>
|
ref="editor"
|
||||||
</editor>
|
v-model="baseInfoForm.intro"
|
||||||
|
height="800px"
|
||||||
|
openXss
|
||||||
|
></editor>
|
||||||
<div class="promise-intro-btn">
|
<div class="promise-intro-btn">
|
||||||
<Button type="primary" @click="promiseIntroEditor">将PC商品描述同步到移动端描述
|
<Button type="primary" @click="promiseIntroEditor">将PC商品描述同步到移动端描述
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -322,8 +325,12 @@
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem class="form-item-view-el" label="移动端描述" prop="skuList" style="width: 100%">
|
<FormItem class="form-item-view-el" label="移动端描述" prop="skuList" style="width: 100%">
|
||||||
<editor ref="editor" v-model="baseInfoForm.mobileIntro" :init="{ ...initEditor, height: '800px' }" openXss>
|
<editor
|
||||||
</editor>
|
ref="introEditor"
|
||||||
|
v-model="baseInfoForm.mobileIntro"
|
||||||
|
height="800px"
|
||||||
|
openXss
|
||||||
|
></editor>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="baseInfoForm.goodsType != 'VIRTUAL_GOODS'">
|
<div v-if="baseInfoForm.goodsType != 'VIRTUAL_GOODS'">
|
||||||
|
@ -416,8 +423,8 @@ import * as API_GOODS from "@/api/goods";
|
||||||
import * as API_Shop from "@/api/shops";
|
import * as API_Shop from "@/api/shops";
|
||||||
import cloneObj from "@/utils/index";
|
import cloneObj from "@/utils/index";
|
||||||
import vuedraggable from "vuedraggable";
|
import vuedraggable from "vuedraggable";
|
||||||
import Editor from "@tinymce/tinymce-vue";
|
import tinymec from "@/views/lili-components/editor/index.vue";
|
||||||
import { initEditor } from "@/views/lili-components/editor/config";
|
|
||||||
import { uploadFile } from "@/libs/axios";
|
import { uploadFile } from "@/libs/axios";
|
||||||
import { regular } from "@/utils";
|
import { regular } from "@/utils";
|
||||||
import DPlayer from 'dplayer';
|
import DPlayer from 'dplayer';
|
||||||
|
@ -425,7 +432,7 @@ import DPlayer from 'dplayer';
|
||||||
export default {
|
export default {
|
||||||
name: "goodsOperationSec",
|
name: "goodsOperationSec",
|
||||||
components: {
|
components: {
|
||||||
editor: Editor,
|
editor: tinymec,
|
||||||
vuedraggable,
|
vuedraggable,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -452,7 +459,7 @@ export default {
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
regular,
|
regular,
|
||||||
initEditor,
|
|
||||||
total: 0,
|
total: 0,
|
||||||
goodsVideo: "",
|
goodsVideo: "",
|
||||||
showContent: false,
|
showContent: false,
|
||||||
|
@ -1035,7 +1042,13 @@ export default {
|
||||||
},
|
},
|
||||||
// 将pc商品描述同步给移动端
|
// 将pc商品描述同步给移动端
|
||||||
promiseIntroEditor() {
|
promiseIntroEditor() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.introEditor.setContent(this.baseInfoForm.intro);
|
||||||
|
})
|
||||||
|
|
||||||
this.baseInfoForm.mobileIntro = this.baseInfoForm.intro;
|
this.baseInfoForm.mobileIntro = this.baseInfoForm.intro;
|
||||||
|
|
||||||
|
this.$forceUpdate();
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 根据当前分类id查询商品应包含的参数 */
|
/** 根据当前分类id查询商品应包含的参数 */
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import plugins from "./plugins";
|
import plugins from "./plugins";
|
||||||
import toobar from "./toolbar";
|
import toobar from "./toolbar";
|
||||||
import { upLoadFileMethods } from "@/api/common";
|
const localCDN = window.location.origin + "/tinymce"; //本地引入
|
||||||
|
|
||||||
export const initEditor = {
|
export const initEditor = {
|
||||||
|
base_url: localCDN,
|
||||||
height: "400px",
|
height: "400px",
|
||||||
language: "zh_CN",
|
language: "zh-Hans",
|
||||||
menubar: "file edit view format table", // 菜单:指定应该出现哪些菜单
|
menubar: "file edit view format table", // 菜单:指定应该出现哪些菜单
|
||||||
toolbar: toobar, // 分组工具栏控件
|
toolbar: toobar, // 分组工具栏控件
|
||||||
plugins:plugins, // 插件(比如: advlist | link | image | preview等)
|
plugins:plugins, // 插件(比如: advlist | link | image | preview等)
|
||||||
|
@ -14,20 +14,11 @@ export const initEditor = {
|
||||||
advlist_bullet_styles: "square", // 无序列表 有序列表
|
advlist_bullet_styles: "square", // 无序列表 有序列表
|
||||||
maxSize: "2097152", // 设置图片大小
|
maxSize: "2097152", // 设置图片大小
|
||||||
accept: "image/jpeg, image/png", // 设置图片上传规则
|
accept: "image/jpeg, image/png", // 设置图片上传规则
|
||||||
images_upload_handler: async function (blobInfo, success, failure) {
|
paste_data_images:false,
|
||||||
const formData = new FormData();
|
browser_spellcheck: true, // 拼写检查
|
||||||
formData.append("file", blobInfo.blob());
|
branding: false, // 去水印
|
||||||
try {
|
elementpath: false, // 禁用编辑器底部的状态栏
|
||||||
const res = await upLoadFileMethods(formData);
|
statusbar: false, // 隐藏编辑器底部的状态栏
|
||||||
if (res.result) {
|
|
||||||
success(res.result)
|
|
||||||
} else {
|
|
||||||
failure("上传文件有误请稍后重试");
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
failure('上传出错')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// init_instance_callback: function (editor) {
|
// init_instance_callback: function (editor) {
|
||||||
// var freeTiny = document.querySelector(".tox .tox-notification--in .tox-notification .tox-notification--warning .tox .tox-notification--warning .tox-notifications-container");
|
// var freeTiny = document.querySelector(".tox .tox-notification--in .tox-notification .tox-notification--warning .tox .tox-notification--warning .tox-notifications-container");
|
||||||
// freeTiny.style.display = "none";
|
// freeTiny.style.display = "none";
|
||||||
|
@ -51,7 +42,4 @@ export const initEditor = {
|
||||||
|
|
||||||
ul,ol{ list-style-position:inside; }
|
ul,ol{ list-style-position:inside; }
|
||||||
`, // 设置样式
|
`, // 设置样式
|
||||||
statusbar: false, // 隐藏编辑器底部的状态栏
|
|
||||||
elementpath: false, // 禁用编辑器底部的状态栏
|
|
||||||
paste_data_images: true, // 允许粘贴图像
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const plugins = [
|
const plugins = [
|
||||||
'advlist anchor autolink autosave code codesample colorpicker colorpicker contextmenu directionality emoticons hr image imagetools importcss insertdatetime link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textcolor textpattern visualblocks visualchars wordcount'
|
'advlist', 'anchor', 'autolink', 'autosave', 'code', 'codesample', 'directionality', 'emoticons', 'fullscreen', 'image', 'importcss', 'insertdatetime', 'link', 'lists', 'media', 'nonbreaking', 'pagebreak', 'preview', 'save', 'searchreplace', 'table', 'template', 'visualblocks', 'visualchars', 'wordcount'
|
||||||
]
|
]
|
||||||
export default plugins
|
export default plugins
|
||||||
|
|
|
@ -804,6 +804,7 @@ export default {
|
||||||
size += item.fileSize * 1.0;
|
size += item.fileSize * 1.0;
|
||||||
});
|
});
|
||||||
this.totalSize = ((size * 1.0) / (1024 * 1024)).toFixed(2) + " MB";
|
this.totalSize = ((size * 1.0) / (1024 * 1024)).toFixed(2) + " MB";
|
||||||
|
this.$emit('selected',e)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
Loading…
Reference in New Issue