|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div class="elegant-container">
|
|
|
<div class="header">
|
|
|
- <span class="title">校园德育风采</span>
|
|
|
+ <span class="title">学生风采</span>
|
|
|
<Button type="success" size="small" @click="onAddElegant">+ 添加素材</Button>
|
|
|
</div>
|
|
|
<div class="elegant-list">
|
|
@@ -11,6 +11,7 @@
|
|
|
<p class="elegant-title">
|
|
|
<span>{{ item.title }}</span>
|
|
|
<span style="margin:0 10px;">
|
|
|
+ <Tag color="geekblue">{{ item.bizCode === 'art' ? '艺术特色' : '德育风采' }}</Tag>
|
|
|
<Tag color="primary">{{ $tools.formatTime(item.createTime) }}</Tag>
|
|
|
</span>
|
|
|
<!-- <Icon type="md-create" color="#2d8cf0" @click="onEditElegant(item,index)"></Icon> -->
|
|
@@ -30,10 +31,25 @@
|
|
|
<FormItem :label="`活动名称`">
|
|
|
<Input v-model="curElegantItem.title" :placeholder="`请输入活动名称...`"></Input>
|
|
|
</FormItem>
|
|
|
+ <FormItem :label="`参与对象`">
|
|
|
+ <Input v-model="curElegantItem.target" :placeholder="`请输入活动参与对象...`"></Input>
|
|
|
+ </FormItem>
|
|
|
<FormItem :label="`活动描述`">
|
|
|
<Input v-model="curElegantItem.content" :placeholder="`请输入活动描述内容...`"></Input>
|
|
|
</FormItem>
|
|
|
- <FormItem :label="`活动素材`">
|
|
|
+ <FormItem :label="`素材类别`">
|
|
|
+ <Select v-model="curElegantItem.bizCode">
|
|
|
+ <Option value="elegant">德育风采</Option>
|
|
|
+ <Option value="art">艺术特色</Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem :label="`附件类型`">
|
|
|
+ <Select v-model="fileType">
|
|
|
+ <Option value="image">图片附件</Option>
|
|
|
+ <Option value="video">视频附件</Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem :label="`活动素材`" v-if="fileType === 'image'">
|
|
|
<Upload multiple type="drag" action="" :before-upload="onBeforeUpload" :show-upload-list="false" accept="image/jpeg,image/jpg,image/png," :format="['jpg','jpeg','png']" :on-format-error="handleFormatError">
|
|
|
<div style="padding: 40px 0">
|
|
|
<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
|
|
@@ -52,6 +68,33 @@
|
|
|
<p style="color:red">1. 活动素材需为后缀名为jpg/jpeg/png格式的图片文件,单张图片大小不得超出10M</p>
|
|
|
<p style="color:red">2. 活动素材图片数量最多为10张</p>
|
|
|
</FormItem>
|
|
|
+ <FormItem :label="`活动素材`" v-if="fileType === 'video'">
|
|
|
+ <Upload multiple type="drag" action="" :before-upload="onBeforeUpload" :show-upload-list="false" accept="video/mp4" :format="['mp4']" :on-format-error="handleFormatError">
|
|
|
+ <div style="padding: 40px 0">
|
|
|
+ <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
|
|
|
+ <p>拖拽或者点击上传活动视频素材</p>
|
|
|
+ </div>
|
|
|
+ </Upload>
|
|
|
+ <div class="img-list" v-if="fileType === 'image'">
|
|
|
+ <div class="img-item" v-for="(imgFile,imgFileIndex) in imgFilePreviewList" :key="imgFileIndex">
|
|
|
+ <div class="mask">
|
|
|
+ <Icon type="md-trash" color="#fff" size="26" @click="onRemoveFile(imgFileIndex)"></Icon>
|
|
|
+ </div>
|
|
|
+ <img :src="getDataUrl(imgFile)" alt="">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="img-list" v-if="fileType === 'video'">
|
|
|
+ <div v-for="(imgFile,imgFileIndex) in videoFilePreviewList" :key="imgFileIndex" style="margin: 10px 0">
|
|
|
+ <p>
|
|
|
+ <span>{{ imgFile.name }}</span>
|
|
|
+ <span style="margin-left: 15px;cursor: pointer;"><Icon type="md-trash" color="#ff0000" size="20" @click="onRemoveFile(imgFileIndex)"></Icon></span>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <p style="margin-top:10px;color:red">上传须知:</p>
|
|
|
+ <p style="color:red">1. 活动素材需为后缀名为mp4格式的图片文件,单个视频大小不得超出100M</p>
|
|
|
+ <p style="color:red">2. 活动素材视频数量最多为1个</p>
|
|
|
+ </FormItem>
|
|
|
<Button type="primary" @click="onConfirm" style="width: 100%;height: 40px;" :loading="btnLoading" class="modal-btn">保存</Button>
|
|
|
</Form>
|
|
|
</Drawer>
|
|
@@ -72,8 +115,10 @@ export default {
|
|
|
fileArr: [],
|
|
|
priviewSrc: '',
|
|
|
imgFilePreviewList: [],
|
|
|
+ videoFilePreviewList:[],
|
|
|
containerClient: null,
|
|
|
- schoolProfile: null
|
|
|
+ schoolProfile: null,
|
|
|
+ fileType:'image',
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -89,17 +134,23 @@ export default {
|
|
|
methods: {
|
|
|
onAddElegant() {
|
|
|
this.editModal = true
|
|
|
+ this.fileType = 'image'
|
|
|
this.curElegantItem = {
|
|
|
title: '',
|
|
|
content: '',
|
|
|
createTime: 0,
|
|
|
+ bizCode:'elegant',
|
|
|
+ target:'',
|
|
|
attachments: []
|
|
|
}
|
|
|
},
|
|
|
onDrawerChange() {
|
|
|
+ this.fileType = 'image'
|
|
|
this.curElegantItem = {
|
|
|
title: '',
|
|
|
content: '',
|
|
|
+ bizCode:'elegant',
|
|
|
+ target:'',
|
|
|
createTime: 0,
|
|
|
attachments: []
|
|
|
}
|
|
@@ -156,18 +207,35 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
onBeforeUpload(file) {
|
|
|
- if (this.imgFilePreviewList.length >= 10) {
|
|
|
- this.$Message.warning('最多允许上传10张图片素材!')
|
|
|
- return
|
|
|
- }
|
|
|
- if (file.size > 10 * 1024 * 1024) {
|
|
|
- this.$Message.warning('单张图片大小不得超过10M')
|
|
|
- return
|
|
|
+ if(this.fileType === 'image'){
|
|
|
+ if (this.imgFilePreviewList.length >= 10) {
|
|
|
+ this.$Message.warning('最多允许上传10张图片素材!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (file.size > 10 * 1024 * 1024) {
|
|
|
+ this.$Message.warning('单张图片大小不得超过10M')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.imgFilePreviewList.push(file)
|
|
|
+ }else{
|
|
|
+ if (this.videoFilePreviewList.length) {
|
|
|
+ this.$Message.warning('最多允许上传1个视频素材!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (file.size > 100 * 1024 * 1024) {
|
|
|
+ this.$Message.warning('视频大小不得超过100M')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.videoFilePreviewList.push(file)
|
|
|
+ console.log(file)
|
|
|
}
|
|
|
- this.imgFilePreviewList.push(file)
|
|
|
},
|
|
|
onRemoveFile(fileIndex) {
|
|
|
- this.imgFilePreviewList.splice(fileIndex, 1)
|
|
|
+ if(this.fileType === 'image'){
|
|
|
+ this.imgFilePreviewList.splice(fileIndex, 1)
|
|
|
+ }else{
|
|
|
+ this.videoFilePreviewList = []
|
|
|
+ }
|
|
|
},
|
|
|
/* 保存上传 */
|
|
|
async onConfirm() {
|
|
@@ -178,6 +246,7 @@ export default {
|
|
|
}
|
|
|
if (!this.imgFilePreviewList.length) {
|
|
|
this.$Message.warning('图片素材不可为空!')
|
|
|
+ return
|
|
|
}
|
|
|
let n = await this.$tools.getSchoolSas()
|
|
|
let elegantId = this.$tools.guid()
|
|
@@ -188,6 +257,7 @@ export default {
|
|
|
let uploadResult = await this.uploadFiles(this.imgFilePreviewList, elegantId)
|
|
|
params.attachments = uploadResult
|
|
|
params.id = elegantId
|
|
|
+ params.fileType = this.fileType
|
|
|
params.publish = 1
|
|
|
params.type = 'school'
|
|
|
params.startTime = 111
|