pageClass.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. <template>
  2. <div>
  3. <!-- 全局组件:页头 -->
  4. <div :class="['FixedModuleBox', { sectorBorder: this.$store.state.template.previewStatus == false }]">
  5. <headSector v-if="this.$store.state.template.editWebsiteClass > 0 && this.$store.state.template.editWebsiteClass <= 4"/>
  6. <headSectorStyle5 v-if="this.$store.state.template.editWebsiteClass >= 5"/>
  7. </div>
  8. <!-- 全局组件:导航 -->
  9. <div :class="['FixedModuleBox', { sectorBorder: this.$store.state.template.previewStatus == false }]">
  10. <menuSector v-if="this.$store.state.template.editWebsiteClass > 0 && this.$store.state.template.editWebsiteClass <= 4"/>
  11. <menuSectorStyle5 v-if="this.$store.state.template.editWebsiteClass >= 5"/>
  12. </div>
  13. <!-- 固定背景图 -->
  14. <div class="fixedBg" v-if="this.$store.state.template.editWebsiteClass == 6">
  15. <img src="http://192.168.1.234:19000/pre/image/png/20251218/176604033999762.png" alt="">
  16. </div>
  17. <div
  18. id="content"
  19. class="canvasBox"
  20. >
  21. <grid-layout
  22. :auto-size="true"
  23. :class="this.$store.state.template.pageData.class.length == 0 ? 'FixedMainModuleBox' : 'FixedMainModuleBoxAuto'"
  24. ref="gridlayout"
  25. :layout="this.$store.state.template.pageData.class"
  26. :layout.sync="this.$store.state.template.pageData.class"
  27. :col-num="12"
  28. :row-height="rowHeight"
  29. :margin="[0,0]"
  30. :is-draggable="true"
  31. :is-resizable="true"
  32. :key="this.$store.state.template.gridKey"
  33. >
  34. <grid-item
  35. v-for="(item, index) in this.$store.state.template.pageData.class"
  36. :key="item.i"
  37. :i="item.i"
  38. :x="item.x"
  39. :y="item.y"
  40. :w="item.w"
  41. :h="item.h"
  42. :is-resizable="false"
  43. >
  44. <div class="grid-item-content">
  45. <!--右侧悬浮按钮-->
  46. <div class="grid-tools-menu" v-if="$store.state.template.previewStatus == false">
  47. <!-- 移动板块-->
  48. <!-- <span @click="moveModule(item.i,'up')"><i class="el-icon-sort-up"></i></span>
  49. <span @click="moveModule(item.i,'down')"><i class="el-icon-sort-down"></i></span> -->
  50. <span @click="deleteModule(item.i, item.dataSort)"><i class="el-icon-close"></i></span>
  51. </div>
  52. <!-- 1.广告通栏 -->
  53. <div v-if="item.type == 'adSector'" class="moduleBox">
  54. <adSector :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  55. </div>
  56. <!-- 2.频道菜单 -->
  57. <div v-if="item.type == 'channelMenu'" class="moduleBox">
  58. <channelMenu :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  59. </div>
  60. <!-- 3.滚动图文组合 -->
  61. <div v-if="item.type == 'scrollTextSector'" class="moduleBox">
  62. <scrollTextSector :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  63. </div>
  64. <!-- 4.新闻多图组合1 -->
  65. <div v-if="item.type == 'manyPictureSector'" class="moduleBox">
  66. <manyPictureSector :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  67. </div>
  68. <!-- 5.新闻多图组合2 -->
  69. <div v-if="item.type == 'commentSector'" class="moduleBox">
  70. <commentSector :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  71. </div>
  72. <!-- 6.新闻多图组合3 -->
  73. <div v-if="item.type == 'listSector'" class="moduleBox">
  74. <listSector :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  75. </div>
  76. <!-- 7.带标题新闻图文组合 -->
  77. <div v-if="item.type == 'channelNewsSector'" class="moduleBox">
  78. <channelNewsSector :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  79. </div>
  80. <!-- 8.新的新闻图文组合1 -->
  81. <div v-if="item.type == 'newsPhotoSector'" class="moduleBox">
  82. <newsPhotoSector :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  83. </div>
  84. <!-- 9.带标题文字新闻通栏 -->
  85. <div v-if="item.type == 'channelTextSector'" class="moduleBox">
  86. <channelTextSector :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  87. </div>
  88. <!-- 10.新的新闻图文组合2 -->
  89. <div v-if="item.type == 'newListPhotoSector'" class="moduleBox">
  90. <newListPhotoSector :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  91. </div>
  92. <!-- 11.皮肤6 带标题图文组合 -->
  93. <div v-if="item.type == 'ChannelNewsPhotoSector'" class="moduleBox">
  94. <ChannelNewsPhotoSector :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  95. </div>
  96. <!-- 12.皮肤6 不带标题图文组合1 -->
  97. <div v-if="item.type == 'ChannelNewsSector'" class="moduleBox">
  98. <ChannelNewsSector :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  99. </div>
  100. <!-- 13.皮肤6 带标题图文组合2 -->
  101. <div v-if="item.type == 'ChannelNewsPhoto'" class="moduleBox">
  102. <ChannelNewsPhoto :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  103. </div>
  104. <!-- 14.皮肤6 不带标题图文组合2 -->
  105. <div v-if="item.type == 'ChannelNewsAndPhoto'" class="moduleBox">
  106. <ChannelNewsAndPhoto :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  107. </div>
  108. <!-- 皮肤7-新闻图文组合4-通栏版式-带选项卡图文组合 -->
  109. <div v-if="item.type == 'newsTextTabsImgSectorClass'" class="moduleBox">
  110. <newsTextTabsImgSectorClass :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  111. </div>
  112. <!-- 12 皮肤7- 热点关注 -->
  113. <div v-if="item.type == 'skinSevenNewsHyjjSector'" class="moduleBox">
  114. <skinSevenNewsHyjjSector :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  115. </div>
  116. <!-- 14.滚动图文组合--皮肤7 -->
  117. <div v-if="item.type == 'scrollTextImgSevenSkinchannelSector'" class="moduleBox">
  118. <scrollTextImgSevenSkinchannelSector :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  119. </div>
  120. <!-- 15.子导航菜单 --皮肤7 channelMenu-->
  121. <div v-if="item.type == 'channelNavigationSector'" class="moduleBox">
  122. <channelNavigationSector :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  123. </div>
  124. </div>
  125. </grid-item>
  126. </grid-layout>
  127. </div>
  128. <!-- 全局组件:页尾 -->
  129. <div class="FixedModuleBoxBottom">
  130. <footerSector v-if="this.$store.state.template.editWebsiteClass <= 4" />
  131. <footerSectorStyle5 v-if="this.$store.state.template.editWebsiteClass >= 5" />
  132. </div>
  133. </div>
  134. </template>
  135. <script>
  136. //页面公用组件 start------------------------------------------------------------>
  137. //引入公用样式
  138. import '@/styles/global.less';
  139. import { GridLayout, GridItem } from "vue-grid-layout";
  140. //1.页面公用组件 end------------------------------------------------------------>
  141. //引入自助建站组件 start------------------------------------------------------------>
  142. //全局组件
  143. //顶部
  144. import headSector from '../style/sector/head/1200x200/1.vue';
  145. import headSectorStyle5 from '../style/sector/head/1200x250/1.vue';
  146. //一级菜单导肮
  147. import menuSector from '../style/sector/menu/1200x130/1.vue';
  148. import menuSectorStyle5 from '../style/sector/menu/1200x187/1.vue';
  149. //底部
  150. import footerSector from '../style/sector/foot/1200x580/1.vue';
  151. import footerSectorStyle5 from '../style/sector/foot/1200x680/1.vue';
  152. //通栏组件 开始:
  153. //通栏广告
  154. import adSector from '../style/sector/body/ad/1200x90/1.vue';
  155. //新闻图文组合1
  156. import manyPictureSector from '../style/sector/body/index/list/1200x470/1.vue';
  157. //新闻图文组合2
  158. import commentSector from '../style/sector/body/index/list/1200x470/2.vue';
  159. //新闻图文组合3
  160. import listSector from '../style/sector/body/index/list/1200x980/1.vue';
  161. //频道菜单
  162. import channelMenu from '../style/sector/body/class/menu/1200x100/1.vue';
  163. //滚动图文组合
  164. import scrollTextSector from '../style/sector/body/class/banner/1200x410/1.vue';
  165. //带标题新闻图文组合
  166. import channelNewsSector from '../style/sector/body/index/list/1200x630/1.vue';
  167. //新的新闻图文组合1
  168. import newsPhotoSector from '../style/sector/body/index/list/1200x430/1.vue';
  169. //带标题文字新闻通栏
  170. import channelTextSector from '../style/sector/body/index/list/1200x530/2.vue';
  171. //新的新闻图文组合2
  172. import newListPhotoSector from '../style/sector/body/index/list/1200x530/3.vue';
  173. // 皮肤6 带标题图文组合
  174. import ChannelNewsPhotoSector from '../style/sector/body/index/list/1200x430/6_2.vue';
  175. // 皮肤6 不带标题图文组合1
  176. import ChannelNewsSector from '../style/sector/body/index/list/1200x330/1.vue';
  177. // 皮肤6 带标题图文组合2
  178. import ChannelNewsPhoto from '../style/sector/body/index/list/1200x400/6.vue';
  179. // 皮肤6 不带标题图文组合2
  180. import ChannelNewsAndPhoto from '../style/sector/body/index/list/1200x480/6_2.vue';
  181. //新闻图文组合4-皮肤7-带选项卡图文组合 行业聚焦
  182. // import newsTextTabsImgSector from '../style/sector/body/index/list/1200x480/6_2.vue';
  183. import newsTextTabsImgSectorClass from '../style/sector/body/class/list/1200x1150/7/1.vue';
  184. //14 皮肤7-------------------------------------------------------------热点关注>
  185. import skinSevenNewsHyjjSector from '../style/sector/body/index/list/1200x720/7/2.vue';
  186. // 皮肤7-合并为一个组件的焦点图通栏 轮播图
  187. import scrollTextImgSevenSkinchannelSector from '../style/sector/body/index/banner/1200x480/7/3.vue';
  188. //频道菜单-子导航菜单皮肤7channelMenu
  189. import channelNavigationSector from '../style/sector/body/class/menu/1200x100/1.vue';
  190. //2.引入自助建站组件 end------------------------------------------------------------>
  191. export default {
  192. components: {
  193. GridLayout,//画布
  194. GridItem,//画布组件
  195. headSector,//全局页头1200x200
  196. headSectorStyle5,//全局页头1200x250
  197. menuSector,//全局导航
  198. menuSectorStyle5,//全局导航1200x187
  199. adSector,//通栏广告
  200. manyPictureSector,//新闻图文组合1
  201. commentSector,//新闻图文组合2
  202. listSector,//新闻图文组合3
  203. channelMenu,//频道菜单
  204. scrollTextSector,//滚动图文组合
  205. channelNewsSector,//带标题新闻图文组合
  206. newsPhotoSector,//新的新闻图文组合1
  207. channelTextSector,//带标题文字新闻通栏
  208. newListPhotoSector,//新的新闻图文组合2
  209. footerSector,//全局页脚1200x580
  210. footerSectorStyle5,//全局页脚1200x680
  211. ChannelNewsPhotoSector,// 皮肤6 带标题图文组合1
  212. ChannelNewsSector,// 皮肤6 不带标题图文组合1
  213. ChannelNewsPhoto,// 皮肤6 带标题图文组合2
  214. ChannelNewsAndPhoto,// 皮肤6 不带标题图文组合2
  215. newsTextTabsImgSectorClass,//新闻图文组合-频道页专用 行业聚焦
  216. skinSevenNewsHyjjSector,//14 皮肤7-----热点关注>
  217. scrollTextImgSevenSkinchannelSector,//14 皮肤7-合并为一个组件的焦点图通栏 轮播图
  218. channelNavigationSector,//14 皮肤7-合并为一个组件的频道菜单-子导航菜单
  219. },
  220. data() {
  221. return {
  222. //0.全局配置 start------------------------------------------------------------>
  223. windowStatus: false,
  224. rowHeight: 10,
  225. //0.全局配置 end------------------------------------------------------------>
  226. //1.编辑模块 start------------------------------------------------------------>
  227. formLabelWidth: '120px',
  228. editModule: "",//待编辑的模块
  229. //1.编辑模块 end------------------------------------------------------------>
  230. }
  231. },
  232. mounted() {
  233. //必备操作
  234. //1.获得vuex中的鼠标对象
  235. let mouseObj = this.$store.state.template.mouseXY;
  236. //2.获得gridlayout对象
  237. this.$store.commit('template/setGridlayoutObj', this.$refs.gridlayout);
  238. //3.监听鼠标按住以后的移动事件
  239. document.addEventListener("dragover", function (e, store) {
  240. mouseObj.x = e.clientX;
  241. mouseObj.y = e.clientY;
  242. // mouseXY.x = e.clientX;
  243. // mouseXY.y = e.clientY;
  244. }, false);
  245. },
  246. methods: {
  247. //0.全局操作 start ------------------------------------------------------------>
  248. //0.1上一步
  249. goStyle() {
  250. this.$router.push({
  251. path: '/templateStyle',
  252. query: {
  253. id: this.editId
  254. }
  255. });
  256. },
  257. //0.2下一步
  258. gotoList() {
  259. this.$router.push({
  260. path: '/templateList'
  261. });
  262. },
  263. //0.全局操作 end ------------------------------------------------------------>
  264. //1.模块操作 start ------------------------------------------------------------>
  265. //1.1 移动模块
  266. moveModule(i, moveType) {
  267. this.$store.commit('template/moveModule', { i: i, moveType: moveType });
  268. },
  269. //1.2 删除模块
  270. deleteModule(i, dataSort) {
  271. let data = {
  272. i: i,
  273. dataSort: dataSort
  274. }
  275. this.$store.commit('template/deleteModule', data);
  276. },
  277. //1.3 打开弹出框
  278. openWindow(item) {
  279. this.editModule = item.i;
  280. this.windowStatus = true;
  281. },
  282. //1.4 关闭弹出框
  283. closeWindow() {
  284. this.windowStatus = false;
  285. }
  286. //1.模块操作 end ------------------------------------------------------------>
  287. }
  288. }
  289. </script>
  290. <style scoped lang="less">
  291. //拖拽demo
  292. .droppable-element {
  293. width: 150px;
  294. text-align: center;
  295. background: #fdd;
  296. border: 1px solid black;
  297. margin: 10px 0;
  298. padding: 10px;
  299. }
  300. //模块 start------------------------------------------------------------>
  301. .sectorBorder {
  302. border: 2px dashed #eee;
  303. }
  304. .moduleBox {
  305. display: flex;
  306. width: 100%;
  307. height: 100%;
  308. position: relative;
  309. justify-content: space-between;
  310. box-sizing: border-box;
  311. background-color: transparent;
  312. //border: 2px dashed #eee;
  313. }
  314. .moduleBoxBorder {
  315. border: 2px dashed #eee;
  316. }
  317. //固定的模块
  318. .FixedModuleBox {
  319. width: 100%;
  320. //margin-bottom: 20px;
  321. //border: 2px dashed #eee;
  322. }
  323. .fixedBg{
  324. width: 100%;
  325. height: 720px;
  326. position: absolute;
  327. top: 422px;
  328. left: 0;
  329. z-index: 0;
  330. img{
  331. width: 100%;
  332. height: 100%;
  333. }
  334. }
  335. .FixedModuleBoxBottom {
  336. width: 100%;
  337. }
  338. .FixedMainModuleBox {
  339. width: 100%;
  340. font-size: 18px;
  341. color: #999;
  342. text-align: center;
  343. img {
  344. margin-bottom: 20px;
  345. }
  346. padding: 100px;
  347. //background: #F5F7FB;
  348. //margin-bottom: 20px;
  349. }
  350. .FixedMainModuleBoxBorder {
  351. border: 2px dashed #eee;
  352. }
  353. //模块 end------------------------------------------------------------>
  354. //栅格布局 start------------------------------------------------------------>
  355. .grid-item-content {
  356. display: flex;
  357. align-items: center;
  358. justify-content: center;
  359. background-color: transparent;
  360. height: 100%;
  361. overflow: hidden;
  362. position: relative;
  363. .grid-tools-menu {
  364. position: absolute;
  365. top: 0;
  366. right:10px;
  367. z-index: 99;
  368. display: flex;
  369. align-items: center;
  370. justify-content: center;
  371. span {
  372. width: 38px;
  373. height: 38px;
  374. line-height: 38px;
  375. text-align: center;
  376. font-size: 30px;
  377. cursor: pointer;
  378. color: #999;
  379. border: 2px dashed #999;
  380. border-radius: 8px;
  381. background-color: #fff1cc;
  382. transition: all 0.3s;
  383. &:hover {
  384. color: #333;
  385. }
  386. }
  387. }
  388. }
  389. .grid-layout {
  390. grid-gap: 0;
  391. row-gap: 0;
  392. }
  393. //画布调整
  394. .canvasBox {
  395. margin-top: 20px;
  396. }
  397. .FixedMainModuleBox {
  398. min-height: 450px;
  399. background-color: #fff;
  400. background: url('../../../assets/template/creat.png') no-repeat center center;
  401. }
  402. .FixedMainModuleBoxAuto {
  403. min-height: 450px;
  404. background-color: transparent;
  405. }
  406. //占位元素颜色
  407. ::v-deep .vue-grid-placeholder {
  408. background: #ccc !important;
  409. opacity: 0.3;
  410. }
  411. //栅格布局 end------------------------------------------------------------>
  412. //执行v-deep穿透scope选择器 start------------------------------------------------------------>*/
  413. ::v-deep .custom-form-item>.el-form-item__label {
  414. line-height: 140px !important;
  415. }
  416. ::v-deep .custom-textarea .el-textarea__inner {
  417. resize: none;
  418. /* 禁止用户拖拽调整大小 */
  419. }
  420. ::v-deep .custom-align-right .el-form-item__label {
  421. text-align: right;
  422. /* 设置标签文字右对齐 */
  423. }
  424. ::v-deep .shadowBox .el-button--mini.is-circle {
  425. border-radius: 50% !important;
  426. }
  427. //执行v-deep穿透scope选择器 end------------------------------------------------------------>*/
  428. </style>