Browse Source

人大代表,内容管理 修改界面增加日期字段

jly/task
LAPTOP-7F135LL2\jly 3 years ago
parent
commit
4e9942fdf8
  1. 915
      src/views/modules/member/newsmember-add-or-update.vue

915
src/views/modules/member/newsmember-add-or-update.vue

@ -1,90 +1,106 @@
<template>
<el-dialog :visible.sync="visible"
:title="!dataForm.id ? $t('add') : $t('update')"
:close-on-click-modal="false"
:close-on-press-escape="false"
@close="visible= false">
<el-form :model="dataForm"
:rules="dataRule"
v-loading="loading"
ref="dataForm"
:label-width="$i18n.locale === 'en-US' ? '120px' : '80px'">
<el-form-item label="所属模块"
prop="businessId">
<el-select v-model="dataForm.businessId" @change="businessChange" ref="businessName"
placeholder="请选择模块">
<el-option v-for="item in options"
:key="item.code"
:label="item.title"
:value="item.code">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="所属类别" v-if="trueOrFalse"
prop="categoryId">
<el-select v-model="dataForm.newsCateroryId" :disabled="!dataForm.businessId"
@change="categoryChange" ref="newsCateroryName"
placeholder="请选择类别">
<el-option v-for="item in categorys"
:key="item.id"
:label="item.categoryName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="所属栏目" v-if="trueOrFalse"
prop="newsSubCateroryId">
<el-select v-model="dataForm.newsSubCateroryId" :disabled="!dataForm.newsCateroryId"
placeholder="请选择栏目" ref="newsSubCateroryName">
<el-option v-for="item in subCategorys"
:key="item.id"
:label="item.categoryName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="标题"
prop="title">
<el-form-item>
<el-input v-model="dataForm.newsTitle"
maxlength="50"
show-word-limit
placeholder="请输入标题"
clearable></el-input>
</el-form-item>
</el-form-item>
<el-form-item prop="newsContent"
label="正文编辑">
<!-- 富文本编辑器, 容器 -->
<div id="J_quillEditor"></div>
<!-- 自定义上传图片功能 (使用element upload组件) -->
<el-upload :action="uploadUrl"
:show-file-list="false"
:before-upload="uploadBeforeUploadHandle"
:on-success="uploadSuccessHandle"
style="display: none;">
<el-button ref="uploadBtn"
type="primary"
size="small">{{ $t('upload.button') }}</el-button>
</el-upload>
</el-form-item>
<el-form-item label="新闻首图"
v-loading="loading"
prop="newsImageUrl">
<el-upload
ref="upload"
:action="uploadUrl"
list-type="picture-card"
:file-list="dataForm.images"
:limit=1
:on-remove="handleRemove"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
style="width:480px">
<i class="el-icon-plus"></i>
</el-upload>
<!-- <el-upload class="avatar-uploader"
<el-dialog :visible.sync="visible"
:title="!dataForm.id ? $t('add') : $t('update')"
:close-on-click-modal="false"
:close-on-press-escape="false"
@close="visible= false">
<el-form :model="dataForm"
:rules="dataRule"
v-loading="loading"
ref="dataForm"
:label-width="$i18n.locale === 'en-US' ? '120px' : '80px'">
<el-form-item label="所属模块"
prop="businessId">
<el-select v-model="dataForm.businessId"
@change="businessChange"
ref="businessName"
placeholder="请选择模块">
<el-option v-for="item in options"
:key="item.code"
:label="item.title"
:value="item.code">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="所属类别"
v-if="trueOrFalse"
prop="categoryId">
<el-select v-model="dataForm.newsCateroryId"
:disabled="!dataForm.businessId"
@change="categoryChange"
ref="newsCateroryName"
placeholder="请选择类别">
<el-option v-for="item in categorys"
:key="item.id"
:label="item.categoryName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="所属栏目"
v-if="trueOrFalse"
prop="newsSubCateroryId">
<el-select v-model="dataForm.newsSubCateroryId"
:disabled="!dataForm.newsCateroryId"
placeholder="请选择栏目"
ref="newsSubCateroryName">
<el-option v-for="item in subCategorys"
:key="item.id"
:label="item.categoryName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="日期"
prop="createdTime">
<el-date-picker v-model="dataForm.createdTime"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
placeholder="选择日期时间">
</el-date-picker>
</el-form-item>
<el-form-item label="标题"
prop="title">
<el-form-item>
<el-input v-model="dataForm.newsTitle"
maxlength="50"
show-word-limit
placeholder="请输入标题"
clearable></el-input>
</el-form-item>
</el-form-item>
<el-form-item prop="newsContent"
label="正文编辑">
<!-- 富文本编辑器, 容器 -->
<div id="J_quillEditor"></div>
<!-- 自定义上传图片功能 (使用element upload组件) -->
<el-upload :action="uploadUrl"
:show-file-list="false"
:before-upload="uploadBeforeUploadHandle"
:on-success="uploadSuccessHandle"
style="display: none;">
<el-button ref="uploadBtn"
type="primary"
size="small">{{ $t('upload.button') }}</el-button>
</el-upload>
</el-form-item>
<el-form-item label="新闻首图"
v-loading="loading"
prop="newsImageUrl">
<el-upload ref="upload"
:action="uploadUrl"
list-type="picture-card"
:file-list="dataForm.images"
:limit=1
:on-remove="handleRemove"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
style="width:480px">
<i class="el-icon-plus"></i>
</el-upload>
<!-- <el-upload class="avatar-uploader"
:action="uploadUrl"
:show-file-list="false"
:on-success="handleAvatarSuccess"
@ -97,402 +113,403 @@
<div slot="tip"
class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload> -->
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary"
@click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
<el-button v-if="dataForm.releaseState === '1'" type="primary" @click="dataFormReleaseHandle()">提报</el-button>
</template>
</el-dialog>
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary"
@click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
<el-button v-if="dataForm.releaseState === '1'"
type="primary"
@click="dataFormReleaseHandle()">提报</el-button>
</template>
</el-dialog>
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
import Cookies from 'js-cookie'
import debounce from 'lodash/debounce'
import 'quill/dist/quill.snow.css'
import Quill from 'quill'
import mixinViewModule from '@/mixins/view-module'
import 'quill/dist/quill.snow.css'
import AddOrUpdate from './newsmember-add-or-update'
export default {
mixins: [mixinViewModule],
data () {
return {
mixinViewModuleOptions: {
getDataListURL: '/news/newsmember/page',
getDataListIsPage: true,
deleteURL: '/news/newsmember',
deleteIsBatch: true
},
dataForm: {
images: [],
id: '',
businessId: '',
//categoryId: '',
newsCateroryId: '',
//subCategoryId: '',
newsSubCateroryId: '',
categoryName: '',
subCategoryName: '',
newsTitle: '',
approvalState: '',
approvalReason: '',
newsContent: '',
imageUrl: '',
allDeptIdsShow: []
},
trueOrFalse: true,
time: [],
streetList: [],
communityList: [],
gridList: [],
options: [],
categorys: [],
subCategorys: [],
loading: false,
//
quillEditor: null,
quillEditorToolbarOptions: [
['bold', 'italic', 'underline', 'strike'],
['blockquote', 'code-block', 'image'],
[{ 'header': 1 }, { 'header': 2 }],
[{ 'list': 'ordered' }, { 'list': 'bullet' }],
[{ 'script': 'sub' }, { 'script': 'super' }],
[{ 'indent': '-1' }, { 'indent': '+1' }],
[{ 'direction': 'rtl' }],
[{ 'size': ['small', false, 'large', 'huge'] }],
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
[{ 'color': [] }, { 'background': [] }],
[{ 'font': [] }],
[{ 'align': [] }],
['clean']
],
uploadUrl: '',
// end
fileList: [],
visible: false
}
},
created () {
this.getListCategory()
this.visible = true
this.$nextTick(() => {
//
this.hideUpload = false
this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/oss/file/uploadImg?token=${Cookies.get('token')}`
if (this.quillEditor) {
this.quillEditor.deleteText(0, this.quillEditor.getLength())
} else {
this.quillEditorHandle()
}
// end
})
},
computed: {
dataRule () {
return {
businessId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
newsTitle: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
newsSubCateroryId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
newsCateroryId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
newsContent: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
]
}
}
},
methods: {
init () {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.getInfo()
mixins: [mixinViewModule],
data() {
return {
mixinViewModuleOptions: {
getDataListURL: '/news/newsmember/page',
getDataListIsPage: true,
deleteURL: '/news/newsmember',
deleteIsBatch: true
},
dataForm: {
images: [],
id: '',
businessId: '',
//categoryId: '',
newsCateroryId: '',
//subCategoryId: '',
newsSubCateroryId: '',
categoryName: '',
subCategoryName: '',
newsTitle: '',
approvalState: '',
approvalReason: '',
newsContent: '',
imageUrl: '',
allDeptIdsShow: []
},
trueOrFalse: true,
time: [],
streetList: [],
communityList: [],
gridList: [],
options: [],
categorys: [],
subCategorys: [],
loading: false,
//
quillEditor: null,
quillEditorToolbarOptions: [
['bold', 'italic', 'underline', 'strike'],
['blockquote', 'code-block', 'image'],
[{ 'header': 1 }, { 'header': 2 }],
[{ 'list': 'ordered' }, { 'list': 'bullet' }],
[{ 'script': 'sub' }, { 'script': 'super' }],
[{ 'indent': '-1' }, { 'indent': '+1' }],
[{ 'direction': 'rtl' }],
[{ 'size': ['small', false, 'large', 'huge'] }],
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
[{ 'color': [] }, { 'background': [] }],
[{ 'font': [] }],
[{ 'align': [] }],
['clean']
],
uploadUrl: '',
// end
fileList: [],
visible: false
}
})
},
handleRemove (file, fileList) {
this.dataForm.images=[]
this.dataForm.newsImageUrl=''
},
businessChange (item) {
this.dataForm.newsCateroryId = ''
this.dataForm.newsSubCateroryId = ''
//
this.$http
.get(`/news/newsmembersection/options/` + item)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
created() {
this.getListCategory()
this.visible = true
this.$nextTick(() => {
//
this.hideUpload = false
this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/oss/file/uploadImg?token=${Cookies.get('token')}`
if (this.quillEditor) {
this.quillEditor.deleteText(0, this.quillEditor.getLength())
} else {
this.quillEditorHandle()
}
this.loading = false
this.categorys = res.data
this.trueOrFalse = true
if(res.data.length===0){
this.trueOrFalse = false
}
})
.catch(() => {
this.loading = false
})
// end
})
},
categoryChange (item) {
this.dataForm.newsSubCateroryId = ''
//
this.$http
.get(`/news/newsmembersection/suboptions/` + item)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
computed: {
dataRule() {
return {
businessId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
newsTitle: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
newsSubCateroryId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
newsCateroryId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
newsContent: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
]
}
this.loading = false
this.subCategorys = res.data
})
.catch(() => {
this.loading = false
})
},
//
getInfo () {
this.loading = true
this.$http.get(`/news/newsmember/${this.dataForm.id}`).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.dataForm = { ...this.dataForm, ...res.data }
this.dataForm.images=[]
if(res.data.newsImageUrl){
this.dataForm.images.push({ url: res.data.newsImageUrl})
}
},
methods: {
this.quillEditor.root.innerHTML = res.data.newsContent
//
this.$http
.get(`/news/newsmembersection/options/` + this.dataForm.businessId)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.loading = false
this.categorys = res.data
this.trueOrFalse = true
if(res.data.length===0){
this.trueOrFalse = false
}
init() {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.getInfo()
}
})
.catch(() => {
this.loading = false
},
handleRemove(file, fileList) {
this.dataForm.images = []
this.dataForm.newsImageUrl = ''
},
businessChange(item) {
this.dataForm.newsCateroryId = ''
this.dataForm.newsSubCateroryId = ''
//
this.$http
.get(`/news/newsmembersection/options/` + item)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.loading = false
this.categorys = res.data
this.trueOrFalse = true
if (res.data.length === 0) {
this.trueOrFalse = false
}
})
.catch(() => {
this.loading = false
})
},
categoryChange(item) {
this.dataForm.newsSubCateroryId = ''
//
this.$http
.get(`/news/newsmembersection/suboptions/` + item)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.loading = false
this.subCategorys = res.data
})
.catch(() => {
this.loading = false
})
},
//
getInfo() {
this.loading = true
this.$http.get(`/news/newsmember/${this.dataForm.id}`).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.dataForm = { ...this.dataForm, ...res.data }
this.dataForm.images = []
if (res.data.newsImageUrl) {
this.dataForm.images.push({ url: res.data.newsImageUrl })
}
this.quillEditor.root.innerHTML = res.data.newsContent
//
this.$http
.get(`/news/newsmembersection/options/` + this.dataForm.businessId)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.loading = false
this.categorys = res.data
this.trueOrFalse = true
if (res.data.length === 0) {
this.trueOrFalse = false
}
})
.catch(() => {
this.loading = false
})
//
this.$http
.get(`/news/newsmembersection/suboptions/` + this.dataForm.newsCateroryId)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.loading = false
this.subCategorys = res.data
})
.catch(() => {
this.loading = false
})
this.loading = false
}).catch(() => {
this.loading = false
})
//
this.$http
.get(`/news/newsmembersection/suboptions/` + this.dataForm.newsCateroryId)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.loading = false
this.subCategorys = res.data
},
//
getDeptInfoList(dataReceiver, faDeptId) {
if (!faDeptId) {
return
}
this.$http.get(`/sys/dept/sublist/` + faDeptId).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
if (dataReceiver === 'street') {
let all = [{ id: '1', name: '全部' }]
this.streetList = all.concat(res.data)
} else if (dataReceiver === 'community') {
this.communityList = res.data
} else if (dataReceiver === 'grid') {
this.gridList = res.data
}
}).catch(() => { })
},
changeStreet(event) {
let choosenItem = this.streetList.filter(item => item.id === this.dataForm.streetId)[0]
this.dataForm.street = choosenItem.name
this.dataForm.communityId = this.dataForm.deptId = this.dataForm.community = this.dataForm.grid = null
this.communityList = this.gridList = []
this.getDeptInfoList('community', event)
},
changeCommunity(event) {
let choosenItem = this.communityList.filter(item => item.id === this.dataForm.communityId)[0]
this.dataForm.community = choosenItem.name
this.dataForm.deptId = this.dataForm.grid = null
this.gridList = []
this.getDeptInfoList('grid', event)
},
changeGrid(event) {
let choosenItem = this.gridList.filter(item => item.id === this.dataForm.deptId)[0]
this.dataForm.grid = choosenItem.name
},
changeCategory() {
//
let choosenItem = this.categorys.filter(item => item.id === this.dataForm.categoryId)[0]
this.dataForm.categoryName = choosenItem.name
},
getListCategory() {
this.$http
.get(`/news/newsmembermenu/options/0`)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.loading = false
this.options = res.data
})
.catch(() => {
this.loading = false
})
},
//
quillEditorHandle() {
this.quillEditor = new Quill('#J_quillEditor', {
modules: {
toolbar: this.quillEditorToolbarOptions
},
theme: 'snow'
})
.catch(() => {
this.loading = false
this.quillEditor.container.style.height = `${300}px`
// // (使element upload)
this.quillEditor.getModule('toolbar').addHandler('image', () => {
this.$refs.uploadBtn.$el.click()
})
this.loading = false
}).catch(() => {
this.loading = false
})
},
//
getDeptInfoList (dataReceiver, faDeptId) {
if (!faDeptId) {
return
}
this.$http.get(`/sys/dept/sublist/` + faDeptId).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
if (dataReceiver === 'street') {
let all = [{ id: '1', name: '全部' }]
this.streetList = all.concat(res.data)
} else if (dataReceiver === 'community') {
this.communityList = res.data
} else if (dataReceiver === 'grid') {
this.gridList = res.data
}
}).catch(() => { })
},
changeStreet (event) {
let choosenItem = this.streetList.filter(item => item.id === this.dataForm.streetId)[0]
this.dataForm.street = choosenItem.name
this.dataForm.communityId = this.dataForm.deptId = this.dataForm.community = this.dataForm.grid = null
this.communityList = this.gridList = []
this.getDeptInfoList('community', event)
},
changeCommunity (event) {
let choosenItem = this.communityList.filter(item => item.id === this.dataForm.communityId)[0]
this.dataForm.community = choosenItem.name
this.dataForm.deptId = this.dataForm.grid = null
this.gridList = []
this.getDeptInfoList('grid', event)
},
changeGrid (event) {
let choosenItem = this.gridList.filter(item => item.id === this.dataForm.deptId)[0]
this.dataForm.grid = choosenItem.name
},
changeCategory () {
//
let choosenItem = this.categorys.filter(item => item.id === this.dataForm.categoryId)[0]
this.dataForm.categoryName = choosenItem.name
},
getListCategory () {
this.$http
.get(`/news/newsmembermenu/options/0`)
.then(({ data: res }) => {
//
this.quillEditor.on('text-change', () => {
this.dataForm.newsContent = this.quillEditor.root.innerHTML
if ((this.dataForm.newsContent).length > 10000) {
return this.$message.error('您输入的的内容已超过字数不能提交')
}
})
},
// ()
uploadBeforeUploadHandle(file) {
if (file.type !== 'image/jpg' && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/gif') {
this.$message.error(this.$t('upload.tip', { 'format': 'jpg、png、gif' }))
return false
}
},
// ()
uploadSuccessHandle(res, file, fileList) {
if (res.code !== 0) {
return this.$message.error(res.msg)
return this.$message.error(res.msg)
}
this.quillEditor.insertEmbed(this.quillEditor.getSelection().index, 'image', res.data.thumbnail)
},
//
handleAvatarSuccess(res, file) {
this.loading = false
this.options = res.data
})
.catch(() => {
this.loading = false
})
},
//
quillEditorHandle () {
this.quillEditor = new Quill('#J_quillEditor', {
modules: {
toolbar: this.quillEditorToolbarOptions
this.dataForm.newsImageUrl = res.data.thumbnail
},
theme: 'snow'
})
this.quillEditor.container.style.height = `${300}px`
// // (使element upload)
this.quillEditor.getModule('toolbar').addHandler('image', () => {
this.$refs.uploadBtn.$el.click()
})
//
this.quillEditor.on('text-change', () => {
this.dataForm.newsContent = this.quillEditor.root.innerHTML
if ((this.dataForm.newsContent).length > 10000) {
return this.$message.error('您输入的的内容已超过字数不能提交')
}
})
},
// ()
uploadBeforeUploadHandle (file) {
if (file.type !== 'image/jpg' && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/gif') {
this.$message.error(this.$t('upload.tip', { 'format': 'jpg、png、gif' }))
return false
}
},
// ()
uploadSuccessHandle (res, file, fileList) {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.quillEditor.insertEmbed(this.quillEditor.getSelection().index, 'image', res.data.thumbnail)
},
//
handleAvatarSuccess (res, file) {
this.loading = false
this.dataForm.newsImageUrl = res.data.thumbnail
},
beforeAvatarUpload (file) {
this.loading = true
},
setRegistTime () {
this.dataForm.releaseStartTime = this.time[0]
this.dataForm.releaseEndTime = this.time[1]
},
resetRegistTime () {
this.time = [this.dataForm.releaseStartTime.substr(0, 10), this.dataForm.releaseEndTime.substr(0, 10)]
},
// end
dataFormReleaseHandle () {
this.dataForm.releaseState = 0
this.dataFormSubmitHandle()
},
//
dataFormSubmitHandle: debounce(function () {
this.loading = true
if(this.trueOrFalse){
this.dataForm.newsProperty = this.$refs.newsCateroryName.selectedLabel
this.dataForm.newsColumn = this.$refs.newsSubCateroryName.selectedLabel
}else{
this.dataForm.newsCateroryId = ''
this.dataForm.newsSubCateroryId = ''
this.dataForm.newsColumn = ''
this.dataForm.newsProperty = ''
}
this.dataForm.approvalState = '0'
this.dataForm.approvalReason = ''
// if ((this.dataForm.newsContent).length > 10000) {
// return this.$message.error('')
// }
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false
}
this.$http['put']('/news/newsmember/', this.dataForm).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.$message({
message: this.$t('prompt.success'),
type: 'success',
duration: 500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
this.dataForm = {}
beforeAvatarUpload(file) {
this.loading = true
},
setRegistTime() {
this.dataForm.releaseStartTime = this.time[0]
this.dataForm.releaseEndTime = this.time[1]
},
resetRegistTime() {
this.time = [this.dataForm.releaseStartTime.substr(0, 10), this.dataForm.releaseEndTime.substr(0, 10)]
},
// end
dataFormReleaseHandle() {
this.dataForm.releaseState = 0
this.dataFormSubmitHandle()
},
//
dataFormSubmitHandle: debounce(function () {
this.loading = true
if (this.trueOrFalse) {
this.dataForm.newsProperty = this.$refs.newsCateroryName.selectedLabel
this.dataForm.newsColumn = this.$refs.newsSubCateroryName.selectedLabel
} else {
this.dataForm.newsCateroryId = ''
this.dataForm.newsSubCateroryId = ''
this.dataForm.newsColumn = ''
this.dataForm.newsProperty = ''
}
})
this.loading = false
}).catch(() => {
this.loading = false
})
})
}, 1000, { 'leading': true, 'trailing': false })
},
components: {
AddOrUpdate
}
this.dataForm.approvalState = '0'
this.dataForm.approvalReason = ''
// if ((this.dataForm.newsContent).length > 10000) {
// return this.$message.error('')
// }
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false
}
this.$http['put']('/news/newsmember/', this.dataForm).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.$message({
message: this.$t('prompt.success'),
type: 'success',
duration: 500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
this.dataForm = {}
}
})
this.loading = false
}).catch(() => {
this.loading = false
})
})
}, 1000, { 'leading': true, 'trailing': false })
},
components: {
AddOrUpdate
}
}
</script>
<style>
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409eff;
border-color: #409eff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
.avatar {
width: 178px;
height: 178px;
display: block;
width: 178px;
height: 178px;
display: block;
}
</style>

Loading…
Cancel
Save