componentWindow.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <div class="componentWindowBox">
  3. <!--开发助手-->
  4. <div class="testAssistant">
  5. <div class="testAssistantTitle">
  6. 开发助手:当前窗口在正式版本中将被移除。
  7. </div>
  8. <div class="testAssistantContent">
  9. <div class="testAssistantContentItem"><span>板块:</span>{{this.$store.state.template.editSectorId}}</div>
  10. <div class="testAssistantContentItem"><span>组件位置:</span>{{this.$store.state.template.editComponentSort}}</div>
  11. <div class="testAssistantContentItem"><span>组件种类:</span>{{this.$store.state.template.editComponentType}}</div>
  12. <div class="testAssistantContentItem"><span>原组件样式:</span>{{this.$store.state.template.pageData.index[this.$store.state.template.editSectorId].content.componentList[this.$store.state.template.editComponentSort].component_style}}</div>
  13. <div class="testAssistantContentItem"><span>当前组件样式:</span>{{this.$store.state.template.editComponentStyle}}</div>
  14. </div>
  15. </div>
  16. <div class="componentStyleBox">
  17. <div class="componentStyleBoxContent">
  18. <!--1.网站核心大标题组件 start---------------------------------------->
  19. <div v-if="this.$store.state.template.editComponentType == 1" class="componentScrollBox">
  20. <table>
  21. <tr>
  22. <td>
  23. <div :class="['componentScrollBoxItem', this.$store.state.template.editComponentStyle === 1 ? 'active' : '']" @click="selectUseStyleNumber(1)">
  24. <img src="@/assets/template/component/mainStyle1.png"/>
  25. </div>
  26. </td>
  27. <td>
  28. <div :class="['componentScrollBoxItem', this.$store.state.template.editComponentStyle === 2 ? 'active' : '']" @click="selectUseStyleNumber(2)">
  29. <img src="@/assets/template/component/mainStyle2.png"/>
  30. </div>
  31. </td>
  32. </tr>
  33. </table>
  34. </div>
  35. <!--1.网站核心大标题组件 end---------------------------------------->
  36. <!--2.板块文字标题 start---------------------------------------->
  37. <div v-if="this.$store.state.template.editComponentType == 2" class="componentScrollBox">
  38. <table>
  39. <tr>
  40. <td>
  41. <div :class="['componentScrollBoxItem', this.$store.state.template.editComponentStyle === 1 ? 'active' : '']" @click="selectUseStyleNumber(1)">
  42. <img src="@/assets/template/component/title1.png"/>
  43. </div>
  44. </td>
  45. </tr>
  46. </table>
  47. </div>
  48. <!--2.板块文字标题 end---------------------------------------->
  49. <!--3.广告组件 start---------------------------------------->
  50. <div v-if="this.$store.state.template.editComponentType == 3" class="componentScrollBox">
  51. <table>
  52. <tr>
  53. <td>
  54. <div :class="['componentScrollBoxItem', this.$store.state.template.editComponentStyle === 1 ? 'active' : '']" @click="selectUseStyleNumber(1)">
  55. <img src="@/assets/template/component/style1imgTitle.png"/>
  56. </div>
  57. </td>
  58. <td>
  59. <div :class="['componentScrollBoxItem', this.$store.state.template.editComponentStyle === 2 ? 'active' : '']" @click="selectUseStyleNumber(2)">
  60. <img src="@/assets/template/component/style2imgTitle.png"/>
  61. </div>
  62. </td>
  63. <td>
  64. <div :class="['componentScrollBoxItem', this.$store.state.template.editComponentStyle === 3 ? 'active' : '']" @click="selectUseStyleNumber(3)">
  65. <img src="@/assets/template/component/style3imgTitle.png"/>
  66. </div>
  67. </td>
  68. <td>
  69. <div :class="['componentScrollBoxItem', this.$store.state.template.editComponentStyle === 4 ? 'active' : '']" @click="selectUseStyleNumber(4)">
  70. <img src="@/assets/template/component/style4imgTitle.png"/>
  71. </div>
  72. </td>
  73. </tr>
  74. </table>
  75. </div>
  76. <!--4.banner组件 start---------------------------------------->
  77. <div v-if="this.$store.state.template.editComponentType == 4" class="componentScrollBox">
  78. <table>
  79. <tr>
  80. <td>
  81. <div :class="['componentScrollBoxItem', this.$store.state.template.editComponentStyle === 1 ? 'active' : '']" @click="selectUseStyleNumber(1)">
  82. <img src="@/assets/template/component/banner_pic1.png"/>
  83. </div>
  84. </td>
  85. <td>
  86. <div :class="['componentScrollBoxItem', this.$store.state.template.editComponentStyle === 2 ? 'active' : '']" @click="selectUseStyleNumber(2)">
  87. <img src="@/assets/template/component/banner_pic2.png"/>
  88. </div>
  89. </td>
  90. </tr>
  91. </table>
  92. </div>
  93. <!--4.banner组件 end---------------------------------------->
  94. <!--5.tabs start---------------------------------------->
  95. <div v-if="this.$store.state.template.editComponentType == 5" class="componentScrollBox">
  96. <table>
  97. <tr>
  98. <td>
  99. <div :class="['componentScrollBoxItem', this.$store.state.template.editComponentStyle === 1 ? 'active' : '']" @click="selectUseStyleNumber(1)">
  100. <img src="@/assets/template/component/tabsList1.png"/>
  101. </div>
  102. </td>
  103. <td>
  104. <div :class="['componentScrollBoxItem', this.$store.state.template.editComponentStyle === 2 ? 'active' : '']" @click="selectUseStyleNumber(2)">
  105. <img src="@/assets/template/component/tabsList2.png"/>
  106. </div>
  107. </td>
  108. </tr>
  109. </table>
  110. </div>
  111. <!--5.tabs end---------------------------------------->
  112. <!--6.list列表组件 start---------------------------------------->
  113. <div v-if="this.$store.state.template.editComponentType == 6" class="componentScrollBox">
  114. <table>
  115. <tr>
  116. <td>
  117. <div :class="['componentScrollBoxItem', this.$store.state.template.editComponentStyle === 1 ? 'active' : '']" @click="selectUseStyleNumber(1)">
  118. <img src="@/assets/template/component/list1.png"/>
  119. </div>
  120. </td>
  121. </tr>
  122. </table>
  123. </div>
  124. <!--6.list列表组件 end---------------------------------------->
  125. <!--7.staticHtml静态组件 start---------------------------------------->
  126. <div v-if="this.$store.state.template.editComponentType == 7" class="componentScrollBox">
  127. <table>
  128. <tr>
  129. <td>
  130. <div :class="['componentScrollBoxItem', this.$store.state.template.editComponentStyle === 1 ? 'active' : '']" @click="selectUseStyleNumber(1)">
  131. <img src="@/assets/template/component/fivePicture.png"/>
  132. </div>
  133. </td>
  134. </tr>
  135. </table>
  136. </div>
  137. <!--7.staticHtml静态组件 end---------------------------------------->
  138. <!--8.表单组件 start---------------------------------------->
  139. <div v-if="this.$store.state.template.editComponentType == 8" class="componentScrollBox">
  140. <table>
  141. <tr>
  142. <td>
  143. <div :class="['componentScrollBoxItem', this.$store.state.template.editComponentStyle === 1 ? 'active' : '']" @click="selectUseStyleNumber(1)">
  144. <img src="@/assets/template/component/form1.png"/>
  145. </div>
  146. </td>
  147. </tr>
  148. </table>
  149. </div>
  150. <!--8.表单组件 end---------------------------------------->
  151. </div>
  152. </div>
  153. <div class="componentWindowBoxFooter">
  154. <el-button type="info" @click="closeEditWindow">取消</el-button>
  155. <el-button type="primary" @click="submitData">确定</el-button>
  156. </div>
  157. </div>
  158. </template>
  159. <script>
  160. export default {
  161. props: {
  162. },
  163. data() {
  164. return {
  165. //选择的组件样式
  166. useStyleNumber:0,
  167. }
  168. },
  169. methods: {
  170. //选择组件样式
  171. selectUseStyleNumber(number){
  172. this.$store.commit('template/selectComponentStyleNumber',number);
  173. },
  174. //关闭选择组件样式弹出框
  175. closeEditWindow(){
  176. this.$store.commit('template/closeComponentStyleStatus');
  177. },
  178. //提交编辑的数据
  179. submitData(){
  180. //提交修改
  181. this.$store.commit('template/setComponentStyleNumber');
  182. //关闭窗口
  183. this.$store.commit('template/closeComponentStyleStatus');
  184. //当前保存完了的数据
  185. //console.log(this.$store.state.template.pageData);
  186. }
  187. },
  188. mounted() {
  189. },
  190. };
  191. </script>
  192. <style scoped lang="less">
  193. .componentWindowBox {
  194. .componentStyleBox {
  195. height: 220px;
  196. margin-bottom: 20px;
  197. overflow-x: auto;
  198. overflow-y: hidden;
  199. clear: both;
  200. .componentScrollBox {
  201. height: 200px;
  202. display: flex; /* 使用 flex */
  203. flex-wrap: wrap; /* 换行 */
  204. .componentScrollBoxItem {
  205. width: 200px;
  206. height: 200px;
  207. display: flex;
  208. justify-content: center;
  209. align-items: center;
  210. margin-right: 10px;
  211. background: #F5F7FB;
  212. border:1px solid #F5F7FB;
  213. img {
  214. width: 100%;
  215. }
  216. &:hover {
  217. border:1px solid #19499F;
  218. background: #e5e5ff;
  219. cursor: pointer;
  220. }
  221. transition: all 0.3s;
  222. }
  223. .active {
  224. border:1px solid #19499F;
  225. background: #e5e5ff;
  226. }
  227. }
  228. }
  229. .componentWindowBoxFooter {
  230. text-align: right;
  231. }
  232. }
  233. </style>