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
placeholder="标题"></el-input>
</el-form-item>
<el-form-item label="所属机构">
<el-form-item label="所属机构" prop="allDeptIdsShow">
<el-cascader
v-model="dataForm.allDeptIdsShow"
:options="options"
@ -77,7 +77,7 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="banner位置">
<el-form-item label="banner位置" prop="position">
<el-select v-model="dataForm.position"
placeholder="请选择">
<el-option v-for="item in positionList"
@ -103,6 +103,21 @@
class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</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>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
@ -132,7 +147,8 @@ export default {
gridId: '',
grid: '',
position: '0',
allDeptIdsShow: []
allDeptIdsShow: [],
videoUrl: ''
},
bannerOptions: [],
streetList: [],
@ -150,9 +166,6 @@ export default {
title: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
imgUrl: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
bannerType: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
@ -241,9 +254,20 @@ export default {
this.dataForm.imgUrl = res.data.url
this.loading = false
},
handleVideoSuccess (res, file) {
this.dataForm.videoUrl = res.data.url
this.loading = false
},
beforeAvatarUpload (file) {
this.loading = true
},
beforeVideoUpload (file) {
console.log(file)
if (file.size > 52428800) {
return this.$message.error('文件大小不能超过50M')
}
this.loading = true
},
handelError () {
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-option
v-for="item in optionNoticeCategoryCode"
:key="item.moduleCode"
:label="item.name"
:value="item.moduleCode">
:key="item.dictValue"
:label="item.dictName"
:value="item.dictValue">
</el-option>
</el-select>
</el-form-item>
@ -339,7 +339,7 @@ export default {
this.loading = false
},
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) {
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-option
v-for="item in optionNoticeCategoryCode"
:key="item.moduleCode"
:label="item.name"
:value="item.moduleCode">
:key="item.dictValue"
:label="item.dictName"
:value="item.dictValue">
</el-option>
</el-select>
</el-form-item>
@ -178,7 +178,7 @@ export default {
}
},
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) {
return this.$message.error(res.msg)
}
@ -187,8 +187,8 @@ export default {
},
noticeCategoryFormat (row, column) {
for (var property in this.optionNoticeCategoryCode) {
if (row.noticeCategory === this.optionNoticeCategoryCode[property].moduleCode) {
return this.optionNoticeCategoryCode[property].name
if (row.noticeCategory === this.optionNoticeCategoryCode[property].dictValue) {
return this.optionNoticeCategoryCode[property].dictName
}
}
}

Loading…
Cancel
Save