style1to4data.py 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. '''
  2. 注意,复制数据的时候不要忘了把sectorCanvasHeight加上,因为我的数据跟前端的不太一样。
  3. 我生成画布数据需要sectorCanvasHeight画布高度。
  4. '''
  5. #1-4套皮肤 首页数据
  6. class sectorStyle1to4Data:
  7. def __init__(self):
  8. # 通栏权重设置
  9. self.sectors_config = [
  10. {"name": "headLineSector", "total": 1, "weight": 10 ,"CNname":"网站头条" , "random": False},
  11. {"name": "bannerSector", "total": 1, "weight": 9 ,"CNname":"焦点图" , "random": False},
  12. {"name": "linkSector", "total": 1, "weight": 8 ,"CNname":"外链面板" , "random": False},
  13. {"name": "manyPictureSector", "total": 2, "weight": 7 ,"CNname":"新闻图文组合1" , "random": True},
  14. {"name": "commentSector", "total": 2, "weight": 7 ,"CNname":"新闻图文组合2" , "random": True},
  15. {"name": "listSector", "total": 2, "weight": 7 ,"CNname":"新闻图文组合3" , "random": True},
  16. {"name": "onlyImgSector", "total": 2, "weight": 7 ,"CNname":"带广告新闻组合" , "random": True},
  17. {"name": "adSector", "total": 4, "weight": 6 ,"CNname":"通栏广告" , "random": False}
  18. ]
  19. # 通栏数据
  20. self.sectors_data = {
  21. #广告通栏
  22. "adSector": {
  23. "sectorName": "adSector",
  24. "sectorCanvasHeight": 12, #占据画布高度
  25. "componentList": [
  26. {
  27. "component_type": 2,
  28. "component_style": 1,
  29. "sort": 1,
  30. "componentData": {}
  31. }
  32. ],
  33. "ad": {
  34. "width": 1200,
  35. "height": 90,
  36. "name": "",
  37. "price": 0,
  38. "introduce":"",
  39. "website_id": "",
  40. "thumb": "https://img.bjzxtw.org.cn/pre/image/png/20250530/1748588901281358.png",
  41. "typeid": 2,
  42. "ad_tag": ""
  43. }
  44. },
  45. #头条通栏
  46. "headLineSector": {
  47. "sectorName": "headLineSector",
  48. "sectorCanvasHeight": 17,
  49. "componentList": [
  50. {
  51. "component_type": 1,
  52. "component_style": 1,
  53. "sort": 1,
  54. "componentData": {
  55. "level": 1,
  56. "imgSize": 0,
  57. "textSize": 4,
  58. "child": {
  59. "id": "",
  60. "imgSize": "",
  61. "textSize": ""
  62. },
  63. "listType": [
  64. "id",
  65. "title",
  66. "imgurl",
  67. "author",
  68. "updated_at",
  69. "introduce",
  70. "islink",
  71. "linkurl",
  72. "copyfrom",
  73. "cat_arr_id",
  74. "catid",
  75. "pinyin"
  76. ],
  77. }
  78. }
  79. ]
  80. },
  81. #轮播图通栏
  82. "bannerSector": {
  83. "sectorName": "bannerSector",
  84. "sectorCanvasHeight": 44,
  85. "componentList": [
  86. {
  87. "component_type": 1,
  88. "component_style": 1,
  89. "sort": 1,
  90. "componentData": {
  91. "level": 2,
  92. "imgSize": 5,
  93. "textSize": 0,
  94. "child": {
  95. "id": "",
  96. "imgSize": "",
  97. "textSize": ""
  98. },
  99. "listType": [
  100. "id",
  101. "title",
  102. "imgurl",
  103. "author",
  104. "updated_at",
  105. "introduce",
  106. "islink",
  107. "linkurl",
  108. "copyfrom",
  109. "cat_arr_id",
  110. "catid",
  111. "pinyin"
  112. ],
  113. }
  114. },
  115. {
  116. "component_type": 1,
  117. "component_style": 1,
  118. "sort": 2,
  119. "componentData": {
  120. "level": 6,
  121. "imgSize": 0,
  122. "textSize": 10,
  123. "child": {
  124. "id": "",
  125. "imgSize": "",
  126. "textSize": ""
  127. },
  128. "listType": [
  129. "id",
  130. "title",
  131. "imgurl",
  132. "author",
  133. "updated_at",
  134. "introduce",
  135. "islink",
  136. "linkurl",
  137. "copyfrom",
  138. "cat_arr_id",
  139. "catid",
  140. "pinyin"
  141. ],
  142. }
  143. }
  144. ]
  145. },
  146. #新闻组合通栏1
  147. "manyPictureSector": {
  148. "sectorName": "manyPictureSector",
  149. "sectorCanvasHeight": 47,
  150. "componentList": [
  151. {
  152. "component_type": 1,
  153. "component_style": 1,
  154. "sort": 1,
  155. "componentData": {
  156. "category_id":"",
  157. "category_arr":"",
  158. "name":"请选择导航..",
  159. "level":"",
  160. "imgSize": 3,
  161. "textSize": 9,
  162. "child":{
  163. "id":"",
  164. "imgSize": "",
  165. "textSize": ""
  166. },
  167. "listType": [
  168. "id",
  169. "title",
  170. "imgurl",
  171. "author",
  172. "updated_at",
  173. "introduce",
  174. "islink",
  175. "linkurl",
  176. "copyfrom",
  177. "cat_arr_id",
  178. "catid",
  179. "pinyin"
  180. ],
  181. }
  182. },
  183. {
  184. "component_type": 1,
  185. "component_style": 1,
  186. "sort": 2,
  187. "componentData": {
  188. "category_id":"",
  189. "category_arr":"",
  190. "name":"请选择导航..",
  191. "level":"",
  192. "imgSize": 3,
  193. "textSize": 6,
  194. "child":{
  195. "id":"",
  196. "imgSize": "",
  197. "textSize": ""
  198. },
  199. "listType": [
  200. "id",
  201. "title",
  202. "imgurl",
  203. "author",
  204. "updated_at",
  205. "introduce",
  206. "islink",
  207. "linkurl",
  208. "copyfrom",
  209. "cat_arr_id",
  210. "catid",
  211. "pinyin"
  212. ],
  213. }
  214. }
  215. ]
  216. },
  217. #新闻组合通栏2
  218. "commentSector": {
  219. "sectorName": "commentSector",
  220. "sectorCanvasHeight": 47,
  221. "componentList": [
  222. {
  223. "component_type": 1,
  224. "component_style": 1,
  225. "sort": 1,
  226. "componentData": {
  227. "category_id":"",
  228. "category_arr":"",
  229. "name":"请选择导航..",
  230. "level":"",
  231. "imgSize": 2,
  232. "textSize": 12,
  233. "child":{
  234. "id":"",
  235. "imgSize": "",
  236. "textSize": ""
  237. },
  238. "listType": [
  239. "id",
  240. "title",
  241. "imgurl",
  242. "author",
  243. "updated_at",
  244. "introduce",
  245. "islink",
  246. "linkurl",
  247. "copyfrom",
  248. "cat_arr_id",
  249. "catid",
  250. "pinyin"
  251. ],
  252. }
  253. },
  254. {
  255. "component_type": 1,
  256. "component_style": 1,
  257. "sort": 2,
  258. "componentData": {
  259. "category_id":"",
  260. "category_arr":"",
  261. "name":"请选择导航..",
  262. "level":"",
  263. "imgSize": 1,
  264. "textSize": 3,
  265. "child":{
  266. "id":"",
  267. "imgSize": "",
  268. "textSize": ""
  269. },
  270. "listType": [
  271. "id",
  272. "title",
  273. "imgurl",
  274. "author",
  275. "updated_at",
  276. "introduce",
  277. "islink",
  278. "linkurl",
  279. "copyfrom",
  280. "cat_arr_id",
  281. "catid",
  282. "pinyin"
  283. ],
  284. }
  285. }
  286. ]
  287. },
  288. #新闻组合通栏3
  289. "listSector": {
  290. "sectorName": "listSector",
  291. "sectorCanvasHeight": 98,
  292. "componentList": [
  293. {
  294. "component_type": 1,
  295. "component_style": 1,
  296. "sort": 1,
  297. "componentData": {
  298. "category_id":"",
  299. "category_arr":"",
  300. "name":"请选择导航..",
  301. "level":"",
  302. "imgSize": 2,
  303. "textSize": 6,
  304. "child":{
  305. "id":"",
  306. "imgSize": "",
  307. "textSize": ""
  308. },
  309. "listType": [
  310. "id",
  311. "title",
  312. "imgurl",
  313. "author",
  314. "updated_at",
  315. "introduce",
  316. "islink",
  317. "linkurl",
  318. "copyfrom",
  319. "cat_arr_id",
  320. "catid",
  321. "pinyin"
  322. ],
  323. }
  324. },
  325. {
  326. "component_type": 1,
  327. "component_style": 1,
  328. "sort": 2,
  329. "componentData": {
  330. "category_id":"",
  331. "category_arr":"",
  332. "name":"请选择导航..",
  333. "level":"",
  334. "imgSize": 2,
  335. "textSize": 14,
  336. "child":{
  337. "id":"",
  338. "imgSize": "",
  339. "textSize": ""
  340. },
  341. "listType": [
  342. "id",
  343. "title",
  344. "imgurl",
  345. "author",
  346. "updated_at",
  347. "introduce",
  348. "islink",
  349. "linkurl",
  350. "copyfrom",
  351. "cat_arr_id",
  352. "catid",
  353. "pinyin"
  354. ],
  355. }
  356. },
  357. {
  358. "component_type": 1,
  359. "component_style": 1,
  360. "sort": 3,
  361. "componentData": {
  362. "category_id":"",
  363. "category_arr":"",
  364. "name":"请选择导航..",
  365. "level":"",
  366. "imgSize": 7,
  367. "textSize": 0,
  368. "child":{
  369. "id":"",
  370. "imgSize": "",
  371. "textSize": ""
  372. },
  373. "listType": [
  374. "id",
  375. "title",
  376. "imgurl",
  377. "author",
  378. "updated_at",
  379. "introduce",
  380. "islink",
  381. "linkurl",
  382. "copyfrom",
  383. "cat_arr_id",
  384. "catid",
  385. "pinyin"
  386. ],
  387. }
  388. }
  389. ]
  390. },
  391. #广告新闻混合通栏
  392. "onlyImgSector": {
  393. "sectorName": "onlyImgSector",
  394. "sectorCanvasHeight": 51,
  395. "componentList": [
  396. {
  397. "component_type": 1,
  398. "component_style": 1,
  399. "sort": 1,
  400. "componentData": {
  401. "category_id":"",
  402. "category_arr":"",
  403. "name":"请选择导航..",
  404. "level":"",
  405. "imgSize": 3,
  406. "textSize": 4,
  407. "child":{
  408. "id":"",
  409. "imgSize": "",
  410. "textSize": ""
  411. },
  412. "listType": [
  413. "id",
  414. "title",
  415. "imgurl",
  416. "author",
  417. "updated_at",
  418. "introduce",
  419. "islink",
  420. "linkurl",
  421. "copyfrom",
  422. "cat_arr_id",
  423. "catid",
  424. "pinyin"
  425. ],
  426. }
  427. },
  428. ],
  429. "ad": {
  430. "width": 450,
  431. "height": 290,
  432. "name": "",
  433. "price": 0,
  434. "introduce":"",
  435. "website_id": "",
  436. "thumb": "http://img.bjzxtw.org.cn/pre/image/png/20250609/174945725555092.png",
  437. "typeid": 2,
  438. "ad_tag": ""
  439. }
  440. },
  441. #外链通栏
  442. "linkSector": {
  443. "sectorName": "linkSector",
  444. "sectorCanvasHeight": 26,
  445. "componentList": [
  446. {
  447. "component_type": 3,
  448. "component_style": 1,
  449. "sort": 1,
  450. "componentData": {}
  451. }
  452. ]
  453. },
  454. }
  455. #初始化通栏权重
  456. def reset_sectors_config(self):
  457. self.sectors_config = [
  458. {"name": "headLineSector", "total": 1, "weight": 10 ,"CNname":"网站头条"},
  459. {"name": "bannerSector", "total": 1, "weight": 9 ,"CNname":"焦点图"},
  460. {"name": "linkSector", "total": 1, "weight": 8 ,"CNname":"外链面板"},
  461. {"name": "manyPictureSector", "total": 2, "weight": 7 ,"CNname":"新闻图文组合1"},
  462. {"name": "commentSector", "total": 2, "weight": 7 ,"CNname":"新闻图文组合2"},
  463. {"name": "listSector", "total": 2, "weight": 7 ,"CNname":"新闻图文组合3"},
  464. {"name": "onlyImgSector", "total": 2, "weight": 7 ,"CNname":"带广告新闻组合"},
  465. {"name": "adSector", "total": 4, "weight": 6 ,"CNname":"通栏广告"}
  466. ]
  467. #创建一个templateData实例
  468. sectorStyle1to4Data = sectorStyle1to4Data()