|
@@ -29,13 +29,42 @@
|
|
<div class="con_tit_three">回复数</div>
|
|
<div class="con_tit_three">回复数</div>
|
|
<div class="con_tit_four">最后发表</div>
|
|
<div class="con_tit_four">最后发表</div>
|
|
</div>
|
|
</div>
|
|
- <div class="con_tit con_tit2" v-for="i in 5" :key="i" @click="skip(i)">
|
|
|
|
- <div class="con_tit_one" title="213">
|
|
|
|
- 某某某在器械训练中突破自我,我要为他点赞
|
|
|
|
|
|
+ <div
|
|
|
|
+ class="con_tit con_tit2"
|
|
|
|
+ v-for="item in data"
|
|
|
|
+ :key="item.id"
|
|
|
|
+ @click="skip(item)"
|
|
|
|
+ >
|
|
|
|
+ <div class="con_tit_one" :title="item.title">
|
|
|
|
+ {{ item.title }}
|
|
|
|
+ </div>
|
|
|
|
+ <div class="con_tit_tow" :title="item.creatorName">
|
|
|
|
+ {{ item.creatorName }}
|
|
|
|
+ </div>
|
|
|
|
+ <div class="con_tit_three" :title="item.reply">
|
|
|
|
+ {{ item.reply ? item.reply : 0 }}
|
|
|
|
+ </div>
|
|
|
|
+ <div
|
|
|
|
+ class="con_tit_four"
|
|
|
|
+ :title="`${item.replyName ? item.replyName : item.creatorName} ${
|
|
|
|
+ item.replyTime ? item.replyTime : item.updateTime
|
|
|
|
+ }`"
|
|
|
|
+ >
|
|
|
|
+ {{
|
|
|
|
+ item.replyName
|
|
|
|
+ ? item.replyName.length > 5
|
|
|
|
+ ? item.replyName.substring(0, 5) + "..."
|
|
|
|
+ : item.replyName
|
|
|
|
+ : item.creatorName.length > 5
|
|
|
|
+ ? item.creatorName.substring(0, 5) + "..."
|
|
|
|
+ : item.creatorName
|
|
|
|
+ }}
|
|
|
|
+ {{
|
|
|
|
+ item.replyTime
|
|
|
|
+ ? item.replyTime.substring(0, 10)
|
|
|
|
+ : item.updateTime.substring(0, 10)
|
|
|
|
+ }}
|
|
</div>
|
|
</div>
|
|
- <div class="con_tit_tow" title="213">陈晨</div>
|
|
|
|
- <div class="con_tit_three" title="213">232</div>
|
|
|
|
- <div class="con_tit_four" title="213">陈晨 2021-07-12</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- 分页 -->
|
|
<!-- 分页 -->
|
|
@@ -59,9 +88,9 @@
|
|
placeholder="请选择主题分类"
|
|
placeholder="请选择主题分类"
|
|
style="width: 400px"
|
|
style="width: 400px"
|
|
>
|
|
>
|
|
- <el-option label="点赞箱" value="one"></el-option>
|
|
|
|
- <el-option label="战友情" value="tow"></el-option>
|
|
|
|
- <el-option label="敢为先" value="three"></el-option>
|
|
|
|
|
|
+ <el-option label="点赞箱" value="scene"></el-option>
|
|
|
|
+ <el-option label="战友情" value="school"></el-option>
|
|
|
|
+ <el-option label="敢为先" value="goods"></el-option>
|
|
</el-select>
|
|
</el-select>
|
|
<el-input
|
|
<el-input
|
|
style="margin-left: 20px"
|
|
style="margin-left: 20px"
|
|
@@ -111,6 +140,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+import { webBbsSave, webBbsList } from "@/utils/api";
|
|
import E from "wangeditor";
|
|
import E from "wangeditor";
|
|
import axios from "@/utils/request";
|
|
import axios from "@/utils/request";
|
|
export default {
|
|
export default {
|
|
@@ -119,19 +149,22 @@ export default {
|
|
data() {
|
|
data() {
|
|
//这里存放数据
|
|
//这里存放数据
|
|
return {
|
|
return {
|
|
- total: 20,
|
|
|
|
|
|
+ data: [],
|
|
|
|
+ total: 0,
|
|
listData: [
|
|
listData: [
|
|
- { biaoshi: "/", id: 1, name: "点赞箱", type: "one" },
|
|
|
|
- { biaoshi: "/", id: 2, name: "战友情", type: "tow" },
|
|
|
|
- { biaoshi: "", id: 3, name: "敢为先", type: "three" },
|
|
|
|
|
|
+ { biaoshi: "/", id: 1, name: "点赞箱", type: "scene" },
|
|
|
|
+ { biaoshi: "/", id: 2, name: "战友情", type: "school" },
|
|
|
|
+ { biaoshi: "", id: 3, name: "敢为先", type: "goods" },
|
|
],
|
|
],
|
|
formData: {
|
|
formData: {
|
|
|
|
+ bbsType: "topic",
|
|
|
|
+ status: 2,
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
pageSize: 5,
|
|
pageSize: 5,
|
|
- type: "one",
|
|
|
|
|
|
+ type: "scene",
|
|
},
|
|
},
|
|
// 有关富文本
|
|
// 有关富文本
|
|
- selectType: "one",
|
|
|
|
|
|
+ selectType: "scene",
|
|
title: "",
|
|
title: "",
|
|
creatorName: "",
|
|
creatorName: "",
|
|
};
|
|
};
|
|
@@ -151,22 +184,49 @@ export default {
|
|
this.$emit("cutComFn", item);
|
|
this.$emit("cutComFn", item);
|
|
},
|
|
},
|
|
// 点击发表
|
|
// 点击发表
|
|
- publish() {},
|
|
|
|
|
|
+ async publish() {
|
|
|
|
+ if (this.creatorName.trim() === "") {
|
|
|
|
+ return this.$message.warning("名字不能为空!");
|
|
|
|
+ }
|
|
|
|
+ if (this.title.trim() === "") {
|
|
|
|
+ return this.$message.warning("标题不能为空!");
|
|
|
|
+ }
|
|
|
|
+ if (this.editor.txt.html() === "") {
|
|
|
|
+ return this.$message.warning("内容不能为空");
|
|
|
|
+ }
|
|
|
|
+ let obj = {
|
|
|
|
+ bbsType: "topic",
|
|
|
|
+ content: this.editor.txt.html(),
|
|
|
|
+ creatorName: this.creatorName,
|
|
|
|
+ title: this.title,
|
|
|
|
+ type: this.selectType,
|
|
|
|
+ };
|
|
|
|
+ let res = await webBbsSave(obj);
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ this.title = this.creatorName = "";
|
|
|
|
+ this.editor.txt.html("");
|
|
|
|
+ this.$message.success("发帖成功,等待审核.");
|
|
|
|
+ } else this.$message.warning(res.msg);
|
|
|
|
+ },
|
|
// 切换顶部tab栏
|
|
// 切换顶部tab栏
|
|
cutTab(val) {
|
|
cutTab(val) {
|
|
if (this.formData.type === val.type) return;
|
|
if (this.formData.type === val.type) return;
|
|
this.formData.pageNum = 1;
|
|
this.formData.pageNum = 1;
|
|
this.formData.type = val.type;
|
|
this.formData.type = val.type;
|
|
|
|
+ this.selectType = val.type;
|
|
|
|
+ this.webBbsList(this.formData);
|
|
},
|
|
},
|
|
// 分页器方法
|
|
// 分页器方法
|
|
currentChange(val) {
|
|
currentChange(val) {
|
|
// console.log('当前页改变了', val)
|
|
// console.log('当前页改变了', val)
|
|
this.formData.pageNum = val;
|
|
this.formData.pageNum = val;
|
|
|
|
+ this.webBbsList(this.formData);
|
|
},
|
|
},
|
|
sizeChange(val) {
|
|
sizeChange(val) {
|
|
// console.log('条数改变了', val)
|
|
// console.log('条数改变了', val)
|
|
this.formData.pageNum = 1;
|
|
this.formData.pageNum = 1;
|
|
this.formData.pageSize = val;
|
|
this.formData.pageSize = val;
|
|
|
|
+ this.webBbsList(this.formData);
|
|
},
|
|
},
|
|
// 上传图片
|
|
// 上传图片
|
|
beforethumbUploadImg(file) {
|
|
beforethumbUploadImg(file) {
|
|
@@ -196,14 +256,21 @@ export default {
|
|
upload_thumb_successImg(data) {
|
|
upload_thumb_successImg(data) {
|
|
this.$message.success("上传成功");
|
|
this.$message.success("上传成功");
|
|
this.editor.txt.append(
|
|
this.editor.txt.append(
|
|
- `<img src="${this.baseURL}${data.data.urlPath}" style="max-width:100%;display: block;margin: 10px auto;"/><p>  </p>`
|
|
|
|
|
|
+ `<img src="${this.baseURL}${data.data.filePath}" style="max-width:100%;display: block;margin: 10px auto;"/><p>  </p>`
|
|
);
|
|
);
|
|
},
|
|
},
|
|
|
|
+ // 封装一个获取列表的方法
|
|
|
|
+ async webBbsList(data) {
|
|
|
|
+ let res = await webBbsList(data);
|
|
|
|
+ this.total = res.data.total;
|
|
|
|
+ this.data = res.data.records;
|
|
|
|
+ },
|
|
},
|
|
},
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
created() {
|
|
created() {
|
|
// 获取服务器前缀地址
|
|
// 获取服务器前缀地址
|
|
this.baseURL = axios.defaults.baseURL;
|
|
this.baseURL = axios.defaults.baseURL;
|
|
|
|
+ this.webBbsList(this.formData);
|
|
},
|
|
},
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
mounted() {
|
|
mounted() {
|