sector.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <div class="sectorBox">
  3. <div class="sectorItemBox"
  4. @click="addModule('adSector', 12, adSector)"
  5. @drag="drag('adSector', 12, adSector)"
  6. @dragend="dragend('adSector', 12, adSector)"
  7. >
  8. <div class="sectorItem">
  9. <img src="http://img.bjzxtw.org.cn/pre/image/png/20250604/1748998088187321.png" v-if="this.$store.state.template.editWebsiteClass==1"/>
  10. <img src="http://img.bjzxtw.org.cn/pre/image/jpeg/20250625/1750817753245775.jpg" v-if="this.$store.state.template.editWebsiteClass==2"/>
  11. </div>
  12. <div class="sectorItemTitle">通栏广告</div>
  13. </div>
  14. <div class="sectorItemBox"
  15. @click="addModule('searchListSector', 133, searchListSector)"
  16. @drag="drag('searchListSector', 133, searchListSector)"
  17. @dragend="dragend('searchListSector', 133, searchListSector)"
  18. >
  19. <div class="sectorItem">
  20. <img src="http://img.bjzxtw.org.cn/pre/image/jpeg/20250624/1750727451366122.jpg" v-if="this.$store.state.template.editWebsiteClass==1"/>
  21. <img src="http://img.bjzxtw.org.cn/pre/image/jpeg/20250625/1750829776880227.jpg" v-if="this.$store.state.template.editWebsiteClass==2"/>
  22. </div>
  23. <div class="sectorItemTitle">通用型搜索列表</div>
  24. </div>
  25. </div>
  26. </template>
  27. <script>
  28. export default {
  29. props: {
  30. type: {
  31. },
  32. },
  33. data() {
  34. return {
  35. //添加通栏广告模块 start---------------------------------------->
  36. adSector: {
  37. "sectorName": "adSector",//板块名称
  38. "componentList": [
  39. {
  40. "component_type": 2,//组件类型 1=新闻(选择导航池id)2=广告(输入广告位名称)
  41. "component_style": 1,//组件选择了哪个版式
  42. "sort": 1,
  43. "componentData": {}
  44. }
  45. ],
  46. "ad": {
  47. "width": 1200, //宽度
  48. "height": 90, //高度
  49. "name": "",//广告名称
  50. "price": 0,//价格
  51. "introduce":"",//介绍
  52. "website_id": "",//网站id
  53. "thumb": "https://img.bjzxtw.org.cn/pre/image/png/20250530/1748588901281358.png",//示例图 - 默认值
  54. "typeid": 2,//广告类型 - 2 图片
  55. "ad_tag": ""//广告标识 - 网站标识 + 页面名称 + sort
  56. }
  57. },
  58. //添加通栏广告模块 end---------------------------------------->
  59. //通用型搜索列表模块 start---------------------------------------->
  60. searchListSector: {
  61. "sectorName": "searchListSector",//板块名称
  62. "componentList": [
  63. {
  64. "component_type": 3,//组件类型 1=新闻 2=广告 3=静态组件
  65. "component_style": 1,
  66. "sort": 1,
  67. },
  68. {
  69. "component_type": 1,
  70. "component_style": 1,
  71. "sort": 2,
  72. }
  73. ],
  74. },
  75. //通用型搜索列表模块 end---------------------------------------->
  76. }
  77. },
  78. methods: {
  79. //添加模块
  80. addModule(type, h, jsonData) {
  81. let data = {
  82. source: "click",//添加方式为点击
  83. type: type,
  84. h: h,
  85. jsonData: jsonData
  86. }
  87. console.log(data);
  88. this.$store.commit('template/addModule', data);
  89. },
  90. //拖拽开始
  91. drag(type, h, jsonData) {
  92. let data = {
  93. type: type,
  94. h: h,
  95. jsonData: jsonData
  96. }
  97. this.$store.commit('template/drag', data);
  98. },
  99. //拖拽结束
  100. dragend(type, h, jsonData) {
  101. let data = {
  102. type: type,
  103. h: h,
  104. jsonData: jsonData
  105. }
  106. this.$store.commit('template/dragend', data);
  107. }
  108. }
  109. }
  110. </script>
  111. <style scoped lang="less">
  112. .sectorBox {
  113. height: 100%;
  114. .sectorItemBox {
  115. box-sizing: border-box;
  116. padding: 0 20px 40px 20px;
  117. cursor: pointer;
  118. .sectorItem {
  119. border: 1px solid #333644;
  120. padding: 10px;
  121. border-radius: 8px;
  122. &:hover {
  123. background: #333644;
  124. transform: scale(1.1);
  125. transition: all 0.2s ease-in-out;
  126. }
  127. img {
  128. display: block;
  129. width: 100%;
  130. }
  131. }
  132. .sectorItemTitle {
  133. color: #fff;
  134. font-size: 14px;
  135. padding: 10px 0 0 0;
  136. text-align: center;
  137. }
  138. }
  139. }
  140. </style>