|
@@ -0,0 +1,756 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" class="baseinfoClass">
|
|
|
+ <el-form-item style="margin-left: -3vw;">
|
|
|
+ <div class="text-with-line">物料图册</div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="1" style="margin-top: 5px;">
|
|
|
+ <span >首页图册</span>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-button type="success" size="small" style="width: 90px;" @click="downBtn1">下载</el-button>
|
|
|
+ <el-button type="danger" size="small" style="width: 90px;" @click="deleteBtn1">删除</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1" style="margin-top: 5px;">
|
|
|
+ <span >详情图册</span>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-button type="success" size="small" style="width: 90px;" @click="downBtn2">下载</el-button>
|
|
|
+ <el-button type="danger" size="small" style="width: 90px;" @click="deleteBtn2">删除</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row style="margin-top: 24px;">
|
|
|
+ <el-col :span="1" style="min-height:1px;"></el-col>
|
|
|
+ <el-col :span="9">
|
|
|
+ <el-upload
|
|
|
+ class="upload-demo"
|
|
|
+ drag
|
|
|
+ :action="uploadUrl"
|
|
|
+ :on-success="onSuccess1"
|
|
|
+ :on-remove="onRemove1"
|
|
|
+ accept="image/png, image/jpeg"
|
|
|
+ :headers="headers"
|
|
|
+ multiple>
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
+ <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
+ <div class="el-upload__tip" slot="tip">只能上传jpg/png文件,且不超过500kb</div>
|
|
|
+ </el-upload>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-upload
|
|
|
+ class="upload-demo"
|
|
|
+ drag
|
|
|
+ :action="uploadUrl"
|
|
|
+ :on-success="onSuccess2"
|
|
|
+ :on-remove="onRemove2"
|
|
|
+ accept="image/png, image/jpeg"
|
|
|
+ :headers="headers"
|
|
|
+ multiple>
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
+ <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
+ <div class="el-upload__tip" slot="tip">只能上传jpg/png文件,且不超过500kb</div>
|
|
|
+ </el-upload>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row style="margin-top: 30px;">
|
|
|
+ <el-col :span="1" style="margin-top: 5px;">
|
|
|
+ <span >首页视频</span>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-button type="success" size="small" style="width: 90px;" @click="downBtn3">下载</el-button>
|
|
|
+ <el-button type="danger" size="small" style="width: 90px;" @click="deleteBtn3">删除</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1" style="margin-top: 5px;">
|
|
|
+ <span >详情视频</span>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-button type="success" size="small" style="width: 90px;" @click="downBtn4">下载</el-button>
|
|
|
+ <el-button type="danger" size="small" style="width: 90px;" @click="deleteBtn4">删除</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row style="margin-top: 24px;">
|
|
|
+ <el-col :span="1" style="min-height:1px;"></el-col>
|
|
|
+ <el-col :span="9">
|
|
|
+ <el-upload
|
|
|
+ class="upload-demo"
|
|
|
+ drag
|
|
|
+ :action="uploadUrl"
|
|
|
+ :on-success="onSuccess3"
|
|
|
+ :on-remove="onRemove3"
|
|
|
+ :before-upload="beforeUpload3"
|
|
|
+ :headers="headers"
|
|
|
+ multiple>
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
+ <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
+ <div class="el-upload__tip" slot="tip">每个附件大小不可超过<em>5M</em>, 支持格式MP4</div>
|
|
|
+ </el-upload>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-upload
|
|
|
+ class="upload-demo"
|
|
|
+ drag
|
|
|
+ :action="uploadUrl"
|
|
|
+ :on-success="onSuccess4"
|
|
|
+ :on-remove="onRemove4"
|
|
|
+ :before-upload="beforeUpload4"
|
|
|
+ :headers="headers"
|
|
|
+ multiple>
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
+ <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
+ <div class="el-upload__tip" slot="tip">每个附件大小不可超过<em>5M</em>, 支持格式MP4</div>
|
|
|
+ </el-upload>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <script>
|
|
|
+ import { EventBus } from '@/views/material/extend/event/event-bus.js';
|
|
|
+ import { getToken } from '@/utils/auth';
|
|
|
+ import { getInfoPicturesByMaterialId, readFile } from "@/api/material/extend/material.js";
|
|
|
+ import JSZip from 'jszip';
|
|
|
+ import FileSaver from 'file-saver';
|
|
|
+ export default {
|
|
|
+ name: "MaterialPictures",
|
|
|
+ components: {
|
|
|
+ BatchImport: () => import("@/components/BatchImport/indexa.vue"),
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ materialId:{
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ form:{},
|
|
|
+ rules:{},
|
|
|
+ uploadUrl:
|
|
|
+ process.env.NODE_ENV == "development"
|
|
|
+ ? "/drp-file/document-center/fastdfs/upload"
|
|
|
+ : "/document-center/fastdfs/upload",
|
|
|
+ // 如果需要token认证,添加token到headers
|
|
|
+ headers: {
|
|
|
+ Authorization: 'Bearer ' + getToken()
|
|
|
+ },
|
|
|
+ sendMaterialPictures:{
|
|
|
+ id: 1,
|
|
|
+ materialId: '432986',
|
|
|
+ homePicture: '123,123',
|
|
|
+ homeVideo: '123,123',
|
|
|
+ infoPicture: '123,123',
|
|
|
+ infoVideo: '123,123'
|
|
|
+ },
|
|
|
+ fileList1: [],
|
|
|
+ fileList2: [],
|
|
|
+ fileList3: [],
|
|
|
+ fileList4: [],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getDetailPicturesByMaterialId();
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ // EventBus.$on('sendMaterialPictures', this.sendMaterialPictures);
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ // EventBus.$off('sendMaterialPictures', this.sendMaterialPictures);
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getDetailPicturesByMaterialId(){
|
|
|
+ getInfoPicturesByMaterialId(this.materialId).then(response => {
|
|
|
+ this.sendMaterialPictures = {
|
|
|
+ id: '',
|
|
|
+ materialId: '',
|
|
|
+ homePicture: '',
|
|
|
+ homeVideo: '',
|
|
|
+ infoPicture: '',
|
|
|
+ infoVideo: ''
|
|
|
+ };
|
|
|
+ if(response.data != undefined){
|
|
|
+ this.sendMaterialPictures = response.data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // sendMaterialPictures(val){
|
|
|
+ // this.$set(this.sendMaterialPictures, 'annex', val);
|
|
|
+ // },
|
|
|
+ getTimestamp() {
|
|
|
+ return Date.now();
|
|
|
+ },
|
|
|
+ downBtn1(){
|
|
|
+ if(this.sendMaterialPictures.homePicture != ''){
|
|
|
+ if(this.sendMaterialPictures.homePicture.includes(',')){
|
|
|
+ let fileInfoList = [];
|
|
|
+ let pics = this.sendMaterialPictures.homePicture.split(',');
|
|
|
+ let flag = false;
|
|
|
+ pics.forEach((element,index) => {
|
|
|
+ if(index == pics.length-1){
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+ readFile(element).then(response => {
|
|
|
+ let newdx = {'fileUrl': 'https://dev-sy.derom.com/document-center/minio/'+response.data.filepath, 'renameFileName': response.data.filepath};
|
|
|
+ fileInfoList.push(newdx);
|
|
|
+ });
|
|
|
+ if(flag){
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.filesToRar(fileInfoList, this.getTimestamp());
|
|
|
+ },1000)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ readFile(this.sendMaterialPictures.homePicture).then(response => {
|
|
|
+ let fileInfoList = [];
|
|
|
+ let newdx = {'fileUrl': 'https://dev-sy.derom.com/document-center/minio/'+response.data.filepath, 'renameFileName': response.data.filepath};
|
|
|
+ fileInfoList.push(newdx);
|
|
|
+ this.filesToRar(fileInfoList, this.getTimestamp());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '当前文件是空的, 请上传文件 !'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ downBtn2(){
|
|
|
+ if(this.sendMaterialPictures.infoPicture != ''){
|
|
|
+ if(this.sendMaterialPictures.infoPicture.includes(',')){
|
|
|
+ let fileInfoList = [];
|
|
|
+ let pics = this.sendMaterialPictures.infoPicture.split(',');
|
|
|
+ let flag = false;
|
|
|
+ pics.forEach((element,index) => {
|
|
|
+ if(index == pics.length-1){
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+ readFile(element).then(response => {
|
|
|
+ let newdx = {'fileUrl': 'https://dev-sy.derom.com/document-center/minio/'+response.data.filepath, 'renameFileName': response.data.filepath};
|
|
|
+ fileInfoList.push(newdx);
|
|
|
+ });
|
|
|
+ if(flag){
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.filesToRar(fileInfoList, this.getTimestamp());
|
|
|
+ },1000)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ readFile(this.sendMaterialPictures.infoPicture).then(response => {
|
|
|
+ let fileInfoList = [];
|
|
|
+ let newdx = {'fileUrl': 'https://dev-sy.derom.com/document-center/minio/'+response.data.filepath, 'renameFileName': response.data.filepath};
|
|
|
+ fileInfoList.push(newdx);
|
|
|
+ this.filesToRar(fileInfoList, this.getTimestamp());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '当前文件是空的, 请上传文件 !'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ downBtn3(){
|
|
|
+ if(this.sendMaterialPictures.homeVideo != ''){
|
|
|
+ if(this.sendMaterialPictures.homeVideo.includes(',')){
|
|
|
+ let fileInfoList = [];
|
|
|
+ let pics = this.sendMaterialPictures.homeVideo.split(',');
|
|
|
+ let flag = false;
|
|
|
+ pics.forEach((element,index) => {
|
|
|
+ if(index == pics.length-1){
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+ readFile(element).then(response => {
|
|
|
+ let newdx = {'fileUrl': 'https://dev-sy.derom.com/document-center/minio/'+response.data.filepath, 'renameFileName': response.data.filepath};
|
|
|
+ fileInfoList.push(newdx);
|
|
|
+ });
|
|
|
+ if(flag){
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.filesToRar(fileInfoList, this.getTimestamp());
|
|
|
+ },1000)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ readFile(this.sendMaterialPictures.homeVideo).then(response => {
|
|
|
+ let fileInfoList = [];
|
|
|
+ let newdx = {'fileUrl': 'https://dev-sy.derom.com/document-center/minio/'+response.data.filepath, 'renameFileName': response.data.filepath};
|
|
|
+ fileInfoList.push(newdx);
|
|
|
+ this.filesToRar(fileInfoList, this.getTimestamp());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '当前文件是空的, 请上传文件 !'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ downBtn4(){
|
|
|
+ if(this.sendMaterialPictures.infoVideo != ''){
|
|
|
+ if(this.sendMaterialPictures.infoVideo.includes(',')){
|
|
|
+ let fileInfoList = [];
|
|
|
+ let pics = this.sendMaterialPictures.infoVideo.split(',');
|
|
|
+ let flag = false;
|
|
|
+ pics.forEach((element,index) => {
|
|
|
+ if(index == pics.length-1){
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+ readFile(element).then(response => {
|
|
|
+ let newdx = {'fileUrl': 'https://dev-sy.derom.com/document-center/minio/'+response.data.filepath, 'renameFileName': response.data.filepath};
|
|
|
+ fileInfoList.push(newdx);
|
|
|
+ });
|
|
|
+ if(flag){
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.filesToRar(fileInfoList, this.getTimestamp());
|
|
|
+ },1000)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ readFile(this.sendMaterialPictures.infoVideo).then(response => {
|
|
|
+ let fileInfoList = [];
|
|
|
+ let newdx = {'fileUrl': 'https://dev-sy.derom.com/document-center/minio/'+response.data.filepath, 'renameFileName': response.data.filepath};
|
|
|
+ fileInfoList.push(newdx);
|
|
|
+ this.filesToRar(fileInfoList, this.getTimestamp());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '当前文件是空的, 请上传文件 !'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deleteBtn1(){
|
|
|
+ this.deleteFileKey('homePicture');
|
|
|
+ },
|
|
|
+ deleteBtn2(){
|
|
|
+ this.deleteFileKey('infoPicture');
|
|
|
+ },
|
|
|
+ deleteBtn3(){
|
|
|
+ this.deleteFileKey('homeVideo');
|
|
|
+ },
|
|
|
+ deleteBtn4(){
|
|
|
+ this.deleteFileKey('infoVideo');
|
|
|
+ },
|
|
|
+ deleteFileKey(val){
|
|
|
+ this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.$set(this.sendMaterialPictures, val, '');
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '删除成功!'
|
|
|
+ });
|
|
|
+ if(val == 'homePicture'){
|
|
|
+ this.submitBus1();
|
|
|
+ }
|
|
|
+ if(val == 'infoPicture'){
|
|
|
+ this.submitBus2();
|
|
|
+ }
|
|
|
+ if(val == 'homeVideo'){
|
|
|
+ this.submitBus3();
|
|
|
+ }
|
|
|
+ if(val == 'infoVideo'){
|
|
|
+ this.submitBus4();
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ onSuccess1(e){
|
|
|
+ this.fileList1.push({id: e.id, name:e.filename})
|
|
|
+ this.submitBus1();
|
|
|
+ },
|
|
|
+ onSuccess2(e){
|
|
|
+ this.fileList2.push({id: e.id, name:e.filename})
|
|
|
+ this.submitBus2();
|
|
|
+ },
|
|
|
+ onSuccess3(e){
|
|
|
+ this.fileList3.push({id: e.id, name:e.filename})
|
|
|
+ this.submitBus3();
|
|
|
+ },
|
|
|
+ onSuccess4(e){
|
|
|
+ this.fileList4.push({id: e.id, name:e.filename})
|
|
|
+ this.submitBus4();
|
|
|
+ },
|
|
|
+ onRemove1(e){
|
|
|
+ this.fileList1 = this.fileList1.filter(row =>
|
|
|
+ row.id != e.response.id
|
|
|
+ );
|
|
|
+ let _this = this;
|
|
|
+ if(_this.sendMaterialPictures.homePicture != ''){
|
|
|
+ if(_this.sendMaterialPictures.homePicture.includes(',')){
|
|
|
+ let sz1 = _this.sendMaterialPictures.homePicture.split(',');
|
|
|
+ sz1 = sz1.filter(row =>
|
|
|
+ row != e.response.id
|
|
|
+ );
|
|
|
+ _this.sendMaterialPictures.homePicture = sz1.join(',');
|
|
|
+ }else{
|
|
|
+ if(_this.sendMaterialPictures.homePicture == e.response.id){
|
|
|
+ _this.$set(_this.sendMaterialPictures, 'homePicture', '');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _this.submitBus1();
|
|
|
+ },
|
|
|
+ onRemove2(e){
|
|
|
+ this.fileList2 = this.fileList2.filter(row =>
|
|
|
+ row.id != e.response.id
|
|
|
+ );
|
|
|
+ let _this = this;
|
|
|
+ if(_this.sendMaterialPictures.infoPicture != ''){
|
|
|
+ if(_this.sendMaterialPictures.infoPicture.includes(',')){
|
|
|
+ let sz2 = _this.sendMaterialPictures.infoPicture.split(',');
|
|
|
+ sz2 = sz2.filter(row =>
|
|
|
+ row != e.response.id
|
|
|
+ );
|
|
|
+ _this.sendMaterialPictures.infoPicture = sz2.join(',');
|
|
|
+ }else{
|
|
|
+ if(_this.sendMaterialPictures.infoPicture == e.response.id){
|
|
|
+ _this.$set(_this.sendMaterialPictures, 'infoPicture', '');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _this.submitBus2();
|
|
|
+ },
|
|
|
+ onRemove3(e){
|
|
|
+ this.fileList3 = this.fileList3.filter(row =>
|
|
|
+ row.id != e.response.id
|
|
|
+ );
|
|
|
+ let _this = this;
|
|
|
+ if(_this.sendMaterialPictures.homeVideo != ''){
|
|
|
+ if(_this.sendMaterialPictures.homeVideo.includes(',')){
|
|
|
+ let sz3 = _this.sendMaterialPictures.homeVideo.split(',');
|
|
|
+ sz3 = sz3.filter(row =>
|
|
|
+ row != e.response.id
|
|
|
+ );
|
|
|
+ _this.sendMaterialPictures.homeVideo = sz3.join(',');
|
|
|
+ }else{
|
|
|
+ if(_this.sendMaterialPictures.homeVideo == e.response.id){
|
|
|
+ _this.$set(_this.sendMaterialPictures, 'homeVideo', '');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _this.submitBus3();
|
|
|
+ },
|
|
|
+ onRemove4(e){
|
|
|
+ this.fileList4 = this.fileList4.filter(row =>
|
|
|
+ row.id != e.response.id
|
|
|
+ );
|
|
|
+ let _this = this;
|
|
|
+ if(_this.sendMaterialPictures.infoVideo != ''){
|
|
|
+ if(_this.sendMaterialPictures.infoVideo.includes(',')){
|
|
|
+ let sz4 = _this.sendMaterialPictures.infoVideo.split(',');
|
|
|
+ sz4 = sz4.filter(row =>
|
|
|
+ row != e.response.id
|
|
|
+ );
|
|
|
+ _this.sendMaterialPictures.infoVideo = sz4.join(',');
|
|
|
+ }else{
|
|
|
+ if(_this.sendMaterialPictures.infoVideo == e.response.id){
|
|
|
+ _this.$set(_this.sendMaterialPictures, 'infoVideo', '');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _this.submitBus4();
|
|
|
+ },
|
|
|
+ beforeUpload3(file){
|
|
|
+ const isMP4 = file.type === 'video/mp4';
|
|
|
+ if (!isMP4) {
|
|
|
+ this.$message.error('只能上传MP4格式的视频!');
|
|
|
+ }
|
|
|
+ return isMP4;
|
|
|
+ },
|
|
|
+ beforeUpload4(file){
|
|
|
+ const isMP4 = file.type === 'video/mp4';
|
|
|
+ if (!isMP4) {
|
|
|
+ this.$message.error('只能上传MP4格式的视频!');
|
|
|
+ }
|
|
|
+ return isMP4;
|
|
|
+ },
|
|
|
+ submitBus1(){
|
|
|
+ if(this.sendMaterialPictures.homePicture.includes(',')){
|
|
|
+ let result = '';
|
|
|
+ this.fileList1.forEach(e1 => {
|
|
|
+ let flag = true;
|
|
|
+ this.sendMaterialPictures.homePicture.split(',').forEach(e2 => {
|
|
|
+ if(e1.id == e2){
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if(flag){
|
|
|
+ result = result+','+e1.id;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.sendMaterialPictures.homePicture = this.sendMaterialPictures.homePicture + result;
|
|
|
+ }else{
|
|
|
+ if(this.sendMaterialPictures.homePicture != ''){
|
|
|
+ this.fileList1.forEach((e1,index) => {
|
|
|
+ if(this.sendMaterialPictures.homePicture != e1.id){
|
|
|
+ this.sendMaterialPictures.homePicture = this.sendMaterialPictures.homePicture+','+e1.id;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ if(this.fileList1.length > 0){
|
|
|
+ if(this.fileList1.length == 1){
|
|
|
+ this.sendMaterialPictures.homePicture = this.fileList1[0].id+"";
|
|
|
+ }else{
|
|
|
+ let resu = '';
|
|
|
+ if(this.sendMaterialPictures.homePicture != ''){
|
|
|
+ this.fileList1.forEach(element => {
|
|
|
+ resu = resu +','+ element.id;
|
|
|
+ });
|
|
|
+ this.sendMaterialPictures.homePicture = this.sendMaterialPictures.homePicture + resu;
|
|
|
+ }else{
|
|
|
+ this.fileList1.forEach(element => {
|
|
|
+ resu = resu + element.id + ','
|
|
|
+ })
|
|
|
+ resu = resu.slice(0, -1);
|
|
|
+ this.sendMaterialPictures.homePicture = this.sendMaterialPictures.homePicture + resu ;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ EventBus.$emit('sendMaterialInfo', this.sendMaterialPictures);
|
|
|
+ },
|
|
|
+ submitBus2(){
|
|
|
+ if(this.sendMaterialPictures.infoPicture.includes(',')){
|
|
|
+ let result = '';
|
|
|
+ this.fileList2.forEach(e1 => {
|
|
|
+ let flag = true;
|
|
|
+ this.sendMaterialPictures.infoPicture.split(',').forEach(e2 => {
|
|
|
+ if(e1.id == e2){
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if(flag){
|
|
|
+ result = result+','+e1.id;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.sendMaterialPictures.infoPicture = this.sendMaterialPictures.infoPicture + result;
|
|
|
+ }else{
|
|
|
+ if(this.sendMaterialPictures.infoPicture != ''){
|
|
|
+ this.fileList2.forEach((e1,index) => {
|
|
|
+ if(this.sendMaterialPictures.infoPicture != e1.id){
|
|
|
+ this.sendMaterialPictures.infoPicture = this.sendMaterialPictures.infoPicture+','+e1.id;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ if(this.fileList2.length > 0){
|
|
|
+ if(this.fileList2.length == 1){
|
|
|
+ this.sendMaterialPictures.infoPicture = this.fileList2[0].id+"";
|
|
|
+ }else{
|
|
|
+ let resu = '';
|
|
|
+ if(this.sendMaterialPictures.infoPicture != ''){
|
|
|
+ this.fileList2.forEach(element => {
|
|
|
+ resu = resu +','+ element.id;
|
|
|
+ });
|
|
|
+ this.sendMaterialPictures.infoPicture = this.sendMaterialPictures.infoPicture + resu;
|
|
|
+ }else{
|
|
|
+ this.fileList2.forEach(element => {
|
|
|
+ resu = resu + element.id + ','
|
|
|
+ })
|
|
|
+ resu = resu.slice(0, -1);
|
|
|
+ this.sendMaterialPictures.infoPicture = this.sendMaterialPictures.infoPicture + resu ;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ EventBus.$emit('sendMaterialInfo', this.sendMaterialPictures);
|
|
|
+ },
|
|
|
+ submitBus3(){
|
|
|
+ if(this.sendMaterialPictures.homeVideo.includes(',')){
|
|
|
+ let result = '';
|
|
|
+ this.fileList3.forEach(e1 => {
|
|
|
+ let flag = true;
|
|
|
+ this.sendMaterialPictures.homeVideo.split(',').forEach(e2 => {
|
|
|
+ if(e1.id == e2){
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if(flag){
|
|
|
+ result = result+','+e1.id;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.sendMaterialPictures.homeVideo = this.sendMaterialPictures.homeVideo + result;
|
|
|
+ }else{
|
|
|
+ if(this.sendMaterialPictures.homeVideo != ''){
|
|
|
+ this.fileList3.forEach((e1,index) => {
|
|
|
+ if(this.sendMaterialPictures.homeVideo != e1.id){
|
|
|
+ this.sendMaterialPictures.homeVideo = this.sendMaterialPictures.homeVideo+','+e1.id;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ if(this.fileList3.length > 0){
|
|
|
+ if(this.fileList3.length == 1){
|
|
|
+ this.sendMaterialPictures.homeVideo = this.fileList3[0].id+"";
|
|
|
+ }else{
|
|
|
+ let resu = '';
|
|
|
+ if(this.sendMaterialPictures.homeVideo != ''){
|
|
|
+ this.fileList3.forEach(element => {
|
|
|
+ resu = resu +','+ element.id;
|
|
|
+ });
|
|
|
+ this.sendMaterialPictures.homeVideo = this.sendMaterialPictures.homeVideo + resu;
|
|
|
+ }else{
|
|
|
+ this.fileList3.forEach(element => {
|
|
|
+ resu = resu + element.id + ','
|
|
|
+ })
|
|
|
+ resu = resu.slice(0, -1);
|
|
|
+ this.sendMaterialPictures.homeVideo = this.sendMaterialPictures.homeVideo + resu ;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ EventBus.$emit('sendMaterialInfo', this.sendMaterialPictures);
|
|
|
+ },
|
|
|
+ submitBus4(){
|
|
|
+ if(this.sendMaterialPictures.infoVideo.includes(',')){
|
|
|
+ let result = '';
|
|
|
+ this.fileList4.forEach(e1 => {
|
|
|
+ let flag = true;
|
|
|
+ this.sendMaterialPictures.infoVideo.split(',').forEach(e2 => {
|
|
|
+ if(e1.id == e2){
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if(flag){
|
|
|
+ result = result+','+e1.id;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.sendMaterialPictures.infoVideo = this.sendMaterialPictures.infoVideo + result;
|
|
|
+ }else{
|
|
|
+ if(this.sendMaterialPictures.infoVideo != ''){
|
|
|
+ this.fileList4.forEach((e1,index) => {
|
|
|
+ if(this.sendMaterialPictures.infoVideo != e1.id){
|
|
|
+ this.sendMaterialPictures.infoVideo = this.sendMaterialPictures.infoVideo+','+e1.id;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ if(this.fileList4.length > 0){
|
|
|
+ if(this.fileList4.length == 1){
|
|
|
+ this.sendMaterialPictures.infoVideo = this.fileList4[0].id+"";
|
|
|
+ }else{
|
|
|
+ let resu = '';
|
|
|
+ if(this.sendMaterialPictures.infoVideo != ''){
|
|
|
+ this.fileList4.forEach(element => {
|
|
|
+ resu = resu +','+ element.id;
|
|
|
+ });
|
|
|
+ this.sendMaterialPictures.infoVideo = this.sendMaterialPictures.infoVideo + resu;
|
|
|
+ }else{
|
|
|
+ this.fileList4.forEach(element => {
|
|
|
+ resu = resu + element.id + ','
|
|
|
+ })
|
|
|
+ resu = resu.slice(0, -1);
|
|
|
+ this.sendMaterialPictures.infoVideo = this.sendMaterialPictures.infoVideo + resu ;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ EventBus.$emit('sendMaterialInfo', this.sendMaterialPictures);
|
|
|
+ },
|
|
|
+ /**文件打包* arrImages:文件list:[{fileUrl:文件url,renameFileName:文件名}]* filename 压缩包名* */
|
|
|
+ filesToRar(arrImages, filename) {
|
|
|
+ let _this = this;
|
|
|
+ let zip = new JSZip();
|
|
|
+ let cache = {};
|
|
|
+ let promises = [];
|
|
|
+ _this.title = '正在加载压缩文件';
|
|
|
+ const loading = this.$loading({lock: true,text: '正在加载压缩文件',spinner: 'el-icon-loading',background: 'rgba(0, 0, 0, 0.7)'});
|
|
|
+ for (let item of arrImages) {
|
|
|
+ // 下载文件, 并存成ArrayBuffer对象
|
|
|
+ const promise = this.getImgArrayBuffer(item.fileUrl).then(data => {
|
|
|
+ // 获取文件名
|
|
|
+ const file_name = item.renameFileName;
|
|
|
+ // 逐个添加文件
|
|
|
+ zip.file(file_name, data, { binary: true })
|
|
|
+ cache[file_name] = data})
|
|
|
+ promises.push(promise);
|
|
|
+ }
|
|
|
+ Promise.all(promises)
|
|
|
+ // 生成二进制流
|
|
|
+ .then(() => {zip.generateAsync({ type: "blob" })
|
|
|
+ .then(content => {_this.title = '正在压缩';
|
|
|
+ // 利用file-saver保存文件 自定义文件名
|
|
|
+ FileSaver.saveAs(content, filename);
|
|
|
+ _this.title = '压缩完成';}
|
|
|
+ );
|
|
|
+ loading.close();
|
|
|
+ }).catch(res=>{
|
|
|
+ _this.$message.error('文件压缩失败');
|
|
|
+ loading.close();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getImgArrayBuffer(url) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ //通过请求获取文件blob格式
|
|
|
+ let xmlhttp = new XMLHttpRequest();
|
|
|
+ xmlhttp.open("GET", url, true);
|
|
|
+ xmlhttp.responseType = "blob";
|
|
|
+ xmlhttp.onload = function () {
|
|
|
+ if (this.status == 200) {
|
|
|
+ resolve(this.response);
|
|
|
+ } else {
|
|
|
+ reject(this.status);
|
|
|
+ }};
|
|
|
+ xmlhttp.send();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ }
|
|
|
+ };
|
|
|
+ </script>
|
|
|
+
|
|
|
+<style>
|
|
|
+.baseinfoClass {
|
|
|
+ margin-left: 4vw;
|
|
|
+}
|
|
|
+.text-with-line {
|
|
|
+ position: relative;
|
|
|
+ font-size: 16px;
|
|
|
+ color: #333;
|
|
|
+ padding-bottom: 5px; /* 确保条线在文字下方 */
|
|
|
+}
|
|
|
+.text-with-line::after {
|
|
|
+ content: '';
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ bottom: 0;
|
|
|
+ width: 100%; /* 条线的宽度 */
|
|
|
+ height: 2px; /* 条线的高度 */
|
|
|
+ background: #000; /* 条线的颜色 */
|
|
|
+}
|
|
|
+.container {
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end; /* 这会把子元素放在容器的右边 */
|
|
|
+}
|
|
|
+.button-container {
|
|
|
+ position: fixed; /* 使用fixed定位,使得容器始终相对于浏览器窗口 */
|
|
|
+ top: 10px; /* 距离顶部10像素 */
|
|
|
+ right: 60px; /* 距离右侧10像素 */
|
|
|
+ z-index: 1000; /* 设置一个较高的z-index确保按钮在其他内容之上 */
|
|
|
+}
|
|
|
+.downfile {
|
|
|
+ color:blue;
|
|
|
+ position: relative;
|
|
|
+ text-decoration: none;
|
|
|
+}
|
|
|
+.downfile::after {
|
|
|
+ content: '';
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ height: 1px; /* 下划线厚度 */
|
|
|
+ background: blue; /* 下划线颜色 */
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+</style>
|