design.html 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <nc-component :data="data[index]" :class="['rubik-cube']">
  2. <template slot="preview">
  3. <div class="preview-box" :class="{'border-radius': nc.elementAngle == 'round'}">
  4. <template v-if="nc.list.length>0 && !nc.list[0].imageUrl">
  5. <div class="tip" :style="{ background : nc.componentBgColor,
  6. borderTopLeftRadius: (nc.componentAngle == 'round' ? nc.topAroundRadius + 'px' : 0),
  7. borderTopRightRadius: (nc.componentAngle == 'round' ? nc.topAroundRadius + 'px' : 0),
  8. borderBottomLeftRadius: (nc.componentAngle == 'round' ? nc.bottomAroundRadius + 'px' : 0),
  9. borderBottomRightRadius: (nc.componentAngle == 'round' ? nc.bottomAroundRadius + 'px' : 0),
  10. backgroundImage: 'url(' + changeImgUrl('public/static/img/default_img/figure.png') + ')'
  11. }"></div>
  12. </template>
  13. <template v-if="(nc.mode != 'custom-rubik-cube')">
  14. <ul :style="{ background : nc.componentBgColor,
  15. borderTopLeftRadius: (nc.componentAngle == 'round' ? nc.topAroundRadius + 'px' : 0),
  16. borderTopRightRadius: (nc.componentAngle == 'round' ? nc.topAroundRadius + 'px' : 0),
  17. borderBottomLeftRadius: (nc.componentAngle == 'round' ? nc.bottomAroundRadius + 'px' : 0),
  18. borderBottomRightRadius: (nc.componentAngle == 'round' ? nc.bottomAroundRadius + 'px' : 0)
  19. }">
  20. <template v-if="nc.mode == 'row1-lt-of2-rt'">
  21. <div class="template-left">
  22. <li :class="nc.mode">
  23. <template v-if="nc.list[0].imageUrl!=''">
  24. <div :style="{margin: nc.imageGap/2 + 'px', height : nc.list[0].previewHeight,
  25. borderTopLeftRadius: (nc.elementAngle == 'round' ? nc.topElementAroundRadius + 'px' : 0),
  26. borderTopRightRadius: (nc.elementAngle == 'round' ? nc.topElementAroundRadius + 'px' : 0),
  27. borderBottomLeftRadius: (nc.elementAngle == 'round' ? nc.bottomElementAroundRadius + 'px' : 0),
  28. borderBottomRightRadius: (nc.elementAngle == 'round' ? nc.bottomElementAroundRadius + 'px' : 0),
  29. overflow: 'hidden'}">
  30. <nc-image :src="changeImgUrl(nc.list[0].imageUrl)" :mode="nc.list[0].imageMode"></nc-image>
  31. </div>
  32. </template>
  33. </li>
  34. </div>
  35. <div class="template-right">
  36. <template v-for="(item, index) in nc.list">
  37. <template v-if="index > 0">
  38. <li :class="nc.mode">
  39. <template v-if="item.imageUrl!=''">
  40. <div :style="{margin: nc.imageGap + 'px ' + nc.imageGap/2 + 'px', height : item.previewHeight,
  41. borderTopLeftRadius: (nc.elementAngle == 'round' ? nc.topElementAroundRadius + 'px' : 0),
  42. borderTopRightRadius: (nc.elementAngle == 'round' ? nc.topElementAroundRadius + 'px' : 0),
  43. borderBottomLeftRadius: (nc.elementAngle == 'round' ? nc.bottomElementAroundRadius + 'px' : 0),
  44. borderBottomRightRadius: (nc.elementAngle == 'round' ? nc.bottomElementAroundRadius + 'px' : 0),
  45. overflow: 'hidden'}">
  46. <nc-image :src="changeImgUrl(item.imageUrl)" :mode="item.imageMode"></nc-image>
  47. </div>
  48. </template>
  49. </li>
  50. </template>
  51. </template>
  52. </div>
  53. </template>
  54. <template v-else-if="nc.mode == 'row1-lt-of1-tp-of2-bm'">
  55. <div class="template-left">
  56. <li :class="nc.mode">
  57. <template v-if="nc.list[0].imageUrl!=''">
  58. <div :style="{marginRight: nc.imageGap/2 + 'px', height : nc.list[0].previewHeight,
  59. borderTopLeftRadius: (nc.elementAngle == 'round' ? nc.topElementAroundRadius + 'px' : 0),
  60. borderTopRightRadius: (nc.elementAngle == 'round' ? nc.topElementAroundRadius + 'px' : 0),
  61. borderBottomLeftRadius: (nc.elementAngle == 'round' ? nc.bottomElementAroundRadius + 'px' : 0),
  62. borderBottomRightRadius: (nc.elementAngle == 'round' ? nc.bottomElementAroundRadius + 'px' : 0),
  63. overflow: 'hidden'}">
  64. <nc-image :src="changeImgUrl(nc.list[0].imageUrl)" :mode="nc.list[0].imageMode"></nc-image>
  65. </div>
  66. </template>
  67. </li>
  68. </div>
  69. <div class="template-right">
  70. <div class="template-top" :style="{marginBottom: nc.imageGap + 'px'}">
  71. <li :class="nc.mode">
  72. <template v-if="nc.list[1].imageUrl!=''">
  73. <div :style="{marginLeft: nc.imageGap/2 + 'px', height : nc.list[1].previewHeight,
  74. borderTopLeftRadius: (nc.elementAngle == 'round' ? nc.topElementAroundRadius + 'px' : 0),
  75. borderTopRightRadius: (nc.elementAngle == 'round' ? nc.topElementAroundRadius + 'px' : 0),
  76. borderBottomLeftRadius: (nc.elementAngle == 'round' ? nc.bottomElementAroundRadius + 'px' : 0),
  77. borderBottomRightRadius: (nc.elementAngle == 'round' ? nc.bottomElementAroundRadius + 'px' : 0),
  78. overflow: 'hidden'}">
  79. <nc-image :src="changeImgUrl(nc.list[1].imageUrl)" :mode="nc.list[1].imageMode"></nc-image>
  80. </div>
  81. </template>
  82. </li>
  83. </div>
  84. <div class="template-bottom" :style="{marginLeft: nc.imageGap/2 + 'px',marginTop: nc.imageGap + 'px'}">
  85. <template v-for="(item, index) in nc.list">
  86. <template v-if="index > 1">
  87. <li :class="nc.mode" :style="{margin: '0 ' + nc.imageGap/2 + 'px'}">
  88. <template v-if="item.imageUrl!=''">
  89. <div :style="{height : item.previewHeight,
  90. borderTopLeftRadius: (nc.elementAngle == 'round' ? nc.topElementAroundRadius + 'px' : 0),
  91. borderTopRightRadius: (nc.elementAngle == 'round' ? nc.topElementAroundRadius + 'px' : 0),
  92. borderBottomLeftRadius: (nc.elementAngle == 'round' ? nc.bottomElementAroundRadius + 'px' : 0),
  93. borderBottomRightRadius: (nc.elementAngle == 'round' ? nc.bottomElementAroundRadius + 'px' : 0),
  94. overflow: 'hidden'}">
  95. <nc-image :src="changeImgUrl(item.imageUrl)" :mode="item.imageMode"></nc-image>
  96. </div>
  97. </template>
  98. </li>
  99. </template>
  100. </template>
  101. </div>
  102. </div>
  103. </template>
  104. <template v-else>
  105. <li v-for="(item,rubikIndex) in nc.list" :key="rubikIndex" :class="nc.mode">
  106. <div v-if="item.imageUrl!=''" :style="{margin: nc.imageGap/2 + 'px', height : item.previewHeight,
  107. borderTopLeftRadius: (nc.elementAngle == 'round' ? nc.topElementAroundRadius + 'px' : 0),
  108. borderTopRightRadius: (nc.elementAngle == 'round' ? nc.topElementAroundRadius + 'px' : 0),
  109. borderBottomLeftRadius: (nc.elementAngle == 'round' ? nc.bottomElementAroundRadius + 'px' : 0),
  110. borderBottomRightRadius: (nc.elementAngle == 'round' ? nc.bottomElementAroundRadius + 'px' : 0),
  111. overflow: 'hidden'}">
  112. <nc-image :src="changeImgUrl(item.imageUrl)" :mode="item.imageMode"></nc-image>
  113. </div>
  114. </li>
  115. </template>
  116. </ul>
  117. </template>
  118. <template v-else>
  119. <template v-if="nc.lazyLoad">
  120. <rubik-cube-diy-html :diy-html="nc.diyHtml"></rubik-cube-diy-html>
  121. </template>
  122. </template>
  123. </div>
  124. </template>
  125. <!-- 内容编辑 -->
  126. <template slot="edit-content">
  127. <template v-if="nc.lazyLoad">
  128. <rubik-cube></rubik-cube>
  129. </template>
  130. </template>
  131. <!-- 样式编辑 -->
  132. <template slot="edit-style">
  133. <template v-if="nc.lazyLoad">
  134. <div class="template-edit-title">
  135. <h3>魔方样式</h3>
  136. <slide :data="{ field : 'imageGap', label : '图片间隙', max: 30 }"></slide>
  137. <slide :data="{ field : 'topElementAroundRadius', label : '上圆角', max : 50 }"></slide>
  138. <slide :data="{ field : 'bottomElementAroundRadius', label : '下圆角', max : 50 }"></slide>
  139. </div>
  140. </template>
  141. </template>
  142. <!-- 资源 -->
  143. <template slot="resource">
  144. <js>
  145. var rubikCubeResourcePath = "{$resource_path}"; // http路径
  146. var rubikCubeRelativePath = "{$relative_path}"; // 相对路径
  147. </js>
  148. <css src="{$resource_path}/css/design.css"></css>
  149. <js src="{$resource_path}/js/design.js"></js>
  150. </template>
  151. </nc-component>