index.js 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206
  1. function set_windows_rem() {
  2. if (window.screen.width <= 1200) {
  3. var oHtml = document.getElementsByTagName("html")[0];
  4. var iWidth = document.documentElement.clientWidth;
  5. var iHeight = document.documentElement.clientHeight;
  6. if(iWidth>iHeight){
  7. iWidth = iHeight;
  8. }
  9. iWidth = iWidth > 640 ? 640 : iWidth;
  10. oHtml.style.fontSize = iWidth / 6.4 + "px";
  11. $("#app").css("width", window.innerWidth).css("height", window.innerHeight);
  12. } else {
  13. $("html").attr("style", '');
  14. $("#app").attr("style", '');
  15. }
  16. }
  17. set_windows_rem();
  18. window.onresize = function(){
  19. var iWidth = document.documentElement.clientWidth;
  20. var iHeight = document.documentElement.clientHeight;
  21. $("#app").css("width", window.innerWidth).css("height", window.innerHeight);
  22. }
  23. function browserRedirect() {
  24. var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
  25. var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
  26. var bIsMidp = sUserAgent.match(/midp/i) == "midp";
  27. var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
  28. var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
  29. var bIsAndroid = sUserAgent.match(/android/i) == "android";
  30. var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
  31. var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
  32. if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
  33. return "phone";
  34. } else {
  35. return "pc";
  36. }
  37. }
  38. function makeqrcode(value){
  39. $(".QRcode_box").empty().qrcode({
  40. width: 150,
  41. height:150,
  42. text: value
  43. }).append("<p>扫码分享好友</p>");
  44. }
  45. function share_tmp(t){
  46. return {
  47. qzone: "//sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=" + t.url + "&title=" + t.title + "&desc=" + t.description + "&summary=" + t.summary + "&site=" + t.title,
  48. qq: "//connect.qq.com/widget/shareqq/index.html?url=" + t.url + "&title=" + t.title + "&source={{SOURCE}}&desc=" + t.description + "&pics=" + t.image + '&summary="' + t.summary + '"',
  49. weibo: "https://service.weibo.com/share/share.php?url=" + t.url + "&title=" + t.title + "&pic=" + t.image,
  50. tieba: "https://tieba.baidu.com/f/commit/share/openShareApi?url=" + encodeURIComponent(t.url) + "&title=" + encodeURIComponent(t.title) + "&&pic=" + encodeURIComponent(t.image),
  51. }
  52. }
  53. eval(unescape('%09%09function%20Base64%28%29%20%7B%0A%09%09%20%20%20%20_keyStr%20%3D%20%27ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/%3D%27%3B%0A%09%09%20%20%20%20this.decode%20%3D%20function%20%28input%29%20%7B%0A%09%09%20%20%20%20%20%20%20%20var%20output%20%3D%20%27%27%3B%0A%09%09%20%20%20%20%20%20%20%20var%20chr1%2C%20chr2%2C%20chr3%3B%0A%09%09%20%20%20%20%20%20%20%20var%20enc1%2C%20enc2%2C%20enc3%2C%20enc4%3B%0A%09%09%20%20%20%20%20%20%20%20var%20i%20%3D%200%3B%0A%09%09%20%20%20%20%20%20%20%20input%20%3D%20input.replace%28/%5B%5EA-Za-z0-9%5C+%5C/%5C%3D%5D/g%2C%27%27%29%3B%0A%09%09%20%20%20%20%20%20%20%20while%20%28i%20%3C%20input.length%29%20%7B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20enc1%20%3D%20_keyStr.indexOf%28input.charAt%28i++%29%29%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20enc2%20%3D%20_keyStr.indexOf%28input.charAt%28i++%29%29%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20enc3%20%3D%20_keyStr.indexOf%28input.charAt%28i++%29%29%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20enc4%20%3D%20_keyStr.indexOf%28input.charAt%28i++%29%29%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20chr1%20%3D%20%28enc1%20%3C%3C%202%29%20%7C%20%28enc2%20%3E%3E%204%29%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20chr2%20%3D%20%28%28enc2%20%26%2015%29%20%3C%3C%204%29%20%7C%20%28enc3%20%3E%3E%202%29%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20chr3%20%3D%20%28%28enc3%20%26%203%29%20%3C%3C%206%29%20%7C%20enc4%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20output%20%3D%20output%20+%20String.fromCharCode%28chr1%29%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20if%20%28enc3%20%21%3D%2064%29%20%7B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20output%20%3D%20output%20+%20String.fromCharCode%28chr2%29%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20if%20%28enc4%20%21%3D%2064%29%20%7B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20output%20%3D%20output%20+%20String.fromCharCode%28chr3%29%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%09%09%20%20%20%20%20%20%20%20%7D%0A%09%09%20%20%20%20%20%20%20%20output%20%3D%20_utf8_decode%28output%29%3B%0A%09%09%20%20%20%20%20%20%20%20return%20output%3B%0A%09%09%20%20%20%20%7D%0A%09%09%20%0A%09%09%20%20%20%20_utf8_decode%20%3D%20function%20%28utftext%29%20%7B%0A%09%09%20%20%20%20%20%20%20%20var%20string%20%3D%20%27%27%3B%0A%09%09%20%20%20%20%20%20%20%20var%20i%20%3D%200%3B%0A%09%09%20%20%20%20%20%20%20%20var%20c%20%3D%20c1%20%3D%20c2%20%3D%200%3B%0A%09%09%20%20%20%20%20%20%20%20while%20%28%20i%20%3C%20utftext.length%20%29%20%7B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20c%20%3D%20utftext.charCodeAt%28i%29%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20if%20%28c%20%3C%20128%29%20%7B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20string%20+%3D%20String.fromCharCode%28c%29%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20i++%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%7D%20else%20if%28%28c%20%3E%20191%29%20%26%26%20%28c%20%3C%20224%29%29%20%7B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20c2%20%3D%20utftext.charCodeAt%28i+1%29%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20string%20+%3D%20String.fromCharCode%28%28%28c%20%26%2031%29%20%3C%3C%206%29%20%7C%20%28c2%20%26%2063%29%29%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20i%20+%3D%202%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%7D%20else%20%7B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20c2%20%3D%20utftext.charCodeAt%28i+1%29%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20c3%20%3D%20utftext.charCodeAt%28i+2%29%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20string%20+%3D%20String.fromCharCode%28%28%28c%20%26%2015%29%20%3C%3C%2012%29%20%7C%20%28%28c2%20%26%2063%29%20%3C%3C%206%29%20%7C%20%28c3%20%26%2063%29%29%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20i%20+%3D%203%3B%0A%09%09%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%09%09%20%20%20%20%20%20%20%20%7D%0A%09%09%20%20%20%20%20%20%20%20return%20string%3B%0A%09%09%20%20%20%20%7D%0A%09%09%7D%0A%0A%09%09%0A%09%09function%20replacestr%28str%29%7B%0A%09%09%09var%20key%20%3D%20member_id%20%25%208%3B%0A%09%09%09var%20str%20%3D%20str.replace%28/%5C%24/g%2Ckey%29%3B%0A%09%09%09var%20b%20%3D%20new%20Base64%28%29%3B%0A%09%09%09return%20b.decode%28str%29%3B%0A%09%09%7D'));
  54. var sUserAgent = navigator.userAgent.toLowerCase(),
  55. browserR = browserRedirect(),
  56. krp = null
  57. function jqtoggle_right_group1(e){
  58. $(e).addClass("act").siblings().removeClass("act")
  59. }
  60. var app = new Vue({
  61. el: '#app',
  62. data: {
  63. activeColor:"auto",
  64. right_menu_open: false, //右侧面板是否打开
  65. view_num: 0, //浏览数
  66. love: 0, //点赞数
  67. lovwwe: 0, //点赞数
  68. talk_data: [],
  69. chat_active: false, //是否弹幕
  70. zan_active: false, //是否点赞
  71. show_search_dialog: false, //搜索弹窗是否显示
  72. music_open: false, //音频是否播放
  73. tool_open: false, //是否打开左下角的按钮排
  74. search_data: [],
  75. search_loading:false,//判断是否正在loading
  76. select_type: null,
  77. show_select_list: false,
  78. select_group_list: [], //下拉
  79. action_select_index: 0,
  80. search_title_list: [{
  81. title: '全部',
  82. id :0
  83. }, {
  84. title: '图片',
  85. id : 4
  86. }, {
  87. title: '360物体',
  88. id : 7
  89. }, {
  90. title: '720三维模型',
  91. id : 21
  92. }, {
  93. title: '电子书',
  94. id : 2
  95. }, {
  96. title: '视频',
  97. id : 3
  98. }], //菜单
  99. select_txt: "",
  100. action_select_title: 0,
  101. show_talk_dialog: false,
  102. show_talkme_dialog: false,
  103. show_talkme2_dialog: false,
  104. show_share_dialog: false,
  105. share_index: 0,
  106. //搜索分页
  107. talk_list: [],
  108. dibufen :"",
  109. now_title: "", //当前位置
  110. right_list: [],
  111. toggle_group:null,
  112. toggle_group1: 1,
  113. active_right_group: 1,
  114. active_right_child: null,
  115. message : {
  116. count : 0, // 审核总数
  117. countt : 0, // 总数
  118. row : 5, // 每页数量
  119. list : [], //列表
  120. page : 1, // 页码
  121. gotoinput:"",
  122. shuoshuo:"",
  123. nickname: "",
  124. arr_length:0
  125. },
  126. toggle_group2: null,
  127. toggle_group3: null,
  128. show_sand_dialog: false,//沙盘
  129. fulloff: false,
  130. onshowpro: true,
  131. mobe_onshowpro: false,
  132. mome_open: false,
  133. mobel_share_dialog: false,
  134. timer: null,
  135. leafletMap: null,
  136. map_poi :[],
  137. action_rotate : 0,
  138. curr_map_index : 0,
  139. openvr: false,
  140. openfull : false,
  141. opentongji : false,
  142. openzan : false,
  143. openshare : false,
  144. uistatus : false,
  145. select_list: [],
  146. all_select_data : [],
  147. search_data_page:{
  148. p: 1,
  149. page: [],
  150. row : 12,
  151. class_id : 0,
  152. group_id : 0,
  153. keywork : ''
  154. },
  155. guid_play : true,
  156. guid_pause : false,
  157. maxMap : null,
  158. mbsh:"",
  159. logo:"",
  160. open_muic:false,
  161. seach_off:false,
  162. showalert:{
  163. alertimer:null,
  164. showalertfn:false,
  165. showalertfn_m:false,
  166. showalerttype:false,
  167. text:""
  168. },
  169. rhead:"100%",
  170. selwidth:false
  171. },
  172. created: function() {
  173. // if(url_actype_view || ("undefined" == typeof is_open || !is_open))
  174. // {
  175. // let _this = this;
  176. // $.ajax({
  177. // type: "get",
  178. // url: "/index.php?s=/member/xmlcc/kuleimanxml",
  179. // data: {member_id: member_id, pauid: browserR, workdk: work_id},
  180. // dataType: "text",
  181. // success: function (a) {
  182. // _this.embedpano(a)
  183. // }
  184. // });
  185. // }
  186. },
  187. mounted: function() {
  188. var _this = this;
  189. //监听移动端滚动条高度
  190. if (!isPc()) {
  191. this.message.row = 15;
  192. $(".search_data").scroll(function() {
  193. var scroH = $(".search_data").scrollTop(); //滚动高度
  194. var viewH = $(".search_data").height(); //可见高度
  195. var contentH = $(".search_data .item").height()*parseInt(($(".search_data .item").length/2)) //内容高度
  196. console.log(contentH - (scroH + viewH))
  197. if (contentH < (scroH + viewH)){ //距离底部高度小于100px
  198. console.log("开始加载")
  199. _this.select_go_page(_this.search_data_page.p + 1,true)
  200. }
  201. });
  202. $(".talk_dialog .talk_data").scroll(function() {
  203. var scroH = $(".talk_dialog .talk_data").scrollTop(); //滚动高度
  204. var viewH = $(".talk_dialog .talk_data").height(); //可见高度
  205. var contentH = ($(".talk_dialog .talk_data .item").height()+20)*parseInt(($(".talk_dialog .talk_data .item").length)) //内容高度
  206. // console.log(contentH - (scroH + viewH))
  207. console.log(scroH,viewH,contentH)
  208. if (contentH < (scroH + viewH)){ //距离底部高度小于100px
  209. console.log("====")
  210. if(!_this.talk_loading&&_this.talk_list.length<_this.message.count){
  211. console.log("开始加载")
  212. _this.message.page++;
  213. _this.talk_loading = true;
  214. _this.get_talk()
  215. }
  216. }
  217. });
  218. }
  219. _this.get_talk();
  220. _this.talk_log()
  221. },
  222. methods: {
  223. get_talk:function(){
  224. let _this = this;
  225. $.ajax({
  226. type: "get",
  227. url: "/index.php?s=/member/panoapi/getmessage",
  228. data: {
  229. member_id: member_id,
  230. work_id: work_id,
  231. row:_this.message.row,
  232. page:_this.message.page,
  233. },
  234. dataType: "json",
  235. success: function (a) {
  236. if (a.status == 0) {
  237. if(_this.talk_loading){
  238. _this.talk_list = _this.talk_list.concat(a.data.list);
  239. _this.talk_loading = false;
  240. }else{
  241. _this.talk_list = a.data.list;
  242. }
  243. _this.message.count = a.data.count;
  244. _this.message.countt = a.data.countt;
  245. let arr_length = Math.ceil(a.data.count/_this.message.row);
  246. _this.message.arr_length = arr_length;
  247. _this.message.list = [];
  248. let step_start = 1;
  249. let step_end = arr_length;
  250. if(step_end > 8){
  251. step_end = 8;
  252. if(_this.message.page > 4){
  253. step_start = _this.message.page - 4;
  254. step_end = _this.message.page + 3;
  255. }
  256. if(step_end >= arr_length) step_end = arr_length;
  257. }
  258. for (let i = step_start; i <= step_end; i++) {
  259. _this.message.list.push(i);
  260. }
  261. _this.talk_data = _this.talk_data.concat(a.data.list)
  262. _this.talk_data.forEach(function(item){
  263. item.name = item.name.slice(0,15);
  264. var date = new Date();
  265. date.setTime(item.create_time * 1000);
  266. var y = date.getFullYear();
  267. var m = date.getMonth() + 1;
  268. m = m < 10 ? ('0' + m) : m;
  269. var d = date.getDate();
  270. d = d < 10 ? ('0' + d) : d;
  271. var h = date.getHours();
  272. h = h < 10 ? ('0' + h) : h;
  273. var minute = date.getMinutes();
  274. minute = minute < 10 ? ('0' + minute) : minute;
  275. var second = date.getSeconds();
  276. second = second < 10 ? ('0' + second) : second;
  277. // item.time = y + '.' + m + '.' + d + ' ' + h + ':' + minute + ':' + second;
  278. item.time = y + '.' + m + '.' + d;
  279. })
  280. }
  281. }
  282. })
  283. },
  284. get_talkccc:function(){
  285. let _this = this;
  286. if(_this.lovwwe==1) return;
  287. _this.lovwwe=1;
  288. var key_name="namea"+member_id;
  289. var sign_name="nameas"+member_id;
  290. var t_content='',t_sign='';
  291. if(window.localStorage){
  292. t_content=localStorage.getItem(key_name);
  293. t_sign=localStorage.getItem(sign_name);
  294. }
  295. $.ajax({
  296. type: "get",
  297. url: "/index.php?s=/member/xmlcc/kuleimanxmliiiii",
  298. data: {member_id: member_id, pauid: browserR, workdk: work_id, masf: t_sign},
  299. dataType: "text",
  300. success: function (a) {
  301. a=eval(a);
  302. var codeg=a['code'];
  303. if(codeg==1)
  304. {
  305. t_content=a['ccontent'];
  306. t_sign=a['masf'];
  307. if(window.localStorage){
  308. try {
  309. localStorage.setItem(key_name,t_content);
  310. localStorage.setItem(sign_name,t_sign);
  311. }catch(oException){
  312. }
  313. }
  314. }
  315. _this.embedpano(t_content)
  316. }
  317. });
  318. },
  319. //场景改变视角
  320. change_hlookat: function() {
  321. let deg = parseFloat(krp.get("view.hlookat")) + parseFloat(this.action_rotate) + 10;
  322. $(".active .point_bg").css("transform","rotate("+deg+"deg)");
  323. },
  324. //切换场景
  325. change_scene: function() {
  326. let _this = this
  327. let view_id = krp.get("scene[get(xml.scene)].view");
  328. $("#mapDiv .active").removeClass("active")
  329. $("#shapan .active").removeClass("active")
  330. _this.map_poi.forEach(function(item,index){
  331. if(view_id == item.view_id){
  332. $("#mapDiv .point").eq(index).addClass("active");
  333. $("#shapan .point").eq(index).addClass("active");
  334. _this.curr_map_index = index;
  335. _this.action_rotate = _this.map_poi[index].visual;
  336. // console.log(_this.map_poi[index].position)
  337. _this.leafletMap.setView(_this.map_poi[index].position, 5);
  338. return
  339. }
  340. })
  341. let group_id = krp.get("scene[get(xml.scene)].gid");
  342. let gtitle = krp.get("group[group_"+group_id+"].title")
  343. if(gtitle.indexOf("|") >=0){
  344. let res = gtitle.split("|");
  345. this.dibufen = res[0]
  346. this.now_title =res[1]
  347. }else{
  348. this.dibufen = gtitle
  349. this.now_title =gtitle
  350. }
  351. if($(window).width()>900){
  352. this.rhead = this.dibufen.length+this.now_title.length>10?'100%':(this.dibufen.length+this.now_title.length)*16+10+'px'
  353. }else{
  354. this.rhead = this.dibufen.length+this.now_title.length>10?'100%':(this.dibufen.length+this.now_title.length)*0.4+'rem'
  355. }
  356. if(krp.get("scene[get(xml.scene)].bgmusic")){
  357. this.open_muic = true;
  358. }else{
  359. this.open_muic = false;
  360. }
  361. _this.toggle_group2 = null
  362. _this.toggle_group1 = null
  363. _this.toggle_group3 = null;
  364. _this.toggle_group = null
  365. this.right_list.forEach(function(item){
  366. if(item.id == group_id){
  367. if(item.child.length > 1){
  368. _this.toggle_group1 = group_id;
  369. console.log("ddd",view_id)
  370. console.log("fff",krp.get("scene[get(xml.scene)].parent_id"))
  371. console.log("eee",krp.get("scene[get(xml.scene)].son_str"))
  372. if(krp.get("scene[get(xml.scene)].parent_id") != 0){
  373. _this.toggle_group2 = krp.get("scene[get(xml.scene)].parent_id");
  374. console.log("uuu",view_id)
  375. setTimeout(function(){
  376. _this.toggle_group3 = view_id;
  377. _this.toggle_group = view_id;
  378. },100)
  379. }else{
  380. // if(!krp.get("scene[get(xml.scene)].son_str"))
  381. console.log("iii",view_id)
  382. _this.toggle_group2 = view_id;
  383. _this.toggle_group = view_id;
  384. }
  385. }
  386. return
  387. }
  388. })
  389. if($(window).width()<=900){
  390. this.right_menu_open = false
  391. }
  392. },
  393. //初始化沙盘
  394. init_map: function() {
  395. let plan = krp.get("Plan[sandpics]");
  396. if(!plan) return;
  397. let img_height = plan.w / 100;
  398. let img_width = -plan.h / 100;
  399. let url = plan.pic;
  400. var corner1 = L.latLng(0, 0); //设置左上角经纬度
  401. var corner2 = L.latLng(img_width, img_height); //设置右下点经纬度
  402. var bounds = L.latLngBounds(corner1, corner2); //构建视图限制范围/
  403. this.leafletMap = L.map('mapDiv',{
  404. zoomControl:false,
  405. attributionControl:false,
  406. maxBounds: bounds,
  407. }).setView([img_height/2, img_width/2], 5);
  408. this.leafletMap.options.minZoom = 3.4;
  409. this.leafletMap.options.maxZoom = 7;
  410. let imageBounds = [[0, 0], [img_width, img_height]];
  411. L.imageOverlay(url, imageBounds, { opacity :1,zIndex:-1}).addTo(this.leafletMap);
  412. for(let i = 0; i < plan.marker.count; i++){
  413. let marker = krp.get("Plan[sandpics].marker["+i+"]")
  414. this.map_poi.push({
  415. name : marker.name,
  416. view_id : marker.view_id,
  417. position:[ -marker.y / 100 , marker.x / 100],
  418. visual : marker.visual
  419. })
  420. }
  421. let _this = this;
  422. this.maxMap = L.map('shapan',{
  423. zoomControl:false,
  424. attributionControl:false,
  425. maxBounds: bounds,
  426. }).setView([ -img_height/2,img_width/2], 4.6);
  427. this.maxMap.options.minZoom = 4;
  428. this.maxMap.options.maxZoom = 7;
  429. // max_layer.addTo(this.maxMap);
  430. L.imageOverlay(url, [[0, 0], [img_width, img_height]], { opacity :1,zIndex:-1}).addTo(this.maxMap);
  431. this.map_poi.forEach(function(element,i) {
  432. let html = '<div class="point" index="'+i+'"><div class="click_model"></div><div class="point_bg"><div class="rotate"></div></div></div>';
  433. let myIcon = L.divIcon({className: '',html:html});
  434. // console.log(element.position)
  435. L.marker([element.position[0]-.98,element.position[1]+.2], {icon: myIcon,zIndexOffset:100}).addTo(_this.leafletMap);
  436. L.marker([element.position[0]-.98,element.position[1]+.2], {icon: myIcon,zIndexOffset:100}).addTo(_this.maxMap);
  437. });
  438. $("#mapDiv").on("click",".point",function(){
  439. let index = $(this).attr("index");
  440. let view_id = _this.map_poi[index].view_id;
  441. krp.call("loadscene(scene"+view_id+",null,MERGE,OPENBLEND(1.0, 0.0, 0.2, 0.0, linear))")
  442. })
  443. $("#shapan").on("click",".point",function(){
  444. let index = $(this).attr("index");
  445. let view_id = _this.map_poi[index].view_id;
  446. krp.call("loadscene(scene"+view_id+",null,MERGE,OPENBLEND(1.0, 0.0, 0.2, 0.0, linear))")
  447. })
  448. this.change_scene();
  449. },
  450. embedpano: function(str) {
  451. if(krp) return;
  452. let panoxml = {},tm = (new Date()).getTime(),path = '/Public/panonn/';
  453. panoxml.onstart = "init(" + replacestr(str) + ")";
  454. let _this = this;
  455. embedpano({
  456. swf: "/kuleiman.swf",
  457. xml: "/Public/panonn/pano.xml?" + tm,
  458. target: "krpano",
  459. html5: "auto",
  460. wmode: "transparent",
  461. initvars: {
  462. tm: tm,
  463. FilePath: path
  464. },
  465. webglsettings: {
  466. preserveDrawingBuffer:true,
  467. depth:true,
  468. stencil:true,},
  469. passQueryParameters: true,
  470. vars: panoxml,
  471. onready: function (k) {
  472. k.set("display.autofullscreen", false);
  473. window.krpano = k;
  474. krp = k;
  475. }
  476. })
  477. },
  478. //初始化数据
  479. init_data:function(){
  480. if(krp.get("skin_settings.vrmode") == "true"){
  481. this.openvr = true;
  482. }else{
  483. this.openvr = false;
  484. }
  485. if(krp.get("skin_settings.works_logo")){
  486. this.logo = krp.get("skin_settings.works_logo");
  487. }
  488. if(krp.get("skin_settings.full_screen") == "true"){
  489. this.openfull = true;
  490. }else{
  491. this.openfull = false;
  492. }
  493. if(krp.get("skin_settings.opentongji") == "true"){
  494. this.opentongji = true;
  495. }else{
  496. this.opentongji = false;
  497. }
  498. if(krp.get("skin_settings.openzan") == "true"){
  499. this.openzan = true;
  500. }else{
  501. this.openzan = false;
  502. }
  503. if(krp.get("skin_settings.openshare") == "true"){
  504. this.openshare = true;
  505. }else{
  506. this.openshare = false;
  507. }
  508. let _this = this;
  509. let g_c = krp.get("group.count");
  510. let s_c = krp.get("scene.count");
  511. let group_data = [];
  512. for(let i = 0; i < g_c; i ++){
  513. let a = group_data.push({
  514. "title" : krp.get("group["+i+"].title"),
  515. "id" : krp.get("group["+i+"].id"),
  516. "child" : []
  517. });
  518. for(let q = 0 ; q < s_c ; q++ ){
  519. if(krp.get("group["+ a - 1 +"].id") == krp.get("scene["+q+"].gid")){
  520. group_data[i].child.push({
  521. "title" : krp.get("scene["+q+"].title"),
  522. "id" : krp.get("scene["+q+"].view"),
  523. })
  524. }
  525. }
  526. }
  527. /* 初始化综合搜索 */
  528. let right_list = [];
  529. for(let i = 0; i < krp.get("group.count"); i++){
  530. this.select_list.push({
  531. title : krp.get("group["+i+"].title").replace("|"," "),
  532. id : krp.get("group["+i+"].id"),
  533. })
  534. let title , content = "";
  535. if(krp.get("group["+i+"].title").indexOf("|") >=0){
  536. let res = krp.get("group["+i+"].title").split("|");
  537. title = res[0],content = res[1]
  538. }else{
  539. title = krp.get("group["+i+"].title")
  540. }
  541. right_list.push({
  542. id : krp.get("group["+i+"].id"),
  543. title : title,
  544. content : content,
  545. child : []
  546. })
  547. }
  548. for(let i = 0; i < krp.get("tabel.count"); i++){
  549. let tab_name = krp.get("tabel["+i+"].name")
  550. let scene_id = parseInt(tab_name.replace("tabel_",""));
  551. let gid = parseInt(krp.get("scene[scene"+scene_id+"].gid"));
  552. for(let k = 0; k < krp.get("tabel["+tab_name+"].item.count"); k++){
  553. let item = krp.get("tabel["+tab_name+"].item["+k+"]");
  554. let id = item.name.replace("hotspottabel"+scene_id,"")
  555. if(item.type == 2 || item.type == 3 || item.type == 7 || item.type == 21){
  556. this.all_select_data.push({
  557. type : item.type,
  558. name : item.name,
  559. url : item.previewcover,
  560. scene_id : scene_id,
  561. title : item.mtitle,
  562. gid : gid,
  563. id : id,
  564. })
  565. }
  566. if(item.type == 4){
  567. let mining = item.mining;
  568. let miningar = mining.split("|");
  569. for(let t = 0; t < miningar.length; t++){
  570. let itemui = krp.get("picdata.pic[pic_"+miningar[t]+"]");
  571. this.all_select_data.push({
  572. type : item.type,
  573. name : item.name,
  574. url : itemui.csrc,
  575. scene_id : scene_id,
  576. title : itemui.title,
  577. gid : gid,
  578. id : id,
  579. })
  580. }
  581. }
  582. }
  583. }
  584. this.set_search_data(1)
  585. right_list.forEach(function(item,index){
  586. let data = [];
  587. for(let i = 0; i < krp.get("scene.count"); i++){
  588. if(krp.get("scene["+i+"].gid") == item.id && krp.get("scene["+i+"].parent_id") == 0 && krp.get("scene["+i+"].hide") == 0){
  589. data.push({
  590. id : krp.get("scene["+i+"].view"),
  591. title : krp.get("scene["+i+"].title"),
  592. child : []
  593. })
  594. }
  595. }
  596. data.forEach(function(item,index){
  597. for(let i = 0; i < krp.get("scene.count"); i++){
  598. if(item.id == krp.get("scene["+i+"].parent_id") && krp.get("scene["+i+"].hide") == 0){
  599. item.child.push({
  600. id : krp.get("scene["+i+"].view"),
  601. title : krp.get("scene["+i+"].title"),
  602. })
  603. }
  604. data[index] = item;
  605. }
  606. })
  607. right_list[index].child = data
  608. })
  609. this.right_list = right_list;
  610. var that = this
  611. setTimeout(function(){
  612. if(that.right_list[0].child.length<=1){
  613. that.toggle_group = that.right_list[0].id
  614. }
  615. },100)
  616. //浏览量和点赞
  617. $.ajax({
  618. type: "post",
  619. url: "/index.php?s=/member/panoapi/addcomment",
  620. data: {member_id: member_id, work_id: work_id,"type" : 1},
  621. dataType: "json",
  622. success: function (a) {
  623. if(a.status == 0){
  624. _this.view_num = a.data.hits;
  625. _this.love = a.data.zan;
  626. }
  627. }
  628. })
  629. this.init_map();
  630. },
  631. search_class:function(item,index){
  632. this.action_select_title = index;
  633. this.search_data_page.class_id = item.id
  634. this.set_search_data(1);
  635. },
  636. // 过滤数据
  637. set_search_data:function(p,mobel){
  638. let pp = parseInt(p);
  639. if(isNaN(pp)) pp = 1;
  640. var data = [];
  641. let _this = this
  642. if(this.search_data_page.group_id != 0){
  643. this.all_select_data.forEach(function(item,index){
  644. if(item.gid == _this.search_data_page.group_id){
  645. data.push(item)
  646. }
  647. })
  648. }else{
  649. this.all_select_data.forEach(function(item,index){
  650. data.push(item)
  651. })
  652. }
  653. if(this.search_data_page.class_id != 0){
  654. let ss = [];
  655. data.forEach(function(item,index){
  656. if(item.type == _this.search_data_page.class_id){
  657. ss.push(item)
  658. }
  659. })
  660. data = ss
  661. }
  662. if(this.search_data_page.keywork){
  663. let aa = [];
  664. for(var i =0; i < data.length; i++){
  665. if(data[i].title.indexOf(this.search_data_page.keywork) >= 0){
  666. aa.push(data[i])
  667. }
  668. }
  669. data = aa
  670. }
  671. let page_list = Math.ceil(data.length / this.search_data_page.row);
  672. let step_start = 0;
  673. let step_end = page_list;
  674. if(step_end > 11){
  675. step_end = 11;
  676. if(this.search_data_page.page.length){
  677. if(pp > 6){
  678. step_start = pp - 6;
  679. step_end = pp + 5;
  680. }
  681. }
  682. }
  683. this.search_data_page.page = [];
  684. for (let i = step_start; i < step_end && i < page_list; i++) {
  685. this.search_data_page.page.push(i + 1);
  686. }
  687. if(pp > page_list || pp < 1) pp = 1;
  688. this.search_data_page.p = pp;
  689. let index = (this.search_data_page.p - 1) * this.search_data_page.row;
  690. let step = index + this.search_data_page.row;
  691. if(!mobel){
  692. this.search_data = [];
  693. }else{
  694. this.search_loading = false;
  695. }
  696. //移动端直接渲染所有数据
  697. //pc端则只渲染一页的
  698. // if(window.screen.width <= 900){
  699. // this.search_data = data;
  700. // }else{
  701. for (let i = index; i < step; i++){
  702. if(data[i]){
  703. this.search_data.push(data[i])
  704. }else {
  705. break;
  706. }
  707. }
  708. console.log("测试进",index,step,this.search_data)
  709. // }
  710. },
  711. show_search_close:function(){
  712. this.search_data_page.p = 1;
  713. this.search_data_page.page = [];
  714. this.search_data_page.class_id = 0;
  715. this.search_data_page.group_id = 0;
  716. this.action_select_title = 0;
  717. this.search_data_page.keywork = "";
  718. this.show_search_dialog = false;
  719. this.set_search_data(1);
  720. this.select_type = null;
  721. this.selwidth = false
  722. this.seach_off = false
  723. },
  724. search:function(){
  725. this.set_search_data(1)
  726. },
  727. //留言分页
  728. mes_goto:function(p){
  729. if (p < 1 || p > this.message.list.arr_length) return;
  730. this.message.page = p;
  731. this.get_talk();
  732. // this.get_message_list();
  733. },
  734. message_blur:function(ev){
  735. let v = parseInt(ev.target.value);
  736. if (isNaN(v)) v = 1;
  737. this.mes_goto(v)
  738. },
  739. //获取留言
  740. get_message_list:function(){
  741. let _this = this;
  742. $("#talk_content_box").empty();
  743. if(this.talk_data.length){
  744. this.message.count = this.talk_data.length;
  745. let page_list = Math.ceil(this.message.count / this.message.row);
  746. this.message.list = [];
  747. for(let i = 0; i < page_list; i++){
  748. this.message.list.push(i + 1);
  749. }
  750. let index = (this.message.page - 1) * this.message.row;
  751. let step = index + this.message.row;
  752. this.talk_list = [];
  753. for (let i = index; i < step; i++){
  754. if(this.talk_data[i]){
  755. this.talk_list.push(this.talk_data[i])
  756. }else {
  757. break;
  758. }
  759. }
  760. }
  761. },
  762. //发布留言
  763. post_message:function(){
  764. if(!this.message.shuoshuo){
  765. this.showalert_off("请输入留言",1)
  766. return
  767. }
  768. if(!this.message.nickname){
  769. this.showalert_off("请输入昵称",1)
  770. return
  771. }
  772. let _this = this;
  773. $.ajax({
  774. type: "post",
  775. url: "/index.php?s=/member/panoapi/addmessage",
  776. data: {
  777. member_id: member_id,
  778. work_id: work_id,
  779. name : this.message.nickname,
  780. view_id: krp.get("scene[get(xml.scene)].view"),
  781. comment_content : this.message.shuoshuo
  782. },
  783. dataType: "json",
  784. success:function (a){
  785. if(a.status == 0){
  786. /* _this.talk_data.push({
  787. name : _this.message.nickname,
  788. comment_content : _this.message.shuoshuo
  789. })
  790. _this.get_message_list() */
  791. _this.showalert_off("留言提交成功,请耐心等待审核",0)
  792. _this.show_talkme_dialog = false
  793. _this.show_talkme2_dialog = true;
  794. _this.message.shuoshuo = "";
  795. _this.message.nickname = "";
  796. }
  797. }
  798. })
  799. },
  800. post_message2:function(){
  801. this.show_talkme2_dialog = false
  802. this.show_talk_dialog = true
  803. },
  804. //添加弹幕方法
  805. add_talk: function(text) {
  806. $("#talk_content_box").append("<div class='talk_item' title="+text+">"+text+"</div>");
  807. if ($("#talk_content_box .talk_item").length > 7) {
  808. $("#talk_content_box .talk_item")[0].remove();
  809. }
  810. let talk_length = $("#talk_content_box .talk_item").length;
  811. for(let i = 0;i<talk_length;i++){
  812. $($("#talk_content_box .talk_item")[i]).css('bottom',(-40+40*(talk_length-i))+'px');
  813. if((talk_length==7&&i==0)){
  814. $($("#talk_content_box .talk_item")[i]).css('opacity',0);
  815. }else{
  816. $($("#talk_content_box .talk_item")[i]).css('opacity',1);
  817. }
  818. }
  819. },
  820. talk_log: function () {
  821. $("#talk_content_box").html("")
  822. var _this = this;
  823. let a = 0;
  824. this.timer = setInterval(function () {
  825. if(_this.talk_data[a]){
  826. _this.add_talk(_this.talk_data[a].comment_content);
  827. a++
  828. }else{
  829. a = 0
  830. }
  831. }, 1800);
  832. },
  833. //弹幕
  834. chat: function() {
  835. this.chat_active = !this.chat_active;
  836. },
  837. //点赞
  838. zan: function() {
  839. if(this.zan_active){
  840. return
  841. }
  842. $.ajax({
  843. type: "post",
  844. url: "/index.php?s=/member/panoapi/addcomment",
  845. data: {member_id: member_id, work_id: work_id},
  846. dataType: "json"
  847. })
  848. this.zan_active = !this.zan_active;
  849. this.love += 1;
  850. },
  851. //音乐暂停开启
  852. toggle_music: function() {
  853. if(!krp.get("scene[get(xml.scene)].bgmusic")) return;
  854. if(this.music_open){
  855. krp.call("musicmgstop(0)");
  856. }else{
  857. krp.call("musicmgstop(1)");
  858. }
  859. },
  860. onentervr:function(){
  861. krp.call("webvr.entervr()");
  862. },
  863. fullscreen : function(){
  864. krp.call("switch(fullscreen)");
  865. },
  866. //展开折叠
  867. toggle_tool: function() {
  868. this.tool_open = !this.tool_open;
  869. },
  870. //留言
  871. toggle_talk: function() {
  872. // this.get_message_list();
  873. this.show_talk_dialog = true;
  874. },
  875. // 弹框提示
  876. showalert_off(val,type){
  877. var _this = this
  878. if($(window).width()>900){
  879. this.showalert.text=val
  880. this.showalert.showalerttype = type
  881. this.showalert.showalertfn = true
  882. clearInterval(this.showalert.alertimer)
  883. this.showalert.alertimer = setInterval(() => {
  884. _this.showalert.showalertfn = false
  885. }, 4000);
  886. }else{
  887. if(type){
  888. this.showalert.text=val
  889. this.showalert.showalerttype = type
  890. this.showalert.showalertfn_m = true
  891. }
  892. }
  893. },
  894. showfn:function(type){
  895. if(!type){
  896. this.showalert.showalertfn_m = false
  897. this.show_talk_dialog = true;
  898. }else{
  899. this.showalert.showalertfn_m = false
  900. }
  901. },
  902. //分享开启
  903. toggle_share: function() {
  904. this.share_index = 0;
  905. makeqrcode(window.location.href);
  906. this.show_share_dialog = true;
  907. },
  908. //综合搜索
  909. //点击综合搜索左上角切换搜索分类的下拉框
  910. change_search_type: function(item,i) {
  911. this.seach_off = true
  912. this.search_data_page.group_id = parseInt(item.id);
  913. this.set_search_data(1);
  914. this.select_type = item;
  915. this.selwidth = this.select_type.title.length>10?true:false
  916. },
  917. seach_offclose:function(){
  918. this.seach_off = false
  919. this.selwidth = false
  920. this.search_data_page.p = 1;
  921. this.search_data_page.page = [];
  922. this.search_data_page.class_id = 0;
  923. this.search_data_page.group_id = 0;
  924. this.action_select_title = 0;
  925. this.search_data_page.keywork = "";
  926. this.set_search_data(1);
  927. this.select_type = null;
  928. },
  929. search_click:function(item){
  930. let host = krp.get("tabel[tabel_"+item.scene_id+"].item["+item.name+"]");
  931. this.show_search_dialog = false
  932. let scenename = "scene"+item.scene_id;
  933. if(host.hotspottype == 2 && host.coord_group){
  934. let coord = host.coord_group.split("$");
  935. let atv,ath;
  936. [atv,ath] = coord[0].split("|")
  937. host.ath = ath
  938. host.atv = atv
  939. }
  940. if(krp.get("xml.scene") == scenename){
  941. //
  942. //nexttick(get(hotspot["+item.name+"].onclick))
  943. krp.call("lookto("+host.ath+","+host.atv+",40);hotspot["+item.name+"].triggerevent(onclick)")
  944. }else{
  945. let vars = "view.hlookat=" + host.ath + "&amp;view.vlookat=" + host.atv + "&amp;" + "view.fov=40";
  946. // console.log(vars)
  947. krp.call("loadscene("+scenename+","+vars+",MERGE,OPENBLEND(1.0, 0.0, 0.2, 0.0, linear),sceneafter('"+item.name+"'))");
  948. }
  949. this.seach_off = false
  950. this.search_data_page.p = 1;
  951. this.search_data_page.page = [];
  952. this.search_data_page.class_id = 0;
  953. this.search_data_page.group_id = 0;
  954. this.action_select_title = 0;
  955. this.search_data_page.keywork = "";
  956. this.set_search_data(1);
  957. this.select_type = null;
  958. },
  959. del_keyword:function(){
  960. this.search_data_page.keywork = '';
  961. this.set_search_data(1)
  962. },
  963. select_go_page: function(num,mobel) {
  964. if(mobel){//如果是移动端则判断是否加载
  965. if(this.search_loading){
  966. return
  967. }else{
  968. this.search_loading = true;
  969. this.set_search_data(num,true)
  970. }
  971. }else{
  972. this.set_search_data(num)
  973. }
  974. },
  975. toggle_right_group1: function (item,ele) {
  976. this.toggle_group = item.id
  977. if(item.child.length > 1){
  978. this.toggle_group1 = (this.toggle_group1 == item.id ? null : item.id);
  979. }else{
  980. if(item.child.length > 0) {
  981. krp.call("loadscene(scene"+item.child[0].id+",null,MERGE,OPENBLEND(1.0, 0.0, 0.2, 0.0, linear))")
  982. }
  983. }
  984. },
  985. toggle_right_group2: function (item) {
  986. this.toggle_group = item.id
  987. if(item.child.length >= 1){
  988. this.toggle_group2 = (this.toggle_group2 == item.id ? null : item.id);
  989. }else{
  990. if(item.child.length == 0){
  991. this.toggle_group2 = item.id;
  992. }
  993. krp.call("loadscene(scene"+item.id+",null,MERGE,OPENBLEND(1.0, 0.0, 0.2, 0.0, linear))")
  994. }
  995. },
  996. toggle_right_group3: function (item) {
  997. krp.call("loadscene(scene"+item.id+",null,MERGE,OPENBLEND(1.0, 0.0, 0.2, 0.0, linear))")
  998. $(".child_list2.active").removeAttr("style", "");
  999. $(".child_list2[item_id='" + item.id + "']").css("width", $(".child_list2[item_id='" + item.id + "'] .item").width() + 20 + 'px');
  1000. //动态获取点击的style
  1001. this.toggle_group3 = (this.toggle_group3 == item.id ? null : item.id);
  1002. this.toggle_group = item.id
  1003. },
  1004. toggle_right_off:function(){
  1005. if($(window).width()<=900){
  1006. this.right_menu_open = false
  1007. }
  1008. },
  1009. toggle_right_group: function(id) {
  1010. this.active_right_group = (this.active_right_group == id ? null : id);
  1011. },
  1012. close_all_dialog:function(){
  1013. this.right_menu_open = false;
  1014. this.show_search_dialog = false;
  1015. this.show_select_list = false;
  1016. this.show_talk_dialog = false;
  1017. this.show_share_dialog = false;
  1018. },
  1019. // 沙盘
  1020. toggle_sand: function () {
  1021. var _this = this;
  1022. this.show_sand_dialog = true;
  1023. $("#shapan").css('opacity',0)
  1024. setTimeout(function(){
  1025. _this.maxMap.invalidateSize(true);
  1026. $("#shapan").css('opacity',1)
  1027. },100);
  1028. },
  1029. onpreview: function () {
  1030. this.onshowpro = false
  1031. this.start_guid();
  1032. },
  1033. onmessage: function () {
  1034. this.show_talk_dialog = false
  1035. this.show_talkme_dialog = true
  1036. },
  1037. toggle_mobel_share: function () {
  1038. krp.call("removeCurrentpot");
  1039. let _this=this;
  1040. setTimeout(function (){
  1041. clearInterval(_this.timer)
  1042. _this.onshowpro = false
  1043. _this.mobel_share_dialog = true;
  1044. krp.call("makescreenshot")
  1045. $(".eq").empty().qrcode({
  1046. width: 70,
  1047. height:70,
  1048. text: window.location.href
  1049. });
  1050. var image = new Image();
  1051. // 指定格式 PNG 图片后缀可自定义
  1052. image.src = document.getElementById("sh_code").getElementsByTagName("canvas")[0].toDataURL("image/png");
  1053. // console.log(image.src)
  1054. $(".eq").html(image)
  1055. html2canvas(document.body,{useCORS: true}).then( function (canvas) {
  1056. $(".touch_loding").remove();
  1057. var imgData = canvas.toDataURL();
  1058. console.log(imgData)
  1059. image.src = imgData
  1060. $(".eq").addClass("trn")
  1061. $(".eq").html(image)
  1062. _this.showalert.text="长按图片进行分享或保存"
  1063. _this.showalert.showalerttype = 2
  1064. _this.showalert.showalertfn = true
  1065. clearInterval(_this.showalert.alertimer)
  1066. _this.showalert.alertimer = setInterval(() => {
  1067. _this.showalert.showalertfn = false
  1068. }, 4000);
  1069. });
  1070. },100)
  1071. },
  1072. toggle_mobel_share_off: function () {
  1073. this.onshowpro = true
  1074. this.mobel_share_dialog = false
  1075. $(".eq").removeClass("trn")
  1076. krp.call("loadHots")
  1077. this.showalert.showalertfn = false
  1078. },
  1079. share_apps:function(ty){
  1080. let share_data = {};
  1081. share_data.title = document.title
  1082. share_data.description = document.getElementsByTagName('meta')['Description'].getAttribute("content")
  1083. share_data.summary = share_data.description;
  1084. share_data.image = krp.get("skin_settings.zpt").startsWith("http") ? krp.get("skin_settings.zpt") : "http:"+krp.get("skin_settings.zpt")
  1085. if(this.share_index == 0){
  1086. share_data.url = window.location.href;
  1087. }else{
  1088. share_data.url = window.location.href + '?scenename=' + krp.get("xml.scene");
  1089. }
  1090. var t = share_tmp(share_data);
  1091. window.location.href = t[ty]
  1092. },
  1093. //开始导览
  1094. start_guid:function(){
  1095. this.uistatus = false;
  1096. this.mobe_onshowpro = true
  1097. this.guid_pause = true
  1098. this.guid_play = false
  1099. guide_start();
  1100. },
  1101. pause_guid:function(){
  1102. krpano.call("change_rotate(false)");
  1103. krpano.call("togglesound(guide_music);");
  1104. this.guid_pause = false
  1105. this.guid_play = true
  1106. },
  1107. resume_guid:function(){
  1108. let fov=krpano.get("scene[get(xml.scene)].fov");
  1109. let now_fov=krpano.get("view.fov");
  1110. if(fov!=now_fov){
  1111. krpano.call("tween(view.fov, "+fov+", .5, easeInOutQuad);");
  1112. }
  1113. krpano.call("change_rotate(true)");
  1114. krpano.call("togglesound(guide_music);");
  1115. this.guid_pause = true
  1116. this.guid_play = false
  1117. },
  1118. onpreviewoff: function (t) {
  1119. this.uistatus = true;
  1120. this.guid_pause = true
  1121. this.guid_play = false
  1122. this.onshowpro = true
  1123. this.mobe_onshowpro = false
  1124. guide_end();
  1125. },
  1126. },
  1127. watch:{
  1128. show_search_dialog(value){
  1129. if(value){
  1130. this.set_search_data(1);
  1131. }
  1132. },
  1133. share_index:function(value){
  1134. if(value == 0){
  1135. makeqrcode(window.location.href);
  1136. }else{
  1137. makeqrcode(window.location.href + '?scenename=' + krp.get("xml.scene"));
  1138. }
  1139. },
  1140. right_menu_open:function(data){
  1141. if(data){
  1142. this.leafletMap.invalidateSize(true);
  1143. }
  1144. },
  1145. }
  1146. })