ui修改
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
var WxParse = null;
|
||||
var WxParse = null;
|
||||
//获取应用实例
|
||||
var app = getApp()
|
||||
var sopenFrame=null;
|
||||
@@ -43,6 +43,71 @@ Page({
|
||||
|
||||
that=this;
|
||||
WxParse = require('../../wxParse/wxParse.js');
|
||||
|
||||
// ============================================
|
||||
// 【测试数据配置区域 - 开始】
|
||||
// 用途:用于本地测试swiper组件渲染效果
|
||||
// 使用方法:将 useTestData 设为 true 启用测试数据,设为 false 恢复正式数据
|
||||
// 注意:测试完成后请将 useTestData 设为 false 或删除测试代码块
|
||||
// ============================================
|
||||
var useTestData = false; // 切换开关:true=使用测试数据,false=使用后端数据
|
||||
|
||||
if (useTestData) {
|
||||
// 虚拟测试数据 - 用于验证swiper组件渲染效果
|
||||
var testData = {
|
||||
ifxn: 1, // 控制wx:if条件显示
|
||||
indicatorDots0: true, // 显示指示点
|
||||
vertical0: false, // 水平轮播
|
||||
autoplay: true, // 自动播放
|
||||
interval0: 3000, // 轮播间隔3秒
|
||||
duration: 500, // 动画时长0.5秒
|
||||
loadingHidden: true, // 隐藏loading
|
||||
// images1数组:包含3个swiper-item,每个item包含4个cell
|
||||
images1: [
|
||||
{
|
||||
datas: [
|
||||
{ id: '1', label: '手机数码', img: 'https://picsum.photos/200/200?random=1' },
|
||||
{ id: '2', label: '电脑办公', img: 'https://picsum.photos/200/200?random=2' },
|
||||
{ id: '3', label: '家用电器', img: 'https://picsum.photos/200/200?random=3' },
|
||||
{ id: '4', label: '服饰鞋包', img: 'https://picsum.photos/200/200?random=4' }
|
||||
]
|
||||
},
|
||||
// {
|
||||
// datas: [
|
||||
// { id: '5', label: '美妆护肤', img: 'https://picsum.photos/200/200?random=5' },
|
||||
// { id: '6', label: '食品生鲜', img: 'https://picsum.photos/200/200?random=6' },
|
||||
// { id: '7', label: '家居家装', img: 'https://picsum.photos/200/200?random=7' },
|
||||
// { id: '8', label: '运动户外', img: 'https://picsum.photos/200/200?random=8' }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// datas: [
|
||||
// { id: '9', label: '图书音像', img: 'https://picsum.photos/200/200?random=9' },
|
||||
// { id: '10', label: '母婴用品', img: 'https://picsum.photos/200/200?random=10' },
|
||||
// { id: '11', label: '汽车用品', img: 'https://picsum.photos/200/200?random=11' },
|
||||
// { id: '12', label: '玩具乐器', img: 'https://picsum.photos/200/200?random=12' }
|
||||
// ]
|
||||
// }
|
||||
],
|
||||
// 其他必要数据
|
||||
images: [
|
||||
{ url: '1', img: 'https://picsum.photos/750/300?random=101' },
|
||||
{ url: '2', img: 'https://picsum.photos/750/300?random=102' },
|
||||
{ url: '3', img: 'https://picsum.photos/750/300?random=103' }
|
||||
],
|
||||
Products: [],
|
||||
Products0: []
|
||||
};
|
||||
|
||||
that.setData(testData);
|
||||
console.log('【测试模式】已加载虚拟测试数据');
|
||||
// 测试数据模式下不调用后端接口,防止数据被覆盖
|
||||
return;
|
||||
}
|
||||
// ============================================
|
||||
// 【测试数据配置区域 - 结束】
|
||||
// ============================================
|
||||
|
||||
/*var shopdata = wx.getStorageSync('shopdata')
|
||||
if(shopdata){
|
||||
var resshopdata=JSON.parse(shopdata);
|
||||
@@ -124,21 +189,41 @@ clearCache:function(){
|
||||
success (res) {
|
||||
|
||||
if(res.data.status==1){
|
||||
wx.setStorageSync('shopdata', JSON.stringify(res.data))
|
||||
wx.setStorageSync('shopdata', JSON.stringify(res.data))
|
||||
|
||||
// 转换 pic1 数据格式:将扁平数组包装为包含 datas 的嵌套结构
|
||||
var pic1Data = res.data.pic1 || []
|
||||
var formattedImages1 = []
|
||||
if (pic1Data.length > 0) {
|
||||
// 每8个一组进行分组(双行显示,每行4个分类)
|
||||
var groupSize = 8
|
||||
for (var i = 0; i < pic1Data.length; i += groupSize) {
|
||||
formattedImages1.push({
|
||||
datas: pic1Data.slice(i, i + groupSize)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
that.setData({
|
||||
images: res.data.pic,
|
||||
images1: res.data.pic1,
|
||||
Products:res.data.products,
|
||||
Products0:res.data.products0,
|
||||
images: res.data.pic || [],
|
||||
images1: formattedImages1,
|
||||
Products:res.data.products || [],
|
||||
Products0:res.data.products0 || [],
|
||||
loadingHidden:true
|
||||
})
|
||||
|
||||
if(res.data.userInfo.ifxn==0){
|
||||
if(res.data.ifxn==1){
|
||||
that.setData({
|
||||
ifxn:1
|
||||
})
|
||||
}
|
||||
|
||||
// if(res.data.userInfo && res.data.userInfo.ifxn==0){
|
||||
// that.setData({
|
||||
// ifxn:1
|
||||
// })
|
||||
// }
|
||||
// that.setData({
|
||||
// ifxn:1
|
||||
// })
|
||||
if(t==1){
|
||||
//隐藏loading 提示框
|
||||
wx.hideLoading();
|
||||
|
||||
Reference in New Issue
Block a user