''' 注意,复制数据的时候不要忘了把sectorCanvasHeight加上,因为我的数据跟前端的不太一样。 我生成画布数据需要sectorCanvasHeight画布高度。 ''' #1-4套皮肤 首页数据 class sectorStyle1to4Data: def __init__(self): # 通栏权重设置 self.sectors_config = [ {"name": "headLineSector", "total": 1, "weight": 10 ,"CNname":"网站头条" , "random": False}, {"name": "bannerSector", "total": 1, "weight": 9 ,"CNname":"焦点图" , "random": False}, {"name": "linkSector", "total": 1, "weight": 8 ,"CNname":"外链面板" , "random": False}, {"name": "manyPictureSector", "total": 2, "weight": 7 ,"CNname":"新闻图文组合1" , "random": True}, {"name": "commentSector", "total": 2, "weight": 7 ,"CNname":"新闻图文组合2" , "random": True}, {"name": "listSector", "total": 2, "weight": 7 ,"CNname":"新闻图文组合3" , "random": True}, {"name": "onlyImgSector", "total": 2, "weight": 7 ,"CNname":"带广告新闻组合" , "random": True}, {"name": "adSector", "total": 4, "weight": 6 ,"CNname":"通栏广告" , "random": False} ] # 通栏数据 self.sectors_data = { #广告通栏 "adSector": { "sectorName": "adSector", "sectorCanvasHeight": 12, #占据画布高度 "componentList": [ { "component_type": 2, "component_style": 1, "sort": 1, "componentData": {} } ], "ad": { "width": 1200, "height": 90, "name": "", "price": 0, "introduce":"", "website_id": "", "thumb": "https://img.bjzxtw.org.cn/pre/image/png/20250530/1748588901281358.png", "typeid": 2, "ad_tag": "" } }, #头条通栏 "headLineSector": { "sectorName": "headLineSector", "sectorCanvasHeight": 17, "componentList": [ { "component_type": 1, "component_style": 1, "sort": 1, "componentData": { "level": 1, "imgSize": 0, "textSize": 4, "child": { "id": "", "imgSize": "", "textSize": "" }, "listType": [ "id", "title", "imgurl", "author", "updated_at", "introduce", "islink", "linkurl", "copyfrom", "cat_arr_id", "catid", "pinyin" ], } } ] }, #轮播图通栏 "bannerSector": { "sectorName": "bannerSector", "sectorCanvasHeight": 44, "componentList": [ { "component_type": 1, "component_style": 1, "sort": 1, "componentData": { "level": 2, "imgSize": 5, "textSize": 0, "child": { "id": "", "imgSize": "", "textSize": "" }, "listType": [ "id", "title", "imgurl", "author", "updated_at", "introduce", "islink", "linkurl", "copyfrom", "cat_arr_id", "catid", "pinyin" ], } }, { "component_type": 1, "component_style": 1, "sort": 2, "componentData": { "level": 6, "imgSize": 0, "textSize": 10, "child": { "id": "", "imgSize": "", "textSize": "" }, "listType": [ "id", "title", "imgurl", "author", "updated_at", "introduce", "islink", "linkurl", "copyfrom", "cat_arr_id", "catid", "pinyin" ], } } ] }, #新闻组合通栏1 "manyPictureSector": { "sectorName": "manyPictureSector", "sectorCanvasHeight": 47, "componentList": [ { "component_type": 1, "component_style": 1, "sort": 1, "componentData": { "category_id":"", "category_arr":"", "name":"请选择导航..", "level":"", "imgSize": 3, "textSize": 9, "child":{ "id":"", "imgSize": "", "textSize": "" }, "listType": [ "id", "title", "imgurl", "author", "updated_at", "introduce", "islink", "linkurl", "copyfrom", "cat_arr_id", "catid", "pinyin" ], } }, { "component_type": 1, "component_style": 1, "sort": 2, "componentData": { "category_id":"", "category_arr":"", "name":"请选择导航..", "level":"", "imgSize": 3, "textSize": 6, "child":{ "id":"", "imgSize": "", "textSize": "" }, "listType": [ "id", "title", "imgurl", "author", "updated_at", "introduce", "islink", "linkurl", "copyfrom", "cat_arr_id", "catid", "pinyin" ], } } ] }, #新闻组合通栏2 "commentSector": { "sectorName": "commentSector", "sectorCanvasHeight": 47, "componentList": [ { "component_type": 1, "component_style": 1, "sort": 1, "componentData": { "category_id":"", "category_arr":"", "name":"请选择导航..", "level":"", "imgSize": 2, "textSize": 12, "child":{ "id":"", "imgSize": "", "textSize": "" }, "listType": [ "id", "title", "imgurl", "author", "updated_at", "introduce", "islink", "linkurl", "copyfrom", "cat_arr_id", "catid", "pinyin" ], } }, { "component_type": 1, "component_style": 1, "sort": 2, "componentData": { "category_id":"", "category_arr":"", "name":"请选择导航..", "level":"", "imgSize": 1, "textSize": 3, "child":{ "id":"", "imgSize": "", "textSize": "" }, "listType": [ "id", "title", "imgurl", "author", "updated_at", "introduce", "islink", "linkurl", "copyfrom", "cat_arr_id", "catid", "pinyin" ], } } ] }, #新闻组合通栏3 "listSector": { "sectorName": "listSector", "sectorCanvasHeight": 98, "componentList": [ { "component_type": 1, "component_style": 1, "sort": 1, "componentData": { "category_id":"", "category_arr":"", "name":"请选择导航..", "level":"", "imgSize": 2, "textSize": 6, "child":{ "id":"", "imgSize": "", "textSize": "" }, "listType": [ "id", "title", "imgurl", "author", "updated_at", "introduce", "islink", "linkurl", "copyfrom", "cat_arr_id", "catid", "pinyin" ], } }, { "component_type": 1, "component_style": 1, "sort": 2, "componentData": { "category_id":"", "category_arr":"", "name":"请选择导航..", "level":"", "imgSize": 2, "textSize": 14, "child":{ "id":"", "imgSize": "", "textSize": "" }, "listType": [ "id", "title", "imgurl", "author", "updated_at", "introduce", "islink", "linkurl", "copyfrom", "cat_arr_id", "catid", "pinyin" ], } }, { "component_type": 1, "component_style": 1, "sort": 3, "componentData": { "category_id":"", "category_arr":"", "name":"请选择导航..", "level":"", "imgSize": 7, "textSize": 0, "child":{ "id":"", "imgSize": "", "textSize": "" }, "listType": [ "id", "title", "imgurl", "author", "updated_at", "introduce", "islink", "linkurl", "copyfrom", "cat_arr_id", "catid", "pinyin" ], } } ] }, #广告新闻混合通栏 "onlyImgSector": { "sectorName": "onlyImgSector", "sectorCanvasHeight": 51, "componentList": [ { "component_type": 1, "component_style": 1, "sort": 1, "componentData": { "category_id":"", "category_arr":"", "name":"请选择导航..", "level":"", "imgSize": 3, "textSize": 4, "child":{ "id":"", "imgSize": "", "textSize": "" }, "listType": [ "id", "title", "imgurl", "author", "updated_at", "introduce", "islink", "linkurl", "copyfrom", "cat_arr_id", "catid", "pinyin" ], } }, ], "ad": { "width": 450, "height": 290, "name": "", "price": 0, "introduce":"", "website_id": "", "thumb": "http://img.bjzxtw.org.cn/pre/image/png/20250609/174945725555092.png", "typeid": 2, "ad_tag": "" } }, #外链通栏 "linkSector": { "sectorName": "linkSector", "sectorCanvasHeight": 26, "componentList": [ { "component_type": 3, "component_style": 1, "sort": 1, "componentData": {} } ] }, } #初始化通栏权重 def reset_sectors_config(self): self.sectors_config = [ {"name": "headLineSector", "total": 1, "weight": 10 ,"CNname":"网站头条"}, {"name": "bannerSector", "total": 1, "weight": 9 ,"CNname":"焦点图"}, {"name": "linkSector", "total": 1, "weight": 8 ,"CNname":"外链面板"}, {"name": "manyPictureSector", "total": 2, "weight": 7 ,"CNname":"新闻图文组合1"}, {"name": "commentSector", "total": 2, "weight": 7 ,"CNname":"新闻图文组合2"}, {"name": "listSector", "total": 2, "weight": 7 ,"CNname":"新闻图文组合3"}, {"name": "onlyImgSector", "total": 2, "weight": 7 ,"CNname":"带广告新闻组合"}, {"name": "adSector", "total": 4, "weight": 6 ,"CNname":"通栏广告"} ] #创建一个templateData实例 sectorStyle1to4Data = sectorStyle1to4Data()