提交 acfee2c9 编写于 作者: chendeli's avatar chendeli

话题

上级 f7e49685
......@@ -69,6 +69,7 @@
<template slot-scope="scope">
<el-button type="primary" size="small" @click="edit(scope.row)">编辑</el-button> <el-button type="primary" v-if="scope.row.status == 3 || scope.row.status == 1" size="small" @click="optFun(scope.row,'发布')">发布</el-button>
<el-button type="primary" v-if="scope.row.status == 2" size="small" @click="optFun(scope.row,'下线')">下线</el-button>
<el-button type="primary" size="small" @click="topicManage(scope.row)">话题管理</el-button>
</template>
</el-table-column>
......@@ -228,6 +229,10 @@ export default {
this.$router.push({path: 'creat-discuss',query:{id:item.id}})
},
topicManage(item){
},
// 发布、下线
optFun(row,str) {
let status = 0;
......
......@@ -44,6 +44,11 @@ export default {
icon: 'el-icon-setting',
index: 'discuss-list'
},
{
title: '话题管理',
icon: 'el-icon-setting',
index: 'topic-list'
},
]
},
......
<template>
<el-dialog title="话题" :visible.sync="dialogFormVisible">
<el-form :model="form" class="topicOpt">
<el-form-item label="主题" :label-width="formLabelWidth">
<el-input v-model="form.name" auto-complete="off" clearable size="mini"></el-input>
</el-form-item>
<el-form-item label="内容" :label-width="formLabelWidth">
<el-input type="textarea" v-model="form.name" auto-complete="off" clearable size="mini"></el-input>
</el-form-item>
<el-form-item label="话题配图" :label-width="formLabelWidth">
<el-upload
action="https://jsonplaceholder.typicode.com/posts/"
list-type="picture-card"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove">
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible" size="tiny">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
</div>
</el-dialog>
</template>
<script>
import { doUpload, getFilePath } from "../../utils/qiniu-util";
import { mapGetters } from "vuex";
import { openLoading, closeLoading } from "../../utils/utils";
import * as commonUtil from "../../utils/utils";
let vm = null;
export default {
data() {
return {
formLabelWidth:"80px",
form:{},
id:null,
dialogImageUrl:'',
dialogVisible:false,
};
},
props:{
isShow:{
default:false,
type:Boolean
}
},
computed: {
...mapGetters(["_token", "idType"])
},
created() {
this.id = this.$route.query.id
if(this.id){
this.getDissById(this.id)
}
this.dialogFormVisible = this.isShow
},
// 挂载到Dom完成时
mounted: function() {
},
methods: {
handlePictureCardPreview(){
},
handleRemove(){
},
//返回
goBack(){
this.$router.back(-1)
},
showError(str){
this.$message({
message: str,
type: 'warning'
});
},
//获取讨论组件详细
getDissById(id){
this.GET('/interaction/discuss/'+id).then((res) => {
// closeLoading(vm)
if( res.code == '000000' ) {
}
})
}
}
};
</script>
<style lang="scss">
.topicOpt{
.el-input__inner,.el-textarea__inner{
width:300px;
}
.el-form-item__label{
// line-height: 26px;
}
}
</style>
\ No newline at end of file
<template>
<div class="item-component-wrap">
<bread-crumb
:curmbFirst="curmbFirst"
:curmbSecond="curmbSecond">
</bread-crumb>
<div class="component-content screenSet" id="screenSet">
<div class="search-title">查询条件</div>
<el-row :gutter="30" class="row" type="flex" style="margin-top: 10px;">
<el-form ref="serchForm" :model="searchParam" label-width="75px" style="width:100%;">
<el-col :span="6">
<el-form-item label="话题名称:">
<el-input clearable v-model="searchParam.theme" size="mini" placeholder="请输入话题名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="创建日期:">
<el-date-picker v-model="searchParam.time" size="mini" type="date" placeholder="选择日期"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="创建人:">
<el-input clearable v-model="searchParam.name" size="mini" placeholder="请输入组件名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="最后修改人:">
<el-input clearable v-model="searchParam.name" size="mini" placeholder="请输入组件名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="状态:">
<el-select clearable v-model="searchParam.status" size="mini" placeholder="请选择发布状态">
<el-option
v-for="(item,index) in statuSelect"
:key="index"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col style="text-align:right;padding:0 30px 15px 0;">
<el-button type="primary" size="small" @click="search">查询</el-button>
<el-button type="default" size="small" @click="reseat">重置</el-button>
<el-button type="primary" size="small" @click="createComponent">新建话题</el-button>
</el-col>
</el-form>
</el-row>
<el-table
:data="tableData"
style="width: 100%" v-loading="loading">
<el-table-column prop="id" label="排序" min-width="50" align="center"></el-table-column>
<el-table-column prop="subject" label="话题名称" min-width="100" align="center"></el-table-column>
<el-table-column prop="createdusername" label="创建人" min-width="50" align="center"></el-table-column>
<el-table-column prop="remark" label="创建日期" min-width="100" align="center"></el-table-column>
<el-table-column prop="createdName" label="最后修改人" min-width="100" align="center"></el-table-column>
<el-table-column prop="createdName" label="修改日期" min-width="100" align="center"></el-table-column>
<el-table-column prop="status" label="状态" min-width="80" align="center">
<template slot-scope="scope">
<span>{{ scope.row.status | filteFun}}</span>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" min-width="200">
<template slot-scope="scope">
<el-button type="primary" size="small" @click="edit(scope.row)">编辑</el-button> <el-button type="primary" v-if="scope.row.status == 3 || scope.row.status == 1" size="small" @click="optFun(scope.row,'发布')">发布</el-button>
<el-button type="primary" v-if="scope.row.status == 2" size="small" @click="optFun(scope.row,'下线')">下线</el-button>
<el-button type="primary" size="small" @click="topicManage(scope.row)">置顶</el-button>
</template>
</el-table-column>
<div slot="empty">
<div class="table-empty">
<img src="../../assets/image/no-content1.png" />
<p>没有查询到相关结果</p>
</div>
</div>
</el-table>
<!-- 分页 -->
<div class="pagination">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="searchParam.pageNo"
:page-sizes="[15, 30, 50, 100, 200, 500, 700, 1000, 1500, 2000]"
:page-size="searchParam.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="totalRows">
</el-pagination>
</div>
</div>
<AddEdit :isShow="isShow"></AddEdit>
</div>
</template>
<script>
import BreadCrumb from '../../components/breadcrumb.vue'
import { doUpload, getFilePath } from "../../utils/qiniu-util"
import { validateWord } from "../../utils/validate.js"
import { mapGetters } from 'vuex'
import { openLoading, closeLoading } from '../../utils/utils'
import * as commonUtil from '../../utils/utils'
import AddEdit from './add-edit.vue'
let vm = null
export default {
components: {
BreadCrumb,AddEdit
},
data() {
return {
curmbFirst: '组件',
curmbSecond: '讨论组件',
searchParam: {
theme:'',
type:'',
name:'',
status: '',
pageNo: 1,
pageSize: 15
},
category:[
{
value:'积木',
label:'积木'
}
],
statuSelect: [
{
label: '未发布',
value: '1'
},{
label: '已发布',
value: '2'
},{
label: '已下架',
value: '3'
}
],
tableData: [],
totalRows: 0,
loading:false,
isShow:true,
}
},
computed: {
...mapGetters([
'_token',
'idType'
])
},
filters:{
filteFun(index){
let str = '';
if(index == 1){
str = '未发布'
}else if(index == 2){
str = '已发布'
}else if(index == 3){
str = '已下线'
}
return str
}
},
created() {
this.getData()
//this.sun()
},
// 挂载到Dom完成时
mounted: function() {
commonUtil.resizeHeight()
},
methods: {
// 列表查询
search() {
this.getData()
},
//获取数据
getData(){
let subject = 0,status = 0,name = 0;
if(this.searchParam.theme != ''){
subject = this.searchParam.theme
}
if(this.searchParam.status != ''){
status = this.searchParam.status
}
if(this.searchParam.name != ''){
name = this.searchParam.name
}
this.loading = true;
let url = '/interaction/discuss/'+subject+'/'+name+'/'+status+'/'+this.searchParam.pageNo+'/'+this.searchParam.pageSize
this.GET(url).then((res) => {
this.loading = false
if( res.code == '000000' ) {
this.tableData = res.data.discuss || []
this.totalRows = res.data.count
}
})
},
// 重置
reseat() {
this.searchParam = Object.assign({},{
theme:'',
type:'',
name:'',
category:'',
status: '',
pageNo: 1,
pageSize: 15
})
this.getData()
},
// 新建组件
createComponent() {
this.$router.push({path: 'creat-discuss'})
},
edit(item){
this.$router.push({path: 'creat-discuss',query:{id:item.id}})
},
topicManage(item){
},
// 发布、下线
optFun(row,str) {
let status = 0;
if(str == '发布'){
status = 2
}else if(str == '下线'){
status = 3
}
this.$confirm('确定要'+str+'该讨论吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.PUT('/interaction/discuss/',{id: row.id,status:status}).then((res) => {
if(res.code == "000000") {
this.$message({
type: 'success',
message: '操作成功!'
});
this.getData()
}
}).catch(function (error) {
this.$message.error(error);
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
})
})
},
handleSizeChange(value) {
this.searchParam.pageSize = value
this.getData()
},
handleCurrentChange(value) {
this.searchParam.pageNo = value
this.getData()
}
}
}
</script>
<style lang="scss">
.item-component-wrap {
.component-content {
padding: 10px;
background: #fff;
// margin: 84px 20px 20px;
.search-title {
padding: 10px 12px;
font-size: 12px;
color: #449284;
border-bottom: 1px solid #efefef;
}
.create-button {
padding: 0 0 15px;
margin-top: 0 !important;
text-align: right;
}
.table-empty {
img{
width: 100px;
}
p {
margin-top: -50px;
}
}
}
}
</style>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册