web-data-structure.md 24.7 KB

WEB数据结构定义

公共定义

公共底部

{
    footerTop: true //是否显示足部有货services,意见反馈和更多YOHO产品等模块
}

商品

{
    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: ''
        }
    ]
}

站点头部

{
    gobuytype: 'gobuyboys',//购物车样式
    searchcate: 'searchcateboys', //搜索栏样式
    navbars: [{//一级导航
        name_cn: '男生',
        name_en: 'BOYS',
        link: '',
        classname: 'boys',
        index_main: 0,
        subnav: [{
            name: '新品到着',
            link: '',
            index_sub:0,
            thirdnav: [
                {
                    title: '上装',
                    branditems: [
                        {
                            brandname: '背心',
                            link: ''
                        },
                        {
                            brandname: 'T恤',
                            link: ''
                        },
                        {
                            brandname: '衬衫',
                            link: ''
                        },
                        {
                            brandname: 'POLO',
                            link: ''
                        },
                        {
                            brandname: '毛衣/针织',
                            link: ''
                        }]
                }
        ]
        }, {
            name: '品牌一览',
            link: '',
            thirdnav: []
        }]
    }],
    myyoho: {
        email: 'caomei@163.com',
        viptype: '普通会员',
        currentscore: 495,
        totalscore: 600,
        cardtype: '银卡',
        infolist: [{
            name: '待处理的订单',
            link: '',
            num: '0'
        }, {
            name: '我的收藏',
            link: '',
            num: '1'
        }, {
            name: '我的优惠券',
            link: '',
            num: '2'
        }, {
            name: '我的YOHO币',
            link: '',
            num: '1'
        }, {
            name: '我的退货换货',
            link: '',
            num: '1'
        }],
        updlink: ''
    },
    gobuy: {
        gobuynum: 3
    },
    breadcrumbnav: [{
        notend: {
            link: 'http://www.yohobuy.com',
            name: 'BOYS首页'
        }
    }, {
        notend: {
            link: 'http://www.yohobuy.com',
            name: '上衣'
        }
    }, {
        isend: {
            link: 'http://list.yohobuy.com/?msort=1&gender=1,3',
            name: '衬衫'
        }
    }]
}

男首

{
    boys: [
        //banner
        {
            slide: {
                //大图列表
                list: [
                    {
                        'href': '',
                        'img': ''
                    },
                    ...
                ],
                //小图列表
                pagination: [
                    {
                        'href': '',
                        'img': ''
                    },
                    ...
                ]
            }
        },
        {
            //最新速报
            newReport: {
                name: '最新速报 NEW!',  //楼层标题
                list: [
                    {
                        'href': '',
                        'img': ''
                    },
                    ...
                ]
            },
        },
        {
            //优选品牌
            preferenceBrand: {
                name: '优选品牌 BRAND',  //楼层标题
                imgBrand: [ //有图片及logo的品牌
                    {
                        'href': '',
                        'img': ''
                    },
                    ...
                ]
            }
        },
        {
            //单品 HOT
            singlehot:{
                name:'单品 HOT',  //楼层标题
                imgHot:[//有图片及logo的品牌
                    {
                        'href': '',
                        'img': ''
                    },
                    ...
                ]
            }
        },
        {
            //广告
            adbanner:{
                'href':'',
                'img':''
            }
        },
        {
            //潮人适配等楼层
            recommend:{
                name:'潮人配饰 ORNAMENT',
                navs:[
                    {
                        'id':'',
                        'href':'',
                        'name':'MORE'
                    }
                ],
                tplrecommend:{
                    //左上角两张图片
                    keyword:[
                        {
                            name:'',
                            img:'',
                            url:''
                        },
                        ...
                    ],
                    //左下角类别文案
                    category:[
                        {
                            name:'',
                            url:''
                        },
                        ...
                    ],
                    //中间两张图片
                    brands:[
                        {
                            name:'',
                            img:'',
                            url:''
                        },
                        ...
                    ],
                    //右边六张图片
                    types:[
                        {
                            name:'',
                            img:'',
                            url:''
                        },
                        ...
                    ],
                    //下面五张图片
                    products:[
                        {
                            name:'',
                            img:'',
                            url:''
                        },
                        ...
                    ]
                }
            }
        },
        {
            //最新上架
            newArrivls:{
                name:'最新上架  NEW ARRIVALS',
                navs:[
                    {
                        'id':'',
                        'href':'',
                        'name':'MORE'
                    }
                ]
            }
        }   
    ]
}

男首新品上架 ajax数据

{
    code:200,  //返回状态
    commodity:[
        {
            'url':'',
            'img':'',
            'name':'',
            'price':'',
            'state':''  //表示商品某种状态,用于显示商品左上角,比如已将售清等
        },
        ...
    ]
}

logo品牌,ajax数据

{
    moreBrand: '',   //更多商品链接
    logoBrand: [
        {
            'href': '',
            'img': ''
        },
        ...
    ]
}

搜索页

{
    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: '' //若当前为最后一页,不传此参数
        },
        // 商品导航列表
        allSort: {
            //全部品类
            updateNum: 2, //更新总数
            list: [
                {
                    name: 'AA', //一级分类
                    num: 12 //一级分类更新数目
                    childList: [
                        {
                            name: 'AAA', //二级分类
                            href: '##', //二级分类跳转链接
                            num: 12 //二级分类更新数目
                        }
                    ]
                }
            ]
        },
        advNav: {
            //图片导航
            advNavTitle: 'AA', 图片导航标题
            list: [
                {
                    href: '',
                    src: '' // 图片地址
                }
            ]
        },
        advPic: {
            //图片banner
            advPicTitle: 'AA', 图片banner标题
            list: [
                {
                    href: '',
                    src: '' // 图片地址
                }
            ]
        },
        newSales: {
            //一周新品上架
            updateNum: 123,
            list: [
                {
                    name: 'AAA',
                    href: '',
                    num: 12,
                }
            ]
        },
        allDiscount: {
            //全部折扣
            updateNum: 111,
            list: [
                {
                    name: 'VVV',
                    href: '##',
                    num: 11
                }
            ]
        }
        //商品列表
        goods: [
            //商品信息
            ...
        ]
    }
}

【公用】资讯

{
    id: '',
    classification: '最新',
    isReco: true, //是否推荐
    url: '',
    isSquareImg: true, //是否是正方形图
    img: '',
    title: '',
    editorUrl: '',
    author: '',
    pTime: '',
    pView: '',
    content: '',
    tags: [
        {
            url: '',
            tag: ''
        },
        ...
    ],
    liked: true,
    like: 10,
    comment: 10
}

【共用】右侧栏

{
    exRecos: [
        {
            url: '',
            img: '',
            title: ''
        },
        ..
    ],
    hotTags: [
        {
            url: '',
            tagName: ''
        },
        ...
    ],
    ads: [
        {
            url: '',
            img: ''
        },
        ...
    ]
}

首页

{
    guang: {
        slider: [
            {
                url: '',
                img: ''
            },
            ...
        ],
        msgTypes: [
            {
                typeId: '',
                isActive: true,
                navUrl: '',
                type: '最新'
            },
            ...
        ],
        msgs: [
            {
                ...//资讯
            }
        ],
        msgPager: ''//HTML
    }
}

列表页

{
    guang: {
        tag: '户外', //XX关联的文章
        msgs: [
            {
                ..//资讯
            },
            ...
        ],
        msgPager: ''
    }
}

编辑页

{
    guang: {
        editor: {
            avatar: '',
            name: '',
            intro: ''
        },
        msgs: [],
        msgPager: ''
    }
}

逛详情页

{
    guang:{
        id: 1,  //详情页id
        header: {
            title: '',  //大标题 
            avatar: '',    //作者头像
            name: '' ,      //作者名字
            authorUrl: '',     //作者主页url
            intro: '',         //作者简介
            time: '',        //时间
            click: '',       //点击数
            commentNum: ''      //评论数
        },
        content: [
            {
                pic: ''    //内容大图
            },
            {
                text: ''    //内容文字
            },
            {
                smallPic: [    //内容两张并列小图
                    'http://img02.static.yohobuy.com/cms/2015/06/26/12/027eb72bc880b4fe1aad361296c871c2ea.jpg',
                    'http://img02.static.yohobuy.com/cms/2015/06/26/12/027eb72bc880b4fe1aad361296c871c2ea.jpg'
                ]
            },
            {
                relatedReco: {      //相关推荐
                    recos: [
                        {
                            ..//通用商品信息
                        }
                        ...
                    ],
                    moreReco: '',  //标题是否有more,有传url,没有不传
                }
            }
        ],
        brands: [   //相关品牌
            {
                'thumb' => '',      //品牌图片
                'name' => '004',    //品牌名称
                'url' => ''         //品牌url
            }
            ...
        ],
        userInfo: {             //用户点赞收藏
            isLike: true,       //当前用户是否点赞
            likeNum: 84,        //点赞次数
            isCollected: true   //当前用户是否收藏
        },
        tag: [      //内容标签
            {
                name: LEE,      //标签内容
                url: www.baidu.com      //标签链接
            }
            ...
        ],
        relatedPost:[   //相关文章
            {
                url => '',      //链接
                thumb => '',        //图片
                title => ''         //标题
            }
            ...
        ],
        commentInfo: '',  //初始内容,用于登陆页跳转回来后的内容不丢失
        comment: {    
            commentNum: 4,  //如果没有评论,数字为0,list和commentPager可以不传
            list: [     //评论列表
                {
                    avatar: '',  //评论用户头像
                    name: '',      //用户名字
                    content: '',    //评论内容
                    time: ''        //发表时间
                }
                ...
            ]
        }
    }
}

Passport

【公用】左侧YohoFamily LOGO

{
    coverHref: '', //跳转链接,需要有跳转就传,不需要就不传
    coverImg: '' //图片地址
}

登录页

{
    passport: {
        coverHref: '', //跳转链接,需要有跳转就传,不需要就不传
        coverImg: '' //图片地址

        countryCode: '86', //无+
        countryName: '中国',

        countryList: [
            {
                code: '',
                name: ''
            },
            ...
        ]
    }
}

注册页

{
    registerPage: true, //用于加载js
    passport: {
        actionUrl: '/passport/register/mobileregister', //action
        region: [
            {
                id: 86, //国家地区码
                name: '中国',
                selected: true
            }
        ],
        location: '+86', //默认在哪个地区
        captchaUrl: 'http://www.yohobuy.com/passport/images?t=1449799445', //验证码请求地址
        itemUrl' => '##', //服务条款地址
        referUrl' => 'http://www.yohobuy.com/', //注册后跳转链接
        loginUrl' => '/signin.html?refer=http://www.yohobuy.com/', //登录链接
        coverHref' => '/passport', //右侧封面跳转链接
        coverImg' => '##', //右侧封面地址
    }
}

Product

热销排行

{ hotrankPage: true, //引用hotrank.js hotrank: [ { slide: { //大图列表 list: [ { 'href': '', 'img': '' }, ... ] } }, { popular: { //人气单品 name: '', //楼层标题 list: [ { href: '', //链接 img: '', //图片 title: '', //商品名称 price: '', //商品原价 sPrice: '', //商品现价 rank: '' //排行 } ... ] } } { hotBrands: { //同上logo品牌 ajax数据 name: '' //楼层标题 } }, { hotWeek: { //一周热卖 name: '' //楼层标题 nav: [ //一周热卖导航 { textCn' => 'TOP100', //导航名称 'url' => '',
'sid' => 1 //对应ajax发送id } ], list: [ //同上面商品数据 { ... } ... ] } } ] }