This commit is contained in:
tangzh 2025-03-21 18:06:41 +08:00
parent 1060f3decc
commit 8f32da7b24
7 changed files with 88 additions and 46 deletions

View File

@ -144,16 +144,13 @@ export default {
imageSuccessCBK(arr) {
const _this = this;
arr.forEach((v) => {
if (this.getFileType(v) == "video") {
window.tinymce
.get(_this.tinymceId)
.insertContent(
`<video class="wscnph" src="${v}" controls muted></video>`
);
let fileType = this.getFileType(v);
if (fileType == "video") {
window.tinymce.get(_this.tinymceId).insertContent(`<video class="wscnph" src="${v}" controls muted></video>`);
} else if (fileType == 'pdf') {
window.tinymce.get(_this.tinymceId).insertContent(`<iframe src="${v}" />`);
} else {
window.tinymce
.get(_this.tinymceId)
.insertContent(`<img class="wscnph" src="${v}" />`);
window.tinymce.get(_this.tinymceId).insertContent(`<img class="wscnph" src="${v}" />`);
}
});
},
@ -196,6 +193,12 @@ export default {
if (result) {
return "video";
}
// pdf
const pdfList = ['pdf'];
result = pdfList.find((item) => item === suffix);
if (result) {
return "pdf";
}
//
return "other";
},

View File

@ -27,7 +27,7 @@
</div>
</div>
<el-dialog
title="上传图片"
title="上传附件"
:visible.sync="visible"
width="896px"
:before-close="handleClose"
@ -111,6 +111,7 @@ export default {
e.dataTransfer.dropEffect = 'move'
},
handleDragEnter (e, item) {
alert(11)
e.dataTransfer.effectAllowed = 'move'
if (item === this.dragging) {
return

View File

@ -55,7 +55,7 @@
>
<el-dropdown-item
v-if="
node.label !== '全部图片' &&
node.label !== '默认' &&
checkPermi(['admin:category:update'])
"
@click.native="onEdit(data.id)"
@ -63,7 +63,7 @@
>
<el-dropdown-item
v-if="
node.label !== '全部图片' &&
node.label !== '默认' &&
checkPermi(['admin:category:delete'])
"
@click.native="handleDelete(data.id)"
@ -88,14 +88,14 @@
type="primary"
class="mr15 mb20"
@click="checkPics"
>使用选中图片
>使用选中附件
</el-button
>
<div class="mb20">
<el-tooltip
class="item"
effect="dark"
content="上传图片"
content="上传附件"
placement="top-start"
>
<el-upload
@ -118,7 +118,7 @@
<el-tooltip
class="item"
effect="dark"
content="删除图片"
content="删除"
placement="top-start"
>
<el-button
@ -141,7 +141,7 @@
:show-file-list="false"
multiple
>
<el-button class="mr10" type="primary" v-if="pictureType">上传{{typeDate =='pic'?'图片':'视频'}}</el-button>
<el-button class="mr10" type="primary" v-if="pictureType">上传{{typeDate =='pic'?'图片':'文件'}}</el-button>
</el-upload>
<div>
<el-button
@ -149,7 +149,7 @@
type="danger"
@click.stop="editPicList('图片')"
v-if="pictureType"
>删除{{typeDate =='pic'?'图片':'视频'}}
>删除{{typeDate =='pic'?'图片':'文件'}}
</el-button
>
</div>
@ -181,11 +181,11 @@
<div class="abs_video">
<el-radio-group v-model="typeDate" @change="radioChange" size="small">
<el-radio-button label="pic">图片</el-radio-button>
<el-radio-button label="video">视频</el-radio-button>
<el-radio-button label="video">文件</el-radio-button>
</el-radio-group>
</div>
</div>
<div class="pictrueList acea-row" v-loading="loadingPic">
<div class="pictrueList acea-row" v-loading="loadingPic" v-if="typeDate == 'pic'">
<div v-show="isShowPic" class="imagesNo">
<i
class="el-icon-picture"
@ -208,17 +208,44 @@
v-lazy="item.sattDir ? item.sattDir : localImg"
:class="item.isSelect ? 'on' : ''"
@click="changImage(item, index, pictrueList.list)"
v-if="item.attType !== 'video/mp4'"
v-if="('jpg,jpeg,gif,png,bmp,PNG,JPG,mp4'.split(',')).includes(item.attType)"
/>
<video
:src="item.sattDir"
:class="item.isSelect ? 'on' : ''"
@click="changImage(item, index, pictrueList.list)"
v-if="item.attType == 'video/mp4'"
></video>
</div>
</div>
</div>
<div class="pictrueList acea-row" v-loading="loadingPic" v-else>
<div v-show="isShowPic" class="imagesNo">
<i
class="el-icon-picture"
style="font-size: 60px; color: rgb(219, 219, 219)"
/>
<span class="imagesNo_sp">附件库为空</span>
</div>
<div
class="conters scrollbarAll"
:style="{ maxHeight: !pictureType ? '500px' : '700px' }"
>
<div
v-for="(item, index) in pictrueList.list"
:key="index"
class="gridPic" style="margin-right: 10px; margin-bottom: 40px; width: 300px; height: 200px"
>
<span class="num_badge" v-if="item.num > 0">{{ item.num }}</span>
<embed
:title="item.name"
:class="item.isSelect ? 'on' : ''"
style="object-fit: contain;"
:src="item.sattDir"
v-lazy="item.sattDir ? item.sattDir : localImg"
v-if="('zip,doc,docx,xls,xlsx,pdf,mp3,wma,wav,amr,mp4,p12,application/pdf'.split(',')).includes(item.attType)"
/>
<span @click="changImage(item, index, pictrueList.list)" style="font-size: 14px">{{item.name}}</span>
</div>
</div>
</div>
</div>
<div class="block">
<el-pagination
@ -386,7 +413,7 @@ export default {
page: 1,
limit: 10,
pid: 0,
attType: "jpg,jpeg,gif,png,bmp,PNG,JPG",
attType: "image_ext_str",
},
classifyId: 0,
myHeaders: {"X-Token": getToken()},
@ -478,7 +505,7 @@ export default {
//
handlerGetList() {
let datas = {
name: "全部图片",
name: "默认",
id: "",
};
treeCategroy(this.treeFrom).then((data) => {
@ -494,7 +521,7 @@ export default {
//
getList() {
const data = {
name: "全部图片",
name: "默认",
id: 10000,
};
treeCategroy(this.treeFrom).then((res) => {
@ -651,27 +678,30 @@ export default {
// 使
checkPics() {
if (!this.checkPicList.length)
return this.$message.warning("请先选择图片");
return this.$message.warning("请先选择");
if (this.$route && this.$route.query.field === "dialog") {
let str = "";
for (let i = 0; i < this.checkPicList.length; i++) {
str += '<img src="' + this.checkPicList[i].sattDir + '">';
if (this.typeDate ==='pic') {
str += '<img src="' + this.checkPicList[i].sattDir + '">';
} else {
str += '<embed src="' + this.checkPicList[i].sattDir + '">';
}
}
/* eslint-disable */
nowEditor.dialog.close(true);
nowEditor.editor.setContent(str, true);
} else {
if (this.isMore === "1" && this.checkPicList.length > 1) {
return this.$message.warning("最多只能选一张图片");
return this.$message.warning("最多只能选一张");
}
this.$emit("getImage", [...this.checkedMore, ...this.checkPicList]);
}
},
//
//
editPicList(tit) {
if (!this.checkPicList.length)
return this.$message.warning("请先选择图片");
return this.$message.warning("请先选择");
this.$modalSure().then(() => {
fileDeleteApi(this.ids.join(",")).then(() => {
this.$message.success("刪除成功");
@ -689,7 +719,7 @@ export default {
};
this.getMove();
} else {
this.$message.warning("请先选择图片");
this.$message.warning("请先选择");
}
},
getMove() {
@ -713,10 +743,10 @@ export default {
},
videoChange(val) {
if (val == false) {
this.$set(this.tableData, "attType", "jpg,jpeg,gif,png,bmp,PNG,JPG");
this.$set(this.tableData, "attType", "image_ext_str");
this.getFileList();
} else {
this.$set(this.tableData, "attType", "video/mp4");
this.$set(this.tableData, "attType", "file_ext_str");
this.getFileList();
}
},
@ -901,8 +931,8 @@ export default {
.gridPic {
margin-right: 15px;
margin-bottom: 10px;
width: 110px;
height: 110px;
width: 140px;
height: 140px;
position: relative;
cursor: pointer;
@ -918,6 +948,12 @@ export default {
display: block;
}
embed {
width: 100%;
height: 100%;
display: block;
}
.num_badge {
position: absolute;
bottom: 6px;

View File

@ -1,7 +1,7 @@
<template>
<div>
<el-dialog
title="上传图片"
title="上传附件"
:visible.sync="visible"
width="950px"
:modal="booleanVal"

View File

@ -993,6 +993,7 @@
selectRule: info.selectRule,
isSub: info.isSub,
content: this.$selfUtil.replaceImgSrcHttps(info.content),
qualityTest: this.$selfUtil.replaceImgSrcHttps(info.qualityTest),
specType: info.specType,
id: info.id,
giveIntegral: info.giveIntegral,
@ -1234,10 +1235,11 @@
let arr = [],arr1 = [];
const listArr = [{ name: '是否热卖', value: 'isGood' }];
let typeLists = [
{ name: '', value: 'isHot',type:'2' }, //
{ name: '', value: 'isBenefit' ,type:'4'}, //
// { name: '', value: 'isHot',type:'2' }, //
// { name: '', value: 'isBenefit' ,type:'4'}, //
{ name: '', value: 'isBest',type:'1' }, //
{ name: '', value: 'isNew',type:'3' }]; //
// { name: '', value: 'isNew',type:'3' }, //
];
list.forEach((item)=>{
let obj = {};
obj.value = JSON.parse(item.value);

View File

@ -146,7 +146,7 @@
</template>
<el-table-column align="center" label="图片" min-width="80">
<template slot-scope="scope">
<el-form-item :rules="[{required: true, message: '请上传图片', trigger: 'change'}]" :prop="'attrValue.'+scope.$index+'.image'">
<el-form-item :rules="[{required: true, message: '请上传附件', trigger: 'change'}]" :prop="'attrValue.'+scope.$index+'.image'">
<div class="upLoadPicBox" @click="modalPicTap('1','duo',scope.$index)">
<div v-if="scope.row.image" class="pictrue pictrueTab"><img :src="scope.row.image"></div>
<div v-else class="upLoad pictrueTab">

View File

@ -239,7 +239,7 @@
onchangeTime(e){
this.ruleForm.dayTime = e ? e.join(',') : '';
},
//
//
modalPicTap (tit) {
const _this = this
this.$modalUpload(function(img) {