Browse Source

Merge pull request 'Xfy' (#4) from Xfy into ly

Reviewed-on: http://8.137.125.67:4000/SwtTt29/Mini-Program/pulls/4
ly 2 months ago
parent
commit
796e0ac627
  1. BIN
      images/立即入驻7.jpg
  2. 2
      pages/chat/index.js
  3. 16
      pages/index/index.js
  4. 17
      pages/index/index.wxml
  5. 80
      pages/index/index.wxss

BIN
images/立即入驻7.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

2
pages/chat/index.js

@ -89,7 +89,7 @@ Page({
// 保存当前时间戳,用于强制刷新 // 保存当前时间戳,用于强制刷新
const forcedLoadTime = Date.now(); const forcedLoadTime = Date.now();
this.setData({ this.setData({
lastLoadTime: forcedLoadTime - 3000, // 设置为3秒前,确保能绕过2秒的节流限制 lastLoadTime: forcedLoadTime - 2000, // 设置为2秒前,确保能绕过2秒的节流限制
}, () => { }, () => {
// 重新加载聊天列表,实现从聊天详情页返回时立即更新 // 重新加载聊天列表,实现从聊天详情页返回时立即更新
this.loadChatList(); this.loadChatList();

16
pages/index/index.js

@ -706,6 +706,7 @@ Page({
filteredGoods: filteredGoods, filteredGoods: filteredGoods,
loadingMore: false, loadingMore: false,
isLoading: false, isLoading: false,
isRefreshing: false, // 确保下拉刷新状态被重置
page: this.data.page + 1, page: this.data.page + 1,
// 更新缓存时间戳 // 更新缓存时间戳
lastDataTimestamp: new Date().getTime() lastDataTimestamp: new Date().getTime()
@ -894,9 +895,10 @@ Page({
return; return;
} }
// 筛选时不显示骨架屏
if (isLoadMore) { if (isLoadMore) {
this.setData({ loadingMore: true }) this.setData({ loadingMore: true })
} else { } else if (!forceRefresh) { // 只有非筛选的首次加载才显示骨架屏
this.setData({ isLoading: true }) this.setData({ isLoading: true })
} }
@ -956,7 +958,11 @@ Page({
}) })
.catch(err => { .catch(err => {
console.error('加载商品数据失败:', err) console.error('加载商品数据失败:', err)
this.setData({ loadingMore: false, isLoading: false }) this.setData({
loadingMore: false,
isLoading: false,
isRefreshing: false // 确保下拉刷新状态被重置
})
}) })
}, },
@ -1056,6 +1062,7 @@ Page({
filteredGoods: filteredGoods, filteredGoods: filteredGoods,
loadingMore: false, loadingMore: false,
isLoading: false, isLoading: false,
isRefreshing: false, // 确保下拉刷新状态被重置
hasMoreData: false // 缓存数据不分页 hasMoreData: false // 缓存数据不分页
}); });
}, },
@ -1408,7 +1415,7 @@ Page({
return // 如果选择的分类和当前相同,不重复加载 return // 如果选择的分类和当前相同,不重复加载
} }
// 清除缓存并重新加载数据 - 仿照下拉刷新机制 // 清除缓存并重新加载数据 - 筛选时不显示骨架屏,直接显示内容
this.setData({ this.setData({
selectedCategory: category, selectedCategory: category,
searchKeyword: '', // 清除搜索关键词,筛选框优先级更高 searchKeyword: '', // 清除搜索关键词,筛选框优先级更高
@ -1417,7 +1424,8 @@ Page({
hasMoreData: true, hasMoreData: true,
goods: [], goods: [],
filteredGoods: [], filteredGoods: [],
isLoading: true, isLoading: false, // 筛选时不显示骨架屏
isRefreshing: false, // 筛选时不显示下拉刷新状态
// 清除所有缓存以获取最新数据 // 清除所有缓存以获取最新数据
categoryQueryCache: {}, categoryQueryCache: {},
lastDataTimestamp: 0, lastDataTimestamp: 0,

17
pages/index/index.wxml

@ -108,7 +108,7 @@
</view> </view>
</view> </view>
<!-- 骨架屏加载 --> <!-- 骨架屏加载 - 只在初始加载时显示,筛选时不显示 -->
<view wx:if="{{isLoading && goods.length === 0}}" class="skeleton-container"> <view wx:if="{{isLoading && goods.length === 0}}" class="skeleton-container">
<view class="skeleton-grid"> <view class="skeleton-grid">
<view class="skeleton-grid-item" wx:for="{{[1,2,3,4,5,6,7,8]}}" wx:key="index"> <view class="skeleton-grid-item" wx:for="{{[1,2,3,4,5,6,7,8]}}" wx:key="index">
@ -123,7 +123,7 @@
</view> </view>
<!-- 商品列表区域 --> <!-- 商品列表区域 -->
<view class="goods-section"> <view class="goods-section" wx:if="{{filteredGoods.length > 0}}">
<scroll-view <scroll-view
class="goods-list" class="goods-list"
id="goodsScrollView" id="goodsScrollView"
@ -180,10 +180,10 @@
<view wx:if="{{item.supplyStatus === '预售'}}" class="promo-tag presale">预售</view> <view wx:if="{{item.supplyStatus === '预售'}}" class="promo-tag presale">预售</view>
<view wx:if="{{item.supplyStatus === '现货'}}" class="promo-tag in-stock">现货</view> <view wx:if="{{item.supplyStatus === '现货'}}" class="promo-tag in-stock">现货</view>
</view> </view>
<view class="product-info" style="height: 181rpx; display: flex; box-sizing: border-box"> <view class="product-info" style="height: 190rpx; display: flex; box-sizing: border-box">
<view class="product-title" style="height: 35rpx; display: -webkit-box; box-sizing: border-box">{{item.name}}</view> <view class="product-title" style="height: 38rpx; display: -webkit-box; box-sizing: border-box">{{item.name}}</view>
<view class="product-spec" style="width: 308rpx; height: 29rpx; display: block; box-sizing: border-box">{{item.displaySpecification}}<text wx:if="{{item.displayYolk}}"> | {{item.displayYolk}}</text></view> <view class="product-spec" style="width: 308rpx; height: 29rpx; display: block; box-sizing: border-box">{{item.displaySpecification}}<text wx:if="{{item.displayYolk}}"> | {{item.displayYolk}}</text></view>
<view class="product-status-row" style="width: 325rpx; display: block; box-sizing: border-box; height: 60rpx"> <view class="product-status-row" style="width: 339rpx; display: block; box-sizing: border-box; height: 60rpx; left: -10rpx; top: 0rpx">
<view class="status-tag source-{{item.sourceType === '三方认证' ? 'third' : (item.sourceType === '平台货源' ? 'platform' : 'unverified')}}">{{item.sourceType || ''}}</view> <view class="status-tag source-{{item.sourceType === '三方认证' ? 'third' : (item.sourceType === '平台货源' ? 'platform' : 'unverified')}}">{{item.sourceType || ''}}</view>
<view class="status-tag negotiate-{{item.negotiateStatus === '可议价' ? 'yes' : 'no'}}" style="width: 70rpx; display: inline-block; box-sizing: border-box">{{item.negotiateStatus}}</view> <view class="status-tag negotiate-{{item.negotiateStatus === '可议价' ? 'yes' : 'no'}}" style="width: 70rpx; display: inline-block; box-sizing: border-box">{{item.negotiateStatus}}</view>
<view class="status-tag item-count">库存:{{item.totalStock && item.totalStock !== '充足' ? item.totalStock + '件' : (item.totalStock || '充足')}}</view> <view class="status-tag item-count">库存:{{item.totalStock && item.totalStock !== '充足' ? item.totalStock + '件' : (item.totalStock || '充足')}}</view>
@ -217,6 +217,13 @@
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
<!-- 无商品时显示(初始加载时) -->
<view wx:if="{{!isLoading && filteredGoods.length === 0}}" class="empty-goods" style="margin-top: 100rpx;">
<view class="empty-icon">📦</view>
<text class="empty-text">暂无商品数据</text>
<text class="empty-hint">下拉刷新试试</text>
</view>
<!-- 登录弹窗 --> <!-- 登录弹窗 -->
<view wx:if="{{showOneKeyLoginModal}}" class="auth-modal-overlay"> <view wx:if="{{showOneKeyLoginModal}}" class="auth-modal-overlay">
<view class="auth-modal-container"> <view class="auth-modal-container">

80
pages/index/index.wxss

@ -871,6 +871,86 @@ wx-button:not([size=mini]) {
border: 1rpx solid rgba(82, 196, 26, 0.5); border: 1rpx solid rgba(82, 196, 26, 0.5);
} }
/* product-status-row 容器样式 */
.product-status-row {
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: flex-start;
gap: 6rpx;
width: 100%;
height: 36rpx;
overflow: visible;
position: relative;
z-index: 9999;
margin: 4rpx 0;
background: transparent;
}
/* 货源类型标签 - 完全根据字数动态调整宽度 */
.product-status-row .source-tag {
width: auto;
min-width: 50rpx;
max-width: 120rpx;
white-space: nowrap;
flex-shrink: 0;
font-size: 16rpx;
padding: 6rpx 8rpx;
height: 28rpx;
line-height: 16rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 6rpx;
border: 1rpx solid rgba(0, 0, 0, 0.1);
background: rgba(24, 144, 255, 0.1);
color: #096dd9;
box-sizing: border-box;
}
/* 议价状态标签 - 完全根据字数动态调整宽度 */
.product-status-row .negotiate-tag {
width: auto;
min-width: 50rpx;
max-width: 80rpx;
white-space: nowrap;
text-align: center;
flex-shrink: 0;
font-size: 16rpx;
padding: 6rpx 8rpx;
height: 28rpx;
line-height: 16rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 6rpx;
border: 1rpx solid rgba(0, 0, 0, 0.1);
background: rgba(255, 255, 255, 0.8);
color: #333;
box-sizing: border-box;
}
/* 库存标签 - 根据字数动态调整宽度 */
.product-status-row .stock-tag {
width: auto;
min-width: 70rpx;
max-width: 160rpx;
white-space: nowrap;
text-align: center;
font-size: 16rpx;
padding: 6rpx 8rpx;
height: 28rpx;
line-height: 16rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 6rpx;
border: 1rpx solid rgba(0, 0, 0, 0.1);
background: rgba(82, 196, 26, 0.1);
color: #389e0d;
box-sizing: border-box;
}
.goods-footer { .goods-footer {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;

Loading…
Cancel
Save