Browse Source

feat-添加咨询

hejie 3 years ago
parent
commit
e89b8c980a
2 changed files with 93 additions and 133 deletions
  1. 84 111
      src/pages/consultation-list/index.vue
  2. 9 22
      src/pages/index/index.vue

+ 84 - 111
src/pages/consultation-list/index.vue

@@ -1,23 +1,19 @@
 <template>
 <template>
   <div class="home_page">
   <div class="home_page">
-    <div class="title">
-      <span>咨询列表</span>
-    </div>
-    <div>
-      <div
-        v-for="(item, index) of 6"
-        :key="index"
-        class="li"
-      >
-        <div class="li_top">
-          <div class="li_left">
-            <span>标题</span>
-            <span class="hint">作者</span>
+    <div class="list">
+      <div class="li" v-for="(i,key) of list" :key="key">
+        <div class="li-left">
+          <span class="title">{{i.title}}</span>
+          <div class="bottom">
+            <span>{{i.author || '数字茶商'}}</span>
+            <span>{{ $day(i.publish_time * 1000).format('MM-DD') }}</span>
           </div>
           </div>
-          <!-- <img src="@/assets/img/rightArrows.png" class="li_img" /> -->
         </div>
         </div>
-        <div class="text">
-          <span>我是测试啊</span>
+        <div class="li-right">
+          <image
+            class="gg_img"
+            :src="i.thumb"
+          ></image>
         </div>
         </div>
       </div>
       </div>
     </div>
     </div>
@@ -29,115 +25,92 @@ import { post } from "@/request/api.js";
 export default {
 export default {
   data() {
   data() {
     return {
     return {
-      noticeList: [],
-      page: 1,
-      pageSize: 10, //页数
-      totalPage: 0, //总页数
-      loading: false,
-      finished: false,
+      list:[]
     };
     };
   },
   },
   methods: {
   methods: {
-    //跳转
-    init() {
-      if (this.account) {
-        this.getNoticeList();
-      }
-    },
-    getNoticeList() {
+    init(){
       let data = {
       let data = {
-        page: this.page,
-        page_size: this.pageSize,
-      };
-      basicApi.noticeList(data).then((res) => {
-        if (res.code == 200) {
-          this.noticeList = this.noticeList.concat(res.data.list);
-          this.totalPage = Math.ceil(res.data.total_count / this.pageSize);
-          this.page++;
-          this.loading = false;
-          if (this.page > this.totalPage) return (this.finished = true);
-        } else {
-          this.$toast(res.msg);
-        }
-      });
-    },
-    switchovers(route, item) {
-      if (route == "") return this.$toast(this.$t("lang.swap109"));
-      this.$router.push({ name: route, query: { item: JSON.stringify(item) } });
-      // this.$Router.pushPage({
-      //   name: route
-      // })
-    },
-  },
-  computed: {
-    ...mapState(["account"]),
-  },
-  created() {
-    this.init();
+        is_index:0
+      }
+      post('/notice',data).then(res => {
+            if(res.code === 0){
+                this.list = res.data.data
+            }
+        })
+    }
   },
   },
-  watch: {
-    account() {
-      this.init();
-    },
+  onLoad(option) {
+    this.init()
   },
   },
+  computed: {},
+  created() {},
 };
 };
 </script>
 </script>
   <style lang="scss" scoped>
   <style lang="scss" scoped>
 .home_page {
 .home_page {
   padding: 20px;
   padding: 20px;
-}
-.title {
-  color: #fff;
-  margin: 20px 0;
-}
-.li {
-  background: #232b3e;
-  border-radius: 8px;
-  padding: 10px;
-  margin-bottom: 20px;
-  .li_top {
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
-    border-bottom: 1px solid #2a272a;
-    padding-bottom: 10px;
-    .li_left {
+  .list {
+    // margin-top: 20px;
+    .li {
       display: flex;
       display: flex;
-      flex-direction: column;
-      font-size: 14px;
-      color: #fff;
-      .hint {
-        color: #999;
-        font-size: 12px;
-        margin-top: 6px;
+      flex-direction: row;
+      background: #fafafa;
+      box-shadow: 0px 2px 50px 0px rgba(0, 0, 0, 0.08);
+      border-radius: 8px 8px 8px 8px;
+      opacity: 1;
+      border: 1px solid #dddddd;
+      margin-top: 20px;
+      // border-image: linear-gradient(
+      //     135deg,
+      //     rgba(41.00000135600567, 121.00000038743019, 255, 1),
+      //     rgba(255, 170.39100408554077, 178.8549891114235, 1)
+      //   )
+      //   1 1;
+      padding: 10rpx;
+      .li-left {
+        flex: 3;
+        display: flex;
+        flex-direction: column;
+        // background: red;
+        justify-content: center;
+        align-items: flex-start;
+        padding: 0 10px;
+        .title {
+          font-size: 28rpx;
+          color: #1b1a1a;
+          font-family: "SourceHanSansCN-Bold";
+          font-weight: bold;
+        }
+
+        .bottom {
+          width: 100%;
+          // background-color: red;
+          margin-top: 50rpx;
+          display: flex;
+          flex-direction: row;
+          justify-content: space-between;
+          span {
+            font-size: 20rpx;
+            font-weight: normal;
+            color: #999999;
+          }
+        }
+      }
+      .li-right {
+        flex: 1;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        padding: 5px;
+        .gg_img {
+          width: 237rpx;
+          height: 166rpx;
+          border-radius: 8px 8px 8px 8px;
+          // background: red;
+        }
       }
       }
     }
     }
-    .li_img {
-      width: 10px;
-      height: 10px;
-    }
-  }
-  .text {
-    color: #999;
-
-    font-size: 12px;
-    margin-top: 10px;
-  }
-}
-.bare {
-  position: fixed;
-  top: 50%;
-  left: 50%;
-  transform: translateX(-50%) translateY(-50%);
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  font-size: 14px;
-  padding: 40px 0;
-  .bare_img {
-    width: 120px;
-    height: 100px;
-    margin-bottom: 8px;
   }
   }
 }
 }
 </style>
 </style>

+ 9 - 22
src/pages/index/index.vue

@@ -74,7 +74,7 @@
         ></image>
         ></image>
         <view class="act_other">
         <view class="act_other">
           <image class="act_two_img" :src="spc_list[1].url" mode=""></image>
           <image class="act_two_img" :src="spc_list[1].url" mode=""></image>
-          <image class="act_two_img" :src="spc_list[2].url" mode=""></image>
+          <image class="act_two_img" :src="spc_list[2].url" mode="" @click="goNoticeList"></image>
         </view>
         </view>
       </view>
       </view>
       <!-- 活动-end -->
       <!-- 活动-end -->
@@ -173,8 +173,6 @@ export default {
     this.loadData();
     this.loadData();
     this.getBanner(); //获取轮播图
     this.getBanner(); //获取轮播图
     this.getAnnounce(); //获取公告列表
     this.getAnnounce(); //获取公告列表
-    // this.getImageTwo(); //金刚区
-    // this.getImage(); //获取活动列表
   },
   },
   onHide() {},
   onHide() {},
   methods: {
   methods: {
@@ -189,6 +187,9 @@ export default {
     NavToGoodsDetail(id, type) {
     NavToGoodsDetail(id, type) {
       this.goto("/pages/product/p_details", { id, type });
       this.goto("/pages/product/p_details", { id, type });
     },
     },
+    goNoticeList(){
+      this.goto("/pages/consultation-list/index");
+    },
     // 获取轮播图
     // 获取轮播图
     getBanner() {
     getBanner() {
       post("banner").then((res) => {
       post("banner").then((res) => {
@@ -202,9 +203,12 @@ export default {
     },
     },
     // 获取公告列表
     // 获取公告列表
     getAnnounce() {
     getAnnounce() {
-      post("notice").then((res) => {
+      let data = {
+        is_index:1
+      }
+      post("notice",data).then((res) => {
         if (res.code === 0) {
         if (res.code === 0) {
-          this.not_list = [res.data.data];
+          this.not_list =res.data.data;
         }
         }
       });
       });
     },
     },
@@ -217,23 +221,6 @@ export default {
       });
       });
       // this.goto("/pages/notice/detail", { ...item });
       // this.goto("/pages/notice/detail", { ...item });
     },
     },
-
-    // 获取金刚区列表
-    getImageTwo() {
-      post("ShuZiTeaSpecial/special/imageTwo").then((res) => {
-        if (res.status == 200) {
-          this.area_list = res.data;
-        }
-      });
-    },
-    // 获取活动区列表
-    getImage() {
-      post("ShuZiTeaSpecial/special/image").then((res) => {
-        if (res.status == 200) {
-          this.spc_list = res.data;
-        }
-      });
-    },
     // 轮播图跳转
     // 轮播图跳转
     goList(e) {},
     goList(e) {},
     // 金刚区跳转
     // 金刚区跳转