panhui 6 лет назад
Родитель
Сommit
08fdb195c2

+ 46 - 90
src/components/AdvertisingSpace.vue

@@ -1,46 +1,48 @@
 <template>
     <div class="advertisingSpace">
-        <div class="topAd" @click="goNext(3)">
-            <img src="/static/images/home_banner_000.png" alt="">
-        </div>
+        <div v-for="(item,index) in adList" :key="index">
+            <div class="topAd" @click="goNext(item.productId)" v-if='item.typeFlag==0'>
+                <image class="img" :src="item.imageUrl" mode="widthFix" />
 
-        <div class="adList">
-            <div class="ad-item" style="background-color:#FF7167" @click="goNext(2)">
-                <div class="left">
-                    <div class="title">新人专区</div>
-                    <div class="subTitle">撒欢任性玩</div>
-                    <div class="go">
-                        GO
-                    </div>
-                </div>
-                <img class="adImg" src="/static/images/home_img_01.png" alt="">
             </div>
-            <div class="line"></div>
-            <div class="ad-item" style="background-color:#9782F8" @click="goNext(1)">
-                <div class="left">
-                    <div class="title">好福利</div>
-                    <div class="subTitle">辅助文字内容</div>
-                    <div class="go">
-                        GO
-                    </div>
+
+            <div class="adList" v-else>
+                <div class="ad-item" style="background-color:#FF7167" @click="goNext(item.productId)">
+                    <img :src="item.imageUrl" alt="">
+
+                </div>
+                <div class="line"></div>
+                <div class="ad-item" style="background-color:#9782F8" @click="goNext(item.product2Id)">
+                    <img :src="item.image2Url" alt="">
                 </div>
-                <img class="adImg" src="/static/images/home_img_02.png" alt="">
             </div>
         </div>
+
     </div>
 </template>
 <script>
 export default {
     data() {
-        return {};
+        return {
+            adList: [],
+        };
+    },
+    onLoad() {
+        this.$http
+            .get('/homeAd/all')
+            .then(res => {
+                if (res.success) {
+                    this.adList = res.data;
+                }
+            })
+            .catch(e => {
+                console.log(e);
+            });
     },
     methods: {
-        goNext(type) {
+        goNext(id) {
             wx.navigateTo({
-                url:
-                    '/pages/productList/productList?serviceType=' +
-                    type +
-                    '&title=广告专区',
+                url: '/pages/product/product?id=' + id,
             });
         },
     },
@@ -52,17 +54,22 @@ export default {
 }
 .topAd {
     display: block;
-
-    img {
+    border-radius: 8px;
+    overflow: hidden;
+    margin: 8px 0;
+    .img {
+        display: block;
         width: 100%;
-        height: 166rpx;
+        border-radius: 8px;
     }
 }
 
 .adList {
     display: flex;
     justify-content: space-between;
-    margin: 0 0 30rpx;
+
+    margin: 8px 0;
+    // margin: 0 0 30rpx;
 
     .line {
         width: 18rpx;
@@ -70,64 +77,13 @@ export default {
     }
 
     .ad-item {
-        display: flex;
-        border-radius: 16rpx;
-        flex-grow: 1;
-        .left {
-            flex-grow: 1;
-            padding: 0 0 0 16rpx;
-            display: flex;
-            flex-direction: column;
-            justify-content: center;
-
-            .title {
-                font-size: 32rpx;
-                font-weight: bold;
-                color: rgba(255, 255, 255, 1);
-                line-height: 44rpx;
-            }
-
-            .subTitle {
-                font-size: 24rpx;
-                color: rgba(255, 255, 255, 1);
-                line-height: 34rpx;
-                margin: 4rpx 0 14rpx 0;
-            }
-
-            .go {
-                position: relative;
-                width: 100rpx;
-                height: 36rpx;
-                background: rgba(0, 0, 0, 0.26);
-                border-radius: 200px;
-                text-align: center;
-                color: #fff;
-                font-size: 26rpx;
-                line-height: 36rpx;
-
-                &::after {
-                    content: ' ';
-                    display: inline-block;
-                    height: 6rpx;
-                    width: 6rpx;
-                    border-width: 2px 2px 0 0;
-                    border-color: #fff;
-                    border-style: solid;
-                    -webkit-transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
-                    transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
-                    position: relative;
-                    top: -2rpx;
-                    position: absolute;
-                    top: 50%;
-                    margin-top: -5rpx;
-                    right: 12rpx;
-                }
-            }
-        }
-        .adImg {
-            width: 180rpx;
-            height: 180rpx;
-            min-height: 180rpx;
+        border-radius: 8px;
+        overflow: hidden;
+        img {
+            display: block;
+            width: 168px;
+            height: 90px;
+            border-radius: 8px;
         }
     }
 }

+ 57 - 31
src/pages/home/home.vue

@@ -19,7 +19,7 @@
             <swiper indicator-dots autoplay circular class="swiper">
                 <block v-for="(item,index) in swiperList" :key="index">
                     <swiper-item>
-                        <image mode="aspectFill" :src="item.imageUrl"></image>
+                        <image mode="aspectFill" :src="item.imageUrl" @click="goBanner(item)"></image>
                     </swiper-item>
                 </block>
             </swiper>
@@ -30,37 +30,40 @@
 
             <div class="linearBg">
                 <!-- <homeCoupon></homeCoupon> -->
+                <div v-for="(item,index) in homeProductList" :key='index'>
 
-                <div class="hot">
-                    <navigator url="/pages/productList/productList?serviceType=1&title=超值热卖" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
-                        <view class="weui-cell__bd">超值热卖</view>
-                        <view class="weui-cell__ft weui-cell__ft_in-access">查看更多</view>
-                    </navigator>
-                    <scroll-view scroll-x style="width: 100%">
-                        <div class="hotList">
-                            <hotItem v-for="(item,index) in hotList" :key="index" :info='item'></hotItem>
-                            <div class="right"></div>
-                        </div>
-                    </scroll-view>
+                    <div class="hot" v-if="item.typeFlag==0">
+                        <navigator :url="'/pages/productList/productList?homeProductId='+item.id+'&title='+item.typeName" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
+                            <view class="weui-cell__bd">{{item.typeName}}</view>
+                            <view class="weui-cell__ft weui-cell__ft_in-access">查看更多</view>
+                        </navigator>
+                        <scroll-view scroll-x style="width: 100%">
+                            <div class="hotList">
+                                <hotItem v-for="(todo,todoIndex) in item.homeProductList" :key="todoIndex" :info='todo.productInfo'></hotItem>
+                                <div class="right"></div>
+                            </div>
+                        </scroll-view>
 
-                </div>
+                    </div>
 
-                <div class="classics">
-                    <navigator url="/pages/productList/productList?serviceType=5&title=经典套餐" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
-                        <view class="weui-cell__bd">经典套餐</view>
-                        <view class="weui-cell__ft weui-cell__ft_in-access">查看更多</view>
-                    </navigator>
+                    <div class="classics" v-else>
+                        <navigator :url="'/pages/productList/productList?homeProductId='+item.id+'&title='+item.typeName" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
+                            <view class="weui-cell__bd">{{item.typeName}}</view>
+                            <view class="weui-cell__ft weui-cell__ft_in-access">查看更多</view>
+                        </navigator>
 
-                    <div class="classicsList">
-                        <productItem v-for="(item,index) in homeList" :key="index" :info='item'></productItem>
+                        <div class="classicsList">
+                            <productItem v-for="(todo,todoIndex)  in item.homeProductList" :key="todoIndex" :info='todo.productInfo'></productItem>
+                        </div>
+                        <view class="weui-loadmore" v-if="isFinish">
+                            <!-- <view class="weui-loadmore__tips">没有更多数据了</view> -->
+                        </view>
+                        <view class="weui-loadmore" v-else>
+                            <view class="weui-loading"></view>
+                            <view class="weui-loadmore__tips">正在加载</view>
+                        </view>
                     </div>
-                    <view class="weui-loadmore" v-if="isFinish">
-                        <!-- <view class="weui-loadmore__tips">没有更多数据了</view> -->
-                    </view>
-                    <view class="weui-loadmore" v-else>
-                        <view class="weui-loading"></view>
-                        <view class="weui-loadmore__tips">正在加载</view>
-                    </view>
+
                 </div>
 
             </div>
@@ -88,6 +91,7 @@ export default {
             homeList: [],
             homeFlag: false,
             isFinish: false,
+            homeProductList: [],
         };
     },
     onLoad() {
@@ -116,8 +120,20 @@ export default {
                 console.log(e);
             });
 
-        this.getHot();
-        this.getHome();
+        // this.getHot();
+        // this.getHome();
+    
+        this.$http
+            .get('/homeProductType/home')
+            .then(res => {
+                if (res.success) {
+                    this.homeProductList = res.data;
+                    this.isFinish=true
+                }
+            })
+            .catch(e => {
+                console.log(e);
+            });
     },
     onReachBottom() {
         // if (this.homeFlag) {
@@ -168,14 +184,24 @@ export default {
                 .then(res => {
                     if (res.success) {
                         this.homeList = this.homeList.concat(res.data.pp);
-                         this.isFinish = true;
+                        this.isFinish = true;
                     }
                 })
                 .catch(e => {
                     console.log(e);
                 });
         },
-        
+        goBanner(info) {
+            if (info.typeFlag == 0 && info.productId) {
+                wx.navigateTo({
+                    url: '/pages/product/product?id=' + info.productId,
+                });
+            } else if (info.typeFlag == 1 && info.pathUrl) {
+                wx.navigateTo({
+                    url: info.pathUrl,
+                });
+            }
+        },
     },
     components: {
         menuList,

+ 5 - 1
src/pages/login/login.vue

@@ -53,6 +53,10 @@ export default {
             // this.showCityPopup = true;
         },
         onGetUserInfo(e) {
+            wx.showLoading({
+                title: '加载中',
+                mask: true,
+            });
             let detail = e.mp.detail;
             this.$http
                 .post('userInfo/getMiniAppUserInfo', {
@@ -64,7 +68,7 @@ export default {
                     miniId: this.miniId,
                 })
                 .then(res => {
-                    console.log(res);
+                    wx.hideLoading();
                     if (res.success) {
                         this.$store.commit('updateUserInfo', res.data);
                         this.goPage();

+ 13 - 3
src/pages/productList/productList.vue

@@ -4,7 +4,7 @@
         <div class="searchContent">
 
             <div class="productList">
-                <productItem v-for="(item,index) in productList" :key="index" :info='item'></productItem>
+                <productItem v-for="(item,index) in productList" :key="index" :info='homeProductId?item.productInfo:item'></productItem>
             </div>
 
             <div class="nothing" v-if="isFinish &&productList.length==0">
@@ -34,10 +34,12 @@ export default {
             isFinish: false,
             flag: false,
             serviceType: 0,
+            homeProductId: 0,
         };
     },
     onLoad(options) {
         this.serviceType = options.serviceType;
+        this.homeProductId = options.homeProductId;
         wx.setNavigationBarTitle({
             title: options.title || '',
         });
@@ -60,10 +62,18 @@ export default {
             var data = {
                 currentPage: this.currentPage,
                 pageNumber: 20,
-                serviceType: this.serviceType,
             };
+
+            if (this.serviceType) {
+                data.serviceType = this.serviceType;
+            }
+
+            if (this.homeProductId) {
+                data.typeId=this.homeProductId
+            }
+
             this.$http
-                .get('/productInfo/page', data)
+                .get(this.homeProductId?'/homeProduct/page':'/productInfo/page', data)
                 .then(res => {
                     if (res.success) {
                         this.productList = this.productList.concat(res.data.pp);

+ 19 - 2
src/pages/user/user.vue

@@ -55,7 +55,7 @@
 
         <div class="menuList">
 
-            <navigator :url="'/pages/myPoint/myPoint'" class="menu-item">
+            <!-- <navigator :url="'/pages/myPoint/myPoint'" class="menu-item">
                 <img src="/static/images/info_icon_jifen.png" alt="">
                 <div class="name">我的积分</div>
                 <img src="/static/images/icon_inter.png" alt="">
@@ -70,7 +70,24 @@
                 <img src="/static/images/info_icon_jifen(2).png" alt="">
                 <div class="name">我的地址</div>
                 <img src="/static/images/icon_inter.png" alt="">
-            </navigator>
+            </navigator> -->
+
+            <div @click="goNext" class="menu-item">
+                <img src="/static/images/info_icon_jifen.png" alt="">
+                <div class="name">我的积分</div>
+                <img src="/static/images/icon_inter.png" alt="">
+            </div>
+            <div @click="goNext" class="menu-item">
+                <img src="/static/images/info_icon_jifen(1).png" alt="">
+                <div class="name">我的优惠券</div>
+                <img src="/static/images/icon_inter.png" alt="">
+            </div>
+
+            <div @click="goNext" class="menu-item">
+                <img src="/static/images/info_icon_jifen(2).png" alt="">
+                <div class="name">我的地址</div>
+                <img src="/static/images/icon_inter.png" alt="">
+            </div>
         </div>
 
     </div>