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') { %> <% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
<script> <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' // window.SITE_CONFIG['apiURL'] = 'https://epdc-test.elinkservice.cn/epdc-api'
</script> </script>
<% } %> <% } %>

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

@ -14,7 +14,7 @@
<el-input v-model="dataForm.url" <el-input v-model="dataForm.url"
maxlength="1000" maxlength="1000"
show-word-limit show-word-limit
placeholder="链接地址"></el-input> placeholder="链接地址(必须在微信公众平台添加安全业务域名)" />
</el-form-item> </el-form-item>
<el-form-item label="标题" <el-form-item label="标题"
prop="title"> prop="title">
@ -23,6 +23,11 @@
show-word-limit show-word-limit
placeholder="标题"></el-input> placeholder="标题"></el-input>
</el-form-item> </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-form-item label="所属机构">
<el-cascader v-model="dataForm.allDeptIdsShow" <el-cascader v-model="dataForm.allDeptIdsShow"
:options="options" :options="options"
@ -86,26 +91,19 @@ export default {
visible: false, visible: false,
dataForm: { dataForm: {
id: '', id: '',
sectionCode: '',
url: '', url: '',
title: '', title: '',
imgUrl: '', imgUrl: '',
bannerType: '', bannerType: '',
streetId: '',
street: '',
communityId: '',
community: '',
gridId: '',
grid: '',
position: '0', position: '0',
allDeptIdsShow: [] allDeptIdsShow: []
}, },
bannerOptions: [], bannerOptions: [],
streetList: [],
communityList: [],
gridList: [],
options: [], options: [],
uploadUrl: '', uploadUrl: '',
positionList: [], positionList: [],
sectionCodeList: [],
loading: false loading: false
} }
}, },
@ -124,10 +122,7 @@ export default {
bannerType: [ bannerType: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } { required: true, message: this.$t('validate.required'), trigger: 'blur' }
], ],
streetId: [ sectionCode: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
gridId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } { required: true, message: this.$t('validate.required'), trigger: 'blur' }
], ],
position: [ position: [
@ -147,7 +142,6 @@ export default {
this.options = res.data.options this.options = res.data.options
}) })
.catch(() => { }) .catch(() => { })
this.getDeptInfoList('street', localStorage.getItem('street') === null ? '1169154711480528897' : localStorage.getItem('street'))
this.getListFromDict('bannerType') this.getListFromDict('bannerType')
this.getListFromDict('bannerPosition') this.getListFromDict('bannerPosition')
}, },
@ -156,13 +150,12 @@ export default {
this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/oss/file/upload?token=${Cookies.get('token')}` this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/oss/file/upload?token=${Cookies.get('token')}`
this.visible = true this.visible = true
this.$nextTick(() => { this.$nextTick(() => {
this.dataForm.communityId = this.dataForm.streetId = this.dataForm.gridId = null
this.communityList = this.gridList = []
this.$refs['dataForm'].resetFields() this.$refs['dataForm'].resetFields()
if (this.dataForm.id) { if (this.dataForm.id) {
this.getInfo() this.getInfo()
} }
}) })
this.getsectionCodeList()
}, },
// //
getInfo () { getInfo () {
@ -171,20 +164,18 @@ export default {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
this.dataForm = res.data 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(() => { }) }).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 () { dataFormSubmitHandle: debounce(function () {
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate((valid) => {
@ -229,46 +220,6 @@ export default {
this.positionList = res.data this.positionList = res.data
} }
}).catch(() => { }) }).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" <el-card shadow="never"
class="aui-card--fill"> class="aui-card--fill">
<div class="mod-news__banner}"> <div class="mod-news__banner}">
<el-form :inline="true" <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
:model="dataForm" <el-form-item label="所属版块">
@keyup.enter.native="getDataList()"> <el-select v-model="dataForm.sectionCode" clearable placeholder="所属版块">
<el-form-item> <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" <el-input v-model="dataForm.title"
placeholder="请输入标题" placeholder="请输入标题"
clearable></el-input> clearable></el-input>
@ -122,8 +125,10 @@ export default {
}, },
dataForm: { dataForm: {
id: '', id: '',
title: '' title: '',
sectionCode: ''
}, },
sectionCodeList: [],
bannerOptions: [], bannerOptions: [],
positionList: [] positionList: []
} }
@ -134,11 +139,22 @@ export default {
created () { created () {
this.getListFromDict('bannerType') this.getListFromDict('bannerType')
this.getListFromDict('bannerPosition') this.getListFromDict('bannerPosition')
this.getsectionCodeList()
}, },
methods: { methods: {
bannerState: function (row, column) { bannerState: function (row, column) {
return row.state === '1' ? '已上架' : row.state === '0' ? '已下架' : '未知' 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) { soltOut (id) {
this.$confirm(this.$t('prompt.info', { 'handle': '下架' }), this.$t('下架'), { this.$confirm(this.$t('prompt.info', { 'handle': '下架' }), this.$t('下架'), {
confirmButtonText: this.$t('confirm'), confirmButtonText: this.$t('confirm'),

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

@ -115,6 +115,11 @@
type="text" type="text"
size="small" size="small"
@click="modifyOnLine(scope.row)">下线</el-button> @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> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -264,6 +269,27 @@ export default {
}).catch(() => { }).catch(() => {
this.dataListLoading = false 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: { components: {

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

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

Loading…
Cancel
Save