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

View File

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

View File

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

View File

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

View File

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

View File

@ -146,7 +146,7 @@
</template> </template>
<el-table-column align="center" label="图片" min-width="80"> <el-table-column align="center" label="图片" min-width="80">
<template slot-scope="scope"> <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 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-if="scope.row.image" class="pictrue pictrueTab"><img :src="scope.row.image"></div>
<div v-else class="upLoad pictrueTab"> <div v-else class="upLoad pictrueTab">

View File

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