app-poster-image.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <view class="app-poster-image">
  3. <view class="goods-one dir-left-wrap" v-if="form.typesetting==1">
  4. <block v-for="(item,key) in info.multi_map" :key="key">
  5. <image mode="aspectFill" v-if="key <= 0" :src="item"></image>
  6. </block>
  7. </view>
  8. <view class="goods-two dir-left-wrap" v-else-if="form.typesetting==2">
  9. <block v-for="(item,key) in info.multi_map" :key="key">
  10. <image mode="aspectFill" v-if="key <= 1" :src="item"></image>
  11. </block>
  12. </view>
  13. <view class="goods-three dir-left-wrap" v-else-if="form.typesetting==3">
  14. <block v-for="(item,key) in info.multi_map" :key="key">
  15. <image mode="aspectFill" v-if="key <= 2" :src="item"></image>
  16. </block>
  17. </view>
  18. <view class="goods-four dir-left-wrap" v-else-if="form.typesetting==4">
  19. <block v-for="(item,key) in info.multi_map" :key="key">
  20. <image mode="aspectFill" v-if="key <= 3" :src="item"></image>
  21. </block>
  22. </view>
  23. <view class="goods-five dir-left-wrap" v-else-if="form.typesetting==5">
  24. <block v-for="(item,key) in info.multi_map" :key="key">
  25. <image mode="aspectFill" v-if="key <= 4" :src="item"></image>
  26. </block>
  27. </view>
  28. <view v-if="info.extra_multiMap" v-for="(item,key) in info.extra_multiMap" :key="key">
  29. <view v-if="item.file_type === 'image'" class="plugin-image-class" :style="[pluginIconStyle(item)]">
  30. <image :src="item.image_url"></image>
  31. </view>
  32. <view v-else-if="item.file_type === 'text'" class="plugin-text-class" :style="[pluginTextStyle(item)]">
  33. <text>{{item.text}}</text>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. name: "app-poster-image",
  41. props: {
  42. info: {
  43. type: Object,
  44. required: true,
  45. },
  46. form: {
  47. type: Object,
  48. required: true,
  49. },
  50. },
  51. computed: {
  52. pluginTextStyle() {
  53. return (data) => {
  54. let style = {};
  55. if (data.bottom !== undefined && this.form.style != 2) {
  56. style = {bottom: parseFloat(data.bottom) - 43 + 'rpx'}
  57. }
  58. return Object.assign({}, data, style);
  59. }
  60. },
  61. pluginIconStyle() {
  62. return (data) => {
  63. let style = {};
  64. if (data.bottom !== undefined && this.form.style != 2) {
  65. style = {bottom: parseFloat(data.bottom) - 40 + 'rpx'};
  66. }
  67. return Object.assign({}, data, style)
  68. }
  69. },
  70. },
  71. }
  72. </script>
  73. <style scoped lang="scss">
  74. .app-poster-image {
  75. height: 100%;
  76. width: 100%;
  77. position: relative;
  78. overflow: hidden;
  79. .plugin-text-class {
  80. position: absolute;
  81. z-index: 11;
  82. }
  83. .plugin-image-class {
  84. position: absolute;
  85. z-index: 10;
  86. image {
  87. height: 100%;
  88. width: 100%;
  89. }
  90. }
  91. image {
  92. display: block;
  93. }
  94. .goods-one {
  95. height: 100%;
  96. width: 100%;
  97. image {
  98. height: 100%;
  99. width: 100%;
  100. }
  101. }
  102. .goods-two {
  103. height: 100%;
  104. width: 100%;
  105. image:nth-child(1) {
  106. height: 50%;
  107. width: 100%;
  108. }
  109. image:nth-child(2) {
  110. height: 50%;
  111. width: 100%;
  112. }
  113. }
  114. .goods-three {
  115. height: 100%;
  116. width: 100%;
  117. image:nth-child(1) {
  118. height: 50%;
  119. width: 100%;
  120. }
  121. image:nth-child(2) {
  122. height: 50%;
  123. width: 50%;
  124. }
  125. image:nth-child(3) {
  126. height: 50%;
  127. width: 50%;
  128. }
  129. }
  130. .goods-four {
  131. height: 100%;
  132. width: 100%;
  133. image:nth-child(1) {
  134. height: 50%;
  135. width: 50%;
  136. }
  137. image:nth-child(2) {
  138. height: 50%;
  139. width: 50%;
  140. }
  141. image:nth-child(3) {
  142. height: 50%;
  143. width: 50%;
  144. }
  145. image:nth-child(4) {
  146. height: 50%;
  147. width: 50%;
  148. }
  149. }
  150. .goods-five {
  151. height: 100%;
  152. width: 100%;
  153. position: relative;
  154. image:nth-child(1) {
  155. position: absolute;
  156. top: 0;
  157. left: 0;
  158. height: 50%;
  159. width: 50%;
  160. }
  161. image:nth-child(2) {
  162. position: absolute;
  163. top: 50%;
  164. left: 0;
  165. height: 50%;
  166. width: 50%;
  167. }
  168. image:nth-child(3) {
  169. position: absolute;
  170. top: 0;
  171. left: 50%;
  172. height: 33.333%;
  173. width: 50%;
  174. }
  175. image:nth-child(4) {
  176. position: absolute;
  177. top: 33.33%;
  178. left: 50%;
  179. height: 33.333%;
  180. width: 50%;
  181. }
  182. image:nth-child(5) {
  183. position: absolute;
  184. top: 66.66%;
  185. left: 50%;
  186. height: 33.333%;
  187. width: 50%;
  188. }
  189. }
  190. }
  191. </style>