Sfoglia il codice sorgente

[fixed] 修复领取佣金后 推广中心不刷新 && 增加首页新闻资讯

x 5 anni fa
parent
commit
fff3d5f5f7

BIN
src/assets/images/news.png


+ 84 - 0
src/components/News.vue

@@ -0,0 +1,84 @@
+<template>
+  <div class="news acea-row row-between-wrapper">
+    <div class="pictrue"><img src="@assets/images/news.png" /></div>
+    <div class="swiper-no-swiping new-banner">
+      <swiper v-swiper:
+          class="swiper-wrapper"
+          :options="swiperRoll"
+          ref="rollSwiper"
+      >
+        <swiper-slide
+            class="swiper-slide"
+            v-for="(item, index) in roll"
+            :key="index"
+        >
+          <router-link
+              :to="item.wap_url ? item.wap_url : ''"
+              class="acea-row row-between-wrapper"
+          >
+            <div class="text acea-row row-between-wrapper">
+              <div class="label" v-if="item.show === '是'">最新</div>
+              <div class="newsTitle line1">{{ item.info }}</div>
+            </div>
+            <div class="iconfont icon-xiangyou"></div>
+          </router-link>
+        </swiper-slide>
+      </swiper>
+    </div>
+  </div>
+</template>
+
+<script>
+import { swiper, swiperSlide } from "vue-awesome-swiper";
+export default {
+  name: "News",
+  props: {
+    roll: [],
+  },
+  components: {
+    swiper,
+    swiperSlide,
+  },
+  watch: {
+    $route(n) {
+      if (n.name === "Index") {
+        this.$refs.rollSwiper.swiper.autoplay.start();
+      } else {
+        this.$refs.rollSwiper.swiper.autoplay.stop();
+      }
+    }
+  },
+  data: function() {
+    return {
+      swiperRoll: {
+        direction: "vertical",
+        autoplay: {
+          disableOnInteraction: false,
+          delay: 2000
+        },
+        loop: true,
+        speed: 1000,
+        observer: true,
+        observeParents: true
+      },
+    };
+  },
+
+  methods: {
+  }
+};
+</script>
+
+<style>
+.news{height:0.77rem;border-top:1px solid #f4f4f4;padding:0 0.3rem;box-shadow:0 0.1rem 0.3rem #f5f5f5;
+  -webkit-box-shadow:0 0.1rem 0.3rem #f5f5f5;-moz-box-shadow:0 0.1rem 0.3rem #f5f5f5;-o-box-shadow:0 0.1rem 0.3rem #f5f5f5;}
+.news .pictrue{width:1.24rem;height:0.28rem;border-right:1px solid #ddd;padding-right:0.23rem;box-sizing:content-box;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;}
+.news .pictrue img{width:100%;height:100%;display:block;}
+.news .new-banner{width:5.23rem;overflow:hidden;height:0.77rem;}
+.news .new-banner .swiper-slide{height:100%;}
+.news .new-banner .text{width:4.8rem;height:0.77rem;}
+.news .new-banner .text .label{font-size:0.2rem;color:#ff4c48;width:0.68rem;height:0.34rem;border-radius:0.2rem;
+  text-align:center;line-height:0.34rem;border:0.02rem solid #ff4947;}
+.news .new-banner .text .newsTitle{width:3.97rem;font-size:0.24rem;color:#666;}
+.news .new-banner .iconfont{font-size:0.28rem;color:#888;}
+</style>

+ 1 - 0
src/utils/index.js

@@ -46,4 +46,5 @@ export function formatRMB(money) {
 const VUE_APP_API_URL = process.env.VUE_APP_API_URL || `${location.origin}/api`;
 const VUE_APP_WS_URL = process.env.VUE_APP_WS_URL;
 
+console.log(VUE_APP_API_URL);
 export { VUE_APP_API_URL, VUE_APP_WS_URL };

+ 7 - 1
src/views/home/Index.vue

@@ -91,6 +91,7 @@
                 <div>积分中心</div>
               </router-link>
             </div>
+            <News :roll="roll"></News>
             <div class="scroll-coupon" v-if="getCouponList.length">
               <swiper :options="swiperScroll">
                 <swiper-slide
@@ -480,6 +481,7 @@
           :title="item.cate_name"
           :key="index"
         >
+          <img v-if="item.pic !== ''" :src="item.pic" style="width: 100%">
           <div class="wrapper">
             <div class="classifyList acea-row row-between-wrapper">
               <div
@@ -572,6 +574,7 @@ import JPush from "@libs/jpush";
 import { WeChat } from "@libs/pay";
 import GoodItem from "@components/GoodItem";
 import {checkUpdate} from "@libs/update";
+import News from "@components/News";
 const HAS_COUPON_WINDOW = "has_coupon_window";
 const LONGITUDE = "user_longitude";
 const LATITUDE = "user_latitude";
@@ -579,6 +582,7 @@ let vm = null;
 export default {
   name: "Index",
   components: {
+    News,
     swiper,
     swiperSlide,
     Tab,
@@ -726,7 +730,8 @@ export default {
         observer: true,
         observeParents: true
       },
-      mapKey: ""
+      mapKey: "",
+      roll: []
     };
   },
   created() {
@@ -861,6 +866,7 @@ export default {
         // } else {
         //   that.followHid = false;
         // }
+        that.$set(that, "roll", res.data.roll);
         that.$set(that, "banner", res.data.banner);
         that.$set(that, "menus", res.data.menus);
         that.$set(that, "activity", res.data.activity);

+ 2 - 1
src/views/user/UserVip.vue

@@ -215,7 +215,7 @@ export default {
       this.$router.push( { path: "/user/user_promotion" });
     },
     update: function() {
-      var that = this;
+      let that = this;
       that.getInfo();
       getVIP().then(res => {
         that.productId = res.data.card_updater_id;
@@ -237,6 +237,7 @@ export default {
           that.taskCount = res.data.task.reach_count;
           getUserInfo().then(res => {
             that.userInfo = res.data;
+            that.$store.commit("UPDATE_USERINFO", res.data);
             that.vipInfo = that.vipList[that.userInfo.vip_level - 1];
           });
         },