Browse Source

banner视频上传

feature/syp_points
songyunpeng 5 years ago
parent
commit
533409b166
  1. 36
      src/views/modules/news/banner-add-or-update.vue
  2. 8
      src/views/modules/news/notice-add-or-update.vue
  3. 12
      src/views/modules/news/notice.vue

36
src/views/modules/news/banner-add-or-update.vue

@ -23,7 +23,7 @@
show-word-limit show-word-limit
placeholder="标题"></el-input> placeholder="标题"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="所属机构"> <el-form-item label="所属机构" prop="allDeptIdsShow">
<el-cascader <el-cascader
v-model="dataForm.allDeptIdsShow" v-model="dataForm.allDeptIdsShow"
:options="options" :options="options"
@ -77,7 +77,7 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="banner位置"> <el-form-item label="banner位置" prop="position">
<el-select v-model="dataForm.position" <el-select v-model="dataForm.position"
placeholder="请选择"> placeholder="请选择">
<el-option v-for="item in positionList" <el-option v-for="item in positionList"
@ -103,6 +103,21 @@
class="el-icon-plus avatar-uploader-icon"></i> class="el-icon-plus avatar-uploader-icon"></i>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="banner视频"
v-loading="loading"
prop="videoUrl">
<el-upload class="avatar-uploader"
:action="this.uploadUrl"
:show-file-list="false"
:on-success="handleVideoSuccess"
:on-error="handelError"
:before-upload="beforeVideoUpload">
<video class="video" v-if="dataForm.videoUrl"
:src="dataForm.videoUrl" controls="controls"></video>
<i v-else
class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
</el-form> </el-form>
<template slot="footer"> <template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> <el-button @click="visible = false">{{ $t('cancel') }}</el-button>
@ -132,7 +147,8 @@ export default {
gridId: '', gridId: '',
grid: '', grid: '',
position: '0', position: '0',
allDeptIdsShow: [] allDeptIdsShow: [],
videoUrl: ''
}, },
bannerOptions: [], bannerOptions: [],
streetList: [], streetList: [],
@ -150,9 +166,6 @@ export default {
title: [ title: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } { required: true, message: this.$t('validate.required'), trigger: 'blur' }
], ],
imgUrl: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
bannerType: [ bannerType: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } { required: true, message: this.$t('validate.required'), trigger: 'blur' }
], ],
@ -241,9 +254,20 @@ export default {
this.dataForm.imgUrl = res.data.url this.dataForm.imgUrl = res.data.url
this.loading = false this.loading = false
}, },
handleVideoSuccess (res, file) {
this.dataForm.videoUrl = res.data.url
this.loading = false
},
beforeAvatarUpload (file) { beforeAvatarUpload (file) {
this.loading = true this.loading = true
}, },
beforeVideoUpload (file) {
console.log(file)
if (file.size > 52428800) {
return this.$message.error('文件大小不能超过50M')
}
this.loading = true
},
handelError () { handelError () {
this.loading = false this.loading = false
}, },

8
src/views/modules/news/notice-add-or-update.vue

@ -38,9 +38,9 @@
<el-select v-model="dataForm.noticeCategory" placeholder="请选择模块"> <el-select v-model="dataForm.noticeCategory" placeholder="请选择模块">
<el-option <el-option
v-for="item in optionNoticeCategoryCode" v-for="item in optionNoticeCategoryCode"
:key="item.moduleCode" :key="item.dictValue"
:label="item.name" :label="item.dictName"
:value="item.moduleCode"> :value="item.dictValue">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -339,7 +339,7 @@ export default {
this.loading = false this.loading = false
}, },
getListSimpleByDictType () { getListSimpleByDictType () {
this.$http.get(`/custom/module/noticeCategory`).then(({ data: res }) => { this.$http.get(`/news/notice/listSimple/notice_category`).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }

12
src/views/modules/news/notice.vue

@ -14,9 +14,9 @@
<el-select v-model="dataForm.noticeCategory" placeholder="请选择模块" clearable> <el-select v-model="dataForm.noticeCategory" placeholder="请选择模块" clearable>
<el-option <el-option
v-for="item in optionNoticeCategoryCode" v-for="item in optionNoticeCategoryCode"
:key="item.moduleCode" :key="item.dictValue"
:label="item.name" :label="item.dictName"
:value="item.moduleCode"> :value="item.dictValue">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -178,7 +178,7 @@ export default {
} }
}, },
getListSimpleByDictType () { getListSimpleByDictType () {
this.$http.get(`/custom/module/noticeCategory`).then(({ data: res }) => { this.$http.get(`/news/notice/listSimple/notice_category`).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
@ -187,8 +187,8 @@ export default {
}, },
noticeCategoryFormat (row, column) { noticeCategoryFormat (row, column) {
for (var property in this.optionNoticeCategoryCode) { for (var property in this.optionNoticeCategoryCode) {
if (row.noticeCategory === this.optionNoticeCategoryCode[property].moduleCode) { if (row.noticeCategory === this.optionNoticeCategoryCode[property].dictValue) {
return this.optionNoticeCategoryCode[property].name return this.optionNoticeCategoryCode[property].dictName
} }
} }
} }

Loading…
Cancel
Save