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

文章管理暂存

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