Ver código fonte

初步完成官兵互动

shaogen1995 3 anos atrás
pai
commit
2c37fc1748

+ 6 - 6
houtai/src/views/tab8/index.vue

@@ -40,9 +40,9 @@
           style="width: 120px"
         >
           <el-option label="全部" value=""></el-option>
-          <el-option label="数字史馆" value="scene"></el-option>
-          <el-option label="美丽校园" value="school"></el-option>
-          <el-option label="文物典藏" value="goods"></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>
         <span class="search_k">类型:</span>
         <el-select
@@ -221,9 +221,9 @@ export default {
         if (v.status === 0) v.status = '待审核'
         else if (v.status === 1) v.status = '不通过'
         else if (v.status === 2) v.status = '通过'
-        if (v.type === 'scene') v.type = '数字史馆'
-        else if (v.type === 'school') v.type = '美丽校园'
-        else if (v.type === 'goods') v.type = '文物典藏'
+        if (v.type === 'scene') v.type = '点赞箱'
+        else if (v.type === 'school') v.type = '战友情'
+        else if (v.type === 'goods') v.type = '敢为先'
       })
       this.tableData = res.data.records
     },

+ 3 - 0
web/src/assets/css/base.css

@@ -156,6 +156,9 @@ ul li {
 .w-e-toolbar .w-e-menu:nth-of-type(21) {
   display: none !important;
 }
+.w-e-toolbar .w-e-menu:nth-of-type(26) {
+  display: none !important;
+}
 
 .el-select .el-input.is-focus .el-input__inner {
   border-color: #BE1220;

BIN
web/src/assets/img/like.jpg


BIN
web/src/assets/img/like.png


BIN
web/src/assets/img/likeAc.jpg


BIN
web/src/assets/img/likeAc.png


BIN
web/src/assets/img/noneTX.jpg


BIN
web/src/assets/img/noneTX.png


+ 33 - 0
web/src/utils/api.js

@@ -50,4 +50,37 @@ export const leaderList = (data) => {
     url: '/web/leaderList',
     data
   })
+}
+
+//-----------------官兵互动----------------
+// 发帖
+export const webBbsSave = (data) => {
+  return axios({
+    method: 'post',
+    url: '/web/bbs/save',
+    data
+  })
+}
+// 帖子列表
+export const webBbsList = (data) => {
+  return axios({
+    method: 'post',
+    url: '/web/bbs/list',
+    data
+  })
+}
+// 回帖列表
+export const webBbsMessageList = (data) => {
+  return axios({
+    method: 'post',
+    url: '/web/bbs/message/list',
+    data
+  })
+}
+// 点赞
+export const webBbsLike = (id) => {
+  return axios({
+    method: 'post',
+    url: `/web/bbs/like/upVote/${id}`
+  })
 }

+ 84 - 17
web/src/views/tab6/list.vue

@@ -29,13 +29,42 @@
           <div class="con_tit_three">回复数</div>
           <div class="con_tit_four">最后发表</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 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>
       <!-- 分页 -->
@@ -59,9 +88,9 @@
             placeholder="请选择主题分类"
             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-input
             style="margin-left: 20px"
@@ -111,6 +140,7 @@
 </template>
 
 <script>
+import { webBbsSave, webBbsList } from "@/utils/api";
 import E from "wangeditor";
 import axios from "@/utils/request";
 export default {
@@ -119,19 +149,22 @@ export default {
   data() {
     //这里存放数据
     return {
-      total: 20,
+      data: [],
+      total: 0,
       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: {
+        bbsType: "topic",
+        status: 2,
         pageNum: 1,
         pageSize: 5,
-        type: "one",
+        type: "scene",
       },
       // 有关富文本
-      selectType: "one",
+      selectType: "scene",
       title: "",
       creatorName: "",
     };
@@ -151,22 +184,49 @@ export default {
       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栏
     cutTab(val) {
       if (this.formData.type === val.type) return;
       this.formData.pageNum = 1;
       this.formData.type = val.type;
+      this.selectType = val.type;
+      this.webBbsList(this.formData);
     },
     // 分页器方法
     currentChange(val) {
       // console.log('当前页改变了', val)
       this.formData.pageNum = val;
+      this.webBbsList(this.formData);
     },
     sizeChange(val) {
       // console.log('条数改变了', val)
       this.formData.pageNum = 1;
       this.formData.pageSize = val;
+      this.webBbsList(this.formData);
     },
     // 上传图片
     beforethumbUploadImg(file) {
@@ -196,14 +256,21 @@ export default {
     upload_thumb_successImg(data) {
       this.$message.success("上传成功");
       this.editor.txt.append(
-        `<img src="${this.baseURL}${data.data.urlPath}"  style="max-width:100%;display: block;margin: 10px auto;"/><p>&emsp;&emsp;</p>`
+        `<img src="${this.baseURL}${data.data.filePath}"  style="max-width:100%;display: block;margin: 10px auto;"/><p>&emsp;&emsp;</p>`
       );
     },
+    // 封装一个获取列表的方法
+    async webBbsList(data) {
+      let res = await webBbsList(data);
+      this.total = res.data.total;
+      this.data = res.data.records;
+    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
     // 获取服务器前缀地址
     this.baseURL = axios.defaults.baseURL;
+    this.webBbsList(this.formData);
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {

Diferenças do arquivo suprimidas por serem muito extensas
+ 170 - 81
web/src/views/tab6/look.vue