Sfoglia il codice sorgente

1.添加详情页分享
2.修复接口问题

zizhong.wang 5 anni fa
parent
commit
3f8b72be87

+ 3 - 0
App.vue

@@ -21,6 +21,8 @@
 			isIos:false,
 			globalShareCounts:'',
 			shareImg:'',
+			shareContent:'',
+			shareTaobaoCode:''
 		},
 		onLaunch: function() {
 			// console.log('App Launch')
@@ -104,6 +106,7 @@
 
 <style>
 	/*每个页面公共css */
+	@import '/components/gaoyia-parse/parse.css';
 	page {
 		height: 100%;
 		background: #eee;

+ 99 - 11
pages/index/detailPage/index.vue

@@ -8,16 +8,13 @@
 		</view>
 		
 	<view class="share-box">
-		<view>分销商分享给好友,好友购买产品成功后即可获</view>
-		<view>得分享奖励</view>
-		<view>单笔最高可赚¥200.00</view>
-		<view>快去分享吧</view>
-		<button type="default" open-type="share">分享</button>
+		<u-parse :content="shareContent"></u-parse>
+		<button type="default" @click.stop='showShareModal'>分享</button>
 	</view>
 	
 	<view class="share-box" style="height: 200upx;margin-top: 2%;" @longpress="copyCode">
 		<view>长按复制框内整段文字,打开 [手淘] 即可购买</view>
-		<view>¥kSfsDfrtrEjt¥</view>
+		<view>{{shareCode}}</view>
 		<button type="default" @click="copyCode">一键复制</button>
 	</view>
 		
@@ -26,25 +23,43 @@
 			<u-parse :content="detailObj.content"></u-parse>
 		</view>
 		<!-- <image class="logo-footer" src="/static/detail-bg2.png"></image> -->
-		
+    	<uni-popup ref="popup" type="bottom">
+			<view class="uni-share">
+				<view class="uni-share-content">
+					<button class="uni-share-content-box" open-type="share">
+						<view class="uni-share-content-image"><image src="/static/userSetIcon.png" class="image" /></view>
+						<view class="uni-share-content-text">分享给好友</view>
+					</button>
+					<button class="uni-share-content-box" @click="goPostShare">
+						<view class="uni-share-content-image"><image src="/static/share-icon1.png" class="image" /></view>
+						<view class="uni-share-content-text">海报分享</view>
+					</button>
+				</view>
+				<view class="uni-share-btn" @click="cancelModal()">取消</view>
+			</view>
+		</uni-popup>
 	</view>
 </template>
 
 <script>
 	var md5 = require("../../../common/md5.js");
 	import uParse from '@/components/gaoyia-parse/parse.vue'
+	import uniPopup from "@/components/uni-popup/uni-popup.vue";
 	export default {
 		components: {
 			uParse,
+			uniPopup
 		},
 		data() {
 			return {
 				title: 'Hello',
 				detailObj:{},
+				shareContent:'',
+				shareCode:''
 			}
 		},
 		onLoad(option) {
-			this.getDetailInfo(option.detailId)
+			this.getDetailInfo(option.detailId);
 		},
 		onShareAppMessage() {
 			  return {
@@ -69,15 +84,31 @@
 					},
 					success: res => {
 						if (res.data.code === 200) {
-							that.detailObj = res.data.msg
-							console.log(res.data.msg)
+							that.detailObj = res.data.msg;
+							that.shareContent = getApp().globalData.shareContent;
+							that.shareCode = getApp().globalData.shareTaobaoCode
+							console.log(that.shareContent)
 						}
 					}
 				});
 			},
+			 showShareModal(){
+					this.$refs.popup.open();
+			      },
+			cancelModal(){
+				 // 需要在 popup 组件,指定 ref 为 popup
+				 this.$refs.popup.close();
+			},
+			goPostShare() {
+				this.$refs.popup.close()
+				uni.navigateTo({
+					url: '/pages/index/postShare/index'
+				})
+				  },
 		    copyCode(){
+				let that = this;
 				uni.setClipboardData({
-					data:'xxx',
+					data:that.shareCode,
 					success() {
 						uni.showToast({
 							icon:'none',
@@ -91,6 +122,7 @@
 </script>
 
 <style>
+	@import url("../../../components/gaoyia-parse/parse.css");
 	.content {
 		display: flex;
 		flex-direction: column;
@@ -154,4 +186,60 @@
 		margin-bottom: 2%;
 		font-size: 32rpx;
 	}
+		//分享模态框
+	.uni-share-content {
+		display: flex;
+		flex-wrap: wrap;
+		padding: 15px;
+		/* justify-content: center */
+	}
+	
+	.uni-share-content-box {
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		width: 25%;
+		box-sizing: border-box;
+		margin-left: 0;
+		margin-right: 0;
+		border: none;
+		background: transparent;
+		padding-left: 0;
+		padding-right: 0;
+	
+	}
+	  .uni-share-content-box::after{
+		  border: none;
+	  }
+	
+	.uni-share-content-image {
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		width: 60upx;
+		height: 60upx;
+		overflow: hidden;
+		border-radius: 10upx;
+	}
+	
+	.uni-share-content-image .image {
+		width: 100%;
+		height: 100%;
+	}
+	
+	.uni-share-content-text {
+		font-size: 26upx;
+		color: #999;
+		padding-top: 5px;
+		// padding-bottom: 10px;
+	}
+	
+	.uni-share-btn {
+		height: 90upx;
+		line-height: 90upx;
+		border-top: 1px #f5f5f5 solid;
+		text-align: center;
+		color: #666;
+		font-size: 30rpx;
+	}
 </style>

+ 10 - 3
pages/index/index.vue

@@ -155,6 +155,9 @@
 				 });
 			 },
 			 getPageInfo(uId){ //获取首页面基本信息接口
+			     uni.showLoading({
+			     	title: '加载中',
+			     });
 				 let that = this;
 				uni.request({
 					url: getApp().globalData.shareUrl, //需要设置为全局
@@ -165,13 +168,16 @@
 					data: {
 						method: 'getHomePageInfo',
 						timestamp: getApp().globalData.globalTimestamp, //Date.now()
-						id: uId,
+						id: 1,
 						sign: md5('getHomePageInfo' + getApp().globalData.globalTimestamp)
 					},
 					success: res => {
 						if (res.data.code === 200) {
+							uni.hideLoading();
 							that.pageInfo = res.data.msg;
 							getApp().globalData.shareImg = res.data.msg.picture;
+							getApp().globalData.shareContent = res.data.msg.sharecontent;
+							getApp().globalData.shareTaobaoCode = res.data.msg.copycontent;
 							console.log(res.data.msg)
 						}
 					}
@@ -241,7 +247,6 @@
 							url: '/pages/index/postShare/index'
 						})
 					},
-			
 			 goDetail(id){
 				uni.navigateTo({
 					url: '/pages/index/detailPage/index?detailId='+id,
@@ -251,8 +256,9 @@
 				});
 			},
 			 copyCode(){
+				 let that = this;
 				uni.setClipboardData({
-					data:'xxx',
+					data:that.pageInfo.copycontent,
 					success() {
 						uni.showToast({
 							icon:'none',
@@ -279,6 +285,7 @@
 </script>
 
 <style lang="scss">
+	// @import url("../../../components/gaoyia-parse/parse.css");
 	// .PullScroll-Page {
 	//   padding: 40rpx;
 	//   .btn {

+ 2 - 2
pages/selfCenter/helpPage/helpDetail/index.vue

@@ -34,8 +34,8 @@
 	}
 </script>
 
-<style>
-	
+<style lang="scss">
+	// @import url("../../../../components/gaoyia-parse/parse.css");
 	.help-content {
 		padding: 15px;
 		font-size: 30rpx;