Browse Source

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

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

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

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

Loading…
Cancel
Save