Parcourir la source

优化项目结构+搜索优化

vaecebyZ il y a 1 an
Parent
commit
d1f679fc00
6 fichiers modifiés avec 36 ajouts et 57 suppressions
  1. 1 0
      App.vue
  2. 31 23
      milktea/index.vue
  3. 0 32
      pages.json
  4. 1 1
      pages/index/index.vue
  5. 2 1
      pages/index/searchResult.vue
  6. 1 0
      utils/tool.js

+ 1 - 0
App.vue

@@ -29,6 +29,7 @@
 				if(res.state == "Success"){
 					uni.setStorageSync('gdShopId',res.content.shopId)
 					uni.setStorageSync("gdTeaId",res.content.teaShop.shopId)
+					uni.setStorageSync("teaCateId",res.content.teaCateId)
 				}
 			})
 		},

+ 31 - 23
milktea/index.vue

@@ -18,7 +18,7 @@
       <swiper class="swiper" @change="swiperChange" :indicator-dots="false" circular :current="current"
         indicatorMode="line" :autoplay="true" :interval="3000" :duration="1000">
         <swiper-item v-for="(item, index) in advList" :key="index">
-          <image class="swiper-item" mode="" :src="item.advertsImg"> </image>
+          <image class="swiper-item" mode="" @click="jump(item.jumpUrl)" :src="item.advertsImg"> </image>
         </swiper-item>
       </swiper>
     </view>
@@ -38,7 +38,7 @@
         </view>
       </view>
 
-      <view class="card-item">
+      <!-- <view class="card-item">
         <view class="card-title">
           <view class="card-item-title">
             <view class="card-img">
@@ -50,7 +50,7 @@
           </view>
 
         </view>
-      </view>
+      </view> -->
     </view>
 
     <view class="swiper-box" style="height: 200rpx">
@@ -152,18 +152,20 @@ export default {
         "location.lon": 0,
         pageCurrent: 1,
         pageSize: 10,
-        status:3
+        status: 3
       },
     };
   },
-  onLoad() { },
+  onLoad(options) {
+    this.columnId = options.columnId;
+    Promise.all([this.getMenu(), this.getBanner(), this.getAdv()]).then((res) => {
+      this.search();
+    });
+  },
   created() {
     this.loading = true;
     this.navBarHeight = this.$navHight(1);
     this.navBarHeight = this.navBarHeight + 10 + "px";
-    Promise.all([this.getMenu(), this.getBanner(), this.getAdv()]).then((res) => {
-      this.search();
-    });
   },
   methods: {
     goGoodsDetail(item) {
@@ -176,11 +178,12 @@ export default {
     swiperChange(val) {
       this.current = val.target.current;
     },
-    toTeaShop(){
+    toTeaShop() {
       const shopId = uni.getStorageSync("gdTeaId");
+      const teaCateId = uni.getStorageSync("teaCateId");
       uni.navigateTo({
-          url: `../pages/index/searchResult?column=奶茶&goodsCateId=46&shopId=${shopId}&columnId=66`,
-        });
+        url: `../pages/index/searchResult?column=奶茶&goodsCateId=${teaCateId}&shopId=${shopId}&columnId=${this.columnId}`,
+      });
     },
 
     // Banner
@@ -243,6 +246,11 @@ export default {
         },
       });
     },
+    jump(url) {
+      uni.navigateTo({
+        url,
+      });
+    },
     search() {
       if (this.status == "noMore") return;
       this.status = "loading";
@@ -388,18 +396,18 @@ page {
       flex: 1;
     }
 
-    .card-item:nth-child(1) {
-      ::after {
-        content: "";
-        position: absolute;
-        margin: 0 auto;
-        right: 0;
-        top: 30rpx;
-        width: 1px;
-        height: 120rpx;
-        background: #FFD9D9;
-      }
-    }
+    // .card-item:nth-child(1) {
+    //   ::after {
+    //     content: "";
+    //     position: absolute;
+    //     margin: 0 auto;
+    //     right: 0;
+    //     top: 30rpx;
+    //     width: 1px;
+    //     height: 120rpx;
+    //     background: #FFD9D9;
+    //   }
+    // }
 
     .card-img {
       display: flex;

+ 0 - 32
pages.json

@@ -136,38 +136,6 @@
 				}
 			]
 		},
-		{
-			"root": "activity",
-			"pages": [{
-				"path": "timeUp/index",
-				"style": {
-					"navigationBarTitleText": "限时秒杀",
-					"navigationStyle": "custom"
-				}
-
-			},
-			{
-				"path": "goPlayRank/index",
-				"style": {
-					"navigationBarTitleText": "趣玩榜"
-				}
-			},
-			{
-				"path": "choiceness/index",
-				"style": {
-					"navigationBarTitleText": "精选折扣",
-					"navigationStyle": "custom"
-				}
-			},
-			{
-				"path": "dailyOffer/index",
-				"style": {
-					"navigationBarTitleText": "天天特惠",
-					"navigationStyle": "custom"
-				}
-			}
-			]
-		},
 		{
 			"root": "detail",
 			"pages": [

+ 1 - 1
pages/index/index.vue

@@ -266,7 +266,7 @@ export default {
       if (item.columnName == '咖啡奶茶' ||  item.columnName == '奶茶单点') {
         uni.navigateTo(
           {
-            url: "/milktea/index"
+            url: "/milktea/index?columnId="+item.id
           }
         )
       } else {

+ 2 - 1
pages/index/searchResult.vue

@@ -81,7 +81,7 @@ export default {
         realPriceOrder: "", //desc,asc
         shopId: "",
         status: 3,
-        currentPage: 0,
+        currentPage: 1,
       },
       status: "more",
       list: [],
@@ -106,6 +106,7 @@ export default {
       this.query.goodsCateId = val[0].id;
       this.query.realPriceOrder = val[1].id || "";
       this.query.pageCurrent = 1;
+      this.query.currentPage = 1;
       this.status = "more";
       this.list = [];
       this.list1 = [];

+ 1 - 0
utils/tool.js

@@ -80,6 +80,7 @@ export const GDZShopiID = async function () {
   if (res.state == "Success") {
     uni.setStorageSync("gdShopId", res.content.shopId);
     uni.setStorageSync("gdTeaId",res.content.teaShop.shopId)
+    uni.setStorageSync("teaCateId",res.content.teaCateId)
 		return res.content.shopId;
   }
 };