|
@@ -69,6 +69,7 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="活动列表图片" prop="coverFile" class="redLabel">
|
|
<el-form-item label="活动列表图片" prop="coverFile" class="redLabel">
|
|
|
<el-upload
|
|
<el-upload
|
|
|
|
|
+ ref="coverUploadRef"
|
|
|
:action="url"
|
|
:action="url"
|
|
|
:file-list="fileListCover"
|
|
:file-list="fileListCover"
|
|
|
:limit="1"
|
|
:limit="1"
|
|
@@ -84,6 +85,7 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="活动详情banner" prop="imageFiles" class="redLabel">
|
|
<el-form-item label="活动详情banner" prop="imageFiles" class="redLabel">
|
|
|
<el-upload
|
|
<el-upload
|
|
|
|
|
+ ref="bannerUploadRef"
|
|
|
:action="url"
|
|
:action="url"
|
|
|
:file-list="fileListBanner"
|
|
:file-list="fileListBanner"
|
|
|
:limit="6"
|
|
:limit="6"
|
|
@@ -95,7 +97,7 @@
|
|
|
>
|
|
>
|
|
|
<i class="el-icon-plus"></i>
|
|
<i class="el-icon-plus"></i>
|
|
|
</el-upload>
|
|
</el-upload>
|
|
|
- <div class="upload_tip">尺寸:702*440px,最多上传6张,图片格式:jpg、png、jpeg</div>
|
|
|
|
|
|
|
+ <div class="upload_tip">尺寸:702*440px,最多上传6张,图片格式:jpg、png、jpeg(可拖动调整顺序)</div>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="活动详情" prop="activityDetails" class="redLabel">
|
|
<el-form-item label="活动详情" prop="activityDetails" class="redLabel">
|
|
|
<editor-vue style="margin-top: -30px;" :content="basicForm.activityDetails" @EditorChange="getEditor" ref="infoIntroduceRef"></editor-vue>
|
|
<editor-vue style="margin-top: -30px;" :content="basicForm.activityDetails" @EditorChange="getEditor" ref="infoIntroduceRef"></editor-vue>
|
|
@@ -226,6 +228,7 @@
|
|
|
<script>
|
|
<script>
|
|
|
import moment from 'moment'
|
|
import moment from 'moment'
|
|
|
import Cookies from 'js-cookie'
|
|
import Cookies from 'js-cookie'
|
|
|
|
|
+import Sortable from 'sortablejs'
|
|
|
import editorVue from '@/components/editor'
|
|
import editorVue from '@/components/editor'
|
|
|
import mixinRegionModule from '@/mixins/region-module.js'
|
|
import mixinRegionModule from '@/mixins/region-module.js'
|
|
|
const getInitialBasicForm = () => ({
|
|
const getInitialBasicForm = () => ({
|
|
@@ -369,6 +372,10 @@ export default {
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.initUploadSortable()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
// 自动暂存:每分钟保存一次(仅编辑模式)
|
|
// 自动暂存:每分钟保存一次(仅编辑模式)
|
|
|
this.autoSaveTimer = setInterval(() => {
|
|
this.autoSaveTimer = setInterval(() => {
|
|
|
this.autoSave()
|
|
this.autoSave()
|
|
@@ -534,6 +541,32 @@ export default {
|
|
|
this.fileListCover = fileList.map((item) => item) || []
|
|
this.fileListCover = fileList.map((item) => item) || []
|
|
|
this.basicForm.coverFile = ''
|
|
this.basicForm.coverFile = ''
|
|
|
},
|
|
},
|
|
|
|
|
+ // 初始化上传列表的拖拽排序
|
|
|
|
|
+ initUploadSortable () {
|
|
|
|
|
+ const setup = (ref, listKey, onChange) => {
|
|
|
|
|
+ const listEl = this.$refs[ref] && this.$refs[ref].$el && this.$refs[ref].$el.querySelector('.el-upload-list--picture-card')
|
|
|
|
|
+ if (!listEl || listEl.__sortable) return
|
|
|
|
|
+ listEl.__sortable = Sortable.create(listEl, {
|
|
|
|
|
+ animation: 150,
|
|
|
|
|
+ onEnd: (evt) => {
|
|
|
|
|
+ const arr = this[listKey]
|
|
|
|
|
+ if (!arr || arr.length < 2) return
|
|
|
|
|
+ const { oldIndex, newIndex } = evt
|
|
|
|
|
+ if (oldIndex === newIndex) return
|
|
|
|
|
+ const moved = arr.splice(oldIndex, 1)[0]
|
|
|
|
|
+ arr.splice(newIndex, 0, moved)
|
|
|
|
|
+ this[listKey] = [...arr]
|
|
|
|
|
+ onChange && onChange()
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ setup('coverUploadRef', 'fileListCover', () => {
|
|
|
|
|
+ this.basicForm.coverFile = this.fileListCover[0] ? this.fileListCover[0].url : ''
|
|
|
|
|
+ })
|
|
|
|
|
+ setup('bannerUploadRef', 'fileListBanner', () => {
|
|
|
|
|
+ this.basicForm.imageFiles = this.fileListBanner.map(item => item.url).join(',')
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
successHandleCover (res, file, fileList) {
|
|
successHandleCover (res, file, fileList) {
|
|
|
if (res.code !== 0) {
|
|
if (res.code !== 0) {
|
|
|
return this.$message.error(res.msg)
|
|
return this.$message.error(res.msg)
|