pageIndex.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <div class="grid-layout-demo">
  3. <div :class="['FixedModuleBox', { sectorBorder: this.$store.state.template.previewStatus==false }]"><!--1-->
  4. <headSector />
  5. </div>
  6. <div :class="['FixedModuleBox', { sectorBorder: this.$store.state.template.previewStatus==false }]"><!--2-->
  7. <menuSector />
  8. </div>
  9. <div :class="['FixedMainModuleBox', { FixedMainModuleBoxBorder: this.$store.state.template.previewStatus==false }]" v-if="this.$store.state.template.pageData.index.length == 0">
  10. <img src="@/assets/template/creat.png">
  11. <div>您选择的板块将展示到此区域</div>
  12. </div>
  13. <grid-layout :layout="this.$store.state.template.pageData.index" :margin="[0,0]" :col-num="12" :row-height="rowHeight" :is-draggable="true" :is-resizable="true">
  14. <grid-item v-for="(item, index) in this.$store.state.template.pageData.index" :key="item.i" :i="item.i" :x="item.x" :y="item.y" :w="item.w" :h="item.h" :is-resizable="false">
  15. <div class="grid-item-content">
  16. <div class="grid-tools-menu" v-if="$store.state.template.previewStatus==false">
  17. <!-- <span><i class="el-icon-setting"></i></span> -->
  18. <!-- 移动板块 暂时停用 会导致组件视图不更新的问题-->
  19. <span @click="moveModule(item.i,'up')"><i class="el-icon-sort-up"></i></span>
  20. <span @click="moveModule(item.i,'down')"><i class="el-icon-sort-down"></i></span>
  21. <span @click="deleteModule(item.i)"><i class="el-icon-close"></i></span>
  22. </div>
  23. <!-- 页头板块 -->
  24. <!-- <div v-if="item.type == 'headSector'" class="moduleBox">
  25. <headSector />
  26. </div> -->
  27. <!-- 导航板块 -->
  28. <!-- <div v-if="item.type == 'menuSector'" class="moduleBox">
  29. <menuSector :id="item.i"/>
  30. </div> -->
  31. <!-- 图片标题模块 --><!--4-->
  32. <div v-if="item.type == 'imgTitleSector'" class="moduleBox">
  33. <imgTitleSector :id="item.i"/>
  34. </div>
  35. <!-- 焦点图模块 --><!--5-->
  36. <div v-if="item.type == 'bannerSector'" class="moduleBox">
  37. <bannerSector :id="item.i"/>
  38. </div>
  39. <!-- 多图模块 --><!--6-->
  40. <div v-if="item.type == 'manyPictureSector'" class="moduleBox">
  41. <manyPictureSector :id="item.i"/>
  42. </div>
  43. <!-- 评论模块 --><!--7-->
  44. <div v-if="item.type == 'commentSector'" class="moduleBox">
  45. <commentSector :id="item.i"/>
  46. </div>
  47. <!-- 双联文章列表模块 -->
  48. <div v-if="item.type == 'listSector'" class="moduleBox">
  49. <listSector :id="item.i"/>
  50. </div>
  51. <!-- 纯图片组合模块 -->
  52. <div v-if="item.type == 'onlyImgSector'" class="moduleBox">
  53. <onlyImgSector :id="item.i"/>
  54. </div>
  55. <!-- 友情链接模块 -->
  56. <div v-if="item.type == 'friendShipLinkSector'" class="moduleBox">
  57. <friendShipLinkSector :id="item.i"/>
  58. </div>
  59. <!-- 页尾板块 -->
  60. <!-- <div v-if="item.type == 'footerSector'" class="moduleBox">
  61. <footerSector />
  62. </div> --><!--3-->
  63. </div>
  64. </grid-item>
  65. </grid-layout>
  66. <div class="FixedModuleBoxBottom">
  67. <footerSector />
  68. </div>
  69. </div>
  70. </template>
  71. <script>
  72. //页面公用组件 start------------------------------------------------------------>
  73. //引入公用样式
  74. import '@/styles/global.less';
  75. //引入vue-grid-layout拖拽效果
  76. import { GridLayout, GridItem } from 'vue-grid-layout';
  77. //页面公用组件 end------------------------------------------------------------>
  78. //自助建站组件 start------------------------------------------------------------>
  79. //style1
  80. import headSector from '../style/1/sector/1.vue';//顶部
  81. import menuSector from '../style/1/sector/2.vue';//菜单
  82. import imgTitleSector from '../style/1/sector/4.vue';//广告
  83. import bannerSector from '../style/1/sector/5.vue';//焦点图
  84. import manyPictureSector from '../style/1/sector/6.vue';//多图
  85. import commentSector from '../style/1/sector/7.vue';//评论
  86. import listSector from '../style/1/sector/8.vue';//文章列表
  87. import onlyImgSector from '../style/1/sector/9.vue';//纯图片组合
  88. import friendShipLinkSector from '../style/1/sector/10.vue';//友情链接
  89. import footerSector from '../style/1/sector/3.vue';//底部
  90. //自助建站组件 end------------------------------------------------------------>
  91. export default {
  92. components: {
  93. //拖拽组件
  94. GridLayout,
  95. GridItem,
  96. //板块组件 style1
  97. headSector,
  98. menuSector,
  99. imgTitleSector,
  100. bannerSector,
  101. manyPictureSector,
  102. commentSector,
  103. listSector,
  104. onlyImgSector,
  105. friendShipLinkSector,
  106. footerSector
  107. },
  108. data() {
  109. return {
  110. //0.全局配置 start------------------------------------------------------------>
  111. windowStatus: false,
  112. rowHeight:10,
  113. //0.全局配置 end------------------------------------------------------------>
  114. //1.编辑模块 start------------------------------------------------------------>
  115. formLabelWidth: '120px',
  116. editModule: "",//待编辑的模块
  117. //1.编辑模块 end------------------------------------------------------------>
  118. }
  119. },
  120. methods: {
  121. //0.全局操作 start ------------------------------------------------------------>
  122. //0.1上一步
  123. goStyle(){
  124. this.$router.push({
  125. path: '/templateStyle',
  126. query: {
  127. id: this.editId
  128. }
  129. });
  130. },
  131. //0.2下一步
  132. gotoList(){
  133. this.$router.push({
  134. path: '/templateList'
  135. });
  136. },
  137. //0.全局操作 end ------------------------------------------------------------>
  138. //1.模块操作 start ------------------------------------------------------------>
  139. //1.1 移动模块
  140. moveModule(i,moveType){
  141. this.$store.commit('template/moveModule',{i:i,moveType:moveType});
  142. },
  143. //1.2 删除模块
  144. deleteModule(i){
  145. this.$store.commit('template/deleteModule',{i:i});
  146. },
  147. //1.3 打开弹出框
  148. openWindow(item) {
  149. this.editModule = item.i;
  150. this.windowStatus = true;
  151. },
  152. //1.4 关闭弹出框
  153. closeWindow() {
  154. this.windowStatus = false;
  155. }
  156. //1.模块操作 end ------------------------------------------------------------>
  157. },
  158. mounted(){
  159. }
  160. }
  161. </script>
  162. <style scoped lang="less">
  163. //模块 start------------------------------------------------------------>
  164. .sectorBorder {
  165. border: 2px dashed #eee;
  166. }
  167. .moduleBox {
  168. display: flex;
  169. width: 100%;
  170. height: 100%;
  171. position: relative;
  172. justify-content: space-between;
  173. box-sizing: border-box;
  174. //border: 2px dashed #eee;
  175. }
  176. .moduleBoxBorder {
  177. border: 2px dashed #eee;
  178. }
  179. //固定的模块
  180. .FixedModuleBox {
  181. width: 100%;
  182. margin-bottom: 20px;
  183. //border: 2px dashed #eee;
  184. }
  185. .FixedModuleBoxBottom {
  186. width: 100%;
  187. }
  188. .FixedMainModuleBox {
  189. width: 100%;
  190. font-size: 18px;
  191. color: #999;
  192. text-align: center;
  193. img {
  194. margin-bottom: 20px;
  195. }
  196. padding: 100px;
  197. //background: #F5F7FB;
  198. margin-bottom: 20px;
  199. }
  200. .FixedMainModuleBoxBorder {
  201. border: 2px dashed #eee;
  202. }
  203. //模块 end------------------------------------------------------------>
  204. //栅格布局 start------------------------------------------------------------>
  205. .grid-item-content {
  206. display: flex;
  207. align-items: center;
  208. justify-content: center;
  209. background-color: #fff;
  210. height: 100%;
  211. overflow: hidden;
  212. position: relative;
  213. .grid-tools-menu {
  214. position: absolute;
  215. top: 0;
  216. right: 0;
  217. z-index: 99;
  218. display: flex;
  219. align-items: center;
  220. justify-content: center;
  221. span {
  222. width: 38px;
  223. height: 38px;
  224. line-height: 38px;
  225. text-align: center;
  226. font-size: 30px;
  227. cursor: pointer;
  228. color: #999;
  229. // display: flex;
  230. // align-items: center;
  231. // justify-content: center;
  232. // cursor: pointer;
  233. // margin: 5px;
  234. // color: #000;
  235. // background: #fff;
  236. // border: 1px solid #000;
  237. // border-radius: 5px;
  238. // width: 24px;
  239. // height: 24px;
  240. // line-height: 24px;
  241. // text-align: center;
  242. // font-size: 14px;
  243. // transition: all 0.3s;
  244. // &:hover {
  245. // color: #fff;
  246. // background: #000;
  247. // }
  248. transition: all 0.3s;
  249. &:hover {
  250. color: #333;
  251. }
  252. }
  253. }
  254. }
  255. .grid-layout {
  256. grid-gap: 0;
  257. row-gap: 0;
  258. }
  259. //栅格布局 end------------------------------------------------------------>
  260. //执行v-deep穿透scope选择器 start------------------------------------------------------------>*/
  261. ::v-deep .custom-form-item > .el-form-item__label {
  262. line-height: 140px !important;
  263. }
  264. ::v-deep .custom-textarea .el-textarea__inner {
  265. resize: none; /* 禁止用户拖拽调整大小 */
  266. }
  267. ::v-deep .custom-align-right .el-form-item__label {
  268. text-align: right; /* 设置标签文字右对齐 */
  269. }
  270. ::v-deep .shadowBox .el-button--mini.is-circle {
  271. border-radius: 50% !important;
  272. }
  273. //执行v-deep穿透scope选择器 end------------------------------------------------------------>*/
  274. </style>