Commit 8df0e89d authored by 刘怀志's avatar 刘怀志

文章管理暂存

parent e558aa38
...@@ -14,14 +14,14 @@ import Qs from 'qs' ...@@ -14,14 +14,14 @@ import Qs from 'qs'
// 1. 查询新闻资讯列表 // 1. 查询新闻资讯列表
export function listSysContentNewsInformation(query) { export function listSysContentNewsInformation(query) {
return request({ return request({
url: '/cmsnews/querySysContentNewsInformationByPagination', url: '/cmsnews/list',
method: 'get', method: 'get',
params: query params: query
}) })
} }
// 2. 查询新闻资讯详细信息 // 2. 查询新闻资讯详细信息
export function getcmsnews(businessId) { export function getSysContentNewsInformation(businessId) {
return request({ return request({
url: '/cmsnews/detail/' + businessId, url: '/cmsnews/detail/' + businessId,
method: 'get' method: 'get'
...@@ -44,7 +44,7 @@ export function updateSysContentNewsInformation(data) { ...@@ -44,7 +44,7 @@ export function updateSysContentNewsInformation(data) {
data = Qs.stringify(data) data = Qs.stringify(data)
return request({ return request({
url: '/cmsnews/update/' + businessId, url: '/cmsnews/update/' + businessId,
method: 'post', method: 'put',
data data
}) })
} }
......
...@@ -7,6 +7,7 @@ const getters = { ...@@ -7,6 +7,7 @@ const getters = {
deptId: state => state.user.deptId, deptId: state => state.user.deptId,
specialTag: state => state.user.specialTag, specialTag: state => state.user.specialTag,
roles: state => state.user.roles, roles: state => state.user.roles,
userId: state => state.user.id,
introduction: state => state.user.introduction, introduction: state => state.user.introduction,
permissions: state => state.user.permissions, permissions: state => state.user.permissions,
permission_routes: state => state.permission.routes, permission_routes: state => state.permission.routes,
......
...@@ -11,6 +11,7 @@ const user = { ...@@ -11,6 +11,7 @@ const user = {
roles: [], roles: [],
permissions: [], permissions: [],
specialTag: '', specialTag: '',
id: '',
deptId: '' deptId: ''
}, },
...@@ -36,6 +37,9 @@ const user = { ...@@ -36,6 +37,9 @@ const user = {
}, },
SET_PERMISSIONS: (state, permissions) => { SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions state.permissions = permissions
},
SET_ID: (state, id) => {
state.id = id
} }
}, },
...@@ -72,6 +76,7 @@ const user = { ...@@ -72,6 +76,7 @@ const user = {
} }
commit('SET_PERMISSIONS', res.data.permissions) commit('SET_PERMISSIONS', res.data.permissions)
commit('SET_NAME', user.username) commit('SET_NAME', user.username)
commit('SET_ID', user.businessId)
commit('SET_DEPTID', user.deptId) commit('SET_DEPTID', user.deptId)
commit('SET_SPECIALTAG', user.specialTag) commit('SET_SPECIALTAG', user.specialTag)
commit('SET_AVATAR', avatar) commit('SET_AVATAR', avatar)
......
...@@ -4,9 +4,19 @@ ...@@ -4,9 +4,19 @@
<div v-show="showSwitch.courseContent" class="courseContent"> <div v-show="showSwitch.courseContent" class="courseContent">
<div class="search" style="border-bottom: 14px solid #f4f4f4"> <div class="search" style="border-bottom: 14px solid #f4f4f4">
<el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true"> <el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true">
<el-form-item label="所属商家:" prop="deptId">
<el-select v-model="queryParams.deptId" :disabled="!queryShop" filterable placeholder="请选择所属商家" style="width: 100%">
<el-option
v-for="(item,index) in deptList"
:key="index"
:label="item.unitName"
:value="item.businessId"
/>
</el-select>
</el-form-item>
<el-form-item label="标题:" prop="username"> <el-form-item label="标题:" prop="username">
<el-input <el-input
v-model.trim="queryParams.username" v-model.trim="queryParams.title"
placeholder="请输入标题" placeholder="请输入标题"
clearable clearable
:maxlength="30" :maxlength="30"
...@@ -14,16 +24,6 @@ ...@@ -14,16 +24,6 @@
style="width: 150px" style="width: 150px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="作者:" prop="username">
<el-input
v-model.trim="queryParams.username"
placeholder="请输入作者"
clearable
:maxlength="30"
size="small"
style="width: 150px"
/>
</el-form-item>
<el-form-item label="发布日期:" prop="releaseDate"> <el-form-item label="发布日期:" prop="releaseDate">
<el-date-picker <el-date-picker
v-model="dateRange" v-model="dateRange"
...@@ -64,13 +64,13 @@ ...@@ -64,13 +64,13 @@
@click="handleAdd" @click="handleAdd"
>{{ commonField.addName }}</el-button> >{{ commonField.addName }}</el-button>
<!-- //新增按钮--> <!-- //新增按钮-->
<!-- <el-button--> <!-- <el-button-->
<!-- :class="commonField.addClass"--> <!-- :class="commonField.addClass"-->
<!-- :type="commonField.typePrimary"--> <!-- :type="commonField.typePrimary"-->
<!-- :icon="commonField.addIcon"--> <!-- :icon="commonField.addIcon"-->
<!-- :size="commonField.smallSize"--> <!-- :size="commonField.smallSize"-->
<!-- @click="handleExamination"--> <!-- @click="handleExamination"-->
<!-- >{{ "跳转考核临时" }}</el-button>--> <!-- >{{ "跳转考核临时" }}</el-button>-->
</el-form-item> </el-form-item>
</div> </div>
</el-form> </el-form>
...@@ -83,9 +83,7 @@ ...@@ -83,9 +83,7 @@
<span>{{ scope.$index + 1 }}</span> <span>{{ scope.$index + 1 }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="left" prop="title" label="所属机构" width="300" show-overflow-tooltip />
<el-table-column align="left" prop="title" label="新闻标题" width="300" show-overflow-tooltip /> <el-table-column align="left" prop="title" label="新闻标题" width="300" show-overflow-tooltip />
<el-table-column align="left" prop="remarks" label="新闻摘要" width="300" show-overflow-tooltip />
<el-table-column align="left" label="新闻标题图" prop="pictureId"> <el-table-column align="left" label="新闻标题图" prop="pictureId">
<template slot-scope="scope"> <template slot-scope="scope">
<div :id="step(scope.$index)"> <div :id="step(scope.$index)">
...@@ -93,11 +91,11 @@ ...@@ -93,11 +91,11 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column align="left" prop="isForntPage" label="是否为头条新闻" show-overflow-tooltip>--> <!-- <el-table-column align="left" prop="isForntPage" label="是否为头条新闻" show-overflow-tooltip>-->
<!-- <template slot-scope="scope">--> <!-- <template slot-scope="scope">-->
<!-- <span>{{ scope.row.isForntPage === 1 ? '是' : '否' }}</span>--> <!-- <span>{{ scope.row.isForntPage === 1 ? '是' : '否' }}</span>-->
<!-- </template>--> <!-- </template>-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<el-table-column align="left" prop="isTop" width="150" label="是否为置顶新闻" show-overflow-tooltip> <el-table-column align="left" prop="isTop" width="150" label="是否为置顶新闻" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.isTop === 1 ? '是' : '否' }}</span> <span>{{ scope.row.isTop === 1 ? '是' : '否' }}</span>
...@@ -108,25 +106,35 @@ ...@@ -108,25 +106,35 @@
<span>{{ scope.row.isRecommended === 1 ? '是' : '否' }}</span> <span>{{ scope.row.isRecommended === 1 ? '是' : '否' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="left" prop="newsType" width="150" label="文章来源" show-overflow-tooltip>
<el-table-column align="left" prop="releaseStatus" label="发布状态" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <span>{{ newsTypeMap[scope.row.newsType] }}</span>
v-model="scope.row.flag"
class="switchDisabledStyle"
inactive-value="0"
active-value="1"
@click.native="handleStatusChange(scope.row)"
/>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column align="left" prop="releaseStatus" label="发布状态" show-overflow-tooltip>-->
<!-- <template slot-scope="scope">-->
<!-- <el-switch-->
<!-- v-model="scope.row.flag"-->
<!-- class="switchDisabledStyle"-->
<!-- inactive-value="0"-->
<!-- active-value="1"-->
<!-- @click.native="handleStatusChange(scope.row)"-->
<!-- />-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="left" prop="releaseDate" label="发布日期" show-overflow-tooltip> <el-table-column align="left" prop="releaseDate" label="发布日期" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.releaseDate }}</span> <span>{{ scope.row.releaseDate }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="left" prop="createDate" label="提交时间" show-overflow-tooltip> <el-table-column align="left" prop="readNum" label="阅读量" show-overflow-tooltip>
<template slot-scope="scope">
<span>{{ scope.row.readNum }}</span>
</template>
</el-table-column>
<!-- <el-table-column align="left" prop="createDate" label="提交时间" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.createDate }}</span> <span>{{ scope.row.createDate }}</span>
</template> </template>
...@@ -135,7 +143,7 @@ ...@@ -135,7 +143,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.nickName }}</span> <span>{{ scope.row.nickName }}</span>
</template> </template>
</el-table-column> </el-table-column>-->
<el-table-column align="center" label="操作" width="150"> <el-table-column align="center" label="操作" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
...@@ -184,6 +192,8 @@ import { ...@@ -184,6 +192,8 @@ import {
} from '@/api/contentManagement/sysContentNewsInformation' } from '@/api/contentManagement/sysContentNewsInformation'
import { error } from 'autoprefixer/lib/utils' import { error } from 'autoprefixer/lib/utils'
import { parseTime } from '@/utils' import { parseTime } from '@/utils'
import { listAllShop } from '@/api/sysUnit'
import { mapGetters } from 'vuex'
export default { export default {
name: 'Index', name: 'Index',
// components: { // components: {
...@@ -191,6 +201,12 @@ export default { ...@@ -191,6 +201,12 @@ export default {
// }, // },
data() { data() {
return { return {
newsTypeMap: {
'0': '爬虫',
'1': '超管自建',
'2': '单位管理员自建'
},
queryShop: true,
hasAddPerm: ['sys:contentNewsInformation:add'], hasAddPerm: ['sys:contentNewsInformation:add'],
hasUpdatePerm: ['sys:contentNewsInformation:update'], hasUpdatePerm: ['sys:contentNewsInformation:update'],
hasDetailPerm: ['sys:contentNewsInformation:query'], hasDetailPerm: ['sys:contentNewsInformation:query'],
...@@ -266,11 +282,13 @@ export default { ...@@ -266,11 +282,13 @@ export default {
// search area // search area
courseid: '', courseid: '',
coursename: '', coursename: '',
deptList: [],
queryParams: { queryParams: {
page: 1, page: 1,
rows: 10, rows: 10,
flag: '' flag: '',
deptId: '',
title: ''
}, },
// pagination // pagination
total: 0, total: 0,
...@@ -287,16 +305,34 @@ export default { ...@@ -287,16 +305,34 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters(['roles', 'deptId']),
commonField() { commonField() {
return commonField return commonField
} }
}, },
created() { created() {
this.roleFunction()
}, },
mounted: function() { mounted: function() {
this.loadData() this.loadData()
this.getDeptList()
}, },
methods: { methods: {
roleFunction() {
if (this.roles[0].roleKey !== 'admin') {
console.log('this.roles', this.roles)
this.queryShop = false
this.queryParams.deptId = this.deptId
}
},
// 获取所有部门信息
getDeptList() {
listAllShop().then(res => {
if (res.code === 200) {
this.deptList = res.data
}
})
},
step(index) { step(index) {
return 'step' + index return 'step' + index
}, },
...@@ -339,7 +375,9 @@ export default { ...@@ -339,7 +375,9 @@ export default {
this.queryParams = { this.queryParams = {
page: 1, page: 1,
rows: 10, rows: 10,
flag: '' flag: '',
deptId: '',
title: ''
} }
this.dateRange = [] this.dateRange = []
...@@ -364,6 +402,8 @@ export default { ...@@ -364,6 +402,8 @@ export default {
page: _this.queryParams.page, page: _this.queryParams.page,
rows: _this.queryParams.rows, rows: _this.queryParams.rows,
flag: _this.queryParams.flag, flag: _this.queryParams.flag,
title: _this.queryParams.title,
deptId: _this.queryParams.deptId,
// plate: _this.queryParams.plate, // plate: _this.queryParams.plate,
beginTime: _this.queryParams.beginTime, beginTime: _this.queryParams.beginTime,
endTime: _this.queryParams.endTime endTime: _this.queryParams.endTime
...@@ -374,7 +414,7 @@ export default { ...@@ -374,7 +414,7 @@ export default {
_this.bussid = [] _this.bussid = []
res.rows.forEach(item => { res.rows.forEach(item => {
item.srclist = [] item.srclist = []
item.srclist.push( item.pictureId) item.srclist.push(item.pictureId)
}) })
_this.tableData = res.rows _this.tableData = res.rows
_this.fullscreenLoading = false _this.fullscreenLoading = false
......
...@@ -142,8 +142,8 @@ ...@@ -142,8 +142,8 @@
</div> </div>
<!-- 按钮区 --> <!-- 按钮区 -->
<div class="btn-box"> <div class="btn-box">
<el-button v-if="controls.isOperation !== '3'" style="width: 80px; height: 40px;font-size: 16px; width: 138px;height: 38px " @click="submit">保存 <!-- <el-button v-if="controls.isOperation !== '3'" style="width: 80px; height: 40px;font-size: 16px; width: 138px;height: 38px " @click="submit">保存
</el-button> </el-button>-->
<el-button v-if="controls.isOperation !== '3'" style="width: 80px; height: 40px;font-size: 16px; width: 138px;height: 38px " type="primary" :loading="pubLoading" @click="publish">发布 <el-button v-if="controls.isOperation !== '3'" style="width: 80px; height: 40px;font-size: 16px; width: 138px;height: 38px " type="primary" :loading="pubLoading" @click="publish">发布
</el-button> </el-button>
<el-button v-if="controls.isOperation === '3'" style="width: 80px; height: 40px;font-size: 16px; width: 138px;height: 38px " @click="goBack">返回 <el-button v-if="controls.isOperation === '3'" style="width: 80px; height: 40px;font-size: 16px; width: 138px;height: 38px " @click="goBack">返回
...@@ -158,6 +158,7 @@ import { ...@@ -158,6 +158,7 @@ import {
} from '@/api/contentManagement/sysContentNewsInformation' } from '@/api/contentManagement/sysContentNewsInformation'
import { VueEditor } from 'vue2-editor' import { VueEditor } from 'vue2-editor'
import { uploadPublic } from '@/api/contentManagement/sysContest' import { uploadPublic } from '@/api/contentManagement/sysContest'
import {mapGetters} from "vuex";
export default { export default {
components: { components: {
...@@ -234,6 +235,8 @@ export default { ...@@ -234,6 +235,8 @@ export default {
weight: undefined, weight: undefined,
// isForntPage: undefined, // isForntPage: undefined,
isRecommended: undefined, isRecommended: undefined,
newsType: undefined,
tenant: undefined,
isTop: undefined isTop: undefined
}, },
// 状态 // 状态
...@@ -255,6 +258,7 @@ export default { ...@@ -255,6 +258,7 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters(['userId']),
// 第一种禁用情况 1.查看的情况 // 第一种禁用情况 1.查看的情况
secondFromDisabled() { secondFromDisabled() {
return (this.controls.isOperation === '3') return (this.controls.isOperation === '3')
...@@ -394,6 +398,7 @@ export default { ...@@ -394,6 +398,7 @@ export default {
publish() { publish() {
// 拷贝form // 拷贝form
const form = JSON.parse(JSON.stringify(this.form)) const form = JSON.parse(JSON.stringify(this.form))
// 转换时间格式 // 转换时间格式
this.pubLoading = true this.pubLoading = true
this.$refs.deviceFormRef.validate(valid => { this.$refs.deviceFormRef.validate(valid => {
...@@ -401,6 +406,7 @@ export default { ...@@ -401,6 +406,7 @@ export default {
if (this.form.businessId !== undefined) { if (this.form.businessId !== undefined) {
// 编辑 // 编辑
form.flag = '1' form.flag = '1'
form.newsType = '1'
updateSysContentNewsInformation(form).then(res => { updateSysContentNewsInformation(form).then(res => {
if (res.code === 200) { if (res.code === 200) {
this.$message({ this.$message({
...@@ -417,6 +423,8 @@ export default { ...@@ -417,6 +423,8 @@ export default {
}) })
} else { } else {
form.flag = '1' form.flag = '1'
form.newsType = '1'
form.tenant = this.userId
addSysContentNewsInformation(form).then(res => { addSysContentNewsInformation(form).then(res => {
if (res.code === 200) { if (res.code === 200) {
this.$message({ this.$message({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment