index.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <cm-construct v-bind:data="data[index]" v-bind:class="['rubik-cube']">
  2. <template slot="preview">
  3. <div class="preview-box" v-bind:style="{background: nc.backgroundColor}">
  4. <template v-if="nc.list.length>0 && !nc.list[0].imageUrl">
  5. <div class="tip">点击编辑魔方</div>
  6. </template>
  7. <template v-if="(nc.selectedTemplate != 'custom-rubik-cube')">
  8. <ul>
  9. <template v-if="nc.selectedTemplate == 'row1-of3'">
  10. <li v-for="item in nc.list" v-bind:class="nc.selectedTemplate" :style="{width: 'calc((100% - '+ nc.imageGap * 2 +'px) / 3)'}">
  11. <template v-if="item.imageUrl!=''">
  12. <div >
  13. <img v-bind:src="changeImgUrl(item.imageUrl)">
  14. </div>
  15. </template>
  16. </li>
  17. </template>
  18. <template v-else-if="nc.selectedTemplate == 'row1-of4'">
  19. <li v-for="item in nc.list" v-bind:class="nc.selectedTemplate" :style="{width: 'calc((100% - '+ nc.imageGap * 3 +'px) / 4)'}">
  20. <template v-if="item.imageUrl!=''">
  21. <div >
  22. <img v-bind:src="changeImgUrl(item.imageUrl)">
  23. </div>
  24. </template>
  25. </li>
  26. </template>
  27. <template v-else-if="nc.selectedTemplate == 'row1-lt-of2-rt'">
  28. <div class="template-left">
  29. <template v-for="(item, index) in nc.list">
  30. <template v-if="index == 0">
  31. <li v-bind:class="nc.selectedTemplate">
  32. <template v-if="item.imageUrl!=''">
  33. <div :style="{padding: nc.imageGap/2 + 'px'}">
  34. <img v-bind:src="changeImgUrl(item.imageUrl)">
  35. </div>
  36. </template>
  37. </li>
  38. </template>
  39. </template>
  40. </div>
  41. <div class="template-right">
  42. <template v-for="(item, index) in nc.list">
  43. <template v-if="index != 0">
  44. <li v-bind:class="nc.selectedTemplate">
  45. <template v-if="item.imageUrl!=''">
  46. <div :style="{padding: nc.imageGap/2 + 'px'}">
  47. <img v-bind:src="changeImgUrl(item.imageUrl)">
  48. </div>
  49. </template>
  50. </li>
  51. </template>
  52. </template>
  53. </div>
  54. </template>
  55. <template v-else-if="nc.selectedTemplate == 'row1-lt-of1-tp-of2-bm'">
  56. <div class="template-left" :style="{paddingRight: nc.imageGap/2 + 'px'}">
  57. <template v-for="(item, index) in nc.list">
  58. <template v-if="index == 0">
  59. <li v-bind:class="nc.selectedTemplate">
  60. <template v-if="item.imageUrl!=''">
  61. <div>
  62. <img v-bind:src="changeImgUrl(item.imageUrl)">
  63. </div>
  64. </template>
  65. </li>
  66. </template>
  67. </template>
  68. </div>
  69. <div class="template-right" :style="{paddingLeft: nc.imageGap/2 + 'px'}">
  70. <div class="template-top" :style="{paddingBottom: nc.imageGap/2 + 'px'}">
  71. <template v-for="(item, index) in nc.list">
  72. <template v-if="index == 1">
  73. <li v-bind:class="nc.selectedTemplate">
  74. <template v-if="item.imageUrl!=''">
  75. <div>
  76. <img v-bind:src="changeImgUrl(item.imageUrl)">
  77. </div>
  78. </template>
  79. </li>
  80. </template>
  81. </template>
  82. </div>
  83. <div class="template-bottom" :style="{paddingTop: nc.imageGap/2 + 'px'}">
  84. <template v-for="(item, index) in nc.list">
  85. <template v-if="index != 1 && index != 0">
  86. <li v-bind:class="nc.selectedTemplate" :style="{padding: '0 ' + nc.imageGap/2 + 'px'}">
  87. <template v-if="item.imageUrl!=''">
  88. <div>
  89. <img v-bind:src="changeImgUrl(item.imageUrl)">
  90. </div>
  91. </template>
  92. </li>
  93. </template>
  94. </template>
  95. </div>
  96. </div>
  97. </template>
  98. <template v-else>
  99. <li v-for="item in nc.list" v-bind:class="nc.selectedTemplate">
  100. <template v-if="item.imageUrl!=''">
  101. <div :style="{padding: nc.imageGap/2 + 'px'}">
  102. <img v-bind:src="changeImgUrl(item.imageUrl)">
  103. </div>
  104. </template>
  105. </li>
  106. </template>
  107. </ul>
  108. </template>
  109. <template v-else>
  110. <template v-if="nc.lazyLoad">
  111. <rubik-cube-diy-html v-bind:diy-html="nc.diyHtml"></rubik-cube-diy-html>
  112. </template>
  113. </template>
  114. </div>
  115. </template>
  116. <template slot="edit">
  117. <template v-if="nc.lazyLoad">
  118. <rubik-cube></rubik-cube>
  119. </template>
  120. <slide v-bind:data="{ field : 'imageGap', label : '图片间隙', max: 30 }"></slide>
  121. <div class="template-edit-title">
  122. <h3>其他设置</h3>
  123. <i class="layui-icon layui-icon-down" onclick="closeBox(this)"></i>
  124. </div>
  125. <div class="template-edit-wrap">
  126. <color v-bind:data="{ field : 'backgroundColor', 'label' : '背景颜色' }"></color>
  127. </div>
  128. </template>
  129. <!-- 资源 -->
  130. <template slot="resource">
  131. <js>
  132. var rubikCubeResourcePath = "{$resourceurl}";
  133. </js>
  134. <css src="{$resourceurl}/rubik_cube/css/style.css"></css>
  135. <js src="{$resourceurl}/rubik_cube/js/style.js"></js>
  136. </template>
  137. </cm-construct>