|
@@ -35,15 +35,6 @@
|
|
</el-select>
|
|
</el-select>
|
|
</div>
|
|
</div>
|
|
</el-col>
|
|
</el-col>
|
|
- <el-col :span="8">
|
|
|
|
- <div class="searchBox">
|
|
|
|
- <div class="searchTitle">资讯状态:</div>
|
|
|
|
- <el-select v-model="getApiData.status" placeholder="请选择..">
|
|
|
|
- <el-option label="待发布" value="0"></el-option>
|
|
|
|
- <el-option label="已发布" value="1"></el-option>
|
|
|
|
- </el-select>
|
|
|
|
- </div>
|
|
|
|
- </el-col>
|
|
|
|
</el-row>
|
|
</el-row>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -65,7 +56,7 @@
|
|
<el-row>
|
|
<el-row>
|
|
<template>
|
|
<template>
|
|
<el-table :data="tableData" style="width: 100%">
|
|
<el-table :data="tableData" style="width: 100%">
|
|
- <el-table-column fixed prop="id" label="编号" width="50"></el-table-column>
|
|
|
|
|
|
+ <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="title" label="资讯题目" width=""></el-table-column>
|
|
<el-table-column prop="category_name" 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 prop="islink" label="是否引用外链" width=""></el-table-column>
|
|
@@ -82,26 +73,24 @@
|
|
<el-table-column prop="author" label="作者" width=""></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="created_at" label="创建时间" width=""></el-table-column>
|
|
<el-table-column prop="updated_at" label="修改时间" width=""></el-table-column>
|
|
<el-table-column prop="updated_at" label="修改时间" width=""></el-table-column>
|
|
- <el-table-column prop="status" label="状态" width="" v-if="$store.state.user.usertype == 10000">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <span v-if="scope.row.status==404">404</span>
|
|
|
|
- <el-switch
|
|
|
|
- v-else
|
|
|
|
- v-model="scope.row.status"
|
|
|
|
- :active-value="1"
|
|
|
|
- :inactive-value="0"
|
|
|
|
- @change="upRow(scope.row.id,scope.row.status)"
|
|
|
|
- ></el-switch>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column prop="status" label="状态" width="" v-else>
|
|
|
|
|
|
+ <el-table-column prop="status" label="状态" width="150">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<span v-if="scope.row.status==0">待审核</span>
|
|
<span v-if="scope.row.status==0">待审核</span>
|
|
<span v-if="scope.row.status==1">已通过</span>
|
|
<span v-if="scope.row.status==1">已通过</span>
|
|
<span v-if="scope.row.status==2">已拒绝</span>
|
|
<span v-if="scope.row.status==2">已拒绝</span>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column fixed="right" label="操作" width="200" header-align="center">
|
|
|
|
|
|
+ <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>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column fixed="right" label="操作" width="180" header-align="center" v-if="creatNews_user_type != 10000">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<div class="listBtnBox">
|
|
<div class="listBtnBox">
|
|
<div class="listDeleteBtn" @click="deleteRow(scope.row.id, tableData)"><i class="el-icon-delete"></i>删除</div>
|
|
<div class="listDeleteBtn" @click="deleteRow(scope.row.id, tableData)"><i class="el-icon-delete"></i>删除</div>
|
|
@@ -123,6 +112,26 @@
|
|
</div>
|
|
</div>
|
|
<!--分页 end------------------------------------------------------------>
|
|
<!--分页 end------------------------------------------------------------>
|
|
<!--表格内容 end------------------------------------------------------------>
|
|
<!--表格内容 end------------------------------------------------------------>
|
|
|
|
+
|
|
|
|
+ <!--弹出框:选择要发布的网站 start------------------------------------------------------------>
|
|
|
|
+ <el-dialog title="请选择不要发布的网站" :visible.sync="selectStatusWindow" :close-on-click-modal="false">
|
|
|
|
+ <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-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>
|
|
|
|
+ </el-table>
|
|
|
|
+ </div>
|
|
|
|
+ </el-form>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <div>
|
|
|
|
+ <el-button type="info" @click="selectStatusWindow=false">取消</el-button>
|
|
|
|
+ <el-button type="primary" @click="selectWebSiteToServe">确定</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ <!--弹出框:选择要发布的网站 end------------------------------------------------------------>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -131,6 +140,8 @@
|
|
import tableTitle from './components/tableTitle';
|
|
import tableTitle from './components/tableTitle';
|
|
//引入公用样式
|
|
//引入公用样式
|
|
import '@/styles/global.less';
|
|
import '@/styles/global.less';
|
|
|
|
+//获得用户身份
|
|
|
|
+import { getUseType } from '@/utils/auth'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
components: {
|
|
components: {
|
|
@@ -141,13 +152,22 @@ export default {
|
|
//1.列表和分页相关 start ------------------------------------------------------------>
|
|
//1.列表和分页相关 start ------------------------------------------------------------>
|
|
tableDivTitle:"资讯列表",
|
|
tableDivTitle:"资讯列表",
|
|
tableData:[],//内容
|
|
tableData:[],//内容
|
|
|
|
+ webSiteData: [],//可选网站列表
|
|
|
|
+ creatNews_user_type:0,//用户类型
|
|
|
|
+ //选择要发布的网站
|
|
|
|
+ webSiteForm:{
|
|
|
|
+ ignore_ids:[]
|
|
|
|
+ },
|
|
|
|
+ ids:[],//待选网站列表
|
|
|
|
+ loading:false,//loading
|
|
editId:0,//要修改的网站id
|
|
editId:0,//要修改的网站id
|
|
|
|
+ selectStatusWindow:false,//反选窗口
|
|
getApiData:{
|
|
getApiData:{
|
|
title:"",//标题
|
|
title:"",//标题
|
|
category_name:"",//导航池id
|
|
category_name:"",//导航池id
|
|
author:"",//作者
|
|
author:"",//作者
|
|
islink:"",//是否使用外链
|
|
islink:"",//是否使用外链
|
|
- status:"",//资讯状态
|
|
|
|
|
|
+ status:1,//资讯状态
|
|
page:1,//当前是第几页
|
|
page:1,//当前是第几页
|
|
pageSize:10,//一共多少条
|
|
pageSize:10,//一共多少条
|
|
},
|
|
},
|
|
@@ -270,10 +290,142 @@ export default {
|
|
path: '/creatNews',
|
|
path: '/creatNews',
|
|
query: data
|
|
query: data
|
|
});
|
|
});
|
|
- }
|
|
|
|
|
|
+ },
|
|
//添加新闻 end ------------------------------------------------------------>
|
|
//添加新闻 end ------------------------------------------------------------>
|
|
|
|
+
|
|
|
|
+ //3.编辑新闻 start ------------------------------------------------------------>
|
|
|
|
+ //3.1 打开反选窗口
|
|
|
|
+ selectRow(cid,row){
|
|
|
|
+ console.log(row)
|
|
|
|
+ this.selectStatusWindow = true;
|
|
|
|
+ //给与编辑的id
|
|
|
|
+ this.editId = row.id;
|
|
|
|
+ //给与编辑的状态
|
|
|
|
+ this.editStatus = row.status;
|
|
|
|
+ //把cid转换成数组,然后取出最后一位
|
|
|
|
+
|
|
|
|
+ let cidLast = "";
|
|
|
|
+ // 判断cid是否为数组
|
|
|
|
+ if (!Array.isArray(cid)) {
|
|
|
|
+ let cidArr = cid.replace(/[\[\]]/g, '').split(',');
|
|
|
|
+ cidLast = cidArr[cidArr.length - 1];
|
|
|
|
+ }else{
|
|
|
|
+ cidLast = cid[cid.length - 1];
|
|
|
|
+ }
|
|
|
|
+ this.getWebsiteNavPoolSite(cidLast,row)
|
|
|
|
+ },
|
|
|
|
+ //3.2 获取可选网站列表
|
|
|
|
+ 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.webSiteData = res.data;
|
|
|
|
+ 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)){
|
|
|
|
+ //调用回显方法
|
|
|
|
+ this.toggleSelection([this.webSiteData[index]])
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.loading = false;
|
|
|
|
+ },500)
|
|
|
|
+ }else{
|
|
|
|
+ this.loading = false;
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ //3.3 回显 选中的方法
|
|
|
|
+ toggleSelection(rows) {
|
|
|
|
+ console.log(rows)
|
|
|
|
+ if (rows) {
|
|
|
|
+ rows.forEach(row => {
|
|
|
|
+ this.$refs.multipleTable.toggleRowSelection(row);
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.$refs.multipleTable.clearSelection();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //3.4 把选择的网站保存到待选择的网站列表
|
|
|
|
+ handleSelectionChange(val) {
|
|
|
|
+ console.log(val)
|
|
|
|
+ this.ids = val;
|
|
|
|
+ },
|
|
|
|
+ //3.5 提交选择的网站列表
|
|
|
|
+ selectWebSiteToServe(id){
|
|
|
|
+ let ids = [];
|
|
|
|
+ for(let item of this.ids){
|
|
|
|
+ ids.push(item.website_id)
|
|
|
|
+ }
|
|
|
|
+ //把数组转换为字符串
|
|
|
|
+ //let idsStr = ids.join(',');
|
|
|
|
+ //把数组转换为字符串
|
|
|
|
+ let idsStr = JSON.stringify(ids);
|
|
|
|
+
|
|
|
|
+ if(idsStr.length==0){
|
|
|
|
+ this.$message.error("至少需要选择一个网站!")
|
|
|
|
+ return;
|
|
|
|
+ }else{
|
|
|
|
+ let data = {
|
|
|
|
+ id:this.editId,
|
|
|
|
+ ignore_ids:idsStr,
|
|
|
|
+ status:this.editStatus
|
|
|
|
+ }
|
|
|
|
+ this.$store.dispatch('news/upArticleStatus',data).then(res=>{
|
|
|
|
+ console.log(res)
|
|
|
|
+ if(res.code==200){
|
|
|
|
+ this.$message({
|
|
|
|
+ type: 'success',
|
|
|
|
+ message: '资讯绑定网站成功!'
|
|
|
|
+ });
|
|
|
|
+ this.selectStatusWindow = false;
|
|
|
|
+ this.getData();
|
|
|
|
+ }else{
|
|
|
|
+ this.$message.error(res.data.msg)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //3.6 撤回审核
|
|
|
|
+ returnRow(id){
|
|
|
|
+ this.$confirm('确定要撤回吗?', '提示', {
|
|
|
|
+ confirmButtonText: '撤回',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ }).then(() => {
|
|
|
|
+ //撤回,把文章状态修改为0,重新进行审核
|
|
|
|
+ this.upRow(id,0)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ //3.5 修改文章状态
|
|
|
|
+ upRow(id,status){
|
|
|
|
+ let data = {
|
|
|
|
+ id:id,
|
|
|
|
+ status:status
|
|
|
|
+ }
|
|
|
|
+ this.$store.dispatch('news/upArticleStatus',data).then(res=> {
|
|
|
|
+ if(res.code==200){
|
|
|
|
+ this.$message({
|
|
|
|
+ type: 'success',
|
|
|
|
+ message: '操作成功!'
|
|
|
|
+ });
|
|
|
|
+ this.getData();
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ //3.编辑新闻 end ------------------------------------------------------------>
|
|
|
|
+
|
|
},
|
|
},
|
|
mounted(){
|
|
mounted(){
|
|
|
|
+ this.creatNews_user_type = getUseType()
|
|
//1.获得初始数据
|
|
//1.获得初始数据
|
|
this.getData();
|
|
this.getData();
|
|
}
|
|
}
|