Browse Source

banner逻辑跟随新闻逻辑修改

feature/yujt_analysis_pc
yujt 5 years ago
parent
commit
44b3e9a34b
  1. 2
      public/index.html
  2. 89
      src/views/modules/news/banner-add-or-update.vue
  3. 26
      src/views/modules/news/banner.vue
  4. 26
      src/views/modules/news/news-safety.vue
  5. 1
      src/views/modules/news/newscategory-add-or-update.vue

2
public/index.html

@ -35,7 +35,7 @@
<!-- 开发环境 -->
<% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
<script>
window.SITE_CONFIG['apiURL'] = 'http://localhost:9094/epdc-api'
window.SITE_CONFIG['apiURL'] = 'http://localhost:10000/epdc-api'
// window.SITE_CONFIG['apiURL'] = 'https://epdc-test.elinkservice.cn/epdc-api'
</script>
<% } %>

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

@ -14,7 +14,7 @@
<el-input v-model="dataForm.url"
maxlength="1000"
show-word-limit
placeholder="链接地址"></el-input>
placeholder="链接地址(必须在微信公众平台添加安全业务域名)" />
</el-form-item>
<el-form-item label="标题"
prop="title">
@ -23,6 +23,11 @@
show-word-limit
placeholder="标题"></el-input>
</el-form-item>
<el-form-item label="所属版块" prop="sectionCode">
<el-select v-model="dataForm.sectionCode" clearable placeholder="所属版块">
<el-option v-for="item in sectionCodeList" :key="item.dictValue" :label="item.dictName" :value="item.dictValue" :disabled="item.dictValue === 'healthy_living'" />
</el-select>
</el-form-item>
<el-form-item label="所属机构">
<el-cascader v-model="dataForm.allDeptIdsShow"
:options="options"
@ -86,26 +91,19 @@ export default {
visible: false,
dataForm: {
id: '',
sectionCode: '',
url: '',
title: '',
imgUrl: '',
bannerType: '',
streetId: '',
street: '',
communityId: '',
community: '',
gridId: '',
grid: '',
position: '0',
allDeptIdsShow: []
},
bannerOptions: [],
streetList: [],
communityList: [],
gridList: [],
options: [],
uploadUrl: '',
positionList: [],
sectionCodeList: [],
loading: false
}
},
@ -124,10 +122,7 @@ export default {
bannerType: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
streetId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
gridId: [
sectionCode: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
position: [
@ -147,7 +142,6 @@ export default {
this.options = res.data.options
})
.catch(() => { })
this.getDeptInfoList('street', localStorage.getItem('street') === null ? '1169154711480528897' : localStorage.getItem('street'))
this.getListFromDict('bannerType')
this.getListFromDict('bannerPosition')
},
@ -156,13 +150,12 @@ export default {
this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/oss/file/upload?token=${Cookies.get('token')}`
this.visible = true
this.$nextTick(() => {
this.dataForm.communityId = this.dataForm.streetId = this.dataForm.gridId = null
this.communityList = this.gridList = []
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.getInfo()
}
})
this.getsectionCodeList()
},
//
getInfo () {
@ -171,20 +164,18 @@ export default {
return this.$message.error(res.msg)
}
this.dataForm = res.data
if (this.dataForm.streetId) {
if (this.dataForm.communityId === 0) {
this.dataForm.communityId = this.dataForm.gridId = null
}
this.getDeptInfoList('community', this.dataForm.streetId)
}
if (this.dataForm.communityId) {
if (this.dataForm.gridId === 0) {
this.dataForm.gridId = null
}
this.getDeptInfoList('grid', this.dataForm.communityId)
}
}).catch(() => { })
},
getsectionCodeList () {
this.$http.get(`/sys/dict/listSimple/function_section_article`)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.sectionCodeList = res.data
})
.catch(() => {})
},
//
dataFormSubmitHandle: debounce(function () {
this.$refs['dataForm'].validate((valid) => {
@ -229,46 +220,6 @@ export default {
this.positionList = res.data
}
}).catch(() => { })
},
//
getDeptInfoList (dataReceiver, faDeptId) {
this.$http.get(`/sys/dept/sublist/` + faDeptId).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
if (dataReceiver === 'street') {
this.streetList = res.data
} else if (dataReceiver === 'community') {
this.communityList = res.data
} else if (dataReceiver === 'grid') {
this.gridList = res.data
}
}).catch(() => { })
},
changeStreet () {
//
let choosenItem = this.streetList.filter(item => item.id === this.dataForm.streetId)[0]
this.dataForm.street = choosenItem.name
//
this.dataForm.communityId = this.dataForm.gridId = this.dataForm.community = this.dataForm.grid = null
this.communityList = this.gridList = []
//
this.getDeptInfoList('community', this.dataForm.streetId)
},
changeCommunity () {
//
let choosenItem = this.communityList.filter(item => item.id === this.dataForm.communityId)[0]
this.dataForm.community = choosenItem.name
//
this.dataForm.gridId = this.dataForm.grid = null
this.gridList = []
//
this.getDeptInfoList('grid', this.dataForm.communityId)
},
changeGrid () {
//
let choosenItem = this.gridList.filter(item => item.id === this.dataForm.gridId)[0]
this.dataForm.grid = choosenItem.name
}
}
}

26
src/views/modules/news/banner.vue

@ -2,10 +2,13 @@
<el-card shadow="never"
class="aui-card--fill">
<div class="mod-news__banner}">
<el-form :inline="true"
:model="dataForm"
@keyup.enter.native="getDataList()">
<el-form-item>
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item label="所属版块">
<el-select v-model="dataForm.sectionCode" clearable placeholder="所属版块">
<el-option v-for="item in sectionCodeList" :key="item.dictValue" :label="item.dictName" :value="item.dictValue" :disabled="item.dictValue === 'healthy_living'"/>
</el-select>
</el-form-item>
<el-form-item label="标题">
<el-input v-model="dataForm.title"
placeholder="请输入标题"
clearable></el-input>
@ -122,8 +125,10 @@ export default {
},
dataForm: {
id: '',
title: ''
title: '',
sectionCode: ''
},
sectionCodeList: [],
bannerOptions: [],
positionList: []
}
@ -134,11 +139,22 @@ export default {
created () {
this.getListFromDict('bannerType')
this.getListFromDict('bannerPosition')
this.getsectionCodeList()
},
methods: {
bannerState: function (row, column) {
return row.state === '1' ? '已上架' : row.state === '0' ? '已下架' : '未知'
},
getsectionCodeList () {
this.$http.get(`/sys/dict/listSimple/function_section_article`)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.sectionCodeList = res.data
})
.catch(() => {})
},
soltOut (id) {
this.$confirm(this.$t('prompt.info', { 'handle': '下架' }), this.$t('下架'), {
confirmButtonText: this.$t('confirm'),

26
src/views/modules/news/news-safety.vue

@ -115,6 +115,11 @@
type="text"
size="small"
@click="modifyOnLine(scope.row)">下线</el-button>
<el-button v-if="scope.row.bannerFlag === '0' && scope.row.newsUpDownState === '0' && new Date(scope.row.newsReleaseStartTime.replace('-', '/')) < new Date()
&& new Date(scope.row.newsReleaseEndTime.replace('-', '/')) > new Date() "
type="text"
size="small"
@click="newsToBanner(scope.row)">上banner</el-button>
</template>
</el-table-column>
</el-table>
@ -264,6 +269,27 @@ export default {
}).catch(() => {
this.dataListLoading = false
})
},
newsToBanner (row) {
this.$confirm(this.$t('prompt.info', { 'handle': '上banner' }), this.$t('上banner'), {
confirmButtonText: this.$t('confirm'),
cancelButtonText: this.$t('cancel'),
type: 'warning'
}).then(() => {
this.$http.post(`/news/news/newsToBanner/` + row.id).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.getDataList()
}).catch(() => { })
}).catch(() => { })
}
},
components: {

1
src/views/modules/news/newscategory-add-or-update.vue

@ -95,7 +95,6 @@ export default {
})
this.getsectionCodeList()
},
//
getsectionCodeList () {
this.$http.get(`/sys/dict/listSimple/function_section_article`)
.then(({ data: res }) => {

Loading…
Cancel
Save