|
|
@ -109,15 +109,9 @@ Page({ |
|
|
console.log('小品种创建者:', smallCreators) |
|
|
console.log('小品种创建者:', smallCreators) |
|
|
console.log('大贸易创建者:', largeCreators) |
|
|
console.log('大贸易创建者:', largeCreators) |
|
|
|
|
|
|
|
|
// 如果从数据库获取失败,使用默认数据
|
|
|
// 直接使用数据库返回的数据,不使用默认数据
|
|
|
let finalSmallCreators = smallCreators |
|
|
const finalSmallCreators = smallCreators |
|
|
let finalLargeCreators = largeCreators |
|
|
const finalLargeCreators = largeCreators |
|
|
|
|
|
|
|
|
if (smallCreators.length === 0 || largeCreators.length === 0) { |
|
|
|
|
|
console.log('从数据库获取数据失败,使用默认数据') |
|
|
|
|
|
finalSmallCreators = ['何佳芹', '李真音', '王磊'] // 小品种创建者
|
|
|
|
|
|
finalLargeCreators = ['吴海燕', '陈骏', '刘琴', '杨率', '汤敏'] // 大贸易创建者
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 更新filterConfig
|
|
|
// 更新filterConfig
|
|
|
this.setData({ |
|
|
this.setData({ |
|
|
@ -138,19 +132,18 @@ Page({ |
|
|
this.loadGoodsList() |
|
|
this.loadGoodsList() |
|
|
} catch (err) { |
|
|
} catch (err) { |
|
|
console.error('加载goods_root数据失败:', err) |
|
|
console.error('加载goods_root数据失败:', err) |
|
|
// 使用默认数据作为fallback
|
|
|
// 即使获取失败,也使用空数组,不使用默认数据
|
|
|
console.log('API调用失败,使用默认数据') |
|
|
|
|
|
this.setData({ |
|
|
this.setData({ |
|
|
filterConfig: { |
|
|
filterConfig: { |
|
|
small: ['何佳芹', '李真音', '王磊'], // 小品种创建者
|
|
|
small: [], // 小品种创建者
|
|
|
large: ['吴海燕', '陈骏', '刘琴', '杨率', '汤敏'] // 大贸易创建者
|
|
|
large: [] // 大贸易创建者
|
|
|
}, |
|
|
}, |
|
|
// 清除缓存,确保重新加载商品列表时使用新的filterConfig
|
|
|
// 清除缓存,确保重新加载商品列表时使用新的filterConfig
|
|
|
'cache.publishedGoods': [], |
|
|
'cache.publishedGoods': [], |
|
|
'cache.soldOutGoods': [], |
|
|
'cache.soldOutGoods': [], |
|
|
'cache.timestamp': 0 |
|
|
'cache.timestamp': 0 |
|
|
}) |
|
|
}) |
|
|
console.log('使用默认数据更新filterConfig成功:', this.data.filterConfig) |
|
|
console.log('API调用失败,使用空数组更新filterConfig:', this.data.filterConfig) |
|
|
// 即使获取失败,也继续加载商品列表
|
|
|
// 即使获取失败,也继续加载商品列表
|
|
|
this.loadGoodsList() |
|
|
this.loadGoodsList() |
|
|
} |
|
|
} |
|
|
|