Browse Source

修改bug

master
qushutong 6 years ago
parent
commit
75cb594348
  1. 3
      src/views/modules/news/banner-add-or-update.vue
  2. 24
      src/views/modules/news/news-add-or-update.vue
  3. 38
      src/views/modules/news/news-publish.vue
  4. 35
      src/views/modules/news/news.vue
  5. 35
      src/views/modules/news/newsdraft.vue
  6. 6
      src/views/modules/news/notice-add-or-update.vue

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

@ -9,8 +9,11 @@
@keyup.enter.native="dataFormSubmitHandle()"
:label-width="$i18n.locale === 'en-US' ? '120px' : '80px'">
<el-form-item label="链接地址"
v-if="dataForm.newsFlag !== '1'"
prop="url">
<el-input v-model="dataForm.url"
maxlength="1000"
show-word-limit
placeholder="链接地址"></el-input>
</el-form-item>
<el-form-item label="标题"

24
src/views/modules/news/news-add-or-update.vue

@ -59,6 +59,8 @@
prop="newsTitle">
<el-form-item>
<el-input v-model="dataForm.newsTitle"
maxlength="50"
show-word-limit
placeholder="请输入标题"
clearable></el-input>
</el-form-item>
@ -79,6 +81,7 @@
</el-upload>
</el-form-item>
<el-form-item label="新闻首图"
v-loading="loading"
prop="newsImageUrl">
<el-upload class="avatar-uploader"
:action="uploadUrl"
@ -152,6 +155,7 @@ export default {
communityList: [],
gridList: [],
categorys: [],
loading: false,
//
quillEditor: null,
quillEditorToolbarOptions: [
@ -311,6 +315,9 @@ export default {
//
this.quillEditor.on('text-change', () => {
this.dataForm.newsContent = this.quillEditor.root.innerHTML
if ((this.dataForm.newsContent).length > 10000) {
return this.$message.error('您输入的的内容已超过字数不能提交')
}
})
},
// ()
@ -329,19 +336,11 @@ export default {
},
//
handleAvatarSuccess (res, file) {
this.loading = false
this.dataForm.newsImageUrl = res.data.url
},
beforeAvatarUpload (file) {
const isJPG = (file.type === 'image/jpeg' || file.type === 'image/png')
const isLt2M = file.size / 1024 / 1024 < 0.5
if (!isJPG) {
this.$message.error('上传图片只能是 JPG/PNG 格式!')
}
if (!isLt2M) {
this.$message.error('上传图片大小不能超过 500KB!')
}
return isJPG && isLt2M
this.loading = true
},
setRegistTime () {
this.dataForm.newsReleaseStartTime = this.time[0]
@ -353,6 +352,9 @@ export default {
// end
//
dataFormSubmitHandle: debounce(function () {
if ((this.dataForm.newsContent).length > 10000) {
return this.$message.error('您输入的的内容已超过字数不能提交')
}
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false
@ -368,10 +370,10 @@ export default {
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
this.dataForm = {}
}
})
}).catch(() => { })
this.dataForm = {}
})
}, 1000, { 'leading': true, 'trailing': false })
},

38
src/views/modules/news/news-publish.vue

@ -293,6 +293,10 @@ export default {
//
this.quillEditor.on('text-change', () => {
this.dataForm.newsContent = this.quillEditor.root.innerHTML
console.log(this.dataForm.newsContent.length)
if ((this.dataForm.newsContent).length > 10000) {
return this.$message.error('您输入的的内容已超过字数')
}
})
},
// ()
@ -316,6 +320,9 @@ export default {
// end
//
dataFormSubmitHandle: debounce(function () {
if ((this.dataForm.newsContent).length > 10000) {
return this.$message.error('您输入的的内容已超过字数不能提交')
}
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false
@ -355,6 +362,9 @@ export default {
}, 1000, { 'leading': true, 'trailing': false }),
// 稿
draftDataFormSubmitHandle: debounce(function () {
if ((this.dataForm.newsContent).length > 10000) {
return this.$message.error('您输入的的内容已超过字数不能提交')
}
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false
@ -368,9 +378,25 @@ export default {
type: 'success',
duration: 500,
onClose: () => {
this.dataForm = {}
this.dataForm.id = ''
this.dataForm.streetId = ''
this.dataForm.communityId = null
this.dataForm.gridId = null
this.dataForm.newsCateroryId = ''
this.dataForm.newsTitle = ''
this.dataForm.newsReleaseStartTime = ''
this.dataForm.newsReleaseEndTime = ''
this.dataForm.newsContent = ''
this.dataForm.newsImageUrl = ''
this.dataForm.street = ''
this.dataForm.community = null
this.dataForm.grid = null
this.dataForm.newsProperty = ''
this.visible = false
this.time = []
this.quillEditor.root.innerHTML = ''
this.dataForm.communityId = this.dataForm.streetId = this.dataForm.gridId = null
this.communityList = this.gridList = []
}
})
}).catch(() => { })
@ -381,17 +407,7 @@ export default {
this.dataForm.newsImageUrl = res.data.url
},
beforeAvatarUpload (file) {
const isJPG = (file.type === 'image/jpeg' || file.type === 'image/png')
const isLt2M = file.size / 1024 / 1024 < 0.5
if (!isJPG) {
this.$message.error('上传图片只能是 JPG/PNG 格式!')
}
if (!isLt2M) {
this.$message.error('上传图片大小不能超过 500KB!')
}
this.loading = true
return isJPG && isLt2M
}
},
components: {

35
src/views/modules/news/news.vue

@ -66,7 +66,7 @@
<el-form-item label="关键字">
<el-form-item>
<el-input v-model="dataForm.keyword"
placeholder="请输入题"
placeholder="请输入题"
clearable></el-input>
</el-form-item>
</el-form-item>
@ -96,7 +96,7 @@
</template>
</el-table-column>
<el-table-column prop="newsTitle"
label="题名称"
label="题名称"
header-align="center"
align="center"></el-table-column>
<el-table-column prop="readingAmount"
@ -339,6 +339,37 @@ export default {
this.getDataList()
}).catch(() => { })
}).catch(() => { })
},
//
getDataList () {
if (this.time === null) {
this.dataForm.startTime = ''
this.dataForm.endTime = ''
}
this.dataListLoading = true
this.$http.get(
this.mixinViewModuleOptions.getDataListURL,
{
params: {
order: this.order,
orderField: this.orderField,
page: this.mixinViewModuleOptions.getDataListIsPage ? this.page : null,
limit: this.mixinViewModuleOptions.getDataListIsPage ? this.limit : null,
...this.dataForm
}
}
).then(({ data: res }) => {
this.dataListLoading = false
if (res.code !== 0) {
this.dataList = []
this.total = 0
return this.$message.error(res.msg)
}
this.dataList = this.mixinViewModuleOptions.getDataListIsPage ? res.data.list : res.data
this.total = this.mixinViewModuleOptions.getDataListIsPage ? res.data.total : 0
}).catch(() => {
this.dataListLoading = false
})
}
},
components: {

35
src/views/modules/news/newsdraft.vue

@ -65,7 +65,7 @@
<el-form-item label="关键字">
<el-form-item>
<el-input v-model="dataForm.keyword"
placeholder="请输入题"
placeholder="请输入题"
clearable></el-input>
</el-form-item>
</el-form-item>
@ -95,7 +95,7 @@
</template>
</el-table-column>
<el-table-column prop="newsTitle"
label="题名称"
label="题名称"
header-align="center"
align="center"></el-table-column>
<el-table-column prop="readingAmount"
@ -295,6 +295,37 @@ export default {
this.getDataList()
}).catch(() => { })
}).catch(() => { })
},
//
getDataList () {
if (this.time === null) {
this.dataForm.startTime = ''
this.dataForm.endTime = ''
}
this.dataListLoading = true
this.$http.get(
this.mixinViewModuleOptions.getDataListURL,
{
params: {
order: this.order,
orderField: this.orderField,
page: this.mixinViewModuleOptions.getDataListIsPage ? this.page : null,
limit: this.mixinViewModuleOptions.getDataListIsPage ? this.limit : null,
...this.dataForm
}
}
).then(({ data: res }) => {
this.dataListLoading = false
if (res.code !== 0) {
this.dataList = []
this.total = 0
return this.$message.error(res.msg)
}
this.dataList = this.mixinViewModuleOptions.getDataListIsPage ? res.data.list : res.data
this.total = this.mixinViewModuleOptions.getDataListIsPage ? res.data.total : 0
}).catch(() => {
this.dataListLoading = false
})
}
},
components: {

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

@ -155,6 +155,9 @@ export default {
//
this.quillEditor.on('text-change', () => {
this.dataForm.noticeContent = this.quillEditor.root.innerHTML
if ((this.dataForm.noticeContent).length > 10000) {
return this.$message.error('您输入的的内容已超过字数不能提交')
}
})
},
// ()
@ -215,6 +218,9 @@ export default {
},
//
dataFormSubmitHandle: debounce(function () {
if ((this.dataForm.noticeContent).length > 10000) {
return this.$message.error('您输入的的内容已超过字数不能提交')
}
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false

Loading…
Cancel
Save