webgl_rxdz_krpano720.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template src="./webgl_rxdz_krpano720.html">
  2. </template>
  3. <script>
  4. import krpanoVideo from "@/components/krpanoVideo/index.vue";
  5. import commonPageMethod from '@/mixins/commonPageMethod.js';
  6. import lottie from "lottie-web"; //lottie
  7. // import commonPageMethod from '@/common/commonPageMethod.js';
  8. export default {
  9. components: {
  10. krpanoVideo,
  11. },
  12. mixins: [commonPageMethod],
  13. /**
  14. * 页面的初始数据
  15. */
  16. data() {
  17. return {
  18. pvCurPageName: "webgl_720",
  19. locusBehaviorName: "720展示",
  20. pvCurPageParams: null,
  21. houseId: "",
  22. pvId: 'p_2cmina_23121201',
  23. navbar: {
  24. showCapsule: 1,
  25. title: '',
  26. titleColor: '#000',
  27. navPadding: 0,
  28. navPaddingBg: 'transparent',
  29. navBarColor: 'transparent',
  30. navBackColor: 'transparent',
  31. haveCallback: true, // 如果是 true 会接手 navbarBackClk
  32. fromShare: false,
  33. fromProject: 0,
  34. shareToken: "",
  35. pageName: this.pvCurPageName,
  36. },
  37. isIOS: false,
  38. videoUrl: '',
  39. bgUrl: '',
  40. rangeValue: 50,
  41. scale: 1,
  42. muted: true,
  43. coordinate: '',
  44. type:'',
  45. AIPeople:'',
  46. AIPet:'',
  47. bgMusic:'',
  48. redBox:'',
  49. showLottery:false,//是否显示中红包状态
  50. result:{
  51. "amount": 0, //抢的红包金额
  52. "status": 3, //状态 1:成功抢到红包,2:已经抢过,3:红包已经被抢完了
  53. }, //中奖
  54. showAnim:false, //是否添加lottie动画
  55. anim:null,
  56. specialList:[
  57. {
  58. id:1,
  59. url:'https://dm.static.elab-plus.com/miniProgram/lottieJson/gold.json',
  60. title:'金光闪闪',
  61. },
  62. {
  63. id:2,
  64. url:'https://dm.static.elab-plus.com/miniProgram/lottieJson/fireworks.json',
  65. title:'烟花',
  66. },
  67. {
  68. id:3,
  69. url:'https://dm.static.elab-plus.com/miniProgram/lottieJson/coloreRibbon.json',
  70. title:'彩带',
  71. },
  72. ],
  73. }
  74. },
  75. beforeDestroy() {
  76. console.warn("***beforeDestroy-webgl_rxdz_krpano720***");
  77. },
  78. mounted(options) {
  79. var that = this;
  80. console.warn("***webgl_rxdz_krpano720-options***", this.$route.query)
  81. this.isIOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  82. // this.videoUrl = this.$route.query.videoUrl || '';
  83. this.bgUrl = this.$route.query.bgUrl || 'https://elab-marketing-web.oss-accelerate.aliyuncs.com/replicate_images/1702457671501.png';
  84. // this.coordinate = this.$route.query.coordinate || '';
  85. // this.scale = this.$route.query.scale || '1';
  86. this.type = this.$route.query.type || '';
  87. this.AIPeople = this.$route.query.AIPeople ? JSON.parse(this.$route.query.AIPeople) : '';
  88. this.AIPet = this.$route.query.AIPet ? JSON.parse(this.$route.query.AIPet) : '';
  89. this.bgMusic = this.$route.query.bgMusic ? JSON.parse(this.$route.query.bgMusic) : '';
  90. this.redBox = this.$route.query.redBox ? JSON.parse(this.$route.query.redBox) : '';
  91. this.initAI();
  92. },
  93. methods: {
  94. initAI(){
  95. if(this.AIPeople){
  96. this.$refs.krpanoVideo.peopleData = this.AIPeople;
  97. }
  98. if(this.AIPet){
  99. this.$refs.krpanoVideo.petData = this.AIPet;
  100. }
  101. if(this.redBox){
  102. this.$refs.krpanoVideo.redBoxData = this.redBox;
  103. }
  104. if(this.bgMusic){
  105. this.$refs.krpanoVideo.bgMusicData = this.bgMusic;
  106. }
  107. },
  108. updateMuted() {
  109. this.muted = !this.muted;
  110. },
  111. closeLottery(){
  112. this.showLottery = false;
  113. },
  114. //用户选中了红包,要派奖了
  115. async winLottery(){
  116. //必须是微信用户
  117. if(!this.$route.query.leavePhoneCustomerId){
  118. console.warn("***no-leavePhoneCustomerId***")
  119. return false
  120. }
  121. if(!this.$route.query.redpackId){
  122. console.warn("***no-redpackId***")
  123. return false
  124. }
  125. let res = await requestConfig("rob", {
  126. "brandId": $config.brandId,
  127. "redpackId": this.$route.query.redpackId,
  128. "userId": this.$route.query.leavePhoneCustomerId,
  129. });
  130. if (res.success) {
  131. this.result = res.single;
  132. this.showLottery = true;
  133. if(this.result.status==1){
  134. this.lottieAni()
  135. }
  136. }else{
  137. this.result = null;
  138. }
  139. },
  140. //播放lottie动画
  141. lottieAni(){
  142. this.showAnim = true;
  143. let lottieIndex = this.redBox.lottieIndex || 0;
  144. // 播放lottie动画
  145. lottie.destroy("lottieView");
  146. var element = document.getElementById("lottie-view");
  147. this.anim = lottie.loadAnimation({
  148. container: element,
  149. name: "lottieView",
  150. renderer: "svg",
  151. loop: false,
  152. autoplay: true,
  153. path: this.specialList[lottieIndex].url, //动画json
  154. });
  155. setTimeout(()=>{
  156. lottie.destroy("lottieView");
  157. this.showAnim = false;
  158. },2000)
  159. }
  160. }
  161. }
  162. </script>
  163. <style lang="scss" scoped>
  164. @import "./webgl_rxdz_krpano720.scss";
  165. /* @import "@/common/css/common.css"; */
  166. </style>