webgl_rxdz_krpanovr.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template src="./webgl_rxdz_krpanovr.html">
  2. </template>
  3. <script>
  4. import krpanoVideo from "@/components/krpanoVideo/index.vue";
  5. import commonPageMethod from '@/mixins/commonPageMethod.js';
  6. import viewAI from '@/components/newBottomCom/viewAI/viewAI.vue';
  7. // import payView from '@/components/payView/payView.vue';
  8. import playTips from '@/components/playTips/playTips.vue';
  9. import {
  10. Toast
  11. } from 'mint-ui';
  12. // import commonPageMethod from '@/common/commonPageMethod.js';
  13. export default {
  14. components: {
  15. krpanoVideo,viewAI,playTips
  16. },
  17. mixins: [commonPageMethod],
  18. /**
  19. * 页面的初始数据
  20. */
  21. data() {
  22. return {
  23. pvCurPageName: "add_AI_people",
  24. locusBehaviorName: "DIY数字场景",
  25. pvCurPageParams: null,
  26. houseId: "",
  27. pvId: 'p_2cmina_23080402',
  28. canvas: null,
  29. navbar: {
  30. showCapsule: 1,
  31. title: 'DIY数字场景',
  32. titleColor: '#000',
  33. navPadding: 0,
  34. navPaddingBg: 'transparent',
  35. navBarColor: 'transparent',
  36. navBackColor: 'transparent',
  37. haveCallback: true, // 如果是 true 会接手 navbarBackClk
  38. fromShare: false,
  39. fromProject: 0,
  40. shareToken: "",
  41. pageName: this.pvCurPageName,
  42. },
  43. isIOS: false,
  44. videoUrl:'',
  45. bgUrl:'',
  46. tabIndex:0,
  47. value:50,
  48. peopleRangeValue:50,
  49. petRangeValue:50,
  50. peopleScale:1,//数字人的大小
  51. petScale:1, //宠物的大小
  52. muted:true,
  53. redBoxData:{//红包设置数据对象
  54. count:'',
  55. money:'',
  56. message:'',
  57. },
  58. music:{
  59. title:'',//音乐标题
  60. url:'', //音乐地址
  61. },
  62. relationId:'', //场景id
  63. amount:'', //场景总金额,如果有的话
  64. deg:0,
  65. }
  66. },
  67. beforeDestroy() {
  68. console.warn("***beforeDestroy-webgl_rxdz_krpanovr***");
  69. },
  70. mounted(options) {
  71. var that = this;
  72. console.warn("***webgl_rxdz_krpanovr-options***", this.$route.query)
  73. this.isIOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  74. this.videoUrl = this.$route.query.videoUrl || '';
  75. this.bgUrl = this.$route.query.bgUrl || 'https://elab-marketing-web.oss-accelerate.aliyuncs.com/replicate_images/1702457671501.png';
  76. this.relationId = this.$route.query.relationId || '';//场景id
  77. this.amount = this.$route.query.amount || '';//场景总金额
  78. if(this.relationId){
  79. this.tabIndex = 2;
  80. }else{
  81. this.tabIndex = 0;
  82. }
  83. // this.AIPeople = this.$route.query.AIPeople ? JSON.parse(this.$route.query.AIPeople) : '';
  84. // this.AIPet = this.$route.query.AIPet ? JSON.parse(this.$route.query.AIPet) : '';
  85. // this.bgMusic = this.$route.query.bgMusic ? JSON.parse(this.$route.query.bgMusic) : '';
  86. // this.redBox = this.$route.query.redBox ? JSON.parse(this.$route.query.redBox) : '';
  87. // this.initAI();
  88. },
  89. methods: {
  90. initAI(){
  91. if(this.AIPeople){
  92. this.$refs.krpanoVideo.peopleData = this.AIPeople;
  93. }
  94. if(this.AIPet){
  95. this.$refs.krpanoVideo.petData = this.AIPet;
  96. }
  97. if(this.redBox){
  98. this.$refs.krpanoVideo.redBoxData = this.redBox;
  99. }
  100. if(this.bgMusic){
  101. this.$refs.krpanoVideo.bgMusicData = this.bgMusic;
  102. }
  103. },
  104. clearHandle() {
  105. this.clearEvent();
  106. },
  107. updateMuted(){
  108. this.muted = !this.muted;
  109. },
  110. rotateVideo(){
  111. this.deg = this.deg + 45;
  112. this.deg = this.deg % 360;
  113. console.warn("******",this.deg)
  114. this.$refs.krpanoVideo.rotateVideo(this.deg);
  115. },
  116. getPosition(){
  117. let position = this.$refs.krpanoVideo.getPosition();
  118. return position;
  119. },
  120. rangeChange(e){
  121. let sca = 1;
  122. sca = (this.value - 50)/50 + 1;
  123. if(this.tabIndex==0){
  124. this.peopleScale = sca;//数字人的大小
  125. this.peopleRangeValue = this.value
  126. }else if(this.tabIndex==1){
  127. this.petScale = sca;//宠物的大小
  128. this.petRangeValue = this.value
  129. }
  130. this.$refs.krpanoVideo.scaleChange(sca,this.tabIndex);
  131. },
  132. tabChange(tabIndex){
  133. this.tabIndex = tabIndex;
  134. this.value = tabIndex==0?this.peopleRangeValue:this.petRangeValue;
  135. },
  136. redBox(type){
  137. this.$refs.krpanoVideo.redBoxChange(type);
  138. },
  139. setRedBox(){
  140. this.$refs.playTips.showRedBoxSet();
  141. },
  142. aiPeopleChange(item,type,tabIndex){
  143. let self = this;
  144. console.warn("***aiPeopleChange***",item,type,tabIndex);
  145. if(!item || !item.url){
  146. Toast({
  147. message: '没有地址...请稍后再试',
  148. });
  149. return false;
  150. }
  151. if(tabIndex==3){
  152. if(type=='add'){
  153. this.music.url = item.url;
  154. this.music.title = item.value;
  155. }else if(type=='canel'){
  156. this.music.url = '';
  157. this.music.title = '';
  158. }
  159. }
  160. this.$refs.krpanoVideo.aiChange(item,type,tabIndex);
  161. }
  162. }
  163. }
  164. </script>
  165. <style lang="scss" scoped>
  166. @import "./webgl_rxdz_krpanovr.scss";
  167. /* @import "@/common/css/common.css"; */
  168. </style>