| | |
| | | <template> |
| | | <div> |
| | | <el-row > |
| | | <el-col :span="18"> |
| | | <el-form label-width="80px" :inline="true" :label-position="labelPosition" :model="formInline" class="form-inline"> |
| | | <el-form-item label="标题"> |
| | | <el-input v-model="formInline.title" placeholder="标题"></el-input> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="描述"> |
| | | <el-input v-model="formInline.desp" placeholder="描述"></el-input> |
| | | </el-form-item> |
| | | |
| | | <el-form-item > |
| | | <el-button type="primary" @click="query_">查询</el-button> |
| | | <el-button type="info" @click="empty_">重置</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-col> |
| | | <el-col :span="4" ><el-button type="primary" @click="createNew">创建</el-button></el-col> |
| | | </el-row> |
| | | |
| | | |
| | | <div class="infinite-list-wrapper" style="overflow:auto"> |
| | | <ul class="list" v-infinite-scroll="load" infinite-scroll-disabled="disabled"> |
| | | <li v-for="item in dataList" :key = "item.id" class="list-item"> |
| | | <el-row> |
| | | <el-col :span="8"><div class="grid-content">{{item.title}}</div></el-col> |
| | | <el-col :span="4" :><div class="grid-content">{{item.time}}</div></el-col> |
| | | <div class="infinite-list-wrapper" style="overflow:auto; height: 70vh; border-top: 1px solid #c3c5c7;"> |
| | | |
| | | <div class="list" v-infinite-scroll="load" infinite-scroll-disabled="disabled"> |
| | | <div v-for="one in dataList" :key="one.id" class="list-item" @click="showItem(one)"> |
| | | <el-row > |
| | | <el-col :span="20"><div class="grid-content z_grid-content1 grid-content_text">{{one.title}}</div></el-col> |
| | | <el-col :span="4"><div class="grid-content z_grid-content1 grid-content_time">{{one.time}}</div></el-col> |
| | | </el-row> |
| | | |
| | | <el-row> |
| | | <el-col :span="20"><div class="grid-content">{{item.desp}}</div></el-col> |
| | | <el-col :span="20"><div class="grid-content z_grid-content2">{{one.desp}}</div></el-col> |
| | | </el-row> |
| | | </li> |
| | | </ul> |
| | | </div> |
| | | </div> |
| | | <p v-if="loading">加载中...</p> |
| | | <p v-if="noMore">没有更多了</p> |
| | | </div> |
| | | <el-dialog |
| | | title="详情" |
| | | :visible.sync="dialogVisible" |
| | | width="40%" |
| | | height="40%" |
| | | custom-class="handleClose"> |
| | | <span>{{selectOne.title}}</span> |
| | | <el-divider></el-divider> |
| | | <div style="content"> |
| | | <span>{{selectOne.desp}}</span> |
| | | </div> |
| | | |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button v-if="selectOne.attachment && selectOne.attachment != ''" type="primary" @click="download">下 载</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | | <el-dialog title="创建话题" :visible.sync="dialogFormVisible"> |
| | | <el-form :model="form"> |
| | | <el-form-item label="话题名称" :label-width="formLabelWidth"> |
| | | <el-input v-model="form.title" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="话题内容" :label-width="formLabelWidth"> |
| | | <el-input type="textarea" v-model="form.desp" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-upload |
| | | class="upload-demo" |
| | | :action="uploadUrl" |
| | | :on-preview="handlePreview" |
| | | :data="form" |
| | | :limit="3" |
| | | :auto-upload='false' |
| | | ref="upload" |
| | | :on-change="onChange" |
| | | :on-exceed="handleExceed" |
| | | > |
| | | <el-button size="small" type="primary">点击上传</el-button> |
| | | <div slot="tip" class="el-upload__tip">不超过50M</div> |
| | | </el-upload> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogFormVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="createTopic">确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import squareList from "./squareList.vue"; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | uploadUrl:"/api/api/file/topicUpload", |
| | | form:{}, |
| | | pageno:1, |
| | | total:0, |
| | | maxPage:0, |
| | | fileList: [], |
| | | dialogVisible: false, |
| | | dialogFormVisible: false, |
| | | labelPosition: "right", |
| | | formInline:{}, |
| | | selectOne:{ |
| | | title:"biaoti", |
| | | desp:"miaoshu", |
| | | attachment:"222" |
| | | }, |
| | | dataList: [ |
| | | {id:1,title:"11",desp:"111",time:"11-11"}, |
| | | {id:1,title:"11",desp:"111",time:"11-11"}, |
| | | {id:1,title:"11",desp:"111",time:"11-11"}, |
| | | {id:1,title:"11",desp:"111",time:"11-11"}, |
| | | {id:1,title:"11",desp:"111",time:"11-11"}, |
| | | ], |
| | | loading: false |
| | | // {id:1,attachment:"222",title:"标题", desp:"描述时发生纠纷司符合双方酒叟发动机时代峰峻配电间 刀片机水电费搜豆腐皮搜的看法我都叫打破是觉得批发商附加费第三季度破发接收到发地方就搜到到四点分发偶读囧", time:"12分钟前"}, |
| | | // {id:1,attachment:"222",title:"11", desp:"111", time:"11111"}, |
| | | // {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, |
| | | // {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, |
| | | // {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, |
| | | // {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, |
| | | // {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, |
| | | // {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, |
| | | // {id:1,attachment:"",title:"11", desp:"111", time:"11111"}, |
| | | ], |
| | | loading: false, |
| | | |
| | | } |
| | | }, |
| | | computed: { |
| | | noMore() { |
| | | return this.count >= 20 |
| | | return this.maxPage == this.pageno |
| | | }, |
| | | disabled() { |
| | | return this.loading || this.noMore |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.getData(); |
| | | }, |
| | | methods: { |
| | | onChange(file, fileList) { |
| | | this.fileList = []; |
| | | this.fileList = fileList; |
| | | }, |
| | | createTopic() { |
| | | let me = this; |
| | | var userId = localStorage.getItem('userId'); |
| | | if(!userId) { |
| | | this.$router.push('/login'); |
| | | } |
| | | this.form.userId = userId; |
| | | let params = this.form; |
| | | |
| | | if(this.fileList.length == 0) { |
| | | //不带附件 |
| | | let url = "/api/topic/add"; |
| | | this.$axios.get(url, { |
| | | params |
| | | }) |
| | | .then(data_ => { |
| | | if(data_.data.success) { |
| | | this.$message('创建成功'); |
| | | me.dialogFormVisible = false; |
| | | }else { |
| | | this.$message({message:'话题创建失败', type: 'warning'}); |
| | | } |
| | | }).catch(error => { |
| | | console.log(error); |
| | | }) |
| | | }else { |
| | | this.$refs.upload.submit(); |
| | | } |
| | | }, |
| | | handleRemove(file, fileList) { |
| | | console.log(file, fileList); |
| | | }, |
| | | handlePreview(file) { |
| | | console.log(file); |
| | | }, |
| | | handleExceed(files, fileList) { |
| | | this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`); |
| | | }, |
| | | beforeRemove(file, fileList) { |
| | | return this.$confirm(`确定移除 ${ file.name }?`); |
| | | }, |
| | | load() { |
| | | // this.loading = true |
| | | // setTimeout(() => { |
| | | // this.count += 2 |
| | | // this.loading = false |
| | | // }, 2000) |
| | | } |
| | | |
| | | if(me.pageno < me.maxPage) { |
| | | me.pageno++; |
| | | } |
| | | query_(); |
| | | |
| | | |
| | | }, |
| | | showItem(one) { |
| | | this.dialogVisible = true; |
| | | this.selectOne = one; |
| | | }, |
| | | createNew() { |
| | | this.dialogFormVisible = true; |
| | | }, |
| | | empty_() { |
| | | this.formInline = {}; |
| | | this.query_(); |
| | | }, |
| | | query_() { |
| | | this.getData(this.formInline); |
| | | }, |
| | | getData(query) { |
| | | let me = this; |
| | | this.loading = true |
| | | this.loading_table = true; |
| | | let pageno = this.pagenum; |
| | | let url = "/api/topic/page/" + this.pageno; |
| | | let params = {}; |
| | | if(query){ |
| | | params.title = query.title; |
| | | params.desp = query.desp; |
| | | } |
| | | this.$axios.get(url, { |
| | | params |
| | | }) |
| | | .then(data_ => { |
| | | console.log(data_); |
| | | if(data_.data.success) { |
| | | me.dataList.push.apply(me.dataList, data_.data.data.records) |
| | | me.total = data_.data.data.total; |
| | | me.pageno = data_.data.data.pageno; |
| | | me.maxPage = data_.data.data.maxPage; |
| | | |
| | | |
| | | } |
| | | me.loading = false |
| | | }).catch(error => { |
| | | console.log(error); |
| | | me.loading = false |
| | | }) |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | .grid-content{ |
| | | text-align: left; |
| | | padding: 5px; |
| | | } |
| | | |
| | | .grid-content_text { |
| | | font-weight: bold; |
| | | font-style: italic; |
| | | color: #000; |
| | | } |
| | | .grid-content_time { |
| | | font-weight: bold; |
| | | font-style: italic; |
| | | color: #909399; |
| | | } |
| | | .z_grid-content1{ |
| | | display:table-cell; |
| | | vertical-align:bottom; |
| | | height: 50px; |
| | | } |
| | | .z_grid-content2{ |
| | | color: #83878a; |
| | | padding: 0px; |
| | | height: 40px; |
| | | line-height: 40px; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | .content{ |
| | | |
| | | } |
| | | |
| | | .form-inline { |
| | | text-align: left; |
| | | } |
| | | |
| | | .list { |
| | | |
| | | } |
| | | .list-item { |
| | | margin-top: 20px; |
| | | padding-bottom: 5px; |
| | | border-bottom: 1px solid #c3c5c7; |
| | | } |
| | | |
| | | .handleClose { |
| | | margin: 10px; |
| | | text-align: left; |
| | | } |
| | | .handleClose .el-dialog__body { |
| | | padding: 10px 20px; |
| | | } |
| | | .handleClose .el-divider--horizontal{ |
| | | margin: 5px; |
| | | } |
| | | </style> |