Pārlūkot izejas kodu

新增经销商分享盲票接受参数

hwb0 3 gadi atpakaļ
vecāks
revīzija
3ad4988301
2 mainītis faili ar 80 papildinājumiem un 64 dzēšanām
  1. 79 62
      pages/index/index.vue
  2. 1 2
      pages/share/index.vue

+ 79 - 62
pages/index/index.vue

@@ -22,15 +22,18 @@
 				</view>
 			</view>
 			<view class="box-ticket">
-				<swiper class="image-container" circular :vertical="true" :current="currentIndex" :autoplay="false" @change="swiperChange">
+				<swiper class="image-container" circular :vertical="true" :current="currentIndex" :autoplay="false"
+					@change="swiperChange">
 					<swiper-item class="swiper-item" v-for="(item, index) in imgList" :key="item.picUrl">
 						<view class="flex image-wrap">
 							<image class="img" @click="clickImg(item)" :src="item.picUrl" lazy-load mode=""></image>
 						</view>
 					</swiper-item>
 				</swiper>
-				
-				<swiper class="prize-container" previous-margin="270rpx" next-margin="270rpx" circular :duration="15000" :interval="1500" easing-function="easeOutCubic" :current="currentPrizeIndex" :disable-touch="true" :autoplay="true">
+
+				<swiper class="prize-container" previous-margin="270rpx" next-margin="270rpx" circular :duration="15000"
+					:interval="1500" easing-function="easeOutCubic" :current="currentPrizeIndex" :disable-touch="true"
+					:autoplay="true">
 					<swiper-item class="swiper-item" v-for="(item, index) in prizeList" :key="index">
 						<view class="flex image-wrap">
 							<image class="img" :src="item.picUrl" lazy-load mode="aspectFill"></image>
@@ -86,6 +89,14 @@
 				prizeList: []
 			};
 		},
+		onLoad(opthios) {
+			if (opthios.scene) {
+				let sceneStr = decodeURIComponent(opthios.scene)
+				this.sceneArr = sceneStr.split('&')
+				uni.setStorageSync('shareUid', this.sceneArr[0])
+				uni.setStorageSync('shareType', this.sceneArr[1])
+			}
+		},
 		onShow(opthios) {
 			this.loginState = uni.getStorageSync('token') ? true : false
 			this.getList()
@@ -96,48 +107,48 @@
 				this.currentIndex = e.detail.current
 				this.getPrize(this.imgList[this.currentIndex].boxId)
 			},
-			
-			prizeChange(e){
+
+			prizeChange(e) {
 				let ticketNum = this.imgList.length - 1
 				let num = this.prizeList.length - 1
 				let index = this.currentPrizeIndex = e.detail.current
-				
+
 				let acIndex = this.currentIndex
-				if(num == index){
-					acIndex ++
-					if(acIndex < ticketNum){
+				if (num == index) {
+					acIndex++
+					if (acIndex < ticketNum) {
 						this.currentIndex++
-					}else if(acIndex == ticketNum){
+					} else if (acIndex == ticketNum) {
 						this.currentIndex = ticketNum
-					}else{
+					} else {
 						this.currentIndex = 0
 					}
 					this.currentPrizeIndex = 2
 					this.getPrize(this.imgList[this.currentIndex].boxId)
 				}
 			},
-			
+
 			clickImg(item) {
 				console.log(item);
 			},
-			
-			ticketLeft(){
-				if((this.currentIndex >= 0) && (this.currentIndex < (this.imgList.length - 1))){
-					this.currentIndex ++
-				}else if (this.currentIndex == (this.imgList.length - 1)){
+
+			ticketLeft() {
+				if ((this.currentIndex >= 0) && (this.currentIndex < (this.imgList.length - 1))) {
+					this.currentIndex++
+				} else if (this.currentIndex == (this.imgList.length - 1)) {
 					this.currentIndex = 0
 				}
 			},
-			
-			ticketRight(){
-				if(this.currentIndex > 0){
-					this.currentIndex --
-				}else if (this.currentIndex == 0){
+
+			ticketRight() {
+				if (this.currentIndex > 0) {
+					this.currentIndex--
+				} else if (this.currentIndex == 0) {
 					this.currentIndex = this.imgList.length - 1
 				}
 			},
-			
-			
+
+
 			getList() {
 				uni.showLoading({
 					title: '加载中'
@@ -164,10 +175,10 @@
 					uni.hideLoading();
 				})
 			},
-			
-			getPrize(id){
+
+			getPrize(id) {
 				this.prizeList = []
-				
+
 				$http.post('/api/v1/mp/user/mall/ticket/detail', {
 					boxId: id,
 					noToken: true
@@ -241,15 +252,15 @@
 				if (!this.loginState) {
 					uni.navigateTo({
 						url: "/pages/login/index"
-					})	
+					})
 					return
 				}
 				uni.navigateTo({
 					url: '/pages/prize/index'
 				})
 			},
-			
-			toRule(){
+
+			toRule() {
 				uni.navigateTo({
 					url: '/pages/about/rule'
 				})
@@ -273,7 +284,7 @@
 	.image-container {
 		width: 750rpx;
 		height: 40vh;
-		
+
 		.swiper-item {
 			position: relative;
 			width: 61vw;
@@ -282,46 +293,46 @@
 			justify-content: center;
 			align-items: center;
 		}
-		
-		.image-wrap{
+
+		.image-wrap {
 			position: relative;
 			width: 61vw;
 			height: 40vh;
-			
-			.img{
+
+			.img {
 				width: 61vw;
 				height: 40vh;
 			}
 		}
 	}
-	
-	.prize-container{
+
+	.prize-container {
 		width: 750rpx;
-		height:  13vh;
+		height: 13vh;
 		margin-top: 2vh;
-		
+
 		.swiper-item {
 			width: 100rpx;
-			height:  13vh;
+			height: 13vh;
 			display: flex;
 			justify-content: flex-start;
 			align-items: center;
-			
-			.image-wrap{
+
+			.image-wrap {
 				width: 160rpx;
 				height: 13vh;
 				border-radius: 20rpx;
 				background: linear-gradient(0deg, #BBBBBB, #FFFFFF);
-				
-				.img{
+
+				.img {
 					width: 100%;
 					height: 76%;
 				}
 			}
 		}
-		
+
 	}
-	
+
 	.box {
 		width: 100%;
 		height: calc(100vh - 50px);
@@ -341,11 +352,11 @@
 					&-cir {
 						width: 72rpx;
 						height: 72rpx;
-						background-color: #FFC320 ;
+						background-color: #FFC320;
 						border-radius: 50%;
 						margin-bottom: 14rpx;
-						
-						image{
+
+						image {
 							width: 40rpx;
 							height: 36rpx;
 						}
@@ -364,8 +375,8 @@
 				flex-direction: column;
 				align-items: flex-end;
 				justify-content: flex-end;
-				
-				&-txt{
+
+				&-txt {
 					font-size: 24rpx;
 					width: 152rpx;
 					height: 48rpx;
@@ -373,7 +384,8 @@
 					border-radius: 24rpx 0 0 24rpx;
 					margin-top: 40rpx;
 				}
-				&-txt:last-child{
+
+				&-txt:last-child {
 					background-color: #FFFFCC;
 				}
 			}
@@ -382,8 +394,8 @@
 		&-ticket {
 			position: relative;
 			margin: 40rpx 0 0;
-			
-			.index-left{
+
+			.index-left {
 				position: absolute;
 				width: 100rpx;
 				height: 100rpx;
@@ -391,7 +403,8 @@
 				left: 10rpx;
 				z-index: 20;
 			}
-			.index-right{
+
+			.index-right {
 				position: absolute;
 				width: 100rpx;
 				height: 100rpx;
@@ -399,8 +412,8 @@
 				right: 10rpx;
 				z-index: 20;
 			}
-			
-			.box-img{
+
+			.box-img {
 				position: absolute;
 				top: 0;
 				z-index: 10;
@@ -409,22 +422,26 @@
 			}
 		}
 
-		&-ticket-btn{
+		&-ticket-btn {
 			margin-top: 30rpx;
-			&-content{
+
+			&-content {
 				position: relative;
 				width: 420rpx;
 				height: 142rpx;
-				image{
+
+				image {
 					width: 420rpx;
 					height: 142rpx;
 				}
-				.title{
+
+				.title {
 					position: absolute;
 					top: 0;
 					width: 100%;
 					height: 142rpx;
-					text{
+
+					text {
 						font-size: 56rpx;
 						font-weight: bold;
 						color: #C44906;

+ 1 - 2
pages/share/index.vue

@@ -43,7 +43,7 @@
 				posterData: {
 					poster: {
 						//根据屏幕大小自动生成图片背景大小
-						url: "https://mp-public-test-1307117429.cos.ap-shanghai.myqcloud.com/mp.png", //图片地址
+						url: "https://mp-public-1310078123.cos.ap-shanghai.myqcloud.com/mp.png", //图片地址
 						r: 15, //圆角半径
 						w: 340, //图片宽度
 						h: 447, //图片高度
@@ -99,7 +99,6 @@
 				$http.post('/api/v1/mp/user/getLoginUserinfo', {}).then(res => {
 					uni.hideLoading();
 					if (res.code == 0) {
-						console.log(res);
 						this.userInfo = res.data
 						this.avatar = this.posterData.mainImg.url = env.filePublic + res.data.avatar
 						this.posterData.title.text = res.data.nickName