Browse Source

调试接口,完成底部组件

306132416@qq.com 4 years ago
parent
commit
79e09e680d
4 changed files with 45 additions and 14 deletions
  1. 1 1
      App.vue
  2. 16 3
      components/footer-share/footer-share.vue
  3. 14 9
      pages/index/index.vue
  4. 14 1
      pages/park/park_deatil.vue

+ 1 - 1
App.vue

@@ -2,7 +2,7 @@
 	export default {
 		globalData: {
 			 //shareUrl: 'https://gdoctor.xazhima.com/api/v1.0/api.php', //开发环境全局接口域名 线上:https://guolu.xazhima.com/
-			shareUrl: 'https://kiq.xazhima.com/api/api.php',
+			shareUrl: 'https://kiq.xazhima.com/',
 			globalTimestamp: (Date.now()).toString(),
 			secret:'AirQK_weichat_app_zhima',
 		},

+ 16 - 3
components/footer-share/footer-share.vue

@@ -1,10 +1,10 @@
 <template>
 	<view class="footer-share-box display-around">
-		<view class="display-flex-start items-center share-font" :style="{'border-right': isCollection ? '1px solid #d8d8d8' : 'none'}">
+		<button class="display-flex-start items-center share-font" :style="{'border-right': isCollection ? '1px solid #d8d8d8' : 'none'}" open-type="share" @click="sharePage()">
 			<view style="margin-right:15rpx;font-size: 26rpx;">分享</view>
 			<image src="../../static/share_icon.png" mode="aspectFill" style="width: 30rpx;height: 30rpx;"></image>
-		</view> 
-		<view class="display-flex-start items-center share-font" v-if='isCollection'>
+		</button> 
+		<view class="display-flex-start items-center share-font" v-if='isCollection' @click="collectionPage()">
 			<view style="margin-right:15rpx;font-size: 26rpx;">收藏</view>
 			<image src="../../static/collection.png" mode="aspectFill" style="width: 40rpx;height: 40rpx;"></image>
 		</view>
@@ -24,6 +24,14 @@
 			return {
 				
 			};
+		},
+		methods:{
+			sharePage() {
+			    this.$emit('sharePages')
+			},
+			collectionPage() {
+			    this.$emit('collectionPages')
+			},
 		}
 	}
 </script>
@@ -43,4 +51,9 @@
 	   width: 45%;
 	   justify-content: center;
    }
+   .footer-share-box button {
+	   background-color: #fff;
+	   border-radius:0;
+   }
+  .footer-share-box button::after{ border: none;} 
 </style>

+ 14 - 9
pages/index/index.vue

@@ -7,7 +7,7 @@
 		 		 duration="500"	
 				 style="height:400rpx">
 		 		<swiper-item v-for="(item , index) in swiperList" :key="index">
-		 			<image :src="item.img" mode="aspectFill" style="width: 100%;height: 100%;"></image>
+		 			<image :src="item.pic_path" mode="aspectFill" style="width: 100%;height: 100%;"></image>
 		 		</swiper-item>
 		 	</swiper>
 		 </view>
@@ -256,25 +256,30 @@
 			}
 		},
 		onLoad() {
-           //this.getSwiperList()
+           this.getSwiperList()
 		},
 		methods: {
 			getSwiperList(){
+				let md5Sign = md5("method="+'common'+"&timestamp="+getApp().globalData.globalTimestamp+"&secret="+getApp().globalData.secret)
+				let url = getApp().globalData.shareUrl+'api/api.php'+'?method=common&source=main_pics&action=list&timestamp='+getApp().globalData.globalTimestamp +'&sign='+md5Sign
 				uni.request({
-					url: getApp().globalData.shareUrl,
-					method: 'GET',
+					url:url,
+					method: 'POST',
 					header: {
 						'content-type': 'application/x-www-form-urlencoded'
 					},
 					data: {
-						method: 'common',
-						source:'main_pics',
-						action:'list',
-						timestamp: getApp().globalData.globalTimestamp,
-						sign: md5("method="+'common'+"&timestamp="+getApp().globalData.globalTimestamp+"&secret="+getApp().globalData.secret)
+						size:5,
+						page:1,
+						s_status:1
 					},
 					success: (res) => {
 						console.log(res)
+						if(res.data.code === 200){
+							res.data.data.list.forEach((item)=>{item.pic_path = getApp().globalData.shareUrl + item.pic_path})
+							this.swiperList = res.data.data.list;
+					  	
+						}
 					},
 					fail: () => {
 						console.log("连接失败");

+ 14 - 1
pages/park/park_deatil.vue

@@ -126,7 +126,7 @@
 			</view>
 		</view>
 	   
-		<footer-share style="width: 100%;" :isCollection="false"></footer-share>
+		<footer-share style="width: 100%;" :isCollection="false" @collectionPages="collectionPage" @sharePages="sharePage"></footer-share>
 	</view> 
 	</view>
 </template>
@@ -192,6 +192,19 @@
 			},
 			changeTab(index) {
 			  console.log('当前选中的项:' + index)
+			},
+			collectionPage(){
+				console.log('已收藏')
+			},
+			sharePage(){
+				console.log('分享')
+				uni.showShareMenu({
+					title: '园区XXX',
+					path:'pages/park/park_detail',
+					success(res) {
+						console.log(res)
+					}
+				})
 			}
 		}
 	}