webgl_rxdz_krpano720.vue 5.1 KB

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