绿满眶商城微信小程序-uniapp
zxl
2025-07-29 66c550a7021c5685e8b7dde4a92e6efd3625689f
Merge remote-tracking branch 'origin/dev_fix_sub' into dev_fix_sub
9个文件已修改
232 ■■■■ 已修改文件
pages.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/commodity-square/commoditySquare.vue 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/cusbar/cart/cartList.vue 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/health/healthVideo.vue 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/kitchen/KitchenVideo.vue 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/mine/address/add.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/mine/im/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/tabbar/index/home.vue 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/video/video-goods-detail.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json
@@ -2005,7 +2005,8 @@
            "componentPlaceholder": {
              "u-navbar": "view",
              "u-search": "view",
              "u-image": "view"
              "u-image": "view",
              "u-icon": "view"
            }
          }
        }
pages/commodity-square/commoditySquare.vue
@@ -16,7 +16,7 @@
                </scroll-view>
            </view>
            <view class="goodsInfos" >
            <view class="goodsInfos" style="position: relative;">
                <scroll-view :scroll-y="true" :show-scrollbar="false" style="height: 100%;" @scrolltolower="loadMoreData()">
                    <view class="goodsItem" v-for="item in goodsList" :key="item.id"
@@ -58,6 +58,10 @@
                        </view>
                    </view>
                </scroll-view>
                </view>
                <view   @click="gotoCardList()" style="position: absolute;bottom: 120rpx; right: 32rpx;">
                  <div class="settlement" >去购物车结算</div>
                </view>
            </view>
        </view>
@@ -87,6 +91,8 @@
        },
        data() {
            return {
                canGoToCarList:false,
                nums:10,
                searchInfo: '',
                //商品列表
                goodsList: [],
@@ -114,6 +120,11 @@
            }
        },
        methods: {
            gotoCardList(){
                uni.navigateTo({
                    url:'/pages/cusbar/cart/cartList'
                })
            },
            addCardNum(e, id) {
                this.goodsList.forEach(item => {
                    if (item.id === id) {
@@ -269,6 +280,7 @@
                const cardInfos = await getCarts();
                // 处理购物车信息
                let cardMap = new Map();
            this.canGoToCarList =    cardInfos.data.result.cartList.length>0
                cardInfos.data.result.cartList.forEach(item => {
                    item.skuList.forEach(sku => {
@@ -333,7 +345,16 @@
        overflow: hidden;
    }
    .settlement {
      width: 180rpx;
      height: 70rpx;
      line-height: 70rpx;
      background: linear-gradient(91deg, $light-color 1%, $aider-light-color 99%);
      border-radius: 900rpx;
      text-align: center;
      color: #fff;
      margin-right: 10rpx;
    }
    .navigatorMenue {
        margin-left: -32rpx;
pages/cusbar/cart/cartList.vue
@@ -240,15 +240,16 @@
   */
  onShow() {
    this.deleteShow ? (this.deleteShow = false) : true;
    if (this.$refs.swiperAction) {
      this.$refs.swiperAction.forEach((item, index) => {
        item.show = false;
      });
    this.getCardData();
        // if (this.$refs.swiperAction) {
        //   this.$refs.swiperAction.forEach((item, index) => {
        //     item.show = false;
        //   });
        //   this.getCardData();
        // } else {
        //   this.getCardData();
        // }
      this.getCardData();
    } else {
      this.getCardData();
    }
  },
  methods: {
    /**
pages/health/healthVideo.vue
@@ -375,18 +375,38 @@
  },
  onLoad(option) {
      this.marginBottom = uni.getSystemInfoSync().safeAreaInsets.bottom
      let queryParam = this.videoQuery;
      if (option.q) {
        // 双重解码:微信对URL进行了两次编码
        const decodedUrl = decodeURIComponent(decodeURIComponent(option.q));
        console.log('原始URL:', decodedUrl);
        // 解析URL中的查询参数
        const params = this.parseUrlParams(decodedUrl);
        const shareType = params.shareType;
        const videoId = params.videoId;
        queryParam.videoId = videoId
        queryParam.shareType = shareType
        console.log('解析参数:', { shareType, videoId });
      }
      const token = storage.getAccessToken();
      if (! token) {
          this.wxSilentLogin(() => {
              this.loadVideos();
              // 判断是不是点击分享链接进来的
              if (option.userId && option.videoId) {
                    queryParam.videoId = option.videoId
                  // 保存分享点击记录
                  saveShareClickRecord({refId: option.videoId, shareUserId: option.userId})
              }
              this.loadVideos(queryParam);
          })
      } else {
        this.loadVideos();
          if (option.userId && option.videoId) {
                queryParam.videoId = option.videoId
              // 保存分享点击记录
              saveShareClickRecord({refId: option.videoId, shareUserId: option.userId})
          }
        this.loadVideos(queryParam);
      }
  },
  onShareAppMessage(e) {
@@ -410,6 +430,23 @@
      }
  },
  methods: {
      // 解析URL参数
      parseUrlParams(url) {
        const params = {};
        // 处理可能存在的hash(如果有的话)
        const cleanUrl = url.split('#')[0];
        const queryStr = cleanUrl.split('?')[1] || '';
        queryStr.split('&').forEach(pair => {
          const [key, value] = pair.split('=');
          if (key) {
            // 如果值存在,则解码,否则设为空字符串
            params[key] = value ? decodeURIComponent(value) : '';
          }
        });
        return params;
      },
      // 查询当前视频的关联视频(挂了同一商品的)
      async getGoodsSimilarly() {
                if (this.similarlyLoading || this.similarlyNomore) return Promise.resolve();;
@@ -739,10 +776,38 @@
      },
    // 加载视频数据
    async loadVideos() {
    async loadVideos(param) {
      if (this.loading || this.videoNoMore) return;
      this.loading = true;
    if(param){
        getHealthRecommendVideos(this.videoQuery).then(res => {
                  // 新增一个字段用于循环时的key
                  const data = res.data.data.map(item => {
                      return {
                          ...item,
                          updateKey: item.id
                      }
                  })
                  if (this.videoQuery.pageNumber === 1) {
                    this.videoList = data;
                  } else {
                    this.videoList = [
                      ...this.videoList,
                      ...data.filter(
                        (newItem) => !this.videoList.some((oldItem) => oldItem.id === newItem.id)
                      ),
                    ];
                  }
                  this.loading = false;
                  if(data.length < this.videoQuery.pageSize) {
                      this.videoNoMore = true;
                      return;
                  }
                  this.videoQuery.pageNumber++;
        })
    }else{
      getHealthRecommendVideos(this.videoQuery).then(res => {
          // 新增一个字段用于循环时的key
          const data = res.data.data.map(item => {
@@ -768,7 +833,7 @@
          }
          this.videoQuery.pageNumber++;
      })
      })}
    },
    // 滑动切换视频
pages/kitchen/KitchenVideo.vue
@@ -413,6 +413,26 @@
      console.log('-------------leftHeight------------------------>',this.leftHeight)
    this.getKitchenTypeList();
    this.loadVideos();
  },
   onShareAppMessage(e) {
    const userInfo = storage.getUserInfo();
    if(!userInfo) {
        console.log("未登录不能分享");
        return
    }
    const videoInfo = e.target.dataset.obj;
    // 保存分享记录
    const data = {
        shareType: 'video',
        refId: videoInfo.id,
        shareUser: userInfo.id
    }
    saveShare(data)
      return {
          title: videoInfo.title,
          path: `/pages/tabbar/index/home?videoId=${videoInfo.id}&userId=${userInfo.id}`,
          imageUrl: videoInfo.coverUrl
      }
  },
  methods: {
    // 查询当前视频的关联视频(挂了同一商品的)
pages/mine/address/add.vue
@@ -3,9 +3,9 @@
    <div class="uForm">
      <u-form :border-bottom="false" :model="form" ref="uForm" :error-type="['toast']" :rule="rules">
                <!-- #ifndef H5 -->
        <view class="selectAddress" @click="clickUniMap">
<!--        <view class="selectAddress" @click="clickUniMap">
          选择收货地址
        </view>
        </view> -->
                <!-- #endif -->
        <u-form-item class="border" label="收货人" label-width="130" prop="name">
          <u-input v-model="form.name" clearable placeholder="请输入收货人姓名" />
@@ -35,7 +35,7 @@
      <m-city :provinceData="list" headTitle="区域选择" ref="cityPicker" @funcValue="getpickerParentValue" pickerSize="4">
      </m-city>
      <uniMap v-if="mapFlag" @close="closeMap" @callback="callBackAddress" />
      <!-- <uniMap v-if="mapFlag" @close="closeMap" @callback="callBackAddress" /> -->
    </div>
  </view>
</template>
@@ -125,7 +125,6 @@
    // 选择地址后数据的回调
    callBackAddress(val) {
      console.log(val)
      uni.showLoading({
        title: "加载中",
      });
pages/mine/im/index.vue
@@ -269,7 +269,6 @@
      this.getTalk(options.userId)
    }
    // this.ws.connect();
    this.sokcet();
  },
pages/tabbar/index/home.vue
@@ -380,19 +380,43 @@
      this.startHidenTime = Date.now()
  },
  onLoad(option) {
      console.log('-----------分享出的数据---------->',option)
      //处理扫码出来的视频
      this.marginBottom = uni.getSystemInfoSync().safeAreaInsets.bottom
            // 检查是否存在q参数
            let queryParam = this.videoQuery;
            if (option.q) {
              // 双重解码:微信对URL进行了两次编码
              const decodedUrl = decodeURIComponent(decodeURIComponent(option.q));
              console.log('原始URL:', decodedUrl);
              // 解析URL中的查询参数
              const params = this.parseUrlParams(decodedUrl);
              const shareType = params.shareType;
              const videoId = params.videoId;
              queryParam.videoId = videoId
              console.log('解析参数:', { shareType, videoId });
            }
      const token = storage.getAccessToken();
      if (! token) {
          this.wxSilentLogin(() => {
              this.loadVideos();
              // 判断是不是点击分享链接进来的
              if (option.userId && option.videoId) {
                  queryParam.videoId = option.videoId
                  // 保存分享点击记录
                  saveShareClickRecord({refId: option.videoId, shareUserId: option.userId})
              }
              console.log('------------------------>',queryParam)
              this.loadVideos(queryParam);
          })
      } else {
        this.loadVideos();
          if (option.userId && option.videoId) {
              queryParam.videoId = option.videoId
                            // 保存分享点击记录
                saveShareClickRecord({refId: option.videoId, shareUserId: option.userId})
          }
          console.log('------------------------2>',queryParam)
        this.loadVideos(queryParam);
      }
  },
  onShareAppMessage(e) {
@@ -412,10 +436,26 @@
      return {
          title: videoInfo.title,
          path: `/pages/tabbar/index/home?videoId=${videoInfo.id}&userId=${userInfo.id}`,
          imageUrl: videoInfo.coverUrl
      }
  },
  methods: {
  methods: {
      // 解析URL参数
    parseUrlParams(url) {
      const params = {};
      // 处理可能存在的hash(如果有的话)
      const cleanUrl = url.split('#')[0];
      const queryStr = cleanUrl.split('?')[1] || '';
      queryStr.split('&').forEach(pair => {
        const [key, value] = pair.split('=');
        if (key) {
          // 如果值存在,则解码,否则设为空字符串
          params[key] = value ? decodeURIComponent(value) : '';
        }
      });
      return params;
    },
      // 查询当前视频的关联视频(挂了同一商品的)
      async getGoodsSimilarly() {
          if (this.similarlyLoading || this.similarlyNomore) return Promise.resolve();;
@@ -753,10 +793,38 @@
      },
    // 加载视频数据
    async loadVideos() {
    async loadVideos(param) {
      if (this.loading || this.videoNoMore) return;
      this.loading = true;
        if(param){
            getRecommendVideos(param).then(res => {
                      // 新增一个字段用于循环时的key
                      const data = res.data.data.map(item => {
                          return {
                              ...item,
                              updateKey: item.id
                          }
                      })
                      if (this.videoQuery.pageNumber === 1) {
                        this.videoList = data;
                      } else {
                        this.videoList = [
                          ...this.videoList,
                          ...data.filter(
                            (newItem) => !this.videoList.some((oldItem) => oldItem.id === newItem.id)
                          ),
                        ];
                      }
                      this.loading = false;
                      if(res.data.data.length < this.videoQuery.pageSize) {
                          this.videoNoMore = true;
                          return;
                      }
                      this.videoQuery.pageNumber++;
            })
        }else{
      getRecommendVideos(this.videoQuery).then(res => {
          // 新增一个字段用于循环时的key
          const data = res.data.data.map(item => {
@@ -784,6 +852,7 @@
          this.videoQuery.pageNumber++;
      })
      }
    },
    // 滑动切换视频
pages/video/video-goods-detail.vue
@@ -53,6 +53,11 @@
            this.getGoodsList();
        },
        methods: {
            selectGoods(goods,id){
                uni.navigateTo({
                    url: `/pages/product/goods?id=${goods.id}&goodsId=${goods.goodsId}`
                })
            },
            // 获取商品列表
            async getGoodsList() {
                getGoodsDetail(this.videoId).then(res => {