web-data-structure.md 8.16 KB

WEB数据结构定义

公共定义

商品

{
    skn: 1,
    thumb: 'path/to/goods/img',
    url: '',
    name: '',
    salePrice: 500, //售价
    marketPrice: 1000, //市场价
    tags: [
        {
            isNew: true //NEW
        },
        {
            isSale: true //SALE
        },
        {
            isLimit: false //限量商品
        },
        {
            isNewFestival: true //新品节
        },
        {
            isReNew: true //再到着
        },
        {
            isYearEndPromotion: true //年终大促
        },
        {
            isYearMidPromotion: true // 年中大促
        }
    ],
    isFew: true, //即将售罄
    showColBtn: true, //是否显示收藏按钮
    coled: true //已收藏
}

路径导航

{
    pathNav: [
        //链接类型
        {
            href: '',
            name: ''
        },
        //文字类型
        {
            name: ''
        }
    ]
}

男首

{
    boy: [
        //banner大图
        bigSlide: [
            {
                'href': '',
                'img': ''
            },
            ...
        ],
        //banner小图
        smallSlide: [
            {
                'href': '',
                'img': ''
            },
            ...
        ],
        //最新速报
        newReport: {
            name: '最新速报 NEW!',  //楼层标题
            list: [
                {
                'href': '',
                'img': ''
                },
            ]
        },
        //优选品牌
        preferenceBrand: {
            name: '优选品牌 BRAND',  //楼层标题
            imgBrand: [
                {

                }
            ]
        }
    ]
}

搜索页

{
    search: {
        //路径导航
        pathNav: [...],

        //筛选相关
        filters: {
            checkedConditions: {
                clearUrl: '', //清空筛选链接
                conditions: [
                    //正常情况下文字显示
                    {
                        href: '',
                        name: '暗黑'
                    },
                    //特殊情况下颜色显示
                    {
                        href: '',
                        'color': '#f00'
                    },
                    ...
                ]
            },
            //-- 筛选项数据Start(需要显示就传,不显示不传) --
            channel: [
                {
                    href: '',
                    name: 'Boys'
                },
                ...
            ],
            sort: [
                {
                    name: '上衣',
                    sub: [
                        {
                            href: '',
                            name: 'T恤'
                        },
                        ...
                    ]
                },
                ...
            ],
            brand: {
                default: [
                    {
                        href: '',
                        name: ''
                    },
                    ...
                ],
                //索引:index为索引键值(字母转化为小写)
                brandIndex: [
                    {
                        index: 'all',
                        name: '全部'
                    },
                    {
                        index: '0-9',
                        name: '0 ~ 9'
                    },
                    {
                        index: 'a',
                        name: 'A'
                    },
                    ...
                ],
                brandShow: [
                    {
                        id: 1,
                        href: '',
                        index:'0-9', //与brandIndex中索引一致
                        name: '5cm',
                        key: '5cm' //key为品牌关键字,用于搜索和索引,保持小写
                    },
                    {
                        id: 2,
                        href: '',
                        index: 'k',
                        name: 'KTZ',
                        key: 'ktz'
                    },
                    ...
                ],
                price: [
                    {
                        href: '',
                        name: '0-239'
                    },
                    ...
                ],
                color: [
                    {
                        href: '',
                        name: '黑色',
                        rgb: '#000' //此处若为彩色和银色,需要传图片路径字符串:url('path/to/img')
                    },
                    ...
                ],
                size: [
                    {
                        href: '',
                        name: ''
                    },
                    ...
                ],
                seniorChose: [
                    {
                        attr: 'style', //查找的键值
                        name: '风格',
                        showMulti: true, //是否显示多选按钮
                        sub: [
                            {
                                id: '',
                                href: '',
                                name: ''
                            },
                            ...
                        ]
                    },
                    ...
                ]
            }
        },

        //操作Banner相关
        opts: {
            sortType: [
                {
                    href: '',
                    name: '默认'
                },
                {
                    active: true, //当前选中
                    href: '',
                    name: '最新',
                    hasSortOrient: true, //是否有正逆序
                    desc: true //逆序排序(默认不传为正序)
                },
                {
                    href: '',
                    name: '价格',
                    hasSortOrient: true
                },
                {
                    href: '',
                    name: '折扣',
                    hasSortOrient: true
                }
            ],
            checks: [
                {
                    name: '新品',
                    checked: true,
                    href: ''
                },
                {
                    name: '打折',
                    href: ''
                },
                {
                    name: '限量',
                    href: ''
                }
            ],
            fivePerLine: true,
            sixPerLineHref: '',
            //or
            sixPerLine: true,
            fivePerLineHref: '',

            countPerPage => 120,
            pageCounts => [
                {
                    href: '',
                    count: 60
                },
                ...
            ],


            curPage: 1,
            pageCount: 30,
            preHref: '', //若当前为第一页,不传此参数
            nexHref: '' //若当前为最后一页,不传此参数
        },
        //商品列表
        goods: [
            //商品信息
            ...
        ]
    }
}