dream.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template name="dream">
  2. <view class="dream">
  3. <!--封面-->
  4. <view v-if="item.type == -1">
  5. <cover :index="index" :item="item" :control="control" :bottom="bottom" @showDrawer="showDrawer"></cover>
  6. </view>
  7. <!--文章-->
  8. <view v-if="item.type == 1">
  9. <news :index="index" :item="item.data" :control="control" :bottom="bottom"></news>
  10. </view>
  11. <!--普通图片-->
  12. <view v-else-if="item.type == 10">
  13. <pic :index="index" :item="item.data" :control="control" :bottom="bottom"></pic>
  14. </view>
  15. <!--多张图片-->
  16. <view v-else-if="item.type == 11">
  17. <!--dever-swiper class="swiper" :circular="circular" :vertical="vertical" :previous_margin="previous_margin" :next_margin="next_margin" @change="setMargin" :item="item.data" v-slot="{k,v}">
  18. <pic @show="show" :index="index" :pic_index="k" :item="v" :control="control" :bottom="bottom"></pic>
  19. </dever-swiper-->
  20. <swiper class="swiper" acceleration="true" :circular="circular" :vertical="vertical" :previous-margin="previous_margin" :next-margin="next_margin">
  21. <swiper-item v-for="(v, k) in item.data" :key="k" style="overflow: unset;">
  22. <pic @show="show" :index="index" :pic_index="k" :item="v" :control="control" :bottom="bottom"></pic>
  23. </swiper-item>
  24. </swiper>
  25. </view>
  26. <!--四宫格图片-->
  27. <view v-else-if="item.type == 12">
  28. <picGrid :index="index" :item="item.data" :control="control" :bottom="bottom"></picGrid>
  29. </view>
  30. <!--多张四宫格图片-->
  31. <view v-else-if="item.type == 13">
  32. <!--dever-swiper class="swiper" :circular="circular" :vertical="vertical" :item="item.data" v-slot="{k,v}">
  33. <picGrid :index="index" :item="v" :control="control" :bottom="bottom"></picGrid>
  34. </dever-swiper-->
  35. <swiper class="swiper" :circular="circular" :vertical="vertical">
  36. <swiper-item v-for="(v, k) in item.data" :key="k">
  37. <picGrid :index="index" :item="v" :control="control" :bottom="bottom"></picGrid>
  38. </swiper-item>
  39. </swiper>
  40. </view>
  41. <!--视频-->
  42. <view v-else-if="item.type == 20">
  43. <!--dever-swiper class="swiper" :circular="circular" :vertical="vertical" :item="item.data" v-slot="{k,v}">
  44. <vod :index="index" :item="v" :control="control" :bottom="bottom"></vod>
  45. </dever-swiper-->
  46. <swiper class="swiper" :circular="circular" :vertical="vertical">
  47. <swiper-item v-for="(v, k) in item.data" :key="k">
  48. <vod :index="index" :item="v" :control="control" :bottom="bottom"></vod>
  49. </swiper-item>
  50. </swiper>
  51. </view>
  52. <!--短视频-->
  53. <view v-else-if="item.type == 21">
  54. <vodShort :index="index" :item="item.data" :control="control" :bottom="bottom"></vodShort>
  55. </view>
  56. <!--留言视频-->
  57. <view v-else-if="item.type == 22">
  58. <vodComment :index="index" :item="item.data" :control="control" :bottom="bottom"></vodComment>
  59. </view>
  60. <!--音频播放-->
  61. <view v-else-if="item.type == 30">
  62. <audioList :index="index" :item="item.data" :control="control" :bottom="bottom"></audioList>
  63. </view>
  64. <!--留言音频-->
  65. <view v-else-if="item.type == 31">
  66. <audioComment :index="index" :item="item.data" :control="control" :bottom="bottom"></audioComment>
  67. </view>
  68. <!--直播-->
  69. <view v-else-if="item.type == 40">
  70. <liveComment :index="index" :item="item.data" :control="control" :bottom="bottom"></liveComment>
  71. </view>
  72. <!--朋友圈-->
  73. <view v-else-if="item.type == 51">
  74. <moment :index="index" :item="item.data" :control="control" :bottom="bottom"></moment>
  75. </view>
  76. <!--对话-->
  77. <view v-else-if="item.type == 60">
  78. <dialogue :index="index" :item="item.data" :control="control" :bottom="bottom"></dialogue>
  79. </view>
  80. <!--电商单个产品-->
  81. <view v-else-if="item.type == 70">
  82. <product :index="index" :item="item.data" :control="control" :bottom="bottom"></product>
  83. </view>
  84. <!--单个链接-->
  85. <view v-else-if="item.type == 80">
  86. <linkView :index="index" :item="item.data" :control="control" :bottom="bottom"></linkView>
  87. </view>
  88. <!--单页面-->
  89. <view v-else-if="item.type == 82">
  90. <webView :index="index" :item="item.data" :control="control" :bottom="bottom"></webView>
  91. </view>
  92. </view>
  93. </template>
  94. <script>
  95. import cover from "@/pages/dream/view/cover.vue";
  96. import news from "@/pages/dream/view/news.vue";
  97. import pic from "@/pages/dream/view/pic.vue";
  98. import picGrid from "@/pages/dream/view/picGrid.vue";
  99. import vod from "@/pages/dream/view/vod.vue";
  100. import vodComment from "@/pages/dream/view/vodComment.vue";
  101. import audioList from "@/pages/dream/view/audioList.vue";
  102. import audioComment from "@/pages/dream/view/audioComment.vue";
  103. import liveComment from "@/pages/dream/view/liveComment.vue";
  104. import vodShort from "@/pages/dream/view/vodShort.vue";
  105. import dialogue from "@/pages/dream/view/dialogue.vue";
  106. import linkView from "@/pages/dream/view/linkView.vue";
  107. import webView from "@/pages/dream/view/webView.vue";
  108. import product from "@/pages/dream/view/product.vue";
  109. import moment from "@/pages/dream/view/moment.vue";
  110. import deverSwiper from '@/lib/dever/components/swiper.vue';
  111. export default {
  112. name: "dream",
  113. props: {
  114. control : {
  115. type : Object,
  116. defalut : {}
  117. },
  118. bottom : {
  119. type : Object,
  120. defalut : {}
  121. },
  122. item : {
  123. type : Object,
  124. defalut : {}
  125. },
  126. index : {
  127. type : Number,
  128. default : 0
  129. },
  130. },
  131. data() {
  132. return {
  133. circular : true,
  134. vertical : true,
  135. next_margin : '0px',
  136. previous_margin : '0px',
  137. }
  138. },
  139. methods:{
  140. getData : function(page) {
  141. },
  142. show : function(index) {
  143. this.setMargin(index);
  144. },
  145. showDrawer : function(key) {
  146. if (key) {
  147. this.$emit('showDrawer', key);
  148. } else {
  149. this.Dever.alert('您点错了吧~');
  150. }
  151. },
  152. showPage : function(index) {
  153. if (index > 0) {
  154. this.$emit('showPage', -1, index);
  155. }
  156. },
  157. handle : function(e) {
  158. this.showDrawer(this.button[e.index].key);
  159. },
  160. setMargin : function(index) {
  161. return;
  162. if (this.item.data[index] && this.item.data[index].pic_info) {
  163. var temp = this.item.data[index].pic_info.split(',');
  164. var width = parseFloat(temp[0]);
  165. var height = parseFloat(temp[1]);
  166. height = height / (width / this.Dever.config.system.windowWidth);
  167. var windowHeight = this.Dever.config.system.windowHeight;
  168. if (windowHeight > height) {
  169. height = windowHeight-height-3;
  170. this.next_margin = height + 'px';
  171. }
  172. }
  173. },
  174. },
  175. components:{
  176. cover,news,pic,picGrid,vod,vodComment,vodShort,audioList,audioComment,liveComment,dialogue,linkView,webView,product,moment,deverSwiper
  177. }
  178. }
  179. </script>
  180. <style>
  181. .dream {
  182. width: 100vw;
  183. height: 100vh;
  184. position: relative;
  185. top: 0;
  186. left: 0;
  187. z-index: 1;
  188. }
  189. .swiper{
  190. width: 100vw;
  191. height: 100vh;
  192. position: relative;
  193. top: 0;
  194. left: 0;
  195. z-index: 1;
  196. }
  197. .page-num {
  198. position: fixed;
  199. right: 30rpx;
  200. bottom: 30rpx;
  201. width: 80rpx;
  202. height: 80rpx;
  203. background-color: rgba(0, 0, 0, 0.75);
  204. border-radius: 80rpx;
  205. color: #fff;
  206. font-size: 30rpx;
  207. line-height: 80rpx;
  208. text-align: center;
  209. z-index: 2000;
  210. }
  211. .love {
  212. bottom: 310rpx;
  213. }
  214. .community {
  215. bottom: 220rpx;
  216. background-color: #ff5500;
  217. }
  218. .cate {
  219. bottom: 130rpx;
  220. background-color: #3688ff;
  221. }
  222. </style>