Browse Source

发布通知内容新增可以发布视频

feature/syp_points
liuchuang 5 years ago
parent
commit
2b37caa7da
  1. 39
      src/views/modules/news/notice-add-or-update.vue

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

@ -77,6 +77,21 @@
size="small">{{ $t('upload.button') }}</el-button> size="small">{{ $t('upload.button') }}</el-button>
</el-upload> --> </el-upload> -->
</el-form-item> </el-form-item>
<el-form-item label="banner视频"
v-loading="videoLoading"
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" height="178px" width="378px"></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>
@ -107,7 +122,8 @@ export default {
noticeTitle: '', noticeTitle: '',
mobile: '', mobile: '',
noticeContent: '', noticeContent: '',
allDeptIdsShow: [] allDeptIdsShow: [],
videoUrl: ''
}, },
value: '', value: '',
// //
@ -133,7 +149,8 @@ export default {
communityList: [], communityList: [],
gridList: [], gridList: [],
options: [], options: [],
optionNoticeCategoryCode: [] optionNoticeCategoryCode: [],
videoLoading: false
} }
}, },
computed: { computed: {
@ -148,9 +165,6 @@ export default {
noticeTitle: [ noticeTitle: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } { required: true, message: this.$t('validate.required'), trigger: 'blur' }
], ],
noticeContent: [
{ required: true, message: this.$t(' ') }
],
noticeCategory: [ noticeCategory: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } { required: true, message: this.$t('validate.required'), trigger: 'blur' }
] ]
@ -261,11 +275,7 @@ export default {
this.dataForm.noticeContent = this.removeHTMLTag(this.dataForm.noticeContent) this.dataForm.noticeContent = this.removeHTMLTag(this.dataForm.noticeContent)
if ((this.dataForm.noticeContent).length > 10000) { if ((this.dataForm.noticeContent).length > 10000) {
return this.$message.error('您输入的的内容已超过字数不能提交') return this.$message.error('您输入的的内容已超过字数不能提交')
} else if (this.dataForm.noticeContent.length === 0) {
return this.$message.error('通知内容不能空')
} }
} else {
return this.$message.error('通知内容不能为空')
} }
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate((valid) => {
if (!valid) { if (!valid) {
@ -334,11 +344,22 @@ export default {
this.loading = false this.loading = false
this.dataForm.noticeImageUrl = res.data.url this.dataForm.noticeImageUrl = res.data.url
}, },
handleVideoSuccess (res, file) {
this.dataForm.videoUrl = res.data.url
this.videoLoading = false
},
beforeAvatarUpload (file) { beforeAvatarUpload (file) {
this.loading = true this.loading = true
}, },
beforeVideoUpload (file) {
if (file.size > 524288000) {
return this.$message.error('文件大小不能超过500M')
}
this.videoLoading = true
},
handelError () { handelError () {
this.loading = false this.loading = false
this.videoLoading = false
}, },
getListSimpleByDictType () { getListSimpleByDictType () {
this.$http.get(`/news/notice/listSimple/notice_category`).then(({ data: res }) => { this.$http.get(`/news/notice/listSimple/notice_category`).then(({ data: res }) => {

Loading…
Cancel
Save