|
@@ -4,6 +4,7 @@
|
|
|
<script>
|
|
|
import krpanoVideo from "@/components/krpanoVideo/index.vue";
|
|
|
import commonPageMethod from '@/mixins/commonPageMethod.js';
|
|
|
+ import lottie from "lottie-web"; //lottie
|
|
|
// import commonPageMethod from '@/common/commonPageMethod.js';
|
|
|
export default {
|
|
|
components: {
|
|
@@ -42,6 +43,34 @@
|
|
|
muted: true,
|
|
|
coordinate: '',
|
|
|
type:'',
|
|
|
+ AIPeople:'',
|
|
|
+ AIPet:'',
|
|
|
+ bgMusic:'',
|
|
|
+ redBox:'',
|
|
|
+ showLottery:false,//是否显示中红包状态
|
|
|
+ result:{
|
|
|
+ "amount": 0, //抢的红包金额
|
|
|
+ "status": 3, //状态 1:成功抢到红包,2:已经抢过,3:红包已经被抢完了
|
|
|
+ }, //中奖
|
|
|
+ showAnim:false, //是否添加lottie动画
|
|
|
+ anim:null,
|
|
|
+ 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:'彩带',
|
|
|
+ },
|
|
|
+ ],
|
|
|
}
|
|
|
},
|
|
|
beforeDestroy() {
|
|
@@ -57,10 +86,10 @@
|
|
|
// this.scale = this.$route.query.scale || '1';
|
|
|
this.type = this.$route.query.type || '';
|
|
|
|
|
|
- this.AIPeople = JSON.parse(this.$route.query.AIPeople) || '';
|
|
|
- this.AIPet = JSON.parse(this.$route.query.AIPet) || '';
|
|
|
- this.bgMusic = JSON.parse(this.$route.query.bgMusic) || '';
|
|
|
- this.redBox = JSON.parse(this.$route.query.redBox) || '';
|
|
|
+ this.AIPeople = this.$route.query.AIPeople ? JSON.parse(this.$route.query.AIPeople) : '';
|
|
|
+ this.AIPet = this.$route.query.AIPet ? JSON.parse(this.$route.query.AIPet) : '';
|
|
|
+ this.bgMusic = this.$route.query.bgMusic ? JSON.parse(this.$route.query.bgMusic) : '';
|
|
|
+ this.redBox = this.$route.query.redBox ? JSON.parse(this.$route.query.redBox) : '';
|
|
|
this.initAI();
|
|
|
},
|
|
|
methods: {
|
|
@@ -81,6 +110,56 @@
|
|
|
updateMuted() {
|
|
|
this.muted = !this.muted;
|
|
|
},
|
|
|
+ closeLottery(){
|
|
|
+ this.showLottery = false;
|
|
|
+ },
|
|
|
+ //用户选中了红包,要派奖了
|
|
|
+ async winLottery(){
|
|
|
+ //必须是微信用户
|
|
|
+ if(!this.$route.query.leavePhoneCustomerId){
|
|
|
+ console.warn("***no-leavePhoneCustomerId***")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if(!this.$route.query.redpackId){
|
|
|
+ console.warn("***no-redpackId***")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let res = await requestConfig("rob", {
|
|
|
+ "brandId": $config.brandId,
|
|
|
+ "redpackId": this.$route.query.redpackId,
|
|
|
+ "userId": this.$route.query.leavePhoneCustomerId,
|
|
|
+ });
|
|
|
+ if (res.success) {
|
|
|
+ this.result = res.single;
|
|
|
+ this.showLottery = true;
|
|
|
+ if(this.result.status==1){
|
|
|
+ this.lottieAni()
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.result = null;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //播放lottie动画
|
|
|
+ lottieAni(){
|
|
|
+ this.showAnim = true;
|
|
|
+ let lottieIndex = this.redBox.lottieIndex || 0;
|
|
|
+ // 播放lottie动画
|
|
|
+ lottie.destroy("lottieView");
|
|
|
+ var element = document.getElementById("lottie-view");
|
|
|
+ this.anim = lottie.loadAnimation({
|
|
|
+ container: element,
|
|
|
+ name: "lottieView",
|
|
|
+ renderer: "svg",
|
|
|
+ loop: false,
|
|
|
+ autoplay: true,
|
|
|
+ path: this.specialList[lottieIndex].url, //动画json
|
|
|
+ });
|
|
|
+ setTimeout(()=>{
|
|
|
+ lottie.destroy("lottieView");
|
|
|
+ this.showAnim = false;
|
|
|
+ },2000)
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
</script>
|