|
@@ -7,19 +7,19 @@
|
|
|
<el-col :span="8">
|
|
|
<div class="searchBox">
|
|
|
<div class="searchTitle">资讯题目:</div>
|
|
|
- <el-input placeholder="请输入资讯题目" autocomplete="off" v-model="getApiData.title"/>
|
|
|
+ <el-input placeholder="请输入资讯题目" autocomplete="off" v-model="getApiData.title" />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<div class="searchBox">
|
|
|
<div class="searchTitle">栏目名称:</div>
|
|
|
- <el-input placeholder="请输入栏目名称" autocomplete="off" v-model="getApiData.category_name"/>
|
|
|
+ <el-input placeholder="请输入栏目名称" autocomplete="off" v-model="getApiData.category_name" />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<div class="searchBox">
|
|
|
<div class="searchTitle">作者:</div>
|
|
|
- <el-input placeholder="请输入作者姓名" autocomplete="off" v-model="getApiData.author"/>
|
|
|
+ <el-input placeholder="请输入作者姓名" autocomplete="off" v-model="getApiData.author" />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -35,10 +35,16 @@
|
|
|
</el-select>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <div class="searchBox">
|
|
|
+ <div class="searchTitle">ID:</div>
|
|
|
+ <el-input placeholder="请输入ID" autocomplete="off" v-model="getApiData.id" />
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
+
|
|
|
<div class="layerBoxNoBg">
|
|
|
<div>
|
|
|
<el-button type="primary" @click="goCreat">发布资讯</el-button>
|
|
@@ -52,49 +58,63 @@
|
|
|
|
|
|
<!--表格内容 start------------------------------------------------------------>
|
|
|
<div class="layerBox">
|
|
|
- <tableTitle :name="tableDivTitle"/>
|
|
|
+ <tableTitle :name="tableDivTitle" />
|
|
|
<el-row>
|
|
|
<template>
|
|
|
<el-table :data="tableData" style="width: 100%">
|
|
|
- <el-table-column fixed prop="id" label="编号" width="80"></el-table-column>
|
|
|
- <el-table-column prop="title" label="资讯题目" width=""></el-table-column>
|
|
|
- <el-table-column prop="category_name" label="栏目名称" width=""></el-table-column>
|
|
|
- <el-table-column prop="islink" label="是否引用外链" width=""></el-table-column>
|
|
|
+ <el-table-column fixed prop="id" label="ID" width="80"></el-table-column>
|
|
|
+ <el-table-column prop="title" label="资讯题目" width="350">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-popover placement="top-start" width="340" trigger="hover" :content="scope.row.title">
|
|
|
+ <span slot="reference" class="titleWidth">{{ scope.row.title }}</span>
|
|
|
+ </el-popover>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="category_name" label="栏目名称" width="100"></el-table-column>
|
|
|
+ <!-- <el-table-column prop="islink" label="是否引用外链" width=""></el-table-column>
|
|
|
<el-table-column prop="linkurl" label="是否为原创" width="">
|
|
|
<template slot-scope="scope">
|
|
|
- <span v-if="scope.row.is_original==1">
|
|
|
+ <span v-if="scope.row.is_original == 1">
|
|
|
是
|
|
|
</span>
|
|
|
- <span v-if="scope.row.is_original==0">
|
|
|
+ <span v-if="scope.row.is_original == 0">
|
|
|
否
|
|
|
</span>
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="author" label="作者" width=""></el-table-column>
|
|
|
- <el-table-column prop="created_at" label="创建时间" width=""></el-table-column>
|
|
|
- <el-table-column prop="updated_at" label="修改时间" width=""></el-table-column>
|
|
|
- <el-table-column prop="status" label="状态" width="150">
|
|
|
+</el-table-column>
|
|
|
+<el-table-column prop="author" label="作者" width=""></el-table-column>
|
|
|
+<el-table-column prop="created_at" label="创建时间" width=""></el-table-column> -->
|
|
|
+ <el-table-column prop="updated_at" label="修改时间" width="160"></el-table-column>
|
|
|
+ <el-table-column prop="status" label="状态" width="">
|
|
|
<template slot-scope="scope">
|
|
|
- <span v-if="scope.row.status==0">待审核</span>
|
|
|
- <span v-if="scope.row.status==1">已通过</span>
|
|
|
- <span v-if="scope.row.status==2">已拒绝</span>
|
|
|
+ <span v-if="scope.row.status == 0">待审核</span>
|
|
|
+ <span v-if="scope.row.status == 1">已通过</span>
|
|
|
+ <span v-if="scope.row.status == 2">已拒绝</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column fixed="right" label="操作" width="350" header-align="center" v-if="creatNews_user_type == 10000">
|
|
|
+ <el-table-column fixed="right" label="操作" width="350" header-align="center"
|
|
|
+ v-if="creatNews_user_type == 10000">
|
|
|
<template slot-scope="scope">
|
|
|
<div class="listBtnBox">
|
|
|
- <div class="listLinkBtn" @click="selectRow(scope.row.cat_arr_id, scope.row)"><i class="el-icon-full-screen"></i>网站权限</div>
|
|
|
- <div class="listUpBtn" @click="returnRow(scope.row.id, tableData)"><i class="el-icon-refresh-right"></i>撤回</div>
|
|
|
- <div class="listDeleteBtn" @click="deleteRow(scope.row.id, tableData)"><i class="el-icon-delete"></i>删除</div>
|
|
|
- <div class="listEditBtn" @click="goEdit(scope.row.id, tableData)"><i class="el-icon-edit-outline"></i>编辑</div>
|
|
|
+ <div class="listLinkBtn" @click="selectRow(scope.row.cat_arr_id, scope.row)"><i
|
|
|
+ class="el-icon-full-screen"></i>网站权限</div>
|
|
|
+ <div class="listUpBtn" @click="returnRow(scope.row.id, tableData)"><i
|
|
|
+ class="el-icon-refresh-right"></i>撤回</div>
|
|
|
+ <div class="listDeleteBtn" @click="deleteRow(scope.row.id, tableData)"><i
|
|
|
+ class="el-icon-delete"></i>删除</div>
|
|
|
+ <div class="listEditBtn" @click="goEdit(scope.row.id, tableData)"><i
|
|
|
+ class="el-icon-edit-outline"></i>编辑</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column fixed="right" label="操作" width="180" header-align="center" v-if="creatNews_user_type != 10000">
|
|
|
+ <el-table-column fixed="right" label="操作" width="180" header-align="center"
|
|
|
+ v-if="creatNews_user_type != 10000">
|
|
|
<template slot-scope="scope">
|
|
|
<div class="listBtnBox">
|
|
|
- <div class="listDeleteBtn" @click="deleteRow(scope.row.id, tableData)"><i class="el-icon-delete"></i>删除</div>
|
|
|
- <div class="listEditBtn" @click="goEdit(scope.row.id, tableData)"><i class="el-icon-edit-outline"></i>编辑</div>
|
|
|
+ <div class="listDeleteBtn" @click="deleteRow(scope.row.id, tableData)"><i
|
|
|
+ class="el-icon-delete"></i>删除</div>
|
|
|
+ <div class="listEditBtn" @click="goEdit(scope.row.id, tableData)"><i
|
|
|
+ class="el-icon-edit-outline"></i>编辑</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -106,7 +126,9 @@
|
|
|
<div class="alignBox">
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
- <el-pagination @size-change="handleSizeChange" :current-page="getApiData.page" @current-change="handleCurrentChange" :page-size="10" layout="total, prev, pager, next, jumper" :total="allCount"></el-pagination>
|
|
|
+ <el-pagination @size-change="handleSizeChange" :current-page="getApiData.page"
|
|
|
+ @current-change="handleCurrentChange" :page-size="10" layout="total, prev, pager, next, jumper"
|
|
|
+ :total="allCount"></el-pagination>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
@@ -115,9 +137,10 @@
|
|
|
|
|
|
<!--弹出框:选择要发布的网站 start------------------------------------------------------------>
|
|
|
<el-dialog title="请选择不要发布的网站" :visible.sync="selectStatusWindow" :close-on-click-modal="false">
|
|
|
- <el-form label-position="left" >
|
|
|
+ <el-form label-position="left">
|
|
|
<div class="formDiv">
|
|
|
- <el-table v-loading="loading" ref="multipleTable" :data="webSiteData" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
|
|
|
+ <el-table v-loading="loading" ref="multipleTable" :data="webSiteData" tooltip-effect="dark"
|
|
|
+ style="width: 100%" @selection-change="handleSelectionChange">
|
|
|
<el-table-column type="selection" width="55"></el-table-column>
|
|
|
<el-table-column prop="website_id" label="网站id"></el-table-column>
|
|
|
<el-table-column prop="website_name" label="网站名称"></el-table-column>
|
|
@@ -126,7 +149,7 @@
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<div>
|
|
|
- <el-button type="info" @click="selectStatusWindow=false">取消</el-button>
|
|
|
+ <el-button type="info" @click="selectStatusWindow = false">取消</el-button>
|
|
|
<el-button type="primary" @click="selectWebSiteToServe">确定</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -150,48 +173,49 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
//1.列表和分页相关 start ------------------------------------------------------------>
|
|
|
- tableDivTitle:"资讯列表",
|
|
|
- tableData:[],//内容
|
|
|
+ tableDivTitle: "资讯列表",
|
|
|
+ tableData: [],//内容
|
|
|
webSiteData: [],//可选网站列表
|
|
|
- creatNews_user_type:0,//用户类型
|
|
|
+ creatNews_user_type: 0,//用户类型
|
|
|
//选择要发布的网站
|
|
|
- webSiteForm:{
|
|
|
- ignore_ids:[]
|
|
|
+ webSiteForm: {
|
|
|
+ ignore_ids: []
|
|
|
},
|
|
|
- ids:[],//待选网站列表
|
|
|
- loading:false,//loading
|
|
|
- editId:0,//要修改的网站id
|
|
|
- selectStatusWindow:false,//反选窗口
|
|
|
- getApiData:{
|
|
|
- title:"",//标题
|
|
|
- category_name:"",//导航池id
|
|
|
- author:"",//作者
|
|
|
- islink:"",//是否使用外链
|
|
|
- status:1,//资讯状态
|
|
|
- page:1,//当前是第几页
|
|
|
- pageSize:10,//一共多少条
|
|
|
+ ids: [],//待选网站列表
|
|
|
+ loading: false,//loading
|
|
|
+ editId: 0,//要修改的网站id
|
|
|
+ selectStatusWindow: false,//反选窗口
|
|
|
+ getApiData: {
|
|
|
+ id: "",//id
|
|
|
+ title: "",//标题
|
|
|
+ category_name: "",//导航池id
|
|
|
+ author: "",//作者
|
|
|
+ islink: "",//是否使用外链
|
|
|
+ status: 1,//资讯状态
|
|
|
+ page: 1,//当前是第几页
|
|
|
+ pageSize: 10,//一共多少条
|
|
|
},
|
|
|
- allCount:0,//总条数
|
|
|
+ allCount: 0,//总条数
|
|
|
//分页相关 end ------------------------------------------------------------>
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
//1.列表和分页相关 start ------------------------------------------------------------>
|
|
|
//1.1 开始请求列表信息方法
|
|
|
- getData(type){
|
|
|
- if(type=="search"){
|
|
|
+ getData(type) {
|
|
|
+ if (type == "search") {
|
|
|
this.getApiData.page = 1;
|
|
|
}
|
|
|
- this.$store.dispatch('news/getArticleList',this.getApiData).then(res=> {
|
|
|
+ this.$store.dispatch('news/getArticleList', this.getApiData).then(res => {
|
|
|
//格式化:islink=0为不使用外面 islink=1为使用外链
|
|
|
//status=1为显示 status=2为不显示
|
|
|
let data = [];
|
|
|
- for(let item of res.data.rows){
|
|
|
+ for (let item of res.data.rows) {
|
|
|
// if(item.status==0){item.status="隐藏"}
|
|
|
// if(item.status==1){item.status="显示"}
|
|
|
// if(item.status==404){item.status="已删除"}
|
|
|
- if(item.islink==0){item.islink="否"}
|
|
|
- if(item.islink==1){item.islink="是"}
|
|
|
+ if (item.islink == 0) { item.islink = "否" }
|
|
|
+ if (item.islink == 1) { item.islink = "是" }
|
|
|
data.push(item)
|
|
|
}
|
|
|
this.tableData = res.data.rows; //给与内容
|
|
@@ -204,14 +228,14 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
//1.2 删除内容
|
|
|
- deleteRow(id){
|
|
|
+ deleteRow(id) {
|
|
|
this.$confirm('此操作将永久删除该条数据, 是否继续?', '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
}).then(() => {
|
|
|
console.log("当前删除:" + id)
|
|
|
- this.$store.dispatch('news/delArticle',{id:id}).then(res=> {
|
|
|
+ this.$store.dispatch('news/delArticle', { id: id }).then(res => {
|
|
|
this.getData();
|
|
|
this.$message({
|
|
|
type: 'success',
|
|
@@ -231,13 +255,13 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
//1.3 修改网站状态
|
|
|
- upRow(id,status){
|
|
|
+ upRow(id, status) {
|
|
|
let data = {
|
|
|
- id:id,
|
|
|
- status:status
|
|
|
+ id: id,
|
|
|
+ status: status
|
|
|
}
|
|
|
- this.$store.dispatch('news/upArticleStatus',data).then(res=> {
|
|
|
- if(res.code==200){
|
|
|
+ this.$store.dispatch('news/upArticleStatus', data).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
this.$message({
|
|
|
type: 'success',
|
|
|
message: '资讯状态已修改!'
|
|
@@ -262,8 +286,9 @@ export default {
|
|
|
this.getData();
|
|
|
},
|
|
|
//1.6 重置按钮
|
|
|
- clearSearchList(){
|
|
|
+ clearSearchList() {
|
|
|
this.tableData = [];
|
|
|
+ this.getApiData.id = "";
|
|
|
this.getApiData.title = "";
|
|
|
this.getApiData.category_name = "";
|
|
|
this.getApiData.author = "";
|
|
@@ -277,14 +302,14 @@ export default {
|
|
|
|
|
|
//2.添加新闻 start ------------------------------------------------------------>
|
|
|
//跳转到资讯发布页面
|
|
|
- goCreat(){
|
|
|
+ goCreat() {
|
|
|
this.$router.push({
|
|
|
path: '/creatNews',
|
|
|
});
|
|
|
},
|
|
|
- goEdit(id){
|
|
|
+ goEdit(id) {
|
|
|
let data = {
|
|
|
- id:id
|
|
|
+ id: id
|
|
|
}
|
|
|
this.$router.push({
|
|
|
path: '/creatNews',
|
|
@@ -295,7 +320,7 @@ export default {
|
|
|
|
|
|
//3.编辑新闻 start ------------------------------------------------------------>
|
|
|
//3.1 打开反选窗口
|
|
|
- selectRow(cid,row){
|
|
|
+ selectRow(cid, row) {
|
|
|
console.log(row)
|
|
|
this.selectStatusWindow = true;
|
|
|
//给与编辑的id
|
|
@@ -303,42 +328,42 @@ export default {
|
|
|
//给与编辑的状态
|
|
|
this.editStatus = row.status;
|
|
|
//把cid转换成数组,然后取出最后一位
|
|
|
-
|
|
|
+
|
|
|
let cidLast = "";
|
|
|
// 判断cid是否为数组
|
|
|
if (!Array.isArray(cid)) {
|
|
|
let cidArr = cid.replace(/[\[\]]/g, '').split(',');
|
|
|
cidLast = cidArr[cidArr.length - 1];
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
cidLast = cid[cid.length - 1];
|
|
|
}
|
|
|
- this.getWebsiteNavPoolSite(cidLast,row)
|
|
|
+ this.getWebsiteNavPoolSite(cidLast, row)
|
|
|
},
|
|
|
//3.2 获取可选网站列表
|
|
|
- getWebsiteNavPoolSite(cid,row){
|
|
|
+ getWebsiteNavPoolSite(cid, row) {
|
|
|
this.loading = true;
|
|
|
let ignoreIds = JSON.parse(row.ignore_ids);
|
|
|
this.webSiteData = [];
|
|
|
- this.$store.dispatch('news/getWebsiteNavPoolSite',{category_id:cid}).then(res=>{
|
|
|
+ this.$store.dispatch('news/getWebsiteNavPoolSite', { category_id: cid }).then(res => {
|
|
|
//this.webSiteData = res.data;
|
|
|
- for(let item of res.data){
|
|
|
- if(item.website_name!=null){
|
|
|
+ for (let item of res.data) {
|
|
|
+ if (item.website_name != null) {
|
|
|
this.webSiteData.push(item)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//延迟一会返显,否则可能显示不了
|
|
|
- if(res.data.length>0&&ignoreIds!=null){
|
|
|
- setTimeout(()=>{
|
|
|
- for(let index in this.webSiteData){
|
|
|
- if(ignoreIds.includes(this.webSiteData[index].website_id)){
|
|
|
+ if (res.data.length > 0 && ignoreIds != null) {
|
|
|
+ setTimeout(() => {
|
|
|
+ for (let index in this.webSiteData) {
|
|
|
+ if (ignoreIds.includes(this.webSiteData[index].website_id)) {
|
|
|
//调用回显方法
|
|
|
this.toggleSelection([this.webSiteData[index]])
|
|
|
}
|
|
|
}
|
|
|
this.loading = false;
|
|
|
- },500)
|
|
|
- }else{
|
|
|
+ }, 500)
|
|
|
+ } else {
|
|
|
this.loading = false;
|
|
|
}
|
|
|
})
|
|
@@ -360,9 +385,9 @@ export default {
|
|
|
this.ids = val;
|
|
|
},
|
|
|
//3.5 提交选择的网站列表
|
|
|
- selectWebSiteToServe(id){
|
|
|
+ selectWebSiteToServe(id) {
|
|
|
let ids = [];
|
|
|
- for(let item of this.ids){
|
|
|
+ for (let item of this.ids) {
|
|
|
ids.push(item.website_id)
|
|
|
}
|
|
|
//把数组转换为字符串
|
|
@@ -370,49 +395,49 @@ export default {
|
|
|
//把数组转换为字符串
|
|
|
let idsStr = JSON.stringify(ids);
|
|
|
|
|
|
- if(idsStr.length==0){
|
|
|
+ if (idsStr.length == 0) {
|
|
|
this.$message.error("至少需要选择一个网站!")
|
|
|
return;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
let data = {
|
|
|
- id:this.editId,
|
|
|
- ignore_ids:idsStr,
|
|
|
- status:this.editStatus
|
|
|
+ id: this.editId,
|
|
|
+ ignore_ids: idsStr,
|
|
|
+ status: this.editStatus
|
|
|
}
|
|
|
- this.$store.dispatch('news/upArticleStatus',data).then(res=>{
|
|
|
+ this.$store.dispatch('news/upArticleStatus', data).then(res => {
|
|
|
console.log(res)
|
|
|
- if(res.code==200){
|
|
|
+ if (res.code == 200) {
|
|
|
this.$message({
|
|
|
type: 'success',
|
|
|
message: '资讯绑定网站成功!'
|
|
|
});
|
|
|
this.selectStatusWindow = false;
|
|
|
this.getData();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
this.$message.error(res.data.msg)
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
//3.6 撤回审核
|
|
|
- returnRow(id){
|
|
|
+ returnRow(id) {
|
|
|
this.$confirm('确定要撤回吗?', '提示', {
|
|
|
confirmButtonText: '撤回',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
}).then(() => {
|
|
|
//撤回,把文章状态修改为0,重新进行审核
|
|
|
- this.upRow(id,0)
|
|
|
+ this.upRow(id, 0)
|
|
|
})
|
|
|
},
|
|
|
//3.5 修改文章状态
|
|
|
- upRow(id,status){
|
|
|
+ upRow(id, status) {
|
|
|
let data = {
|
|
|
- id:id,
|
|
|
- status:status
|
|
|
+ id: id,
|
|
|
+ status: status
|
|
|
}
|
|
|
- this.$store.dispatch('news/upArticleStatus',data).then(res=> {
|
|
|
- if(res.code==200){
|
|
|
+ this.$store.dispatch('news/upArticleStatus', data).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
this.$message({
|
|
|
type: 'success',
|
|
|
message: '操作成功!'
|
|
@@ -424,7 +449,7 @@ export default {
|
|
|
//3.编辑新闻 end ------------------------------------------------------------>
|
|
|
|
|
|
},
|
|
|
- mounted(){
|
|
|
+ mounted() {
|
|
|
this.creatNews_user_type = getUseType()
|
|
|
//1.获得初始数据
|
|
|
this.getData();
|
|
@@ -433,5 +458,10 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="less">
|
|
|
-
|
|
|
+.titleWidth {
|
|
|
+ width: 350px;
|
|
|
+ white-space: nowrap;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+}
|
|
|
</style>
|