Kaynağa Gözat

红包页面开发

zjs_project 1 yıl önce
ebeveyn
işleme
9b423e6d03

+ 1 - 0
package.json

@@ -44,6 +44,7 @@
     "eslint": "^7.32.0",
     "eslint-plugin-vue": "^8.0.3",
     "file-loader": "^6.2.0",
+    "lottie-web": "^5.12.2",
     "node-sass": "^4.14.1",
     "px2rem-loader": "^0.1.9",
     "sass-loader": "^7.3.1",

+ 40 - 19
src/components/krpanoVideo/index.vue

@@ -119,6 +119,15 @@
 			},
 		},
         methods: {
+			redBoxChange(type){
+				// console.warn("**redBoxChange****",type)
+				if(type=='add'){
+					let url = "https://dm.static.elab-plus.com/miniProgram/redbox.mp4"
+					this.panoramicKrpano.call(`showRedBox(${url})`);
+				}else if(type=='canel'){
+					this.panoramicKrpano.call(`hideRedBox()`);
+				}
+			},
 			scaleChange(scale,tabIndex){
 				console.warn("**scaleChange****",scale,tabIndex)
 				if(tabIndex==0){//数字人
@@ -267,21 +276,32 @@
 				+ width+','
 				+ height+")");
 			},
-			getScale(){
-				let video = this.panoramicKrpano.get("hotspot[video]");
-				console.warn("***getPeolpeScale***",video.scale);
-			},
-			getPetScale(){
-				let petVideo = this.panoramicKrpano.get("hotspot[petVideo]");
-				console.warn("***getPetScale***",petVideo.scale);
-			},
+			// getScale(){
+			// 	let video = this.panoramicKrpano.get("hotspot[video]");
+			// 	console.warn("***getPeolpeScale***",video.scale);
+			// },
+			// getPetScale(){
+			// 	let petVideo = this.panoramicKrpano.get("hotspot[petVideo]");
+			// 	console.warn("***getPetScale***",petVideo.scale);
+			// },
 			getPosition(){
+				let posi = {}
 				let video = this.panoramicKrpano.get("hotspot[video]");
-				let posi = {
-					ath:video.ath,
-					atv:video.atv,
+				if(video && video.visible){
+					posi.peopleAth = video.ath;
+					posi.peopleAtv = video.atv;
 				}
-				console.warn("***getPosition***",posi);
+				let petVideo = this.panoramicKrpano.get("hotspot[petVideo]");
+				if(petVideo && petVideo.visible){
+					posi.petAth = petVideo.ath;
+					posi.petAtv = petVideo.atv;
+				}
+				let redBox = this.panoramicKrpano.get("hotspot[redBox]");
+				if(redBox && redBox.visible){
+					posi.redBoxAth = redBox.ath;
+					posi.redBoxAtv = redBox.atv;
+				}
+				// console.warn("***getPosition***",posi);
 				return posi
 			},
 			setPosition(position){
@@ -293,6 +313,7 @@
 					image_hotspot.ath = position.ath;
 					image_hotspot.atv = position.atv;
 				}
+				//移动视角到AI人物上
 				this.panoramicKrpano.set('view.hlookat', position.ath);
 				this.panoramicKrpano.set('view.vlookat', position.atv);
 				console.warn("***setPosition***",position);
@@ -306,13 +327,13 @@
 				console.warn("***setSphereUrl***",url);
 			},
 			//设置视频地址
-			setVideoUrl(url){
-				if(!url){
-					return false
-				}
-				this.panoramicKrpano.set("video_url",url)
-				console.warn("***setVideoUrl***",url);
-			},
+			// setVideoUrl(url){
+			// 	if(!url){
+			// 		return false
+			// 	}
+			// 	this.panoramicKrpano.set("video_url",url)
+			// 	console.warn("***setVideoUrl***",url);
+			// },
         },
         mounted() {
             embedpano({

+ 47 - 3
src/components/krpanoVideo/panoramic.xml

@@ -134,8 +134,6 @@
 			autopause="true"
 			autoresume="true"
 			scale="1"
-			onvideoready="videoreadyFunc"
-			onvideoplay="videoplayHandle"
 			ondown="dragpetspot();"
 			cursor="grab"
 			ondown.addevent="set(cursor,grabbing);"
@@ -153,7 +151,53 @@
 				screentosphere(dx, dy, ath, atv);
 			);
 		</action>
-		
+		<!-- 红包 -->
+		<!-- <hotspot name="redBox" ath="50.082" atv="14" rotate="-45.0" zorder="1"
+			distorted="true"  ondown="dragRedSpot();"
+			url="https://dm.static.elab-plus.com/miniProgram/redbox.gif">
+		</hotspot> -->
+		<hotspot name="redBox"
+			ath="60" 
+			atv="14"
+			url="https://dm.static.elab-plus.com/videoplayer.js"
+			videourl=""
+			chromakey="0x30B524|0.294|0.133"
+			preload="true"
+			pausedonstart="false"
+			loop="true"
+			distorted="true"
+			muted="true"
+			zoom="true"
+			autopause="true"
+			autoresume="true"
+			scale="1"
+			ondown="dragRedSpot();"
+			cursor="grab"
+			ondown.addevent="set(cursor,grabbing);"
+			onup.addevent="set(cursor,grab);"
+			zorder="2"
+		>
+		</hotspot>
+		<action name="dragRedSpot">
+			spheretoscreen(ath, atv, hotspotcenterx, hotspotcentery, calc(mouse.stagex LT stagewidth/2 ? 'l' : 'r'));
+			sub(drag_adjustx, mouse.stagex, hotspotcenterx);
+			sub(drag_adjusty, mouse.stagey, hotspotcentery);
+			asyncloop(pressed,
+				sub(dx, mouse.stagex, drag_adjustx);
+				sub(dy, mouse.stagey, drag_adjusty);
+				screentosphere(dx, dy, ath, atv);
+			);
+		</action>
+		<action name="showRedBox">
+			def(scale, string, get(hotspot[redBox].scale));
+			set(hotspot[redBox].visible, 'true');
+			hotspot[redBox].playvideo(%1, '', false);
+			set(hotspot[redBox].scale, get(scale));
+		</action>
+		<action name="hideRedBox">
+			hotspot[redBox].stop();
+			set(hotspot[redBox].visible, get(false));
+		</action>
 		<action name="mobilescale" autorun="preinit" devices="mobile">
 		    mul(stagescale,0.5);
 		</action>

+ 17 - 5
src/components/newBottomCom/viewAI/viewAI.html

@@ -1,6 +1,9 @@
 <div class="ai-view">
 	<div class="ai-title rows">
-		<div class="title-btn rows justify-center" :class="{active:tabIndex==2}" @click.stop="tabChange(2)">红包</div>
+		<div class="title-btn rows justify-center" :class="{active:tabIndex==2}" @click.stop="tabChange(2)">
+			<img class="redbox_icon" src="https://dm.static.elab-plus.com/miniProgram/redbox_icon.png" alt=""></img>
+			红包
+		</div>
 		<div class="title-btn rows justify-center" :class="{active:tabIndex==0}" @click.stop="tabChange(0)">数字人</div>
 		<div class="title-btn rows justify-center" :class="{active:tabIndex==1}" @click.stop="tabChange(1)">数字宠物</div>
 		<div class="title-btn rows justify-center" :class="{active:tabIndex==3}" @click.stop="tabChange(3)">音乐</div>
@@ -27,14 +30,23 @@
 	<div class="redbox" v-else-if="tabIndex==2">
 		<div class="main-box rows rows-between flex-start">
 			<div class="left-box">
-				<div class="title" style="text-align: left;">点击红包添加</div>
+				<div class="title">红包设置</div>
 				<div class="left-main rows">
 					<div class="main-red columns justify-center">
-						<img class="red-img" src="../../krpanoImg/img/horn-img.png"/>
-						<div class="red-btn rows justify-center">塞钱</div>
+						<img class="red-img" src="https://dm.static.elab-plus.com/miniProgram/redbox.gif"/>
+						<div v-if="hasRedBox==false" class="red-btn rows justify-center" @click="addRedBox">添加红包</div>
+						<div class="rows justify-center" v-else>
+							<div class="iconfont icon-icon_delete rows justify-center" @click="removeRedBox"></div>
+							<div class="red-btn rows justify-center red-adjust">
+								红包调整
+							</div>
+						</div>
+							
+						
 					</div>
 					<div class="plus">+</div>
-					<img class="special-img" :src="specialImg"/>
+					<!-- <img class="special-img" :src="specialImg"/> -->
+					<div id="special-img" class="special-img"></div>
 				</div>
 			</div>
 			<div class="right-box">

+ 24 - 3
src/components/newBottomCom/viewAI/viewAI.scss

@@ -20,6 +20,11 @@
 			color: #4e4e4e;
 			padding: 7px 17px;
 			box-sizing: border-box;
+			.redbox_icon{
+				width: 30px;
+				height: 35px;
+				margin-right: 15px;
+			}
 		}
 		.title-btn.active{
 			background: #343434;
@@ -121,14 +126,27 @@
 			opacity: 0.5;
 		}
 		.left-box{
+			.title{
+				text-align: center;
+				width: 217px;
+			}
 			.left-main{
 				.main-red{
 					.red-img{
 						width: 217px;
 						height: 217px;
+						margin-bottom:20px;
+					}
+					.icon-icon_delete{
+						width: 54px;
+						height: 54px;
+						border-radius: 27px;
+						background: rgba(118, 118, 118, 0.1);
+						font-size: 20px;
+						margin-right: 10px;
 					}
 					.red-btn{
-						width: 124px;
+						width: 166px;
 						height: 54px;
 						border-radius: 27px;
 						background: #f27966;
@@ -136,12 +154,15 @@
 						font-weight: 700;
 						font-size: 24px;
 						color: #fff;
-						margin-top:20px;
+					}
+					.red-adjust{
+						background: rgba(242, 121, 102, 0.1);
+						color: #f27966;
 					}
 				}
 				.plus{
-
 					font-size: 20px;
+					margin-top: -50px;
 				}
 				.special-img{
 					width: 242px;

+ 131 - 70
src/components/newBottomCom/viewAI/viewAI.vue

@@ -3,9 +3,16 @@
 </template>
 <script>
 	const util = require('@/utils/util.js').default;
-	import { MessageBox } from 'mint-ui';
-	import { Indicator } from 'mint-ui';
-	import { Toast } from 'mint-ui';
+	import {
+		MessageBox
+	} from 'mint-ui';
+	import {
+		Indicator
+	} from 'mint-ui';
+	import {
+		Toast
+	} from 'mint-ui';
+	import lottie from "lottie-web"; //lottie
 	// import commonMethod from '@/common/commonMethod.js';
 	// import touchHandle from '@/mixins/touchHandle.js';
 	// import requestConfig from '@/static/lib/requestConfig';
@@ -13,21 +20,38 @@
 	export default {
 		data: function() {
 			return {
-				leftList:[],
-				rightList:[],
-				musicList:[],//音乐列表
-				dataList:[],
-				tabIndex:0,//当前选中的tab序号
-				selectIndex:-1,
-				peopleIndex:-1,
-				petIndex:-1,
-				musicIndex:-1,
-				specialIndex:0,
-				specialImg:'https://dm.static.elab-plus.com/miniProgram/ai-icon.png',
+				leftList: [],
+				rightList: [],
+				musicList: [], //音乐列表
+				dataList: [],
+				tabIndex: 0, //当前选中的tab序号
+				selectIndex: -1,
+				peopleIndex: -1,
+				petIndex: -1,
+				musicIndex: -1,
+				specialIndex: 0,
+				specialList:[
+					{
+						id:1,
+						url:'https://dm.static.elab-plus.com/miniProgram/lottieJson/gold.json',
+						title:'金光闪闪',
+					},
+					{
+						id:2,
+						url:'https://dm.static.elab-plus.com/miniProgram/lottieJson/fireworks.json',
+						title:'烟花',
+					},
+					{
+						id:3,
+						url:'https://dm.static.elab-plus.com/miniProgram/lottieJson/coloreRibbon.json',
+						title:'彩带',
+					},
+				],
+				hasRedBox:false,	//是否添加了红包
 			}
 		},
-		props:{
-			
+		props: {
+
 		},
 		// mixins: [touchHandle],
 		async mounted() {
@@ -39,85 +63,112 @@
 			this.getDatalist(3);
 		},
 		// 页面被展示时执行
-		onPageShow: function() {  
-			
+		onPageShow: function() {
+
 		},
 		//页面被隐藏时执行
-        onPageHide: function() {
-        	// console.warn("***detached-hide***")
-        },
-		methods:{
-			resolveIndex(index){
+		onPageHide: function() {
+			// console.warn("***detached-hide***")
+		},
+		methods: {
+			resolveIndex(index) {
 				this.selectIndex = index || 0;
 			},
-			specialChange(index){
-				if(this.specialIndex == index){
+			specialChange(index) {
+				if (this.specialIndex == index) {
 					return false;
 				}
 				this.specialIndex = index;
-				this.specialImg = 'https://dm.static.elab-plus.com/miniProgram/ai-icon.png';
+				this.$nextTick(() => {
+					// 播放lottie动画
+					lottie.destroy("markLoading");
+					var element = document.getElementById("special-img");
+					this.anim = lottie.loadAnimation({
+						container: element,
+						name: "markLoading",
+						renderer: "svg",
+						loop: true,
+						autoplay: true,
+						path: this.specialList[this.specialIndex].url, //动画json
+					});
+				});
 			},
-			
-			tabChange(index){
-				if(this.tabIndex == index){
+
+			tabChange(index) {
+				if (this.tabIndex == index) {
 					return false;
 				}
-				if(this.$parent.repeatFlag == true){
+				if (this.$parent.repeatFlag == true) {
 					Toast({
 						message: '加载中...请稍后再试',
 					});
 					return false
 				}
 				this.tabIndex = index;
-				this.$emit("tabChange",this.tabIndex);//通知页面,户型大类发生了变更
+				this.$emit("tabChange", this.tabIndex); //通知页面,户型大类发生了变更
+				if(this.tabIndex==2 && this.specialIndex>-1){
+					this.$nextTick(() => {
+						// 播放lottie动画
+						lottie.destroy("markLoading");
+						var element = document.getElementById("special-img");
+						this.anim = lottie.loadAnimation({
+							container: element,
+							name: "markLoading",
+							renderer: "svg",
+							loop: true,
+							autoplay: true,
+							path: this.specialList[this.specialIndex].url, //动画json
+						});
+					});
+				}
 			},
 			//AI数字人切换
-			selectAction(selItem,index) {
-				console.log('点击动作111:', selItem,index)
-				if(this.tabIndex==0){
-					if(this.peopleIndex == index){//取消选中
-						this.aiPeopleChange(this.leftList[this.peopleIndex],'canel')
+			selectAction(selItem, index) {
+				console.log('点击动作111:', selItem, index)
+				if (this.tabIndex == 0) {
+					if (this.peopleIndex == index) { //取消选中
+						this.aiPeopleChange(this.leftList[this.peopleIndex], 'canel')
 						this.peopleIndex = -1;
 						return false
 					}
-				}else if(this.tabIndex==1){
-					if(this.petIndex == index){//取消选中
-						this.aiPeopleChange(this.rightList[this.petIndex],'canel')
+				} else if (this.tabIndex == 1) {
+					if (this.petIndex == index) { //取消选中
+						this.aiPeopleChange(this.rightList[this.petIndex], 'canel')
 						this.petIndex = -1;
 						return false
 					}
-				}else if(this.tabIndex==3){
-					if(this.musicIndex == index){//取消选中
-						this.aiPeopleChange(this.musicList[this.musicIndex],'canel')
+				} else if (this.tabIndex == 3) {
+					if (this.musicIndex == index) { //取消选中
+						this.aiPeopleChange(this.musicList[this.musicIndex], 'canel')
 						this.musicIndex = -1;
 						return false
 					}
 				}
-				if(this.$parent.repeatFlag == true){
+				if (this.$parent.repeatFlag == true) {
 					Toast({
 						message: '加载中...请稍后再试',
 					});
 					return false
 				}
-				if(this.tabIndex==0){
+				if (this.tabIndex == 0) {
 					this.peopleIndex = index;
-					this.aiPeopleChange(this.leftList[this.peopleIndex],'add')
-				}else if(this.tabIndex==1){
+					this.aiPeopleChange(this.leftList[this.peopleIndex], 'add')
+				} else if (this.tabIndex == 1) {
 					this.petIndex = index;
-					this.aiPeopleChange(this.rightList[this.petIndex],'add')
-				}else if(this.tabIndex==3){
+					this.aiPeopleChange(this.rightList[this.petIndex], 'add')
+				} else if (this.tabIndex == 3) {
 					this.musicIndex = index;
-					this.aiPeopleChange(this.musicList[this.musicIndex],'add')
+					this.aiPeopleChange(this.musicList[this.musicIndex], 'add')
 				}
 			},
 			// 获取瀑布流数据
 			async getDatalist(type) {
 				let typeName = "Virtual_Human";
-				if(type==0){
+				if (type == 0) {
 					typeName = "Virtual_Human";
-				}else if(type==1){
+				} else if (type == 1) {
 					typeName = "Virtual_Pet";
-				}else if(type==3){
+				} else if (type == 3) {
 					typeName = "Virtual_Music";
 					Indicator.close();
 				}
@@ -129,11 +180,11 @@
 				this.selectIndex = 0;
 				if (res && res.success && res.list) {
 					let list = res.list;
-					if(type==0){
+					if (type == 0) {
 						this.leftList = list;
-					}else if(type==1){
+					} else if (type == 1) {
 						this.rightList = list;
-					}else if(type==3){
+					} else if (type == 3) {
 						this.musicList = list;
 					}
 				}
@@ -144,9 +195,17 @@
 			// hideOrShowActor(type){
 			// 	this.$emit('hideOrShowActor',type);//隐藏所有视角
 			// },
-			//种子户型变更-户型大类变更
-			aiPeopleChange(item,type){
-				this.$emit("aiPeopleChange", item,type,this.tabIndex);//通知页面,户型大类发生了变更
+			addRedBox(){//添加红包
+				this.$emit("redBox",'add');
+				this.hasRedBox = true;
+			},
+			removeRedBox(){//去除红包
+				this.$emit("redBox",'canel');
+				this.hasRedBox = false;
+			},
+			//AI数字人切换
+			aiPeopleChange(item, type) {
+				this.$emit("aiPeopleChange", item, type, this.tabIndex); //通知页面,AI数字人切换了
 			},
 			//发布全景
 			mynavigateFuc(e) {
@@ -161,16 +220,18 @@
 					};
 					util.trackRequest(param);
 					let _ps = JSON.stringify(this.$parent.getPosition());
-					let _scale = this.$parent.scale;
-					console.warn("_ps",_ps,_scale)
-					if(window.__wxjs_environment === 'miniprogram'){
-						wx.miniProgram.navigateTo({url: '/extraPackage/pages/aiPublishPage/aiPublishPage?houseId='+(this.$route.query.houseId || '')
-						+ '&coordinate=' + encodeURIComponent(_ps) 
-						// + '&scale=' + encodeURIComponent(_scale) 
-						+ '&scale=' + _scale 
-						+ '&bgUrl=' + this.$parent.bgUrl
-						+ '&videoUrl=' + encodeURIComponent(this.dataList[this.selectIndex].url)})
-					}else{
+					console.warn("_ps", _ps, this.$parent.peopleScale,this.$parent.petScale)
+					if (window.__wxjs_environment === 'miniprogram') {
+						wx.miniProgram.navigateTo({
+							url: '/extraPackage/pages/aiPublishPage/aiPublishPage?houseId=' + (this.$route.query
+									.houseId || '') +
+								'&coordinate=' + encodeURIComponent(_ps) +
+								'&peopleScale=' + this.$parent.peopleScale +
+								'&petScale=' + this.$parent.petScale +
+								'&bgUrl=' + this.$parent.bgUrl +
+								'&videoUrl=' + encodeURIComponent(this.dataList[this.selectIndex].url)
+						})
+					} else {
 						Toast({
 							message: '敬请期待',
 						});
@@ -181,6 +242,6 @@
 	}
 </script>
 <style lang="scss" scoped>
-    @import "./viewAI.scss";
+	@import "./viewAI.scss";
 	/* @import "@/common/css/common.css"; */
-</style>
+</style>

+ 2 - 2
src/pages/webgl_rxdz_krpanovr/webgl_rxdz_krpanovr.html

@@ -11,7 +11,7 @@
 	<div class="voice-btn rows justify-center" @click="updateMuted">
 		<span :class="[muted?'iconfont icon-jingyin':'iconfont icon-yinliang']" style="color: #ffffff;"></span>
 	</div>
-	<div class="slide-mask"></div>
+	<div class="slide-mask" v-if="tabIndex==0 || tabIndex==1"></div>
 	<!-- 数字人大小滚动条 -->
 	<div class="slide-view columns rows-between" v-if="tabIndex==0 || tabIndex==1">
 		<div class="slide-tips">{{tabIndex==0?'数字人':'宠物'}}<br>大小</div>
@@ -29,5 +29,5 @@
 		<div class="slide-word">缩小</div>
 	</div>
 	<!-- AI数字人组件 -->
-	<viewAI ref="viewAI" @aiPeopleChange="aiPeopleChange" @tabChange="tabChange" style="z-index: 13;"></viewAI>
+	<viewAI ref="viewAI" @aiPeopleChange="aiPeopleChange" @tabChange="tabChange" @redBox="redBox" style="z-index: 13;"></viewAI>
 </div>

+ 5 - 0
src/pages/webgl_rxdz_krpanovr/webgl_rxdz_krpanovr.vue

@@ -74,8 +74,10 @@
 				let sca = 1;
 				sca = (this.value - 50)/50 + 1;
 				if(this.tabIndex==0){
+					this.peopleScale = sca;//数字人的大小
 					this.peopleRangeValue = this.value
 				}else if(this.tabIndex==1){
+					this.petScale = sca;//宠物的大小
 					this.petRangeValue = this.value
 				}
 				this.$refs.krpanoVideo.scaleChange(sca,this.tabIndex);
@@ -84,6 +86,9 @@
 				this.tabIndex = tabIndex;
 				this.value = tabIndex==0?this.peopleRangeValue:this.petRangeValue;
 			},
+			redBox(type){
+				this.$refs.krpanoVideo.redBoxChange(type);
+			},
 			aiPeopleChange(item,type,tabIndex){
 				let self = this;
 				// console.warn("***aiPeopleChange***",item,type,tabIndex);