pageIndex.vue 8.0 KB

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