sector.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. <template>
  2. <div class="sectorBox">
  3. <div
  4. class="sectorItemBox"
  5. @click="addModule('adSector', 12, adSector)"
  6. @drag="drag('adSector', 12, adSector)"
  7. @dragend="dragend('adSector', 12, adSector)"
  8. >
  9. <div class="sectorItem">
  10. <img src="http://img.bjzxtw.org.cn/pre/image/png/20250604/1748998088187321.png" />
  11. </div>
  12. <div class="sectorItemTitle">通栏广告</div>
  13. </div>
  14. <div
  15. class="sectorItemBox"
  16. @click="addModule('headLineSector', 17, headLineSector)"
  17. @drag="drag('headLineSector', 17, headLineSector)"
  18. @dragend="dragend('headLineSector', 17, headLineSector)"
  19. >
  20. <div class="sectorItem">
  21. <img src="http://img.bjzxtw.org.cn/pre/image/png/20250603/1748914467583559.png" />
  22. </div>
  23. <div class="sectorItemTitle">网站头条</div>
  24. </div>
  25. <div
  26. class="sectorItemBox"
  27. @click="addModule('bannerSector', 44, bannerSector)"
  28. @drag="drag('bannerSector', 44, bannerSector)"
  29. @dragend="dragend('bannerSector', 44, bannerSector)"
  30. >
  31. <div class="sectorItem">
  32. <img src="http://img.bjzxtw.org.cn/pre/image/png/20250604/174899892158949.png" />
  33. </div>
  34. <div class="sectorItemTitle">焦点图</div>
  35. </div>
  36. <div
  37. class="sectorItemBox"
  38. @click="addModule('manyPictureSector', 47, manyPictureSector)"
  39. @drag="drag('manyPictureSector', 47, manyPictureSector)"
  40. @dragend="dragend('manyPictureSector', 47, manyPictureSector)"
  41. >
  42. <div class="sectorItem">
  43. <img src="http://img.bjzxtw.org.cn/pre/image/jpeg/20250605/1749085058737998.jpg" />
  44. </div>
  45. <div class="sectorItemTitle">新闻图文组合1</div>
  46. </div>
  47. <div
  48. class="sectorItemBox"
  49. @click="addModule('commentSector', 47, commentSector)"
  50. @drag="drag('commentSector', 47, commentSector)"
  51. @dragend="dragend('commentSector', 47, commentSector)">
  52. <div class="sectorItem">
  53. <img src="http://img.bjzxtw.org.cn/pre/image/jpeg/20250606/1749170683104422.jpg" />
  54. </div>
  55. <div class="sectorItemTitle">新闻图文组合2</div>
  56. </div>
  57. <div
  58. class="sectorItemBox"
  59. @click="addModule('listSector', 98, listSector)"
  60. @drag="drag('listSector', 98, listSector)"
  61. @dragend="dragend('listSector', 98, listSector)"
  62. >
  63. <div class="sectorItem">
  64. <img src="http://img.bjzxtw.org.cn/pre/image/jpeg/20250606/1749200397579402.jpg" />
  65. </div>
  66. <div class="sectorItemTitle">新闻图文组合3</div>
  67. </div>
  68. <div
  69. class="sectorItemBox"
  70. @click="addModule('onlyImgSector', 51, onlyImgSector)"
  71. @drag="drag('onlyImgSector', 51, onlyImgSector)"
  72. @dragend="dragend('onlyImgSector', 51, onlyImgSector)"
  73. >
  74. <div class="sectorItem">
  75. <img src="http://img.bjzxtw.org.cn/pre/image/jpeg/20250609/1749451127220319.jpg" />
  76. </div>
  77. <div class="sectorItemTitle">带广告新闻组合</div>
  78. </div>
  79. </div>
  80. </template>
  81. <script>
  82. export default {
  83. props: {
  84. type: {
  85. },
  86. },
  87. data() {
  88. return {
  89. //模块1通栏广告模块 start---------------------------------------->
  90. adSector: {
  91. "sectorName": "adSector",//板块名称
  92. "componentList": [
  93. {
  94. "component_type": 2,//组件类型 1=新闻(选择导航池id)2=广告(输入广告位名称)
  95. "component_style": 1,//组件选择了哪个版式
  96. "sort": 1,
  97. "componentData": {}
  98. }
  99. ],
  100. "ad": {
  101. "width": 1200, //宽度
  102. "height": 90, //高度
  103. "name": "",//广告名称
  104. "price": 0,//价格
  105. "introduce":"",//介绍
  106. "website_id": "",//网站id
  107. "thumb": "https://img.bjzxtw.org.cn/pre/image/png/20250530/1748588901281358.png",//示例图 - 默认值
  108. "typeid": 2,//广告类型 - 2 图片
  109. "ad_tag": ""//广告标识 - 网站标识 + 页面名称 + sort
  110. }
  111. },
  112. //添加通栏广告模块 start---------------------------------------->
  113. //添加头条广告模块 start---------------------------------------->
  114. headLineSector: {
  115. "sectorName": "headLineSector",//板块名称
  116. "componentList": [
  117. {
  118. "component_type": 1,//组件类型 1=新闻 2=广告
  119. "component_style": 1,//该组件使用哪个展示样式
  120. "sort": 1,//排序位置
  121. "componentData": {
  122. "level": 1,
  123. "imgSize": 0,
  124. "textSize": 4,
  125. "child": {
  126. "id": "",
  127. "imgSize": "",
  128. "textSize": ""
  129. },
  130. "listType": [
  131. "id",
  132. "title",
  133. "imgurl",
  134. "author",
  135. "updated_at",
  136. "introduce",
  137. "islink",
  138. "linkurl",
  139. "copyfrom",
  140. "cat_arr_id",
  141. "catid",
  142. "pinyin"
  143. ],
  144. }
  145. }
  146. ]
  147. },
  148. //添加头条广告模块 start---------------------------------------->
  149. //添加banner模块 start---------------------------------------->
  150. bannerSector: {
  151. "sectorName": "bannerSector",//板块名称
  152. "componentList": [
  153. {
  154. "component_type": 1,//组件类型 1=新闻 2=广告
  155. "component_style": 1,//该组件使用哪个展示样式
  156. "sort": 1,//排序位置
  157. "componentData": {
  158. "level": 2,
  159. "imgSize": 5,
  160. "textSize": 0,
  161. "child": {
  162. "id": "",
  163. "imgSize": "",
  164. "textSize": ""
  165. },
  166. "listType": [
  167. "id",
  168. "title",
  169. "imgurl",
  170. "author",
  171. "updated_at",
  172. "introduce",
  173. "islink",
  174. "linkurl",
  175. "copyfrom",
  176. "cat_arr_id",
  177. "catid",
  178. "pinyin"
  179. ],
  180. }
  181. },
  182. {
  183. "component_type": 1,//组件类型 1=新闻 2=广告
  184. "component_style": 1,//该组件使用哪个展示样式
  185. "sort": 2,//排序位置
  186. "componentData": {
  187. "level": 6,
  188. "imgSize": 0,
  189. "textSize": 10,
  190. "child": {
  191. "id": "",
  192. "imgSize": "",
  193. "textSize": ""
  194. },
  195. "listType": [
  196. "id",
  197. "title",
  198. "imgurl",
  199. "author",
  200. "updated_at",
  201. "introduce",
  202. "islink",
  203. "linkurl",
  204. "copyfrom",
  205. "cat_arr_id",
  206. "catid",
  207. "pinyin"
  208. ],
  209. }
  210. }
  211. ]
  212. },
  213. //添加banner模块 end---------------------------------------->
  214. //两列新闻组合模块1 start---------------------------------------->
  215. manyPictureSector: {
  216. sectorName: "manyPictureSector",//板块名称
  217. componentList: [
  218. {
  219. "component_type": 1,
  220. "component_style": 1,
  221. "sort": 1,
  222. "componentData": {
  223. "category_id":"",
  224. "category_arr":"",
  225. "name":"请选择导航..",
  226. "level":"",
  227. "imgSize": 3,
  228. "textSize": 9,
  229. "child":{
  230. "id":"",
  231. "imgSize": "",
  232. "textSize": ""
  233. },
  234. "listType": [
  235. "id",
  236. "title",
  237. "imgurl",
  238. "author",
  239. "updated_at",
  240. "introduce",
  241. "islink",
  242. "linkurl",
  243. "copyfrom",
  244. "cat_arr_id",
  245. "catid",
  246. "pinyin"
  247. ],
  248. }
  249. },
  250. {
  251. "component_type": 1,
  252. "component_style": 1,
  253. "sort": 2,
  254. "componentData": {
  255. "category_id":"",
  256. "category_arr":"",
  257. "name":"请选择导航..",
  258. "level":"",
  259. "imgSize": 3,
  260. "textSize": 6,
  261. "child":{
  262. "id":"",
  263. "imgSize": "",
  264. "textSize": ""
  265. },
  266. "listType": [
  267. "id",
  268. "title",
  269. "imgurl",
  270. "author",
  271. "updated_at",
  272. "introduce",
  273. "islink",
  274. "linkurl",
  275. "copyfrom",
  276. "cat_arr_id",
  277. "catid",
  278. "pinyin"
  279. ],
  280. }
  281. }
  282. ]
  283. },
  284. //两列新闻组合模块1 end---------------------------------------->
  285. //两列新闻组合模块2 end---------------------------------------->
  286. commentSector: {
  287. sectorName: "commentSector",//板块名称
  288. componentList: [
  289. {
  290. "component_type": 1,
  291. "component_style": 1,
  292. "sort": 1,
  293. "componentData": {
  294. "category_id":"",
  295. "category_arr":"",
  296. "name":"请选择导航..",
  297. "level":"",
  298. "imgSize": 2,
  299. "textSize": 12,
  300. "child":{
  301. "id":"",
  302. "imgSize": "",
  303. "textSize": ""
  304. },
  305. "listType": [
  306. "id",
  307. "title",
  308. "imgurl",
  309. "author",
  310. "updated_at",
  311. "introduce",
  312. "islink",
  313. "linkurl",
  314. "copyfrom",
  315. "cat_arr_id",
  316. "catid",
  317. "pinyin"
  318. ],
  319. }
  320. },
  321. {
  322. "component_type": 1,
  323. "component_style": 1,
  324. "sort": 2,
  325. "componentData": {
  326. "category_id":"",
  327. "category_arr":"",
  328. "name":"请选择导航..",
  329. "level":"",
  330. "imgSize": 1,
  331. "textSize": 3,
  332. "child":{
  333. "id":"",
  334. "imgSize": "",
  335. "textSize": ""
  336. },
  337. "listType": [
  338. "id",
  339. "title",
  340. "imgurl",
  341. "author",
  342. "updated_at",
  343. "introduce",
  344. "islink",
  345. "linkurl",
  346. "copyfrom",
  347. "cat_arr_id",
  348. "catid",
  349. "pinyin"
  350. ],
  351. }
  352. }
  353. ]
  354. },
  355. //两列新闻组合模块2 end---------------------------------------->
  356. //两列新闻组合模块3 start---------------------------------------->
  357. listSector: {
  358. sectorName: "listSector",//板块名称
  359. componentList: [
  360. {
  361. "component_type": 1,
  362. "component_style": 1,
  363. "sort": 1,
  364. "componentData": {
  365. "category_id":"",
  366. "category_arr":"",
  367. "name":"请选择导航..",
  368. "level":"",
  369. "imgSize": 2,
  370. "textSize": 12,
  371. "child":{
  372. "id":"",
  373. "imgSize": "",
  374. "textSize": ""
  375. },
  376. "listType": [
  377. "id",
  378. "title",
  379. "imgurl",
  380. "author",
  381. "updated_at",
  382. "introduce",
  383. "islink",
  384. "linkurl",
  385. "copyfrom",
  386. "cat_arr_id",
  387. "catid",
  388. "pinyin"
  389. ],
  390. }
  391. },
  392. {
  393. "component_type": 1,
  394. "component_style": 1,
  395. "sort": 2,
  396. "componentData": {
  397. "category_id":"",
  398. "category_arr":"",
  399. "name":"请选择导航..",
  400. "level":"",
  401. "imgSize": 1,
  402. "textSize": 3,
  403. "child":{
  404. "id":"",
  405. "imgSize": "",
  406. "textSize": ""
  407. },
  408. "listType": [
  409. "id",
  410. "title",
  411. "imgurl",
  412. "author",
  413. "updated_at",
  414. "introduce",
  415. "islink",
  416. "linkurl",
  417. "copyfrom",
  418. "cat_arr_id",
  419. "catid",
  420. "pinyin"
  421. ],
  422. }
  423. },
  424. {
  425. "component_type": 1,
  426. "component_style": 1,
  427. "sort": 3,
  428. "componentData": {
  429. "category_id":"",
  430. "category_arr":"",
  431. "name":"请选择导航..",
  432. "level":"",
  433. "imgSize": 1,
  434. "textSize": 3,
  435. "child":{
  436. "id":"",
  437. "imgSize": "",
  438. "textSize": ""
  439. },
  440. "listType": [
  441. "id",
  442. "title",
  443. "imgurl",
  444. "author",
  445. "updated_at",
  446. "introduce",
  447. "islink",
  448. "linkurl",
  449. "copyfrom",
  450. "cat_arr_id",
  451. "catid",
  452. "pinyin"
  453. ],
  454. }
  455. }
  456. ]
  457. },
  458. //两列新闻组合模块3 end---------------------------------------->
  459. //带广告新闻组合 start---------------------------------------->
  460. onlyImgSector: {
  461. "sectorName": "onlyImgSector",//板块名称
  462. "componentList": [
  463. {
  464. "component_type": 1,
  465. "component_style": 1,
  466. "sort": 1,
  467. "componentData": {
  468. "category_id":"",
  469. "category_arr":"",
  470. "name":"请选择导航..",
  471. "level":"",
  472. "imgSize": 3,
  473. "textSize": 4,
  474. "child":{
  475. "id":"",
  476. "imgSize": "",
  477. "textSize": ""
  478. },
  479. "listType": [
  480. "id",
  481. "title",
  482. "imgurl",
  483. "author",
  484. "updated_at",
  485. "introduce",
  486. "islink",
  487. "linkurl",
  488. "copyfrom",
  489. "cat_arr_id",
  490. "catid",
  491. "pinyin"
  492. ],
  493. }
  494. },
  495. ],
  496. "ad": {
  497. "width": 450, //宽度
  498. "height": 290, //高度
  499. "name": "",//广告名称
  500. "price": 0,//价格
  501. "introduce":"",//介绍
  502. "website_id": "",//网站id
  503. "thumb": "http://img.bjzxtw.org.cn/pre/image/png/20250609/174945725555092.png",//示例图 - 默认值
  504. "typeid": 2,//广告类型 - 2 图片
  505. "ad_tag": ""//广告标识 - 网站标识 + 页面名称 + sort
  506. }
  507. }
  508. //带广告新闻组合 end---------------------------------------->
  509. }
  510. },
  511. methods: {
  512. //添加模块
  513. addModule(type, h, jsonData) {
  514. let data = {
  515. source: "click",//添加方式为点击
  516. type: type,
  517. h: h,
  518. jsonData: jsonData
  519. }
  520. console.log(data);
  521. this.$store.commit('template/addModule', data);
  522. },
  523. //拖拽开始
  524. drag(type, h, jsonData) {
  525. let data = {
  526. type: type,
  527. h: h,
  528. jsonData: jsonData
  529. }
  530. this.$store.commit('template/drag', data);
  531. },
  532. //拖拽结束
  533. dragend(type, h, jsonData) {
  534. let data = {
  535. type: type,
  536. h: h,
  537. jsonData: jsonData
  538. }
  539. this.$store.commit('template/dragend', data);
  540. }
  541. }
  542. }
  543. </script>
  544. <style scoped lang="less">
  545. .sectorBox {
  546. height: 100%;
  547. .sectorItemBox {
  548. box-sizing: border-box;
  549. padding: 0 20px 40px 20px;
  550. cursor: pointer;
  551. .sectorItem {
  552. border: 1px solid #333644;
  553. padding: 10px;
  554. border-radius: 8px;
  555. &:hover {
  556. background: #333644;
  557. transform: scale(1.1);
  558. transition: all 0.2s ease-in-out;
  559. }
  560. img {
  561. display: block;
  562. width: 100%;
  563. }
  564. }
  565. .sectorItemTitle {
  566. color: #fff;
  567. font-size: 14px;
  568. padding: 10px 0 0 0;
  569. text-align: center;
  570. }
  571. }
  572. }
  573. </style>