rabin 2 年 前
コミット
7b6ed6ead3

+ 1 - 1
lib/dever/components/share.vue

@@ -43,7 +43,7 @@
 			}
 		},
 		props: {
-			id : 0,
+			curid : 0,
 			data : {},
 			code : '',
 		},

+ 114 - 0
lib/dever/components/swiper.vue

@@ -0,0 +1,114 @@
+<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-item>
+		</swiper>
+	</view>
+</template>
+<script>
+	// 无限轮播组件,参考https://blog.csdn.net/qq_40026668/article/details/122236668
+	export default {
+		props: {
+			//传入的数据
+			item : {
+				type : Array,
+				value : []
+			},
+			//是否可以循环滚动
+			circular : {
+				type    : Boolean,
+				value	: true
+			},
+			//设置从第几个开始滚动
+			current : {
+				type    : Number,
+				value	: 0
+			},
+			//是否自动切换
+			autoplay : {
+				type    : Boolean,
+				value	: false
+			},
+			//自动切换时间间隔
+			interval : {
+				type    : Number,
+				value	: 5000
+			}
+		},
+		data() {
+			return {
+				swiper_index : 0, // 当前轮播图激活索引
+				data_index : 0, // 当前展示数据在列表中的索引值
+				length : 3, // 总的轮播图数量
+			}
+		},
+		mounted() {
+			this.data_index = 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)]
+
+				// 获取当前轮播索引对应的值、下个索引对应的值、上个索引对应的值
+				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
+			}
+		},
+		methods: {
+			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)
+				}
+				this.swiper_index = current
+				//console.info(this.data_index, this.swiper_index)
+				this.$emit('change', this.data_index, this.swiper_index);
+			},
+			getDataIndex : function(index) {
+				if (index < 0) {
+					// 小于零,返回数据列表末尾索引
+					return this.item.length - 1
+				} else if (index >= this.item.length) {
+					// 等于(或大于,一般不会)数据列表长度,返回数据首位索引
+					return 0
+				} else {
+					return index
+				}
+			},
+			getIndex : function(index) {
+				if (index < 0) {
+					return this.length - 1
+				} else if (index >= this.length) {
+					return 0
+				} else {
+					return index
+				}
+			}
+		}
+	}
+</script>
+<style scoped lang="scss">
+.swiper {
+	width: 750rpx;
+	height: 100%;
+}
+swiper-item>view{
+  height: 100%;
+}
+swiper-item image{
+  width: 750rpx;
+  height: 100%;
+}
+</style>

+ 20 - 1
lib/dever/index.js

@@ -681,11 +681,30 @@ var share =
 			    jsApiList: [
 			        'onMenuShareTimeline',
 			        'onMenuShareAppMessage',
-			        'onMenuShareQQ'
+			        'onMenuShareQQ',
+					'updateAppMessageShareData',
+					'updateTimelineShareData'
 			    ]
 			});
 			
 			self.wx.ready(function() {
+				self.wx.updateAppMessageShareData({
+					title: param.title,
+					desc: param.content,
+					link: param.source_link,
+					imgUrl: param.pic,
+					success: function(res) {
+						
+					},
+				});
+				self.wx.updateTimelineShareData({
+					title: param.title,
+					link: param.source_link,
+					imgUrl: param.img,
+					success: function(res) {
+						
+					},
+				});
 			    self.wx.onMenuShareAppMessage({
 			        title: param.title,
 			        desc: param.content,

+ 54 - 0
lib/dever/pages/swiper.vue

@@ -0,0 +1,54 @@
+<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>
+		</view>
+	</gracePage>
+</template>
+
+<script>
+	import deverSwiper from '@/lib/dever/components/swiper.vue';
+	export default {
+		data() {
+			return {
+				current : 0,
+				circular : true,
+				data : [1, 2, 3, 4, 5, 6, 7] // 数据列表
+			}
+		},
+		onLoad() {
+			
+		},
+		
+		
+		methods: {
+			change : function(cur, index) {
+				console.info(cur, index);
+			}
+		},
+		components:{
+			deverSwiper
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+page {
+	max-height: 100%;
+}
+
+.swiper {
+	width: 750rpx;
+	height: 100%;
+}
+swiper-item>view{
+  height: 100%;
+}
+swiper-item image{
+  width: 750rpx;
+  height: 100%;
+}
+
+</style>

+ 20 - 20
manifest.json

@@ -17,35 +17,30 @@
             "delay" : 0
         },
         /* 模块配置 */
-        "modules" : {
-            "Contacts" : {}
-        },
+        "modules" : {},
         /* 应用发布信息 */
         "distribute" : {
             /* android打包配置 */
             "android" : {
                 "permissions" : [
-                    "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
-                    "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
-                    "<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
-                    "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
-                    "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
-                    "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
+                    "<uses-feature android:name=\"android.hardware.camera\"/>",
                     "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
-                    "<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
+                    "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
+                    "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
                     "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
                     "<uses-permission android:name=\"android.permission.CAMERA\"/>",
-                    "<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
-                    "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
+                    "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
                     "<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
+                    "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
+                    "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
                     "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
-                    "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
+                    "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
                     "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
-                    "<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
-                    "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
-                    "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
-                    "<uses-feature android:name=\"android.hardware.camera\"/>",
-                    "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
                     "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
                 ]
             },
@@ -56,7 +51,9 @@
             /* SDK配置 */
             "sdkConfigs" : {
                 "maps" : {},
-                "oauth" : {}
+                "oauth" : {},
+                "ad" : {},
+                "payment" : {}
             }
         },
         "uniStatistics" : {
@@ -69,7 +66,10 @@
     "mp-weixin" : {
         "appid" : "wx6f582b09daa468fa",
         "setting" : {
-            "urlCheck" : false
+            "urlCheck" : true,
+            "postcss" : true,
+            "minified" : true,
+            "es6" : false
         },
         "usingComponents" : true,
         "permission" : {

+ 2 - 2
pages/dream/buy.vue

@@ -95,7 +95,7 @@
 export default {
 	name: "buy",
 	props: {
-		id : 0,
+		curid : 0,
 		bgcolor : '',
 		color : '',
 		code : '',
@@ -122,7 +122,7 @@ export default {
 		getData : function() {
 			var self = this;
 			var url = this.Dever.host + '/pages/dream/index';
-			this.Dever.get(this, 'app/collection/?l=api.getBuy', {id:this.id, code:this.code, url:url}, function(t) {
+			this.Dever.get(this, 'app/collection/?l=api.getBuy', {id:this.curid, code:this.code, url:url}, function(t) {
 				self.show = true;
 			});
 		},

+ 7 - 7
pages/dream/index.vue

@@ -16,13 +16,13 @@
 						<view class="text-color-assist">{{fetch.info.desc}}</view>
 					</view>
 					<view class="item" v-if="fetch.info.uid > 0 && fetch.share_user.uid <= 0">
-						<image :src="fetch.info.user.avatar" mode="widthFix" class="avatar"></image>
+						<image :src="fetch.info.user.avatar" mode="widthFix" style="border-radius: 100%;"></image>
 						<view class="wenyue-font">{{fetch.info.user.username}}</view>
 						<view class="text-color-assist">{{fetch.info.user.author}}</view>
 					</view>
 					
 					<view class="item" v-if="fetch.share_user.uid > 0">
-						<image :src="fetch.info.share_user.avatar" mode="widthFix" class="avatar"></image>
+						<image :src="fetch.info.share_user.avatar" mode="widthFix" style="border-radius: 100%;"></image>
 						<view class="wenyue-font">{{fetch.info.share_user.username}}</view>
 						<view class="text-color-assist">{{fetch.info.user.author}}</view>
 					</view>
@@ -53,22 +53,22 @@
 			</view>
 			
 			<view v-if="buyState">
-				<buy :id="id" :bgcolor="fetch.button.bgcolor" :color="fetch.button.color" :code="fetch.code" :name="fetch.info.name" @hideBuy="hideBuy" @share="share" @view="view"></buy>
+				<buy :curid="id" :bgcolor="fetch.button.bgcolor" :color="fetch.button.color" :code="fetch.code" :name="fetch.info.name" @hideBuy="hideBuy" @share="share" @view="view"></buy>
 			</view>
 			
 			<view v-if="passState">
-				<pass :id="id" :bgcolor="fetch.button.bgcolor" :color="fetch.button.color" :code="fetch.code" :name="fetch.info.name" @hidePass="hidePass" @share="share" @view="view"></pass>
+				<pass :curid="id" :bgcolor="fetch.button.bgcolor" :color="fetch.button.color" :code="fetch.code" :name="fetch.info.name" @hidePass="hidePass" @share="share" @view="view"></pass>
 			</view>
 			
 			<view v-if="rankingState">
-				<ranking :id="id" :bgcolor="fetch.button.bgcolor" :color="fetch.button.color" @hideRanking="hideRanking"></ranking>
+				<ranking :curid="id" :bgcolor="fetch.button.bgcolor" :color="fetch.button.color" @hideRanking="hideRanking"></ranking>
 			</view>
 			
 			<view v-if="infoState">
-				<info :id="id" :bgcolor="fetch.button.bgcolor" :color="fetch.button.color" @hideInfo="hideInfo"></info>
+				<info :curid="id" :bgcolor="fetch.button.bgcolor" :color="fetch.button.color" @hideInfo="hideInfo"></info>
 			</view>
 			
-			<dever-share ref="share" :id="id" :code="fetch.code" :data="fetch.share" v-if="fetch.share && fetch.code"></dever-share>
+			<dever-share ref="share" :curid="id" :code="fetch.code" :data="fetch.share" v-if="fetch.share && fetch.code"></dever-share>
 			
 			<view class="mask buy-layer" v-if="inviteState && fetch.share_user && fetch.share_user.code">
 			  <view class="buytip-layer layer " catchtap="handleStop">

+ 2 - 2
pages/dream/info.vue

@@ -88,7 +88,7 @@
 export default {
 	name: "info",
 	props: {
-		id : 0,
+		curid : 0,
 		bgcolor : '',
 		color : '',
 	},
@@ -109,7 +109,7 @@ export default {
 	methods:{
 		getData : function() {
 			var self = this;
-			this.Dever.get(this, 'app/collection/?l=api.getInfo', {id:this.id}, function(t) {
+			this.Dever.get(this, 'app/collection/?l=api.getInfo', {id:this.curid}, function(t) {
 				self.show = true;
 			});
 		},

+ 3 - 3
pages/dream/pass.vue

@@ -27,7 +27,7 @@
 export default {
 	name: "buy",
 	props: {
-		id : 0,
+		curid : 0,
 		bgcolor : '',
 		color : '',
 		code : '',
@@ -48,7 +48,7 @@ export default {
 	methods:{
 		getData : function() {
 			var self = this;
-			this.Dever.get(this, 'app/collection/?l=api.getInfo', {id:this.id, code:this.code}, function(t) {
+			this.Dever.get(this, 'app/collection/?l=api.getInfo', {id:this.curid, code:this.code}, function(t) {
 				self.show = true;
 			});
 		},
@@ -60,7 +60,7 @@ export default {
 			}
 			var data = {};
 			data.password = this.password;
-			data.id = this.id;
+			data.id = this.curid;
 			data.code = this.code;
 			var location = 'dream/view?code='+this.code + '&name=' + this.name;
 

+ 3 - 3
pages/dream/ranking.vue

@@ -67,7 +67,7 @@
 export default {
 	name: "ranking",
 	props: {
-		id : 0,
+		curid : 0,
 		bgcolor : '',
 		color : '',
 	},
@@ -90,7 +90,7 @@ export default {
 	methods:{
 		getData : function() {
 			var self = this;
-			this.Dever.get(this, 'app/collection/?l=api.getRanking', {id:this.id,noloading:1}, function(t) {
+			this.Dever.get(this, 'app/collection/?l=api.getRanking', {id:this.curid,noloading:1}, function(t) {
 				if (t && t.ranking && t.ranking[self.index]) {
 					self.getRankingData(t.ranking[self.index].id, 0);
 				}
@@ -100,7 +100,7 @@ export default {
 			var self = this;
 			this.fetch.ranking_data = [];
 			this.ranking_periods = [];
-			this.Dever.get(this, 'app/collection/?l=api.getRankingData', {id:this.id,ranking_id:ranking_id,ranking_periods:ranking_periods}, function(t) {
+			this.Dever.get(this, 'app/collection/?l=api.getRankingData', {id:this.curid,ranking_id:ranking_id,ranking_periods:ranking_periods}, function(t) {
 				self.show = true;
 				if (t && t.ranking_periods) {
 					for (var i in t.ranking_periods) {

+ 15 - 6
pages/dream/view.vue

@@ -10,7 +10,8 @@
 							  <view class='guide-center'></view>
 							  <view class='guide-bottom'></view>
 							</view>
-						</view>
+						</view>
+						<!--
 						<swiper class="swiper" @change="change" :circular="swiper.circular" :current="fetch.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">
@@ -18,6 +19,12 @@
 								</scroll-view>
 							</swiper-item>
 						</swiper>
+						-->
+						<dever-swiper class="swiper" @change="change" :current="fetch.index" :circular="swiper.circular" :item="fetch.items" v-slot="{k,v}">
+							<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>
+							</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>
@@ -71,7 +78,8 @@ import share from "@/pages/dream/func/share.vue";
 import dream from "@/pages/dream/view/dream.vue";
 import deverDrawerPage from "@/lib/dever/components/drawerPage.vue";
 import deverDrawerWindow from "@/lib/dever/components/drawerWindow.vue";
-import deverShare from '@/lib/dever/components/share.vue';
+import deverShare from '@/lib/dever/components/share.vue';
+import deverSwiper from '@/lib/dever/components/swiper.vue';
 export default{
 	data() {
 		return {
@@ -166,7 +174,6 @@ export default{
 		//this.Dever.login = 'user/login?code=' + option.code;
 		//this.Dever.checkLogin();
 		this.login = this.Dever.getToken();
-		this.showPage(this.swiper.index);
 		this.Dever.config.name = option.name;
 		this.Dever.config.code = option.code;
 		this.Dever.config.system = uni.getSystemInfoSync();
@@ -262,8 +269,9 @@ export default{
 				}
 			}
 		},
-		change : function(e) {
-			this.fetch.index = this.swiper.index = parseInt(e.detail.current);
+		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();
@@ -296,6 +304,7 @@ export default{
 					title:t.info.name
 				});
 				self.swiper.index = t.index ? parseInt(t.index) : 0;
+				self.showPage(self.swiper.index);
 				self.record();
 				if (t && t['func']) {
 					self.drawer.item = t['func'];
@@ -386,7 +395,7 @@ export default{
 		}
 	},
 	components:{
-		dream,cate,community,times,shop,my,share,deverDrawerPage,deverDrawerWindow,deverShare
+		dream,cate,community,times,shop,my,share,deverDrawerPage,deverDrawerWindow,deverShare,deverSwiper
 	}
 }
 </script>

+ 5 - 5
pages/index/list.vue

@@ -2,12 +2,12 @@
 	<gui-page :customFooter="true" :customHeader="true" iphoneXButtomStyle="background:#F8F8F8"
 		:footerSets="{height:150, zIndex:100, bg:'none'}" :isLoading="pageLoading" :headerStyle="headerStyle">
 		<view slot="gHeader">
-					<view class="gui-flex gui-nowrap gui-rows gui-align-items-center gui-padding">
-						<view class="gui-flex1 gui-text-center">
-							<text class="gui-h4 gui-ellipsis gui-primary-color">合小记</text>
-						</view>
-					</view>
+			<view class="gui-flex gui-nowrap gui-rows gui-align-items-center gui-padding">
+				<view class="gui-flex1 gui-text-center">
+					<text class="gui-h4 gui-ellipsis gui-primary-color">合小记</text>
 				</view>
+			</view>
+		</view>
 		<!-- 页面主体 -->
 		<view slot="gBody">
 

+ 3 - 5
pages/user/login.vue

@@ -2,11 +2,9 @@
 	<gui-page :customHeader="true">
 		<view slot="gHeader">
 			<view class="gui-flex gui-nowrap gui-rows gui-align-items-center gui-padding">
-				<!-- 使用组件实现返回按钮及返回首页按钮 -->
-				<gui-header-leading :onlyBack="true"></gui-header-leading>
-				<!-- 导航文本此处也可以是其他自定义内容 -->
-				<text class="gui-h4 gui-ellipsis gui-text-center gui-header-content gui-primary-color">登录</text>
-				<!-- 如果右侧有其他内容可以利用条件编译和定位来实现-->
+				<view class="gui-flex1 gui-text-center">
+					<text class="gui-h4 gui-ellipsis gui-primary-color">登录</text>
+				</view>
 			</view>
 		</view>
 		<view slot="gBody" class="register">