Bladeren bron

提交内容

liuqiwen 5 jaren geleden
bovenliggende
commit
0e1e437480
4 gewijzigde bestanden met toevoegingen van 129 en 127 verwijderingen
  1. 3 3
      src/router/index.ts
  2. 4 4
      src/views/home/index.vue
  3. 34 34
      src/views/news/details.vue
  4. 88 86
      src/views/news/index.vue

+ 3 - 3
src/router/index.ts

@@ -142,9 +142,9 @@ const router = new VueRouter({
           meta: { title: "news" }
         },
         {
-            path: "/news/newsDetail",
-            component: () => import("../views/news/details.vue"),
-            meta: { title: "newsDetail" }
+          path: "/news/newsDetail",
+          component: () => import("../views/news/details.vue"),
+          meta: { title: "newsDetail" }
         }
       ]
     },

+ 4 - 4
src/views/home/index.vue

@@ -199,8 +199,8 @@
             <span class="orangeLine"></span>行业资讯
             <router-link to="/news?active=second">
               <span class="more"
-            >more<i class="el-icon-d-arrow-right"></i
-            ></span>
+                >more<i class="el-icon-d-arrow-right"></i
+              ></span>
             </router-link>
           </div>
           <div class="hyzxDiv">
@@ -228,8 +228,8 @@
             <span class="orangeLine"></span>家具保养
             <router-link to="/news?active=third">
               <span class="more"
-            >more<i class="el-icon-d-arrow-right"></i
-            ></span>
+                >more<i class="el-icon-d-arrow-right"></i
+              ></span>
             </router-link>
           </div>
           <div class="hyzxDiv">

+ 34 - 34
src/views/news/details.vue

@@ -16,41 +16,41 @@
 <script>
 import { Component, Vue, Watch } from "vue-property-decorator";
 export default {
-    name: "app",
-    components: {},
-    data() {
-        return {
-            noticeId:'',
-            detailObj:{},
-        };
-    },
-    methods: {
-        detail() {
-            var that = this;
-            that
-                .$post("/interface/notice/getNoticeListById", {
-                    noticeId: that.noticeId
-                })
-                .then(function(res) {
-                    console.log(res);
-                    if (!res[0]) {
-                        that.detailObj = res[1];
-                    }
-                });
-        },
-    },
-    activated() {
-        if (this.$route.query.noticeId) {
-            this.noticeId = this.$route.query.noticeId;
-            this.detail();
-        }
-    },
-    mounted() {
-        if (this.$route.query.noticeId) {
-            this.noticeId = this.$route.query.noticeId;
-            this.detail();
-        }
+  name: "app",
+  components: {},
+  data() {
+    return {
+      noticeId: "",
+      detailObj: {}
+    };
+  },
+  methods: {
+    detail() {
+      var that = this;
+      that
+        .$post("/interface/notice/getNoticeListById", {
+          noticeId: that.noticeId
+        })
+        .then(function(res) {
+          console.log(res);
+          if (!res[0]) {
+            that.detailObj = res[1];
+          }
+        });
     }
+  },
+  activated() {
+    if (this.$route.query.noticeId) {
+      this.noticeId = this.$route.query.noticeId;
+      this.detail();
+    }
+  },
+  mounted() {
+    if (this.$route.query.noticeId) {
+      this.noticeId = this.$route.query.noticeId;
+      this.detail();
+    }
+  }
 };
 </script>
 <style lang="scss" scoped>

+ 88 - 86
src/views/news/index.vue

@@ -8,11 +8,11 @@
               <ul class="listUl">
                 <li v-for="item in tzggArr" :key="item.noticeId">
                   <div class="dateDiv">
-                    <div class="day">{{item.createDay}}</div>
-                    <div>{{item.createMonth}}</div>
+                    <div class="day">{{ item.createDay }}</div>
+                    <div>{{ item.createMonth }}</div>
                   </div>
                   <router-link class="conDiv" :to="`/home`">
-                    <div class="tit">{{item.noticeTitle}}</div>
+                    <div class="tit">{{ item.noticeTitle }}</div>
                     <div class="detail">
                       <div v-html="item.noticeContent"></div>
                       <span class="xq"
@@ -29,15 +29,15 @@
               <ul class="listUl">
                 <li v-for="item in hyzxArr" :key="item.noticeId">
                   <div class="dateDiv">
-                    <div class="day">{{item.createDay}}</div>
-                    <div>{{item.createMonth}}</div>
+                    <div class="day">{{ item.createDay }}</div>
+                    <div>{{ item.createMonth }}</div>
                   </div>
                   <router-link class="conDiv" :to="`/home`">
-                    <div class="tit">{{item.noticeTitle}}</div>
+                    <div class="tit">{{ item.noticeTitle }}</div>
                     <div class="detail">
                       <div v-html="item.noticeContent"></div>
                       <span class="xq"
-                      >详情<i class="el-icon-d-arrow-right"></i
+                        >详情<i class="el-icon-d-arrow-right"></i
                       ></span>
                     </div>
                   </router-link>
@@ -50,15 +50,18 @@
               <ul class="listUl">
                 <li v-for="item in jjbyArr" :key="item.noticeId">
                   <div class="dateDiv">
-                    <div class="day">{{item.createDay}}</div>
-                    <div>{{item.createMonth}}</div>
+                    <div class="day">{{ item.createDay }}</div>
+                    <div>{{ item.createMonth }}</div>
                   </div>
-                  <router-link class="conDiv" :to="`/news/newsDetail?noticeId=${item.noticeId}`">
-                    <div class="tit">{{item.noticeTitle}}</div>
+                  <router-link
+                    class="conDiv"
+                    :to="`/news/newsDetail?noticeId=${item.noticeId}`"
+                  >
+                    <div class="tit">{{ item.noticeTitle }}</div>
                     <div class="detail">
                       <div v-html="item.noticeContent"></div>
                       <span class="xq"
-                      >详情<i class="el-icon-d-arrow-right"></i
+                        >详情<i class="el-icon-d-arrow-right"></i
                       ></span>
                     </div>
                   </router-link>
@@ -69,13 +72,13 @@
         </el-tabs>
       </div>
       <el-pagination
-              class="pageDiv"
-              background
-              @current-change="handleCurrentChange"
-              :page-size="pageSize"
-              :current-page="currentPage"
-              layout="prev, pager, next,total, jumper"
-              :total="total"
+        class="pageDiv"
+        background
+        @current-change="handleCurrentChange"
+        :page-size="pageSize"
+        :current-page="currentPage"
+        layout="prev, pager, next,total, jumper"
+        :total="total"
       ></el-pagination>
     </div>
   </div>
@@ -88,80 +91,79 @@ export default {
   data() {
     return {
       activeName: "first",
-      tzggArr:[],
-      hyzxArr:[],
-      jjbyArr:[],
-      currentPage:1,
-      pageSize:10,
-      total:0,
+      tzggArr: [],
+      hyzxArr: [],
+      jjbyArr: [],
+      currentPage: 1,
+      pageSize: 10,
+      total: 0
     };
   },
   methods: {
-      tabChange() {
-          var that = this;
-          that.currentPage = 1;
-          if (that.activeName == "first") {
-              that.listAll(1);
-          } else if (that.activeName == "second") {
-              that.listAll(2);
-          }else if(that.activeName == "third"){
-              that.listAll(3);
-          }
-      },
-      handleCurrentChange(val) {
-          this.currentPage = val;
-          if (that.activeName == "first") {
-              that.listAll(1);
-          } else if (that.activeName == "second") {
-              that.listAll(2);
-          }else{
-              that.listAll(3);
+    tabChange() {
+      var that = this;
+      that.currentPage = 1;
+      if (that.activeName == "first") {
+        that.listAll(1);
+      } else if (that.activeName == "second") {
+        that.listAll(2);
+      } else if (that.activeName == "third") {
+        that.listAll(3);
+      }
+    },
+    handleCurrentChange(val) {
+      this.currentPage = val;
+      if (that.activeName == "first") {
+        that.listAll(1);
+      } else if (that.activeName == "second") {
+        that.listAll(2);
+      } else {
+        that.listAll(3);
+      }
+    },
+    listAll(noticeType) {
+      var that = this;
+      that
+        .$post("interface/notice/getNoticeListAll", {
+          pageNum: that.currentPage1,
+          pageSize: that.pageSize1,
+          noticeType: noticeType
+        })
+        .then(function(res) {
+          console.log(res);
+          if (!res[0]) {
+            res[1].rows.forEach(function(item, index) {
+              let date = [];
+              let dateTime = [];
+              if (item.createTime) {
+                dateTime = item.createTime.split(" ");
+                date = dateTime[0].split("-");
+                item.createDay = date[2];
+                item.createMonth = date[0] + "-" + date[1];
+              }
+            });
+            that.total = res[1].total;
+            if (noticeType == 1) {
+              that.tzggArr = res[1].rows;
+            } else if (noticeType == 2) {
+              that.hyzxArr = res[1].rows;
+            } else {
+              that.jjbyArr = res[1].rows;
+            }
           }
-      },
-      listAll(noticeType) {
-          var that = this;
-          that
-              .$post("interface/notice/getNoticeListAll", {
-                  pageNum: that.currentPage1,
-                  pageSize: that.pageSize1,
-                  noticeType:noticeType
-              })
-              .then(function(res) {
-                  console.log(res);
-                  if (!res[0]) {
-                      res[1].rows.forEach(function(item,index){
-                          let date = [];
-                          let dateTime = [];
-                          if(item.createTime){
-                              dateTime = item.createTime.split(" ");
-                              date = dateTime[0].split("-");
-                              item.createDay = date[2];
-                              item.createMonth =  date[0]+'-'+date[1];
-                          }
-                      })
-                      that.total = res[1].total;
-                      if(noticeType == 1){
-                          that.tzggArr = res[1].rows;
-                      }else if(noticeType == 2){
-                          that.hyzxArr = res[1].rows;
-                      }else{
-                          that.jjbyArr = res[1].rows;
-                      }
-
-                  }
-              });
-      },
+        });
+    }
   },
   activated() {
-      if (this.$route.query.active) {
-          this.activeName = this.$route.query.active;
-          this.tabChange();
-      }
+    if (this.$route.query.active) {
+      this.activeName = this.$route.query.active;
+      this.tabChange();
+    }
   },
   mounted() {
-      this.listAll(1);
-      this.listAll(2);
-      this.listAll(3);
+    this.listAll(1);
+    this.listAll(2);
+    this.listAll(3);
   }
 };
 </script>
@@ -229,7 +231,7 @@ export default {
     .detail {
       height: 5rem;
       line-height: 1.6rem;
-      div{
+      div {
         height: 3.2rem;
         line-height: 1.6rem;
         font-size: 1.2rem;