webgl_rxdz_krpanoclipImg.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template src="./webgl_rxdz_krpanoclipImg.html">
  2. </template>
  3. <script>
  4. import krpanoVideo from "@/components/krpanoVideo/index.vue";
  5. import {getStorage} from '@/utils/localStorage';
  6. import { MessageBox } from 'mint-ui';
  7. import {
  8. Toast
  9. } from 'mint-ui';
  10. var requestId = "";
  11. const util = require('@/utils/util.js').default;
  12. import commonPageMethod from '@/mixins/commonPageMethod.js';
  13. import screenshot from '@/mixins/screenshot.js';
  14. // import commonPageMethod from '@/common/commonPageMethod.js';
  15. export default {
  16. components: {
  17. krpanoVideo,
  18. },
  19. mixins: [commonPageMethod,screenshot],
  20. /**
  21. * 页面的初始数据
  22. */
  23. data() {
  24. return {
  25. pvCurPageName: "webgl_clipImg",
  26. locusBehaviorName: "720设置封面",
  27. pvCurPageParams: null,
  28. houseId: "",
  29. pvId: 'p_2cmina_23121201',
  30. navbar: {
  31. showCapsule: 1,
  32. title: '设置封面',
  33. titleColor: '#000',
  34. navPadding: 0,
  35. navPaddingBg: 'transparent',
  36. navBarColor: 'transparent',
  37. navBackColor: 'transparent',
  38. haveCallback: true, // 如果是 true 会接手 navbarBackClk
  39. fromShare: false,
  40. fromProject: 0,
  41. shareToken: "",
  42. pageName: this.pvCurPageName,
  43. },
  44. id: '', // 户型编号
  45. houseId:'',
  46. canvasHeight:'',
  47. isIOS: false,
  48. videoUrl:'', //绿幕视频地址
  49. bgUrl:'',
  50. scale:'',
  51. coordinate:'',
  52. muted: true, //视频是否静音
  53. width:'620',
  54. height:'620',
  55. left:'65',
  56. top:'150',
  57. startX:0,
  58. startY:0,
  59. clientX:0,
  60. clientY:0,
  61. screenWidth:0,
  62. screenHeight:0,
  63. type:1,
  64. bottomLeftX:0,
  65. bottomLeftY:0,
  66. AIPeople:'',
  67. AIPet:'',
  68. bgMusic:'',
  69. redBox:'',
  70. bili: 2/3,
  71. instance:null,
  72. }
  73. },
  74. beforeDestroy() {
  75. console.warn("***beforeDestroy-webgl_rxdz_krpanoclipImg***");
  76. },
  77. mounted(options) {
  78. var that = this;
  79. console.warn("***webgl_rxdz_roam-options***", this.$route.query)
  80. this.isIOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  81. // this.videoUrl = this.$route.query.videoUrl || '';
  82. this.bgUrl = this.$route.query.bgUrl || 'https://elab-marketing-web.oss-accelerate.aliyuncs.com/replicate_images/1702457671501.png';
  83. // this.coordinate = this.$route.query.coordinate || '';
  84. // this.scale = this.$route.query.scale || '1';
  85. this.AIPeople = this.$route.query.AIPeople ? JSON.parse(this.$route.query.AIPeople) : '';
  86. this.AIPet = this.$route.query.AIPet ? JSON.parse(this.$route.query.AIPet) : '';
  87. this.bgMusic = this.$route.query.bgMusic ? JSON.parse(this.$route.query.bgMusic) : '';
  88. this.redBox = this.$route.query.redBox ? JSON.parse(this.$route.query.redBox) : '';
  89. let screenWidth = window.screen.width;
  90. let screenHeight = window.screen.height;
  91. if (window.innerWidth && window.screen.width) {
  92. this.screenWidth = screenWidth = Math.min(window.innerWidth, window.screen.width);
  93. }
  94. if (window.innerHeight && window.screen.height) {
  95. this.screenHeight = screenHeight = Math.min(window.innerHeight, window.screen.height)
  96. }
  97. let unit = screenWidth / 750; //单位rpm 对应 px 的值
  98. this.width = this.width * unit;
  99. this.height = parseInt(this.height/this.bili) * unit;
  100. this.left = this.left * unit;
  101. this.top = this.top * unit;
  102. this.canvasHeight = screenHeight;
  103. this.houseId = this.$route.query.houseId ? this.$route.query.houseId : '';
  104. if(window.__wxjs_environment === 'miniprogram'){
  105. this.navbar.showCapsule = 0;
  106. }
  107. this.initAI();
  108. },
  109. methods: {
  110. initAI(){
  111. if(this.AIPeople){
  112. this.$refs.krpanoVideo.peopleData = this.AIPeople;
  113. }
  114. if(this.AIPet){
  115. this.$refs.krpanoVideo.petData = this.AIPet;
  116. }
  117. if(this.redBox){
  118. this.$refs.krpanoVideo.redBoxData = this.redBox;
  119. }
  120. if(this.bgMusic){
  121. this.$refs.krpanoVideo.bgMusicData = this.bgMusic;
  122. }
  123. },
  124. async clipImgHandle(){
  125. console.warn("***clipImgHandle1***");
  126. this.instance = Toast({
  127. message: '正在截图,请稍后',
  128. duration:-1,
  129. });
  130. this.bottomLeftX = this.left;
  131. this.bottomLeftY = this.screenHeight - this.top - this.height;
  132. this.$refs.krpanoVideo.makescreenshot();
  133. },
  134. closeToast(){
  135. this.instance && this.instance.close();
  136. },
  137. navbarBackClk() {
  138. },
  139. mytouchstart(e,type) {
  140. console.warn("***mytouchstart***",type)
  141. this.type = type;
  142. this.startLeft = this.left;
  143. // this.clientX = 0;
  144. // this.clientY = 0;
  145. this.startX = e.changedTouches[0].clientX;
  146. this.startY = e.changedTouches[0].clientY;
  147. e.preventDefault();
  148. },
  149. mytouchmove(e) {
  150. let startX = this.startX; // 开始x坐标
  151. let startY = this.startY; //开始y坐标
  152. let touchMoveX = e.changedTouches[0].clientX //滑动变化坐标
  153. let touchMoveY = e.changedTouches[0].clientY //滑动变化坐标
  154. // this.clientX = touchMoveX - startX;
  155. // this.clientY = touchMoveY - startY;
  156. this.widthHandle(touchMoveX,1);
  157. e.preventDefault();
  158. },
  159. mytouchend(e) {
  160. },
  161. widthHandle(touchMoveX){
  162. let clientX = touchMoveX - this.startX;
  163. if(this.type==1){//左上角
  164. if(clientX < 0){//左移动
  165. let _juli = Math.abs(clientX);
  166. this.left = this.startLeft - _juli;
  167. this.width = this.screenWidth - (this.left * 2);
  168. if(this.left < 0){
  169. this.left = 0;
  170. this.width = this.screenWidth;
  171. }
  172. }else if(clientX > 0){//右移动
  173. let _juli = Math.abs(clientX);
  174. this.left = this.startLeft + _juli;
  175. this.width = this.screenWidth - (this.left * 2);
  176. if(this.left > (this.screenWidth - 200)/2){
  177. this.left = (this.screenWidth - 200)/2;
  178. this.width = 200;
  179. }
  180. }
  181. this.height = parseInt(this.width/this.bili);
  182. }else if(this.type==2){//右上角
  183. if(clientX < 0){//左移动
  184. let _juli = Math.abs(clientX);
  185. this.left = this.startLeft + _juli;
  186. this.width = this.screenWidth - (this.left * 2);
  187. if(this.left > (this.screenWidth - 200)/2){
  188. this.left = (this.screenWidth - 200)/2;
  189. this.width = 200;
  190. }
  191. }else if(clientX > 0){//右移动
  192. let _juli = Math.abs(clientX);
  193. this.left = this.startLeft - _juli;
  194. this.width = this.screenWidth - (this.left * 2);
  195. if(this.left < 0){
  196. this.left = 0;
  197. this.width = this.screenWidth;
  198. }
  199. }
  200. this.height = parseInt(this.width/this.bili);
  201. }else if(this.type==3){//右下角
  202. if(clientX < 0){//左移动
  203. let _juli = Math.abs(clientX);
  204. this.left = this.startLeft + _juli;
  205. this.width = this.screenWidth - (this.left * 2);
  206. if(this.left > (this.screenWidth - 200)/2){
  207. this.left = (this.screenWidth - 200)/2;
  208. this.width = 200;
  209. }
  210. }else if(clientX > 0){//右移动
  211. let _juli = Math.abs(clientX);
  212. this.left = this.startLeft - _juli;
  213. this.width = this.screenWidth - (this.left * 2);
  214. if(this.left < 0){
  215. this.left = 0;
  216. this.width = this.screenWidth;
  217. }
  218. }
  219. this.height = parseInt(this.width/this.bili);
  220. }else if(this.type==4){//左下角
  221. if(clientX < 0){//左移动
  222. let _juli = Math.abs(clientX);
  223. this.left = this.startLeft - _juli;
  224. this.width = this.screenWidth - (this.left * 2);
  225. if(this.left < 0){
  226. this.left = 0;
  227. this.width = this.screenWidth;
  228. }
  229. }else if(clientX > 0){//右移动
  230. let _juli = Math.abs(clientX);
  231. this.left = this.startLeft + _juli;
  232. this.width = this.screenWidth - (this.left * 2);
  233. if(this.left > (this.screenWidth - 200)/2){
  234. this.left = (this.screenWidth - 200)/2;
  235. this.width = 200;
  236. }
  237. }
  238. this.height = parseInt(this.width/this.bili);
  239. }
  240. }
  241. }
  242. }
  243. </script>
  244. <style lang="scss" scoped>
  245. @import "./webgl_rxdz_krpanoclipImg.scss";
  246. /* @import "@/common/css/common.css"; */
  247. </style>