pageSearch.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <div>
  3. <!-- 1.页头板块 -->
  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. <!--使用gridKey来强制更新视图-->
  18. <div
  19. id="content"
  20. class="canvasBox"
  21. >
  22. <grid-layout
  23. :auto-size="true"
  24. :class="this.$store.state.template.pageData.search.length == 0 ? 'FixedMainModuleBox' : 'FixedMainModuleBoxAuto'"
  25. ref="gridlayout"
  26. :layout="this.$store.state.template.pageData.search"
  27. :layout.sync="this.$store.state.template.pageData.search"
  28. :col-num="12"
  29. :row-height="rowHeight"
  30. :margin="[0, 0]"
  31. :is-draggable="true"
  32. :is-resizable="true"
  33. :key="this.$store.state.template.gridKey
  34. ">
  35. <grid-item
  36. v-for="(item, index) in this.$store.state.template.pageData.search"
  37. :key="item.i"
  38. :i="item.i"
  39. :x="item.x"
  40. :y="item.y"
  41. :w="item.w"
  42. :h="item.h"
  43. :is-resizable="false"
  44. >
  45. <div class="grid-item-content">
  46. <div class="grid-tools-menu" v-if="$store.state.template.previewStatus == false">
  47. <span @click="deleteModule(item.i, item.dataSort)"><i class="el-icon-close"></i></span>
  48. </div>
  49. <!-- 1.广告通栏 -->
  50. <div v-if="item.type == 'adSector'" class="moduleBox">
  51. <adSector :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  52. </div>
  53. <!-- 2.固定列表 -->
  54. <div v-if="item.type == 'searchListSector'" class="moduleBox">
  55. <searchListSector :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  56. </div>
  57. <!-- 3.固定列表5 -->
  58. <div v-if="item.type == 'searchListpicSector'" class="moduleBox">
  59. <searchListpicSector :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  60. </div>
  61. <!-- 4.皮肤6搜索列表模块 -->
  62. <div v-if="item.type == 'SearchbigListSector'" class="moduleBox">
  63. <SearchbigListSector :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  64. </div>
  65. <!-- 4.固定列表7 皮肤7-->
  66. <div v-if="item.type == 'SevenSearchbigListscSector'" class="moduleBox">
  67. <SevenSearchbigListscSector :dataSort="item.dataSort" :id="item.i" :y="item.y" />
  68. </div>
  69. </div>
  70. </grid-item>
  71. </grid-layout>
  72. </div>
  73. <!-- 全局组件:页尾 -->
  74. <div class="FixedModuleBoxBottom">
  75. <footerSector v-if="this.$store.state.template.editWebsiteClass <= 4" />
  76. <footerSectorStyle5 v-if="this.$store.state.template.editWebsiteClass >= 5" />
  77. </div>
  78. </div>
  79. </template>
  80. <script>
  81. //页面公用组件 start------------------------------------------------------------>
  82. //引入公用样式
  83. import '@/styles/global.less';
  84. import { GridLayout, GridItem } from "vue-grid-layout";
  85. //1.页面公用组件 end------------------------------------------------------------>
  86. //引入自助建站组件 start------------------------------------------------------------>
  87. //全局组件
  88. //顶部
  89. import headSector from '../style/sector/head/1200x200/1.vue';
  90. import headSectorStyle5 from '../style/sector/head/1200x250/1.vue';
  91. //一级菜单导肮
  92. import menuSector from '../style/sector/menu/1200x130/1.vue';
  93. import menuSectorStyle5 from '../style/sector/menu/1200x187/1.vue';
  94. //列表页是固定的
  95. import searchListSector from '../style/sector/body/search/list/1200x1300/1.vue';
  96. //皮肤5列表页是固定的
  97. import searchListpicSector from '../style/sector/body/search/list/1200x2354/1.vue';
  98. //皮肤6搜索列表模块
  99. import SearchbigListSector from '../style/sector/body/search/list/1200x1530/1.vue';
  100. //底部
  101. import footerSector from '../style/sector/foot/1200x580/1.vue';
  102. import footerSectorStyle5 from '../style/sector/foot/1200x680/1.vue';
  103. //通栏组件 开始:
  104. //通栏广告
  105. import adSector from '../style/sector/body/ad/1200x90/1.vue';
  106. //2.引入自助建站组件 end------------------------------------------------------------>
  107. //皮肤7列表页是固定的
  108. import SevenSearchbigListscSector from '../style/sector/body/search/list/1200x1720/7/1.vue';
  109. export default {
  110. components: {
  111. GridLayout,//画布
  112. GridItem,//画布组件
  113. headSector,//全局页头
  114. headSectorStyle5,//全局页头5
  115. menuSector,//全局导航
  116. menuSectorStyle5,//全局导航5
  117. adSector,//通栏广告
  118. searchListSector,//固定列表
  119. searchListpicSector,//固定列表5
  120. SearchbigListSector,//皮肤6搜索列表模块
  121. footerSector,//全局页脚
  122. footerSectorStyle5,//全局页脚5
  123. SevenSearchbigListscSector,//皮肤7搜索列表模块
  124. },
  125. data() {
  126. return {
  127. //0.全局配置 start------------------------------------------------------------>
  128. windowStatus: false,
  129. rowHeight: 10,
  130. //0.全局配置 end------------------------------------------------------------>
  131. //1.编辑模块 start------------------------------------------------------------>
  132. formLabelWidth: '120px',
  133. editModule: "",//待编辑的模块
  134. //1.编辑模块 end------------------------------------------------------------>
  135. }
  136. },
  137. mounted() {
  138. //必备操作
  139. //1.获得vuex中的鼠标对象
  140. let mouseObj = this.$store.state.template.mouseXY;
  141. //2.获得gridlayout对象
  142. this.$store.commit('template/setGridlayoutObj', this.$refs.gridlayout);
  143. //3.监听鼠标按住以后的移动事件
  144. document.addEventListener("dragover", function (e, store) {
  145. mouseObj.x = e.clientX;
  146. mouseObj.y = e.clientY;
  147. // mouseXY.x = e.clientX;
  148. // mouseXY.y = e.clientY;
  149. }, false);
  150. },
  151. methods: {
  152. //0.全局操作 start ------------------------------------------------------------>
  153. //0.1上一步
  154. goStyle() {
  155. this.$router.push({
  156. path: '/templateStyle',
  157. query: {
  158. id: this.editId
  159. }
  160. });
  161. },
  162. //0.2下一步
  163. gotoList() {
  164. this.$router.push({
  165. path: '/templateList'
  166. });
  167. },
  168. //0.全局操作 end ------------------------------------------------------------>
  169. //1.模块操作 start ------------------------------------------------------------>
  170. //1.1 移动模块
  171. moveModule(i, moveType) {
  172. this.$store.commit('template/moveModule', { i: i, moveType: moveType });
  173. },
  174. //1.2 删除模块
  175. deleteModule(i, dataSort) {
  176. let data = {
  177. i: i,
  178. dataSort: dataSort
  179. }
  180. this.$store.commit('template/deleteModule', data);
  181. },
  182. //1.3 打开弹出框
  183. openWindow(item) {
  184. this.editModule = item.i;
  185. this.windowStatus = true;
  186. },
  187. //1.4 关闭弹出框
  188. closeWindow() {
  189. this.windowStatus = false;
  190. }
  191. //1.模块操作 end ------------------------------------------------------------>
  192. }
  193. }
  194. </script>
  195. <style scoped lang="less">
  196. //拖拽demo
  197. .droppable-element {
  198. width: 150px;
  199. text-align: center;
  200. background: #fdd;
  201. border: 1px solid black;
  202. margin: 10px 0;
  203. padding: 10px;
  204. }
  205. //模块 start------------------------------------------------------------>
  206. .sectorBorder {
  207. border: 2px dashed #eee;
  208. }
  209. .moduleBox {
  210. display: flex;
  211. width: 100%;
  212. height: 100%;
  213. position: relative;
  214. justify-content: space-between;
  215. box-sizing: border-box;
  216. background-color: transparent;
  217. //border: 2px dashed #eee;
  218. }
  219. .moduleBoxBorder {
  220. border: 2px dashed #eee;
  221. }
  222. //固定的模块
  223. .FixedModuleBox {
  224. width: 100%;
  225. //margin-bottom: 20px;
  226. //border: 2px dashed #eee;
  227. }
  228. .fixedBg{
  229. width: 100%;
  230. height: 720px;
  231. position: absolute;
  232. top: 422px;
  233. left: 0;
  234. z-index: 0;
  235. img{
  236. width: 100%;
  237. height: 100%;
  238. }
  239. }
  240. .FixedModuleBoxBottom {
  241. width: 100%;
  242. }
  243. .FixedMainModuleBox {
  244. width: 100%;
  245. font-size: 18px;
  246. color: #999;
  247. text-align: center;
  248. img {
  249. margin-bottom: 20px;
  250. }
  251. padding: 100px;
  252. //background: #F5F7FB;
  253. //margin-bottom: 20px;
  254. }
  255. .FixedMainModuleBoxBorder {
  256. border: 2px dashed #eee;
  257. }
  258. //模块 end------------------------------------------------------------>
  259. //栅格布局 start------------------------------------------------------------>
  260. .grid-item-content {
  261. display: flex;
  262. align-items: center;
  263. justify-content: center;
  264. background-color: transparent;
  265. height: 100%;
  266. overflow: hidden;
  267. position: relative;
  268. .grid-tools-menu {
  269. position: absolute;
  270. top: 0;
  271. right:10px;
  272. z-index: 99;
  273. display: flex;
  274. align-items: center;
  275. justify-content: center;
  276. span {
  277. width: 38px;
  278. height: 38px;
  279. line-height: 38px;
  280. text-align: center;
  281. font-size: 30px;
  282. cursor: pointer;
  283. color: #999;
  284. border: 2px dashed #999;
  285. border-radius: 8px;
  286. background-color: #fff1cc;
  287. transition: all 0.3s;
  288. &:hover {
  289. color: #333;
  290. }
  291. }
  292. }
  293. }
  294. .grid-layout {
  295. grid-gap: 0;
  296. row-gap: 0;
  297. }
  298. //画布调整
  299. .canvasBox {
  300. margin-top: 20px;
  301. }
  302. .FixedMainModuleBox {
  303. min-height: 450px;
  304. background-color: #fff;
  305. background: url('../../../assets/template/creat.png') no-repeat center center;
  306. }
  307. .FixedMainModuleBoxAuto {
  308. min-height: 450px;
  309. background-color: transparent;
  310. }
  311. //占位元素颜色
  312. ::v-deep .vue-grid-placeholder {
  313. background: #ccc !important;
  314. opacity: 0.3;
  315. }
  316. //栅格布局 end------------------------------------------------------------>
  317. //执行v-deep穿透scope选择器 start------------------------------------------------------------>*/
  318. ::v-deep .custom-form-item>.el-form-item__label {
  319. line-height: 140px !important;
  320. }
  321. ::v-deep .custom-textarea .el-textarea__inner {
  322. resize: none;
  323. /* 禁止用户拖拽调整大小 */
  324. }
  325. ::v-deep .custom-align-right .el-form-item__label {
  326. text-align: right;
  327. /* 设置标签文字右对齐 */
  328. }
  329. ::v-deep .shadowBox .el-button--mini.is-circle {
  330. border-radius: 50% !important;
  331. }
  332. //执行v-deep穿透scope选择器 end------------------------------------------------------------>*/
  333. </style>