rabin 1 year ago
parent
commit
e550562db4

+ 91 - 27
lib/dever/components/swiper.vue

@@ -1,8 +1,8 @@
 <template name="dever-swiper">
 	<view class="index-box">
-		<swiper class="swiper" @change="change" :circular="circular" :current="current" :autoplay="autoplay" :interval="interval">
-			<swiper-item v-for="(v, k) in getData" :key="k" >
-				<slot :v="v" :k="k"></slot>
+		<swiper class="swiper" :display-multiple-items="num" @change="change" :vertical="vertical" :circular="circular" :current="swiper_current" :autoplay="autoplay" :interval="interval" :previous-margin="previous_margin" :next-margin="next_margin">
+			<swiper-item v-for="(v, k) in getData" :key="k" style="overflow: unset;">
+				<slot :k="getKey(k)" :v="v" :i="k"></slot>
 			</swiper-item>
 		</swiper>
 	</view>
@@ -14,66 +14,123 @@
 			//传入的数据
 			item : {
 				type : Array,
-				value : []
+				default : []
+			},
+			//同时显示的滑块数量
+			num : {
+				type    : Number,
+				default	: 1
 			},
 			//是否可以循环滚动
 			circular : {
 				type    : Boolean,
-				value	: true
+				default	: true
 			},
 			//设置从第几个开始滚动
 			current : {
 				type    : Number,
-				value	: 0
+				default	: 0
 			},
 			//是否自动切换
 			autoplay : {
 				type    : Boolean,
-				value	: false
+				default	: false
 			},
 			//自动切换时间间隔
 			interval : {
 				type    : Number,
-				value	: 5000
+				default	: 5000
+			},
+			//是否竖向
+			vertical : {
+				type    : Boolean,
+				default	: false
+			},
+			//前边距
+			previous_margin : {
+				type    : String,
+				default	: '0px'
+			},
+			//后边距
+			next_margin : {
+				type    : String,
+				default	: '0px'
+			},
+		},
+		watch: {
+			current: {
+				handler(current, old) {
+					this.init(current);
+					this.finish();
+				},
+				//deep: true // 深度监听父组件传过来对象变化
 			}
 		},
 		data() {
 			return {
+				length : 3, // 总的轮播图数量
+				swiper_current : 0,
 				swiper_index : 0, // 当前轮播图激活索引
 				data_index : 0, // 当前展示数据在列表中的索引值
-				length : 3, // 总的轮播图数量
+				data : new Array(3),
 			}
 		},
-		mounted() {
-			this.data_index = this.current;
+		created() {
+			this.init(this.current);
 		},
 		computed: {
 			getData() {
 				// 获取当前值、下一个值、上一个值
-				let current = this.item[this.data_index]
-				let next = this.item[this.getDataIndex(this.data_index + 1)]
-				let prev = this.item[this.getDataIndex(this.data_index - 1)]
+				var current_k = this.data_index;
+				var next_k = this.getDataIndex(this.data_index + 1);
+				var prev_k = this.getDataIndex(this.data_index - 1);
+				
+				let current = this.item[current_k]
+				let next = this.item[next_k]
+				let prev = this.item[prev_k]
+				
+				if (typeof(current) == 'object') {
+					current.k = current_k
+					next.k = next_k
+					prev.k = prev_k
+				}
 
 				// 获取当前轮播索引对应的值、下个索引对应的值、上个索引对应的值
-				let list = new Array(3)
-				list[this.swiper_index] = current
-				list[this.getIndex(this.swiper_index + 1)] = next
-				list[this.getIndex(this.swiper_index - 1)] = prev
-				return list
-			}
+				this.data[this.swiper_index] = current
+				this.data[this.getIndex(this.swiper_index + 1)] = next
+				this.data[this.getIndex(this.swiper_index - 1)] = prev
+				return this.data
+			},
 		},
 		methods: {
+			init : function(current) {
+				this.swiper_index = this.getSwiperIndex(current, 3);
+				this.data_index = current;
+				this.swiper_current = this.swiper_index;
+			},
+			getKey : function(k) {
+				if (typeof(this.data[k]) == 'object') {
+					return this.data[k].k;
+				} else {
+					return k;
+				}
+			},
 			change : function(event) {
 				let current = Number(event.detail.current)
-				if ([1, 1 - this.length].includes(current - this.swiper_index)) {
-					// 向左滑动
-					this.data_index = this.getDataIndex(this.data_index + 1)
-				} else {
-					// 向右滑动
-					this.data_index = this.getDataIndex(this.data_index - 1)
+				if (current != this.swiper_index) {
+					if ([1, 1 - this.length].includes(current - this.swiper_index)) {
+						// 向左滑动
+						this.data_index = this.getDataIndex(this.data_index + 1)
+					} else {
+						// 向右滑动
+						this.data_index = this.getDataIndex(this.data_index - 1)
+					}
 				}
+				
 				this.swiper_index = current
-				//console.info(this.data_index, this.swiper_index)
+				this.finish()
+			},
+			finish : function() {
 				this.$emit('change', this.data_index, this.swiper_index);
 			},
 			getDataIndex : function(index) {
@@ -95,6 +152,13 @@
 				} else {
 					return index
 				}
+			},
+			getSwiperIndex : function(current, length) {
+				if (current < (length - 1)) {
+					return current
+				} else {
+					return current % length
+				}
 			}
 		}
 	}

+ 3 - 3
lib/dever/pages/swiper.vue

@@ -1,8 +1,8 @@
 <template>
 	<gracePage :customHeader="false">
 		<view class="container" slot="gBody">
-			<dever-swiper class="swiper" @change="change" :current="current" :circular="circular" :item="data" v-slot="{item}">
-				<view>{{item}}</view>
+			<dever-swiper class="swiper" @change="change" :current="current" :circular="circular" :item="data" v-slot="{k,v}">
+				<view>{{v}}</view>
 			</dever-swiper>
 		</view>
 	</gracePage>
@@ -41,7 +41,7 @@ page {
 
 .swiper {
 	width: 750rpx;
-	height: 100%;
+	height: 600rpx;
 }
 swiper-item>view{
   height: 100%;

+ 30 - 23
pages/dream/view.vue

@@ -12,7 +12,7 @@
 							</view>
 						</view>
 						<!--
-						<swiper class="swiper" @change="change" :circular="swiper.circular" :current="fetch.index">
+						<swiper class="swiper" @change="change" :circular="swiper.circular" :current="swiper.index">
 							<swiper-item v-for="(v, k) in fetch.items"  v-if="v.data" :key="k" >
 								<scroll-view scroll-y="true" scroll-x="true" class="scroll-height" @scrolltolower="bottomCall">
 									<dream ref="dream" @showDrawer="showDrawer" @showPage="showPage" :index="k" :item="v" :control="control" :bottom="bottom" class="item"></dream>
@@ -20,14 +20,14 @@
 							</swiper-item>
 						</swiper>
 						-->
-						<dever-swiper class="swiper" @change="change" :current="fetch.index" :circular="swiper.circular" :item="fetch.items" v-slot="{k,v}">
+						<dever-swiper class="swiper" @change="change" :current="swiper.index" :circular="swiper.circular" :item="fetch.items" v-slot="{k,v,i}">
 							<scroll-view scroll-y="true" scroll-x="true" class="scroll-height" @scrolltolower="bottomCall">
-								<dream ref="dream" @showDrawer="showDrawer" @showPage="showPage" :index="k" :item="v" :control="control" :bottom="bottom" class="item"></dream>
+								<dream :ref="`dream_`+k" @showDrawer="showDrawer" @showPage="showPage" :index="k" :item="v" :control="control" :bottom="bottom" class="item"></dream>
 							</scroll-view>
 						</dever-swiper>
 					</block>
 					<block v-if="!show">
-						<dream ref="dream" @showDrawer="showDrawer" @showPage="showPage" :index="fetch.index" :item="fetch.items[fetch.index]" :control="control" :bottom="bottom" class="item"></dream>
+						<dream :ref="`dream_`+swiper.index" @showDrawer="showDrawer" @showPage="showPage" :index="swiper.index" :item="fetch.items[swiper.index]" :control="control" :bottom="bottom" class="item"></dream>
 					</block>
 				</view>
 			</dever-drawer-page>
@@ -36,27 +36,27 @@
 			<dever-drawer-window v-for="(v, k) in drawer.item" :key="k" :type="k" :show="v.show" :zIndex="v.index" padding="v.padding" :top="v.top" :direction="v.direction" :width="v.width" v-on:closeDrawer="closeDrawer(k)" v-on:bottomFunc="bottomFunc">
 				<view slot="links">
 					<block v-if="k == 'cate'">
-						<cate ref="cate" @goIndex="goIndex" :index="fetch.index" :content_id="content_id" :width="v.width" :param="v.param" :page_id="fetch.page_id"  @getCate="getCate"></cate>
+						<cate ref="cate" @goIndex="goIndex" :index="swiper.index" :content_id="content_id" :width="v.width" :param="v.param" :page_id="fetch.page_id"  @getCate="getCate"></cate>
 					</block>
 					
 					<block v-if="k == 'community'">
-						<community ref="community" @goIndex="goIndex" :index="fetch.index" :content_id="content_id" :width="v.width" :param="v.param"></community>
+						<community ref="community" @goIndex="goIndex" :index="swiper.index" :content_id="content_id" :width="v.width" :param="v.param"></community>
 					</block>
 					
 					<block v-if="k == 'times'">
-						<times ref="times" @goIndex="goIndex" :index="fetch.index" :content_id="content_id" :width="v.width" :param="v.param" :set="v.set" :times="fetch.times_id" @getTimes="getTimes"></times>
+						<times ref="times" @goIndex="goIndex" :index="swiper.index" :content_id="content_id" :width="v.width" :param="v.param" :set="v.set" :times="fetch.times_id" @getTimes="getTimes"></times>
 					</block>
 					
 					<block v-if="k == 'shop'">
-						<shop ref="shop" @goIndex="goIndex" :index="fetch.index" :content_id="content_id" :width="v.width" :param="v.param"></shop>
+						<shop ref="shop" @goIndex="goIndex" :index="swiper.index" :content_id="content_id" :width="v.width" :param="v.param"></shop>
 					</block>
 					
 					<block v-if="k == 'my'">
-						<my ref="my" @goIndex="goIndex" :index="fetch.index" :content_id="content_id" :width="v.width" :param="v.param"></my>
+						<my ref="my" @goIndex="goIndex" :index="swiper.index" :content_id="content_id" :width="v.width" :param="v.param"></my>
 					</block>
 					
 					<block v-if="k == 'share'">
-						<share ref="share" @goIndex="goIndex" :index="fetch.index" :content_id="content_id" :width="v.width" :param="v.param" :type="type"></share>
+						<share ref="share" @goIndex="goIndex" :index="swiper.index" :content_id="content_id" :width="v.width" :param="v.param" :type="type"></share>
 					</block>
 				</view>
 			</dever-drawer-window>
@@ -82,7 +82,8 @@ import deverShare from '@/lib/dever/components/share.vue';
 import deverSwiper from '@/lib/dever/components/swiper.vue';
 export default{
 	data() {
-		return {
+		return {
+			s:2,
 			guide : false,
 			bgm : {
 				show : false,
@@ -176,6 +177,8 @@ export default{
 		this.login = this.Dever.getToken();
 		this.Dever.config.name = option.name;
 		this.Dever.config.code = option.code;
+		// 此处为了记录图片信息
+		this.Dever.config.pic = {};
 		this.Dever.config.system = uni.getSystemInfoSync();
 		this.getData();
 	},
@@ -232,13 +235,16 @@ export default{
 				this.$refs[this.drawer.show][0].getInfo(2);
 			}
 		},
-		record : function() {
+		record : function(index) {
 			if (!this.login) {
 				return;
+			}
+			if (!index) {
+				index = this.swiper.index;
 			}
 			var self = this;
-			var content_id = this.fetch.items[this.swiper.index].id;
-			this.Dever.post('app/user/?l=api.record', {noloading:1, code:this.Dever.config.code, index: this.swiper.index, content_id: content_id}, function(t) {
+			var content_id = this.fetch.items[index].id;
+			this.Dever.post('app/user/?l=api.record', {noloading:1, code:this.Dever.config.code, index: index, content_id: content_id}, function(t) {
 				self.Dever.config.code = t.code;
 				if (self.Dever.source == 'h5') {
 					
@@ -269,12 +275,13 @@ export default{
 				}
 			}
 		},
-		change : function(current, index) {
-			//this.fetch.index = this.swiper.index = parseInt(e.detail.current);
-			this.swiper.index = parseInt(current);
-			this.showPage(this.swiper.index);
-			//用户记录
-			this.record();
+		change : function(current, index) {
+			/*
+			if (this.$refs['dream_' + index]) {
+				this.$refs['dream_' + index].show(0);
+			}*/
+			this.showPage(current);
+			this.record(current);
 			this.controlHandle();
 			if (this.swiper.index >= this.fetch.total) {
 				
@@ -305,7 +312,7 @@ export default{
 				});
 				self.swiper.index = t.index ? parseInt(t.index) : 0;
 				self.showPage(self.swiper.index);
-				self.record();
+				self.record(self.swiper.index);
 				if (t && t['func']) {
 					self.drawer.item = t['func'];
 					self.initDrawer();
@@ -341,8 +348,8 @@ export default{
 				}
 			});
 		},
-		goIndex : function(index) {
-			this.fetch.index = index;
+		goIndex : function(index) {
+			this.swiper.index = index;
 			if (this.drawer.show) {
 				this.closeDrawer(this.drawer.show);
 			}

+ 153 - 148
pages/dream/view/dream.vue

@@ -1,58 +1,66 @@
 <template name="dream">
-	<view class="dream">
-		<!--封面-->
-		<view v-if="item.type == -1">
-			<cover :index="index" :item="item" :control="control" :bottom="bottom" @showDrawer="showDrawer"></cover>
-		</view>
-		
+	<view class="dream">
+		<!--封面-->
+		<view v-if="item.type == -1">
+			<cover :index="index" :item="item" :control="control" :bottom="bottom" @showDrawer="showDrawer"></cover>
+		</view>
+		
 		<!--文章-->
 		<view v-if="item.type == 1">
 			<news :index="index" :item="item.data" :control="control" :bottom="bottom"></news>
-		</view>
-		<!--普通图片-->
-		<view v-else-if="item.type == 10">
-			<pic :index="index" :item="item.data" :control="control" :bottom="bottom"></pic>
+		</view>
+		<!--普通图片-->
+		<view v-else-if="item.type == 10">
+			<pic :index="index" :item="item.data" :control="control" :bottom="bottom"></pic>
 		</view>
 		<!--多张图片-->
 		<view v-else-if="item.type == 11">
-			<swiper class="swiper" autoplay="false" vertical="true" interval="990000" :previous-margin="previous_margin" :next-margin="next_margin" @change="setMargin" circular="true">
-				<swiper-item v-for="(v, k) in item.data" :key="k" style="overflow: unset;">
-					<pic @setHeight="setHeight" :index="index" :pic_index="k" :item="v" :control="control" :bottom="bottom"></pic>
-				</swiper-item>
+			<!--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}">
+				<pic @show="show" :index="index" :pic_index="k" :item="v" :control="control" :bottom="bottom"></pic>
+			</dever-swiper-->
+			<swiper class="swiper" acceleration="true" :circular="circular" :vertical="vertical" :previous-margin="previous_margin" :next-margin="next_margin">
+				<swiper-item v-for="(v, k) in item.data" :key="k" style="overflow: unset;">
+					<pic @show="show" :index="index" :pic_index="k" :item="v" :control="control" :bottom="bottom"></pic>
+				</swiper-item>
 			</swiper>
 		</view>
-		
-		<!--四宫格图片-->
-		<view v-else-if="item.type == 12">
-			<picGrid :index="index" :item="item.data" :control="control" :bottom="bottom"></picGrid>
+		
+		<!--四宫格图片-->
+		<view v-else-if="item.type == 12">
+			<picGrid :index="index" :item="item.data" :control="control" :bottom="bottom"></picGrid>
 		</view>
 		
 		<!--多张四宫格图片-->
 		<view v-else-if="item.type == 13">
-			<swiper class="swiper" autoplay="false" vertical="true" interval="990000" circular="true">
-				<swiper-item v-for="(v, k) in item.data" :key="k">
-					<picGrid :index="index" :item="v" :control="control" :bottom="bottom"></picGrid>
-				</swiper-item>
+			<!--dever-swiper class="swiper" :circular="circular" :vertical="vertical" :item="item.data" v-slot="{k,v}">
+				<picGrid :index="index" :item="v" :control="control" :bottom="bottom"></picGrid>
+			</dever-swiper-->
+			<swiper class="swiper" :circular="circular" :vertical="vertical">
+				<swiper-item v-for="(v, k) in item.data" :key="k">
+					<picGrid :index="index" :item="v" :control="control" :bottom="bottom"></picGrid>
+				</swiper-item>
 			</swiper>
-			
 		</view>
 		
-		
-		<!--视频-->
+		
+		<!--视频-->
 		<view v-else-if="item.type == 20">
-			<swiper class="swiper" autoplay="false" vertical="true" interval="990000" circular="true">
-				<swiper-item v-for="(v, k) in item.data" :key="k">
-					<vod :index="index" :item="v" :control="control" :bottom="bottom"></vod>
-				</swiper-item>
-			</swiper>
+			<!--dever-swiper class="swiper" :circular="circular" :vertical="vertical" :item="item.data" v-slot="{k,v}">
+				<vod :index="index" :item="v" :control="control" :bottom="bottom"></vod>
+			</dever-swiper-->
+			<swiper class="swiper" :circular="circular" :vertical="vertical">
+				<swiper-item v-for="(v, k) in item.data" :key="k">
+					<vod :index="index" :item="v" :control="control" :bottom="bottom"></vod>
+				</swiper-item>
+			</swiper>
 		</view>
 		<!--短视频-->
 		<view v-else-if="item.type == 21">
 			<vodShort :index="index" :item="item.data" :control="control" :bottom="bottom"></vodShort>
-		</view>
-		<!--留言视频-->
-		<view v-else-if="item.type == 22">
-			<vodComment :index="index" :item="item.data" :control="control" :bottom="bottom"></vodComment>
+		</view>
+		<!--留言视频-->
+		<view v-else-if="item.type == 22">
+			<vodComment :index="index" :item="item.data" :control="control" :bottom="bottom"></vodComment>
 		</view>
 		
 		
@@ -68,124 +76,121 @@
 		<!--直播-->
 		<view v-else-if="item.type == 40">
 			<liveComment :index="index" :item="item.data" :control="control" :bottom="bottom"></liveComment>
-		</view>
-		
-		<!--朋友圈-->
-		<view v-else-if="item.type == 51">
-			<moment :index="index" :item="item.data" :control="control" :bottom="bottom"></moment>
+		</view>
+		
+		<!--朋友圈-->
+		<view v-else-if="item.type == 51">
+			<moment :index="index" :item="item.data" :control="control" :bottom="bottom"></moment>
 		</view>
 		
 		<!--对话-->
 		<view v-else-if="item.type == 60">
 			<dialogue :index="index" :item="item.data" :control="control" :bottom="bottom"></dialogue>
-		</view>
-		
-		<!--电商单个产品-->
-		<view v-else-if="item.type == 70">
-			<product :index="index" :item="item.data" :control="control" :bottom="bottom"></product>
-		</view>
-		
-		<!--单个链接-->
-		<view v-else-if="item.type == 80">
-			<linkView :index="index" :item="item.data" :control="control" :bottom="bottom"></linkView>
-		</view>
-		
-		<!--单页面-->
-		<view v-else-if="item.type == 82">
-			<webView :index="index" :item="item.data" :control="control" :bottom="bottom"></webView>
+		</view>
+		
+		<!--电商单个产品-->
+		<view v-else-if="item.type == 70">
+			<product :index="index" :item="item.data" :control="control" :bottom="bottom"></product>
+		</view>
+		
+		<!--单个链接-->
+		<view v-else-if="item.type == 80">
+			<linkView :index="index" :item="item.data" :control="control" :bottom="bottom"></linkView>
+		</view>
+		
+		<!--单页面-->
+		<view v-else-if="item.type == 82">
+			<webView :index="index" :item="item.data" :control="control" :bottom="bottom"></webView>
 		</view>
 	</view>
 </template>
 
-<script>
-import cover from "@/pages/dream/view/cover.vue";
-import news from "@/pages/dream/view/news.vue";
-import pic from "@/pages/dream/view/pic.vue";
-import picGrid from "@/pages/dream/view/picGrid.vue";
-import vod from "@/pages/dream/view/vod.vue";
+<script>
+import cover from "@/pages/dream/view/cover.vue";
+import news from "@/pages/dream/view/news.vue";
+import pic from "@/pages/dream/view/pic.vue";
+import picGrid from "@/pages/dream/view/picGrid.vue";
+import vod from "@/pages/dream/view/vod.vue";
 import vodComment from "@/pages/dream/view/vodComment.vue";
-import audioList from "@/pages/dream/view/audioList.vue";
+import audioList from "@/pages/dream/view/audioList.vue";
 import audioComment from "@/pages/dream/view/audioComment.vue";
-import liveComment from "@/pages/dream/view/liveComment.vue";
+import liveComment from "@/pages/dream/view/liveComment.vue";
 import vodShort from "@/pages/dream/view/vodShort.vue";
-import dialogue from "@/pages/dream/view/dialogue.vue";
-import linkView from "@/pages/dream/view/linkView.vue";
-import webView from "@/pages/dream/view/webView.vue";
-import product from "@/pages/dream/view/product.vue";
-import moment from "@/pages/dream/view/moment.vue";
-export default {
-	name: "dream",
-	props: {
-		control : {
-			type : Object,
-			value : null
-		},
-		bottom : {
-			type : Object,
-			value : null
-		},
-		item : {
-			type    : Object,
-			value	: null
+import dialogue from "@/pages/dream/view/dialogue.vue";
+import linkView from "@/pages/dream/view/linkView.vue";
+import webView from "@/pages/dream/view/webView.vue";
+import product from "@/pages/dream/view/product.vue";
+import moment from "@/pages/dream/view/moment.vue";
+import deverSwiper from '@/lib/dever/components/swiper.vue';
+export default {
+	name: "dream",
+	props: {
+		control : {
+			type : Object,
+			defalut : {}
+		},
+		bottom : {
+			type : Object,
+			defalut : {}
 		},
-		index : 0,
-	},
-	data() {
-		return {
-			item_height : {},
+		item : {
+			type    : Object,
+			defalut : {}
+		},
+		index : {
+			type    : Number,
+			default	: 0
+		},
+	},
+	data() {
+		return {
+			circular : true,
+			vertical : true,
 			next_margin : '0px',
-			previous_margin : '0px',
-		}
-	},
-	mounted() {
-		this.item_height[this.index] = [];
-	},
-	methods:{
-		setHeight : function(index, height) {
-			this.item_height[this.index][index] = height;
-			if (index == 0) {
-				this.setMargin(false, index);
-			}
-		},
+			previous_margin : '0px',
+		}
+	},
+	methods:{
 		getData : function(page) {
 			
 		},
-		showDrawer : function(key) {
-			if (key) {
-				this.$emit('showDrawer', key);
-			} else {
-				this.Dever.alert('您点错了吧~');
-			}
-		},
-		showPage : function(index) {
-			if (index > 0) {
-				this.$emit('showPage', -1, index);
-			}
-		},
-		handle : function(e) {
-			this.showDrawer(this.button[e.index].key);
+		show : function(index) {
+			this.setMargin(index);
+		},
+		showDrawer : function(key) {
+			if (key) {
+				this.$emit('showDrawer', key);
+			} else {
+				this.Dever.alert('您点错了吧~');
+			}
+		},
+		showPage : function(index) {
+			if (index > 0) {
+				this.$emit('showPage', -1, index);
+			}
+		},
+		handle : function(e) {
+			this.showDrawer(this.button[e.index].key);
 		},
-		setMargin : function(e, i) {
-			var index = i >= 0 ? i : e.detail.current;
-			/*
-			if (this.item.type == 11 || this.item.type == 13 || this.item.type == 20) {
-				this.showPage(index);
-			}
-			*/
-			if (this.item_height[this.index].length > 0 && this.item_height[this.index][index]) {
-				var height = this.item_height[this.index][index];
+		setMargin : function(index) {
+			return;
+			if (this.item.data[index] && this.item.data[index].pic_info) {
+				var temp = this.item.data[index].pic_info.split(',');
+				var width = parseFloat(temp[0]);
+				var height = parseFloat(temp[1]);
+				height = height / (width / this.Dever.config.system.windowWidth);
 				var windowHeight = this.Dever.config.system.windowHeight;
 				if (windowHeight > height) {
 					height = windowHeight-height-3;
 					this.next_margin = height + 'px';
 				}
 			}
-		},
-	},
-	components:{
-		cover,news,pic,picGrid,vod,vodComment,vodShort,audioList,audioComment,liveComment,dialogue,linkView,webView,product,moment
-	}
-}
+		},
+	},
+	components:{
+		cover,news,pic,picGrid,vod,vodComment,vodShort,audioList,audioComment,liveComment,dialogue,linkView,webView,product,moment,deverSwiper
+	}
+}
 </script>
 
 <style>
@@ -196,14 +201,14 @@ export default {
 	top: 0;
 	left: 0;
 	z-index: 1;
-}
-.swiper{
-	width: 100vw;
-	height: 100vh;	
-	position: relative;
-	top: 0;
+}
+.swiper{
+	width: 100vw;
+	height: 100vh;	
+	position: relative;
+	top: 0;
 	left: 0;
-	z-index: 1;
+	z-index: 1;
 }
 .page-num {
   position: fixed;
@@ -218,20 +223,20 @@ export default {
   line-height: 80rpx;
   text-align: center;
   z-index: 2000;
-}
-
+}
+
 .love {
   bottom: 310rpx;
-}
-
-.community {
-  bottom: 220rpx;
-  background-color: #ff5500;
-}
-
-.cate {
-  bottom: 130rpx;
-  background-color: #3688ff;
-}
+}
+
+.community {
+  bottom: 220rpx;
+  background-color: #ff5500;
+}
+
+.cate {
+  bottom: 130rpx;
+  background-color: #3688ff;
+}
 
 </style>

+ 33 - 12
pages/dream/view/pic.vue

@@ -1,12 +1,12 @@
 <template name="pic">
 	<view class="cover cover-height">
 		<block v-if="item.text.length > 0">
-			<image v-show="loaded" @click="Dever.viewPic([item.pic], item.pic)" :src="item.pic" mode="widthFix" :class="['default', 'slide-image', 'slide-image-'+item.type]" @error="onError" @load="onSuccess" style="height:auto"></image>
+			<image v-show="loaded" @click="Dever.viewPic([item.pic], item.pic)" :src="item.pic" @error="onError" @load="onSuccess" mode="aspectFill" :class="['default', 'slide-image', 'slide-image-'+item.type]" style="height:100%;scroll-snap-align: start;"></image>
 			<ourLoading v-show="!loaded" active text="加载中..." />
 			<dever-position :item="item.text" :down="item.pic" :button="item.is_button"></dever-position>
 		</block>
 		<block v-if="item.text.length <= 0">
-			<image v-show="loaded" @click="Dever.viewPic([item.pic], item.pic)" :src="item.pic" mode="widthFix" :class="['default', 'slide-image', 'slide-image-'+item.type]" @error="onError" @load="onSuccess" style="height:auto"></image>
+			<image v-show="loaded" @click="Dever.viewPic([item.pic], item.pic)" :src="item.pic" @error="onError" @load="onSuccess" mode="aspectFill" :class="['default', 'slide-image', 'slide-image-'+item.type]" style="height:100%;scroll-snap-align: start;"></image>
 			<ourLoading v-show="!loaded" active text="加载中..." />
 		</block>
 	</view>
@@ -19,31 +19,52 @@ export default {
 	props: {
 		control : {
 			type : Object,
-			value : null
+			defalut : {}
 		},
 		item : {
 			type    : Object,
-			value	: null
+			defalut : {}
 		},
-		index : 0,
-		pic_index : 0,
+		index : {
+			type    : Number,
+			default	: 0
+		},
+		pic_index : {
+			type    : Number,
+			default	: 0
+		},
 	},
 	data() {
 		return {
 			loaded : false
 		};
 	},
+	mounted : function() {
+		this.loaded = false;
+		//this.loadImage();
+	},
 	methods:{
+		async loadImage() {
+		    // 由于方法是异步的,渲染时高度会不生效,所以要加await
+		    let info = await uni.getImageInfo({src: this.item.pic}) 
+		 
+		    // 取到图片的宽高
+		    let {width, height} = info[1]
+			
+			this.loaded = true;
+		},
 		onSuccess : function(e) {
-			this.onImg(e);
 			this.loaded = true;
 		},
 		onError : function(e) {
 			this.loaded = false;
 		},
-		onImg : function(e) {
-			var height = e.detail.height / (e.detail.width / this.Dever.config.system.windowWidth);
-			this.$emit('setHeight', this.pic_index, height);
+		onImg : function(width, height) {
+			//var height = e.detail.height / (e.detail.width / this.Dever.config.system.windowWidth);
+			/*
+			if (this.pic_index == 0) {
+				this.$emit('show', this.pic_index);
+			}*/
 		}
 	},
 	components:{
@@ -55,7 +76,7 @@ export default {
 <style>
 .cover{
   position: relative;
-  width: 100%;
+  /*width: 100%;*/
   height: 100%;
 }
 .cover-height{
@@ -63,7 +84,7 @@ export default {
   position: absolute;
   top:0;
   left:0;
-  width:100%;
+  /*width: 100%;*/
   height:100%;
 }
 .slide-image {

+ 26 - 5
pages/dream/view/vodShort.vue

@@ -1,6 +1,6 @@
 <template name="vodShort">
 	<view>
-		<swiper class="swiper" autoplay="false" vertical="true" interval="990000" @change="changeVod" circular="true">
+		<swiper class="swiper" :circular="circular" :vertical="vertical" @change="changeVod">
 			<swiper-item v-for="(v, k) in item" :key="k">
 				<dever-video
 				:src="v.video" 
@@ -17,27 +17,48 @@
 				</dever-video>
 			</swiper-item>
 		</swiper>
+		<!--dever-swiper class="swiper" :circular="circular" :vertical="vertical" :item="item" v-slot="{k,v}" @change="changeVod">
+			<dever-video
+			:src="v.video" 
+			:pic="v.pic" 
+			:index="k" 
+			:vid="v.id"
+			:type="v.type"
+			:disabled="false"
+			:position_item="v.text"
+			:position_save="v.is_button"
+			:load.sync="load"
+			ref="video"
+			>
+			</dever-video>
+		</dever-swiper-->
 	</view>
 </template>
 
 <script>
 import deverVideo from '@/lib/dever/components/video.nvue';
+import deverSwiper from '@/lib/dever/components/swiper.vue';
 var play = true;
 export default {
 	name: "vodShort",
 	props: {
 		control : {
 			type : Object,
-			value : null
+			defalut : {}
 		},
 		item : {
 			type    : Array,
-			value	: null
+			defalut : {}
+		},
+		index : {
+			type    : Number,
+			default	: 0
 		},
-		index : 0
 	},
 	data() {
 		return {
+			circular : true,
+			vertical : true,
 			load : false,
 			current_index: 0,
 		};
@@ -77,7 +98,7 @@ export default {
 	},
 
 	components:{
-		deverVideo
+		deverVideo,deverSwiper
 	}
 }
 </script>

+ 1 - 1
pages/index/list.vue

@@ -87,7 +87,7 @@
 		},
 		onShow() {
 			this.$nextTick(function() {
-				this.$refs.foot.cur = this.foot_value;
+				//this.$refs.foot.cur = this.foot_value;
 			});
 		},
 		// 重新加载