youyawu 5 years ago
parent
commit
da13b45219
3 changed files with 57 additions and 49 deletions
  1. 2 2
      src/utils/request.ts
  2. 54 47
      src/views/home/index.vue
  3. 1 0
      src/views/mall/index.vue

+ 2 - 2
src/utils/request.ts

@@ -6,8 +6,8 @@ import md5 from "js-md5";
 import { getErrMsg } from "@/utils";
 const instance = axios.create({
   baseURL: process.env.VUE_APP_BASE_API,
-  timeout: 3000,
-  withCredentials: true
+  timeout: 3000
+  // withCredentials: true
 });
 const appKey = "cd72c223-923f-44a3-aede-b9f07dcd56b8";
 const plat = "steelfurniture";

+ 54 - 47
src/views/home/index.vue

@@ -33,49 +33,20 @@
       </el-row>
       <div class="partTitle"><span class="orangeLine"></span>服务能力</div>
       <div class="fwnl">
-        <div class="fwnlItem">
-          <div class="numDiv">
-            <img src="@assets/qiyeruzhu.png" alt />
-            <span>1536</span>
-          </div>
-          <div class="titleDiv">
-            <span>1536</span>
-            家钢制家具生产企业入驻
-          </div>
-          <div class="line"></div>
-        </div>
-        <div class="fwnlItem">
-          <div class="numDiv">
-            <img src="@assets/chanpin.png" alt />
-            <span>1536</span>
-          </div>
-          <div class="titleDiv">
-            <span>1536</span>
-            个钢制家具产品入驻
-          </div>
-          <div class="line"></div>
-        </div>
-        <div class="fwnlItem">
-          <div class="numDiv">
-            <img src="@assets/huiyuan.png" alt />
-            <span>1536</span>
-          </div>
-          <div class="titleDiv">
-            <span>1536</span>
-            位平台会员注册
-          </div>
-          <div class="line"></div>
-        </div>
-        <div class="fwnlItem">
+        <div
+          class="fwnlItem"
+          v-for="({ text, img, num }, index) in fwList"
+          :key="`fwList${index}`"
+        >
           <div class="numDiv">
-            <img src="@assets/yingyee.png" alt />
-            <span>1536</span>
+            <img :src="require(`@assets/${img}.png`)" alt />
+            <span>{{ num }}</span>
           </div>
           <div class="titleDiv">
-            <span>1536</span>
-            万在线电商营业额
+            <span>{{ num }}</span>
+            {{ text }}
           </div>
-          <div class="line"></div>
+          <div class="line" v-if="index < fwList.length - 1"></div>
         </div>
       </div>
       <!-- 广告位 -->
@@ -221,26 +192,62 @@ export default class extends Vue {
   private infos: IAny[] = [];
   private products: IAny[] = [];
   private shops: IAny[] = [];
-
+  private fwList: Array<{
+    img: string;
+    num: number;
+    text: string;
+  }> = [
+    {
+      img: "qiyeruzhu",
+      num: 0,
+      text: "家钢制家具生产企业入驻"
+    },
+    {
+      img: "chanpin",
+      num: 0,
+      text: "个钢制家具产品入驻"
+    },
+    {
+      img: "huiyuan",
+      num: 0,
+      text: "位平台会员注册"
+    },
+    {
+      img: "yingyee",
+      num: 0,
+      text: "万在线电商营业额"
+    }
+  ];
   async created() {
+    const arr = `/goods/info/hotlist,
+      /demand/info/getDemandInfoTenList,
+      /supply/info/getSupplyInfoTenLsit,
+      /company/hotlist,
+      /company/countCompanyInfo`
+      .split(",")
+      .map(url => this.$post(url.trim()));
     const [
       { list: p },
       { demandList: d },
       { supplyList: s },
       { list: shops },
+      { companyNum, goodsNum, memberNum },
+
       ...n
     ] = await Promise.all([
-      this.$post("/goods/info/hotlist"),
-      this.$post("/demand/info/getDemandInfoTenList"),
-      this.$post("/supply/info/getSupplyInfoTenLsit"),
-      this.$post("/company/hotlist"),
-      this.$post("/interface/notice/getNoticeListTop5", { noticeType: 1 }),
-      this.$post("/interface/notice/getNoticeListTop5", { noticeType: 2 }),
-      this.$post("/interface/notice/getNoticeListTop5", { noticeType: 3 })
+      ...arr,
+      ...[...Array(3)].map((x, index) =>
+        this.$post("/interface/notice/getNoticeListTop5", {
+          noticeType: index + 1
+        })
+      )
     ]).then(x => x.map(([, data]) => data));
     this.products = p;
     this.infos = [d, s];
     this.shops = shops;
+    [companyNum, goodsNum, memberNum].forEach(
+      (x: number, index) => (this.fwList[index].num = x)
+    );
     this.notices = n.map(({ list }) => list);
   }
 }

+ 1 - 0
src/views/mall/index.vue

@@ -92,6 +92,7 @@
       <div class="products">
         <load-more
           url="/goods/info/page"
+          :rows="20"
           :params="params"
           v-slot="{
             item: { id, name, companyId, price, cover, companyName }