function set_windows_rem() { if (window.screen.width <= 1200) { var oHtml = document.getElementsByTagName("html")[0]; var iWidth = document.documentElement.clientWidth; var iHeight = document.documentElement.clientHeight; if(iWidth>iHeight){ iWidth = iHeight; } iWidth = iWidth > 640 ? 640 : iWidth; oHtml.style.fontSize = iWidth / 6.4 + "px"; $("#app").css("width", window.innerWidth).css("height", window.innerHeight); } else { $("html").attr("style", ''); $("#app").attr("style", ''); } } set_windows_rem(); window.onresize = function(){ var iWidth = document.documentElement.clientWidth; var iHeight = document.documentElement.clientHeight; $("#app").css("width", window.innerWidth).css("height", window.innerHeight); } function browserRedirect() { var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; var bIsMidp = sUserAgent.match(/midp/i) == "midp"; var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"; var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb"; var bIsAndroid = sUserAgent.match(/android/i) == "android"; var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"; var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile"; if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) { return "phone"; } else { return "pc"; } } function makeqrcode(value){ $(".QRcode_box").empty().qrcode({ width: 150, height:150, text: value }).append("

扫码分享好友

"); } function share_tmp(t){ return { 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, 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 + '"', weibo: "https://service.weibo.com/share/share.php?url=" + t.url + "&title=" + t.title + "&pic=" + t.image, tieba: "https://tieba.baidu.com/f/commit/share/openShareApi?url=" + encodeURIComponent(t.url) + "&title=" + encodeURIComponent(t.title) + "&&pic=" + encodeURIComponent(t.image), } } 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')); var sUserAgent = navigator.userAgent.toLowerCase(), browserR = browserRedirect(), krp = null function jqtoggle_right_group1(e){ $(e).addClass("act").siblings().removeClass("act") } var app = new Vue({ el: '#app', data: { activeColor:"auto", right_menu_open: false, //右侧面板是否打开 view_num: 0, //浏览数 love: 0, //点赞数 lovwwe: 0, //点赞数 talk_data: [], chat_active: false, //是否弹幕 zan_active: false, //是否点赞 show_search_dialog: false, //搜索弹窗是否显示 music_open: false, //音频是否播放 tool_open: false, //是否打开左下角的按钮排 search_data: [], search_loading:false,//判断是否正在loading select_type: null, show_select_list: false, select_group_list: [], //下拉 action_select_index: 0, search_title_list: [{ title: '全部', id :0 }, { title: '图片', id : 4 }, { title: '360物体', id : 7 }, { title: '720三维模型', id : 21 }, { title: '电子书', id : 2 }, { title: '视频', id : 3 }], //菜单 select_txt: "", action_select_title: 0, show_talk_dialog: false, show_talkme_dialog: false, show_talkme2_dialog: false, show_share_dialog: false, share_index: 0, //搜索分页 talk_list: [], dibufen :"", now_title: "", //当前位置 right_list: [], toggle_group:null, toggle_group1: 1, active_right_group: 1, active_right_child: null, message : { count : 0, // 审核总数 countt : 0, // 总数 row : 5, // 每页数量 list : [], //列表 page : 1, // 页码 gotoinput:"", shuoshuo:"", nickname: "", arr_length:0 }, toggle_group2: null, toggle_group3: null, show_sand_dialog: false,//沙盘 fulloff: false, onshowpro: true, mobe_onshowpro: false, mome_open: false, mobel_share_dialog: false, timer: null, leafletMap: null, map_poi :[], action_rotate : 0, curr_map_index : 0, openvr: false, openfull : false, opentongji : false, openzan : false, openshare : false, uistatus : false, select_list: [], all_select_data : [], search_data_page:{ p: 1, page: [], row : 12, class_id : 0, group_id : 0, keywork : '' }, guid_play : true, guid_pause : false, maxMap : null, mbsh:"", logo:"", open_muic:false, seach_off:false, showalert:{ alertimer:null, showalertfn:false, showalertfn_m:false, showalerttype:false, text:"" }, rhead:"100%", selwidth:false }, created: function() { // if(url_actype_view || ("undefined" == typeof is_open || !is_open)) // { // let _this = this; // $.ajax({ // type: "get", // url: "/index.php?s=/member/xmlcc/kuleimanxml", // data: {member_id: member_id, pauid: browserR, workdk: work_id}, // dataType: "text", // success: function (a) { // _this.embedpano(a) // } // }); // } }, mounted: function() { var _this = this; //监听移动端滚动条高度 if (!isPc()) { this.message.row = 15; $(".search_data").scroll(function() { var scroH = $(".search_data").scrollTop(); //滚动高度 var viewH = $(".search_data").height(); //可见高度 var contentH = $(".search_data .item").height()*parseInt(($(".search_data .item").length/2)) //内容高度 console.log(contentH - (scroH + viewH)) if (contentH < (scroH + viewH)){ //距离底部高度小于100px console.log("开始加载") _this.select_go_page(_this.search_data_page.p + 1,true) } }); $(".talk_dialog .talk_data").scroll(function() { var scroH = $(".talk_dialog .talk_data").scrollTop(); //滚动高度 var viewH = $(".talk_dialog .talk_data").height(); //可见高度 var contentH = ($(".talk_dialog .talk_data .item").height()+20)*parseInt(($(".talk_dialog .talk_data .item").length)) //内容高度 // console.log(contentH - (scroH + viewH)) console.log(scroH,viewH,contentH) if (contentH < (scroH + viewH)){ //距离底部高度小于100px console.log("====") if(!_this.talk_loading&&_this.talk_list.length<_this.message.count){ console.log("开始加载") _this.message.page++; _this.talk_loading = true; _this.get_talk() } } }); } _this.get_talk(); _this.talk_log() }, methods: { get_talk:function(){ let _this = this; $.ajax({ type: "get", url: "/index.php?s=/member/panoapi/getmessage", data: { member_id: member_id, work_id: work_id, row:_this.message.row, page:_this.message.page, }, dataType: "json", success: function (a) { if (a.status == 0) { if(_this.talk_loading){ _this.talk_list = _this.talk_list.concat(a.data.list); _this.talk_loading = false; }else{ _this.talk_list = a.data.list; } _this.message.count = a.data.count; _this.message.countt = a.data.countt; let arr_length = Math.ceil(a.data.count/_this.message.row); _this.message.arr_length = arr_length; _this.message.list = []; let step_start = 1; let step_end = arr_length; if(step_end > 8){ step_end = 8; if(_this.message.page > 4){ step_start = _this.message.page - 4; step_end = _this.message.page + 3; } if(step_end >= arr_length) step_end = arr_length; } for (let i = step_start; i <= step_end; i++) { _this.message.list.push(i); } _this.talk_data = _this.talk_data.concat(a.data.list) _this.talk_data.forEach(function(item){ item.name = item.name.slice(0,15); var date = new Date(); date.setTime(item.create_time * 1000); var y = date.getFullYear(); var m = date.getMonth() + 1; m = m < 10 ? ('0' + m) : m; var d = date.getDate(); d = d < 10 ? ('0' + d) : d; var h = date.getHours(); h = h < 10 ? ('0' + h) : h; var minute = date.getMinutes(); minute = minute < 10 ? ('0' + minute) : minute; var second = date.getSeconds(); second = second < 10 ? ('0' + second) : second; // item.time = y + '.' + m + '.' + d + ' ' + h + ':' + minute + ':' + second; item.time = y + '.' + m + '.' + d; }) } } }) }, get_talkccc:function(){ let _this = this; if(_this.lovwwe==1) return; _this.lovwwe=1; var key_name="namea"+member_id; var sign_name="nameas"+member_id; var t_content='',t_sign=''; if(window.localStorage){ t_content=localStorage.getItem(key_name); t_sign=localStorage.getItem(sign_name); } $.ajax({ type: "get", url: "/index.php?s=/member/xmlcc/kuleimanxmliiiii", data: {member_id: member_id, pauid: browserR, workdk: work_id, masf: t_sign}, dataType: "text", success: function (a) { a=eval(a); var codeg=a['code']; if(codeg==1) { t_content=a['ccontent']; t_sign=a['masf']; if(window.localStorage){ try { localStorage.setItem(key_name,t_content); localStorage.setItem(sign_name,t_sign); }catch(oException){ } } } _this.embedpano(t_content) } }); }, //场景改变视角 change_hlookat: function() { let deg = parseFloat(krp.get("view.hlookat")) + parseFloat(this.action_rotate) + 10; $(".active .point_bg").css("transform","rotate("+deg+"deg)"); }, //切换场景 change_scene: function() { let _this = this let view_id = krp.get("scene[get(xml.scene)].view"); $("#mapDiv .active").removeClass("active") $("#shapan .active").removeClass("active") _this.map_poi.forEach(function(item,index){ if(view_id == item.view_id){ $("#mapDiv .point").eq(index).addClass("active"); $("#shapan .point").eq(index).addClass("active"); _this.curr_map_index = index; _this.action_rotate = _this.map_poi[index].visual; // console.log(_this.map_poi[index].position) _this.leafletMap.setView(_this.map_poi[index].position, 5); return } }) let group_id = krp.get("scene[get(xml.scene)].gid"); let gtitle = krp.get("group[group_"+group_id+"].title") if(gtitle.indexOf("|") >=0){ let res = gtitle.split("|"); this.dibufen = res[0] this.now_title =res[1] }else{ this.dibufen = gtitle this.now_title =gtitle } if($(window).width()>900){ this.rhead = this.dibufen.length+this.now_title.length>10?'100%':(this.dibufen.length+this.now_title.length)*16+10+'px' }else{ this.rhead = this.dibufen.length+this.now_title.length>10?'100%':(this.dibufen.length+this.now_title.length)*0.4+'rem' } if(krp.get("scene[get(xml.scene)].bgmusic")){ this.open_muic = true; }else{ this.open_muic = false; } _this.toggle_group2 = null _this.toggle_group1 = null _this.toggle_group3 = null; _this.toggle_group = null this.right_list.forEach(function(item){ if(item.id == group_id){ if(item.child.length > 1){ _this.toggle_group1 = group_id; console.log("ddd",view_id) console.log("fff",krp.get("scene[get(xml.scene)].parent_id")) console.log("eee",krp.get("scene[get(xml.scene)].son_str")) if(krp.get("scene[get(xml.scene)].parent_id") != 0){ _this.toggle_group2 = krp.get("scene[get(xml.scene)].parent_id"); console.log("uuu",view_id) setTimeout(function(){ _this.toggle_group3 = view_id; _this.toggle_group = view_id; },100) }else{ // if(!krp.get("scene[get(xml.scene)].son_str")) console.log("iii",view_id) _this.toggle_group2 = view_id; _this.toggle_group = view_id; } } return } }) if($(window).width()<=900){ this.right_menu_open = false } }, //初始化沙盘 init_map: function() { let plan = krp.get("Plan[sandpics]"); if(!plan) return; let img_height = plan.w / 100; let img_width = -plan.h / 100; let url = plan.pic; var corner1 = L.latLng(0, 0); //设置左上角经纬度 var corner2 = L.latLng(img_width, img_height); //设置右下点经纬度 var bounds = L.latLngBounds(corner1, corner2); //构建视图限制范围/ this.leafletMap = L.map('mapDiv',{ zoomControl:false, attributionControl:false, maxBounds: bounds, }).setView([img_height/2, img_width/2], 5); this.leafletMap.options.minZoom = 3.4; this.leafletMap.options.maxZoom = 7; let imageBounds = [[0, 0], [img_width, img_height]]; L.imageOverlay(url, imageBounds, { opacity :1,zIndex:-1}).addTo(this.leafletMap); for(let i = 0; i < plan.marker.count; i++){ let marker = krp.get("Plan[sandpics].marker["+i+"]") this.map_poi.push({ name : marker.name, view_id : marker.view_id, position:[ -marker.y / 100 , marker.x / 100], visual : marker.visual }) } let _this = this; this.maxMap = L.map('shapan',{ zoomControl:false, attributionControl:false, maxBounds: bounds, }).setView([ -img_height/2,img_width/2], 4.6); this.maxMap.options.minZoom = 4; this.maxMap.options.maxZoom = 7; // max_layer.addTo(this.maxMap); L.imageOverlay(url, [[0, 0], [img_width, img_height]], { opacity :1,zIndex:-1}).addTo(this.maxMap); this.map_poi.forEach(function(element,i) { let html = '
'; let myIcon = L.divIcon({className: '',html:html}); // console.log(element.position) L.marker([element.position[0]-.98,element.position[1]+.2], {icon: myIcon,zIndexOffset:100}).addTo(_this.leafletMap); L.marker([element.position[0]-.98,element.position[1]+.2], {icon: myIcon,zIndexOffset:100}).addTo(_this.maxMap); }); $("#mapDiv").on("click",".point",function(){ let index = $(this).attr("index"); let view_id = _this.map_poi[index].view_id; krp.call("loadscene(scene"+view_id+",null,MERGE,OPENBLEND(1.0, 0.0, 0.2, 0.0, linear))") }) $("#shapan").on("click",".point",function(){ let index = $(this).attr("index"); let view_id = _this.map_poi[index].view_id; krp.call("loadscene(scene"+view_id+",null,MERGE,OPENBLEND(1.0, 0.0, 0.2, 0.0, linear))") }) this.change_scene(); }, embedpano: function(str) { if(krp) return; let panoxml = {},tm = (new Date()).getTime(),path = '/Public/panonn/'; panoxml.onstart = "init(" + replacestr(str) + ")"; let _this = this; embedpano({ swf: "/kuleiman.swf", xml: "/Public/panonn/pano.xml?" + tm, target: "krpano", html5: "auto", wmode: "transparent", initvars: { tm: tm, FilePath: path }, webglsettings: { preserveDrawingBuffer:true, depth:true, stencil:true,}, passQueryParameters: true, vars: panoxml, onready: function (k) { k.set("display.autofullscreen", false); window.krpano = k; krp = k; } }) }, //初始化数据 init_data:function(){ if(krp.get("skin_settings.vrmode") == "true"){ this.openvr = true; }else{ this.openvr = false; } if(krp.get("skin_settings.works_logo")){ this.logo = krp.get("skin_settings.works_logo"); } if(krp.get("skin_settings.full_screen") == "true"){ this.openfull = true; }else{ this.openfull = false; } if(krp.get("skin_settings.opentongji") == "true"){ this.opentongji = true; }else{ this.opentongji = false; } if(krp.get("skin_settings.openzan") == "true"){ this.openzan = true; }else{ this.openzan = false; } if(krp.get("skin_settings.openshare") == "true"){ this.openshare = true; }else{ this.openshare = false; } let _this = this; let g_c = krp.get("group.count"); let s_c = krp.get("scene.count"); let group_data = []; for(let i = 0; i < g_c; i ++){ let a = group_data.push({ "title" : krp.get("group["+i+"].title"), "id" : krp.get("group["+i+"].id"), "child" : [] }); for(let q = 0 ; q < s_c ; q++ ){ if(krp.get("group["+ a - 1 +"].id") == krp.get("scene["+q+"].gid")){ group_data[i].child.push({ "title" : krp.get("scene["+q+"].title"), "id" : krp.get("scene["+q+"].view"), }) } } } /* 初始化综合搜索 */ let right_list = []; for(let i = 0; i < krp.get("group.count"); i++){ this.select_list.push({ title : krp.get("group["+i+"].title").replace("|"," "), id : krp.get("group["+i+"].id"), }) let title , content = ""; if(krp.get("group["+i+"].title").indexOf("|") >=0){ let res = krp.get("group["+i+"].title").split("|"); title = res[0],content = res[1] }else{ title = krp.get("group["+i+"].title") } right_list.push({ id : krp.get("group["+i+"].id"), title : title, content : content, child : [] }) } for(let i = 0; i < krp.get("tabel.count"); i++){ let tab_name = krp.get("tabel["+i+"].name") let scene_id = parseInt(tab_name.replace("tabel_","")); let gid = parseInt(krp.get("scene[scene"+scene_id+"].gid")); for(let k = 0; k < krp.get("tabel["+tab_name+"].item.count"); k++){ let item = krp.get("tabel["+tab_name+"].item["+k+"]"); let id = item.name.replace("hotspottabel"+scene_id,"") if(item.type == 2 || item.type == 3 || item.type == 7 || item.type == 21){ this.all_select_data.push({ type : item.type, name : item.name, url : item.previewcover, scene_id : scene_id, title : item.mtitle, gid : gid, id : id, }) } if(item.type == 4){ let mining = item.mining; let miningar = mining.split("|"); for(let t = 0; t < miningar.length; t++){ let itemui = krp.get("picdata.pic[pic_"+miningar[t]+"]"); this.all_select_data.push({ type : item.type, name : item.name, url : itemui.csrc, scene_id : scene_id, title : itemui.title, gid : gid, id : id, }) } } } } this.set_search_data(1) right_list.forEach(function(item,index){ let data = []; for(let i = 0; i < krp.get("scene.count"); i++){ if(krp.get("scene["+i+"].gid") == item.id && krp.get("scene["+i+"].parent_id") == 0 && krp.get("scene["+i+"].hide") == 0){ data.push({ id : krp.get("scene["+i+"].view"), title : krp.get("scene["+i+"].title"), child : [] }) } } data.forEach(function(item,index){ for(let i = 0; i < krp.get("scene.count"); i++){ if(item.id == krp.get("scene["+i+"].parent_id") && krp.get("scene["+i+"].hide") == 0){ item.child.push({ id : krp.get("scene["+i+"].view"), title : krp.get("scene["+i+"].title"), }) } data[index] = item; } }) right_list[index].child = data }) this.right_list = right_list; var that = this setTimeout(function(){ if(that.right_list[0].child.length<=1){ that.toggle_group = that.right_list[0].id } },100) //浏览量和点赞 $.ajax({ type: "post", url: "/index.php?s=/member/panoapi/addcomment", data: {member_id: member_id, work_id: work_id,"type" : 1}, dataType: "json", success: function (a) { if(a.status == 0){ _this.view_num = a.data.hits; _this.love = a.data.zan; } } }) this.init_map(); }, search_class:function(item,index){ this.action_select_title = index; this.search_data_page.class_id = item.id this.set_search_data(1); }, // 过滤数据 set_search_data:function(p,mobel){ let pp = parseInt(p); if(isNaN(pp)) pp = 1; var data = []; let _this = this if(this.search_data_page.group_id != 0){ this.all_select_data.forEach(function(item,index){ if(item.gid == _this.search_data_page.group_id){ data.push(item) } }) }else{ this.all_select_data.forEach(function(item,index){ data.push(item) }) } if(this.search_data_page.class_id != 0){ let ss = []; data.forEach(function(item,index){ if(item.type == _this.search_data_page.class_id){ ss.push(item) } }) data = ss } if(this.search_data_page.keywork){ let aa = []; for(var i =0; i < data.length; i++){ if(data[i].title.indexOf(this.search_data_page.keywork) >= 0){ aa.push(data[i]) } } data = aa } let page_list = Math.ceil(data.length / this.search_data_page.row); let step_start = 0; let step_end = page_list; if(step_end > 11){ step_end = 11; if(this.search_data_page.page.length){ if(pp > 6){ step_start = pp - 6; step_end = pp + 5; } } } this.search_data_page.page = []; for (let i = step_start; i < step_end && i < page_list; i++) { this.search_data_page.page.push(i + 1); } if(pp > page_list || pp < 1) pp = 1; this.search_data_page.p = pp; let index = (this.search_data_page.p - 1) * this.search_data_page.row; let step = index + this.search_data_page.row; if(!mobel){ this.search_data = []; }else{ this.search_loading = false; } //移动端直接渲染所有数据 //pc端则只渲染一页的 // if(window.screen.width <= 900){ // this.search_data = data; // }else{ for (let i = index; i < step; i++){ if(data[i]){ this.search_data.push(data[i]) }else { break; } } console.log("测试进",index,step,this.search_data) // } }, show_search_close:function(){ this.search_data_page.p = 1; this.search_data_page.page = []; this.search_data_page.class_id = 0; this.search_data_page.group_id = 0; this.action_select_title = 0; this.search_data_page.keywork = ""; this.show_search_dialog = false; this.set_search_data(1); this.select_type = null; this.selwidth = false this.seach_off = false }, search:function(){ this.set_search_data(1) }, //留言分页 mes_goto:function(p){ if (p < 1 || p > this.message.list.arr_length) return; this.message.page = p; this.get_talk(); // this.get_message_list(); }, message_blur:function(ev){ let v = parseInt(ev.target.value); if (isNaN(v)) v = 1; this.mes_goto(v) }, //获取留言 get_message_list:function(){ let _this = this; $("#talk_content_box").empty(); if(this.talk_data.length){ this.message.count = this.talk_data.length; let page_list = Math.ceil(this.message.count / this.message.row); this.message.list = []; for(let i = 0; i < page_list; i++){ this.message.list.push(i + 1); } let index = (this.message.page - 1) * this.message.row; let step = index + this.message.row; this.talk_list = []; for (let i = index; i < step; i++){ if(this.talk_data[i]){ this.talk_list.push(this.talk_data[i]) }else { break; } } } }, //发布留言 post_message:function(){ if(!this.message.shuoshuo){ this.showalert_off("请输入留言",1) return } if(!this.message.nickname){ this.showalert_off("请输入昵称",1) return } let _this = this; $.ajax({ type: "post", url: "/index.php?s=/member/panoapi/addmessage", data: { member_id: member_id, work_id: work_id, name : this.message.nickname, view_id: krp.get("scene[get(xml.scene)].view"), comment_content : this.message.shuoshuo }, dataType: "json", success:function (a){ if(a.status == 0){ /* _this.talk_data.push({ name : _this.message.nickname, comment_content : _this.message.shuoshuo }) _this.get_message_list() */ _this.showalert_off("留言提交成功,请耐心等待审核",0) _this.show_talkme_dialog = false _this.show_talkme2_dialog = true; _this.message.shuoshuo = ""; _this.message.nickname = ""; } } }) }, post_message2:function(){ this.show_talkme2_dialog = false this.show_talk_dialog = true }, //添加弹幕方法 add_talk: function(text) { $("#talk_content_box").append("
"+text+"
"); if ($("#talk_content_box .talk_item").length > 7) { $("#talk_content_box .talk_item")[0].remove(); } let talk_length = $("#talk_content_box .talk_item").length; for(let i = 0;i900){ this.showalert.text=val this.showalert.showalerttype = type this.showalert.showalertfn = true clearInterval(this.showalert.alertimer) this.showalert.alertimer = setInterval(() => { _this.showalert.showalertfn = false }, 4000); }else{ if(type){ this.showalert.text=val this.showalert.showalerttype = type this.showalert.showalertfn_m = true } } }, showfn:function(type){ if(!type){ this.showalert.showalertfn_m = false this.show_talk_dialog = true; }else{ this.showalert.showalertfn_m = false } }, //分享开启 toggle_share: function() { this.share_index = 0; makeqrcode(window.location.href); this.show_share_dialog = true; }, //综合搜索 //点击综合搜索左上角切换搜索分类的下拉框 change_search_type: function(item,i) { this.seach_off = true this.search_data_page.group_id = parseInt(item.id); this.set_search_data(1); this.select_type = item; this.selwidth = this.select_type.title.length>10?true:false }, seach_offclose:function(){ this.seach_off = false this.selwidth = false this.search_data_page.p = 1; this.search_data_page.page = []; this.search_data_page.class_id = 0; this.search_data_page.group_id = 0; this.action_select_title = 0; this.search_data_page.keywork = ""; this.set_search_data(1); this.select_type = null; }, search_click:function(item){ let host = krp.get("tabel[tabel_"+item.scene_id+"].item["+item.name+"]"); this.show_search_dialog = false let scenename = "scene"+item.scene_id; if(host.hotspottype == 2 && host.coord_group){ let coord = host.coord_group.split("$"); let atv,ath; [atv,ath] = coord[0].split("|") host.ath = ath host.atv = atv } if(krp.get("xml.scene") == scenename){ // //nexttick(get(hotspot["+item.name+"].onclick)) krp.call("lookto("+host.ath+","+host.atv+",40);hotspot["+item.name+"].triggerevent(onclick)") }else{ let vars = "view.hlookat=" + host.ath + "&view.vlookat=" + host.atv + "&" + "view.fov=40"; // console.log(vars) krp.call("loadscene("+scenename+","+vars+",MERGE,OPENBLEND(1.0, 0.0, 0.2, 0.0, linear),sceneafter('"+item.name+"'))"); } this.seach_off = false this.search_data_page.p = 1; this.search_data_page.page = []; this.search_data_page.class_id = 0; this.search_data_page.group_id = 0; this.action_select_title = 0; this.search_data_page.keywork = ""; this.set_search_data(1); this.select_type = null; }, del_keyword:function(){ this.search_data_page.keywork = ''; this.set_search_data(1) }, select_go_page: function(num,mobel) { if(mobel){//如果是移动端则判断是否加载 if(this.search_loading){ return }else{ this.search_loading = true; this.set_search_data(num,true) } }else{ this.set_search_data(num) } }, toggle_right_group1: function (item,ele) { this.toggle_group = item.id if(item.child.length > 1){ this.toggle_group1 = (this.toggle_group1 == item.id ? null : item.id); }else{ if(item.child.length > 0) { krp.call("loadscene(scene"+item.child[0].id+",null,MERGE,OPENBLEND(1.0, 0.0, 0.2, 0.0, linear))") } } }, toggle_right_group2: function (item) { this.toggle_group = item.id if(item.child.length >= 1){ this.toggle_group2 = (this.toggle_group2 == item.id ? null : item.id); }else{ if(item.child.length == 0){ this.toggle_group2 = item.id; } krp.call("loadscene(scene"+item.id+",null,MERGE,OPENBLEND(1.0, 0.0, 0.2, 0.0, linear))") } }, toggle_right_group3: function (item) { krp.call("loadscene(scene"+item.id+",null,MERGE,OPENBLEND(1.0, 0.0, 0.2, 0.0, linear))") $(".child_list2.active").removeAttr("style", ""); $(".child_list2[item_id='" + item.id + "']").css("width", $(".child_list2[item_id='" + item.id + "'] .item").width() + 20 + 'px'); //动态获取点击的style this.toggle_group3 = (this.toggle_group3 == item.id ? null : item.id); this.toggle_group = item.id }, toggle_right_off:function(){ if($(window).width()<=900){ this.right_menu_open = false } }, toggle_right_group: function(id) { this.active_right_group = (this.active_right_group == id ? null : id); }, close_all_dialog:function(){ this.right_menu_open = false; this.show_search_dialog = false; this.show_select_list = false; this.show_talk_dialog = false; this.show_share_dialog = false; }, // 沙盘 toggle_sand: function () { var _this = this; this.show_sand_dialog = true; $("#shapan").css('opacity',0) setTimeout(function(){ _this.maxMap.invalidateSize(true); $("#shapan").css('opacity',1) },100); }, onpreview: function () { this.onshowpro = false this.start_guid(); }, onmessage: function () { this.show_talk_dialog = false this.show_talkme_dialog = true }, toggle_mobel_share: function () { krp.call("removeCurrentpot"); let _this=this; setTimeout(function (){ clearInterval(_this.timer) _this.onshowpro = false _this.mobel_share_dialog = true; krp.call("makescreenshot") $(".eq").empty().qrcode({ width: 70, height:70, text: window.location.href }); var image = new Image(); // 指定格式 PNG 图片后缀可自定义 image.src = document.getElementById("sh_code").getElementsByTagName("canvas")[0].toDataURL("image/png"); // console.log(image.src) $(".eq").html(image) html2canvas(document.body,{useCORS: true}).then( function (canvas) { $(".touch_loding").remove(); var imgData = canvas.toDataURL(); console.log(imgData) image.src = imgData $(".eq").addClass("trn") $(".eq").html(image) _this.showalert.text="长按图片进行分享或保存" _this.showalert.showalerttype = 2 _this.showalert.showalertfn = true clearInterval(_this.showalert.alertimer) _this.showalert.alertimer = setInterval(() => { _this.showalert.showalertfn = false }, 4000); }); },100) }, toggle_mobel_share_off: function () { this.onshowpro = true this.mobel_share_dialog = false $(".eq").removeClass("trn") krp.call("loadHots") this.showalert.showalertfn = false }, share_apps:function(ty){ let share_data = {}; share_data.title = document.title share_data.description = document.getElementsByTagName('meta')['Description'].getAttribute("content") share_data.summary = share_data.description; share_data.image = krp.get("skin_settings.zpt").startsWith("http") ? krp.get("skin_settings.zpt") : "http:"+krp.get("skin_settings.zpt") if(this.share_index == 0){ share_data.url = window.location.href; }else{ share_data.url = window.location.href + '?scenename=' + krp.get("xml.scene"); } var t = share_tmp(share_data); window.location.href = t[ty] }, //开始导览 start_guid:function(){ this.uistatus = false; this.mobe_onshowpro = true this.guid_pause = true this.guid_play = false guide_start(); }, pause_guid:function(){ krpano.call("change_rotate(false)"); krpano.call("togglesound(guide_music);"); this.guid_pause = false this.guid_play = true }, resume_guid:function(){ let fov=krpano.get("scene[get(xml.scene)].fov"); let now_fov=krpano.get("view.fov"); if(fov!=now_fov){ krpano.call("tween(view.fov, "+fov+", .5, easeInOutQuad);"); } krpano.call("change_rotate(true)"); krpano.call("togglesound(guide_music);"); this.guid_pause = true this.guid_play = false }, onpreviewoff: function (t) { this.uistatus = true; this.guid_pause = true this.guid_play = false this.onshowpro = true this.mobe_onshowpro = false guide_end(); }, }, watch:{ show_search_dialog(value){ if(value){ this.set_search_data(1); } }, share_index:function(value){ if(value == 0){ makeqrcode(window.location.href); }else{ makeqrcode(window.location.href + '?scenename=' + krp.get("xml.scene")); } }, right_menu_open:function(data){ if(data){ this.leafletMap.invalidateSize(true); } }, } })