绿满眶商城微信小程序-uniapp
zxl
2025-06-26 3bff34c3aa7ad412042272ea6a37b7d5b49b8d9b
pages/commodity-square/commoditySquare.vue
@@ -1,5 +1,6 @@
<template>
   <view class="container">
      <top-bar selectedTitleIndex="shop" textColor="black" @changeTab="topBarChange" class="topBar"></top-bar>
      <input type="text" v-show="false" v-model="flushDom" />
      <view class="search">
         <u-search class="nav-search" @blur='searchGoods' placeholder="搜索商品" :show-action="false"></u-search>
@@ -12,7 +13,7 @@
                  :controls="false" object-fit="contain" :show-play-btn="false" :show-center-play-btn="false"
                  @loadedmetadata="getvideoInfo($event,'goodsList1',index)" :ref="'video'+item.id"
                  :style="{width:item.width,height:item.height}"></video> -->
               <image :src="item.thumbnail"
               <image :src="item.thumbnail"
                  mode="aspectFill" class="goodsImg">
               </image>
               <view class="goodsInfo">
@@ -31,7 +32,7 @@
                  :controls="false" object-fit="contain" :show-play-btn="false" :show-center-play-btn="false"
                  @loadedmetadata="getvideoInfo($event,'goodsList2',index)" :ref="'video'+item.id"
                  :style="{width:item.width,height:item.height}"></video> -->
               <image :src="item.thumbnail"
               <image :src="item.thumbnail"
                  mode="aspectFill" class="goodsImg">
               </image>
               <view class="goodsInfo">
@@ -48,7 +49,7 @@
         <view class="openShowLeft" @click="showDrawer('showLeft')" v-if="!showLeft">
            <uni-icons type="right" size="30"></uni-icons>
         </view>
         <uni-drawer ref="showLeft" mode="left" width="120" height="94vh" @change="change($event,'showLeft')"
         <uni-drawer ref="showLeft" mode="left" width="120" height="80vh" @change="change($event,'showLeft')"
            :cus-style="true" class="navigationLeft">
            <scroll-view class="typeNavigation" :scroll-y="true" show-scrollbar="false">
               <view class="typeNavigationItem" :class="{typeNavigationItemCheck:currentCategort ==item.id}"
@@ -60,11 +61,11 @@
      </view>
      <view style="display: flex;align-items: center;justify-content: center;margin-top: 20rpx;" v-if="canLoadMore">
         没有更多数据了.................</view>
      <custom-tabbar bgColor="#ffffff" selected="shop"></custom-tabbar>
   </view>
</template>
<script>
   import TopBar from "@/components/TopBar.vue";
   import {
      getCategoryList,
      getGoodsList
@@ -73,6 +74,7 @@
      getSTSToken
   } from '@/api/common.js'
   export default {
      components: {TopBar},
      data() {
         return {
            //记录两列高度
@@ -104,6 +106,17 @@
         }
      },
      methods: {
         topBarChange(titleObj) {
            if (titleObj.index === 'home') {
               uni.switchTab({
                  url: titleObj.pagePath
               });
            } else {
               uni.redirectTo({
                  url: titleObj.pagePath
               });
            }
         },
         async searchGoods(keyWard) {
            this.getGoodsParam.keyword = keyWard
            this.getGoodsParam.pageNumber = 1
@@ -290,7 +303,7 @@
   .openShowLeft {
      position: fixed;
      top: 120rpx;
      top: 200rpx;
      left: 0;
      align-items: center;
      justify-content: flex-start;
@@ -393,4 +406,10 @@
      color: red;
      font-weight: bold;
   }
</style>
   .topBar {
      position: fixed;
      top: 20rpx;
      left: 20rpx;
      z-index: 1000
   }
</style>