|
@@ -1,409 +1,380 @@
|
|
|
//管理js文件 获取modeldata.js 判断是否有特殊的字段,如果有就先加载SpecialScene.js 里面有对特殊场景处理的代码 否则就直接加载main
|
|
//管理js文件 获取modeldata.js 判断是否有特殊的字段,如果有就先加载SpecialScene.js 里面有对特殊场景处理的代码 否则就直接加载main
|
|
|
-var Manage = function(){
|
|
|
|
|
- this.weixinURL = "https://res.wx.qq.com/open/js/jweixin-1.2.0.js",
|
|
|
|
|
- this.time = "?"+new Date().getTime();
|
|
|
|
|
- this.loadAudio();
|
|
|
|
|
- this.loadWeixin();
|
|
|
|
|
|
|
+var Manage = function () {
|
|
|
|
|
+ ;(this.weixinURL = 'https://res.wx.qq.com/open/js/jweixin-1.2.0.js'), (this.time = '?' + new Date().getTime())
|
|
|
|
|
+ this.loadAudio()
|
|
|
|
|
+ this.loadWeixin()
|
|
|
}
|
|
}
|
|
|
//动态加载js文件
|
|
//动态加载js文件
|
|
|
-Manage.prototype.LoadJs = function(_files, succes){
|
|
|
|
|
- /* 已加载文件缓存列表,用于判断文件是否已加载过,若已加载则不再次加载*/
|
|
|
|
|
- var classcodes = [];
|
|
|
|
|
- var FileArray = [];
|
|
|
|
|
- if (typeof _files === "object") {
|
|
|
|
|
- FileArray = _files;
|
|
|
|
|
- } else {
|
|
|
|
|
- /*如果文件列表是字符串,则用,切分成数组*/
|
|
|
|
|
- if (typeof _files === "string") {
|
|
|
|
|
- FileArray = _files.split(",");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+Manage.prototype.LoadJs = function (_files, succes) {
|
|
|
|
|
+ /* 已加载文件缓存列表,用于判断文件是否已加载过,若已加载则不再次加载*/
|
|
|
|
|
+ var classcodes = []
|
|
|
|
|
+ var FileArray = []
|
|
|
|
|
+ if (typeof _files === 'object') {
|
|
|
|
|
+ FileArray = _files
|
|
|
|
|
+ } else {
|
|
|
|
|
+ /*如果文件列表是字符串,则用,切分成数组*/
|
|
|
|
|
+ if (typeof _files === 'string') {
|
|
|
|
|
+ FileArray = _files.split(',')
|
|
|
}
|
|
}
|
|
|
- if (FileArray != null && FileArray.length > 0) {
|
|
|
|
|
- var LoadedCount = 0;
|
|
|
|
|
- for (var i = 0; i < FileArray.length; i++) {
|
|
|
|
|
- loadFile(FileArray[i], function() {
|
|
|
|
|
- LoadedCount++;
|
|
|
|
|
- if (LoadedCount == FileArray.length) {
|
|
|
|
|
- try {
|
|
|
|
|
- succes();
|
|
|
|
|
- }
|
|
|
|
|
- catch(err) {
|
|
|
|
|
- console.log("err: 您未定义回调");
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ if (FileArray != null && FileArray.length > 0) {
|
|
|
|
|
+ var LoadedCount = 0
|
|
|
|
|
+ for (var i = 0; i < FileArray.length; i++) {
|
|
|
|
|
+ loadFile(FileArray[i], function () {
|
|
|
|
|
+ LoadedCount++
|
|
|
|
|
+ if (LoadedCount == FileArray.length) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ succes()
|
|
|
|
|
+ } catch (err) {
|
|
|
|
|
+ console.log('err: 您未定义回调')
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
- /*加载JS文件,url:文件路径,success:加载成功回调函数*/
|
|
|
|
|
- function loadFile(url, success) {
|
|
|
|
|
- if (!FileIsExt(classcodes, url)) {
|
|
|
|
|
- var _ThisType = GetFileType(url);
|
|
|
|
|
- var ThisType = _ThisType.indexOf("?") == -1 ? _ThisType : _ThisType.substring(0,_ThisType.indexOf("?"));
|
|
|
|
|
- var fileObj = null;
|
|
|
|
|
- if (ThisType == ".js") {
|
|
|
|
|
- fileObj = document.createElement('script');
|
|
|
|
|
- fileObj.src = url;
|
|
|
|
|
- } else if (ThisType == ".css") {
|
|
|
|
|
- fileObj = document.createElement('link');
|
|
|
|
|
- fileObj.href = url;
|
|
|
|
|
- fileObj.type = "text/css";
|
|
|
|
|
- fileObj.rel = "stylesheet";
|
|
|
|
|
- } else if (ThisType == ".less") {
|
|
|
|
|
- fileObj = document.createElement('link');
|
|
|
|
|
- fileObj.href = url;
|
|
|
|
|
- fileObj.type = "text/css";
|
|
|
|
|
- fileObj.rel = "stylesheet/less";
|
|
|
|
|
- }
|
|
|
|
|
- success = success || function() {};
|
|
|
|
|
- fileObj.onload = fileObj.onreadystatechange = function() {
|
|
|
|
|
- if (!this.readyState || 'loaded' === this.readyState || 'complete' === this.readyState) {
|
|
|
|
|
- success();
|
|
|
|
|
- classcodes.push(url)
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- document.getElementsByTagName('head')[0].appendChild(fileObj);
|
|
|
|
|
- } else {
|
|
|
|
|
- success();
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ /*加载JS文件,url:文件路径,success:加载成功回调函数*/
|
|
|
|
|
+ function loadFile(url, success) {
|
|
|
|
|
+ if (!FileIsExt(classcodes, url)) {
|
|
|
|
|
+ var _ThisType = GetFileType(url)
|
|
|
|
|
+ var ThisType = _ThisType.indexOf('?') == -1 ? _ThisType : _ThisType.substring(0, _ThisType.indexOf('?'))
|
|
|
|
|
+ var fileObj = null
|
|
|
|
|
+ if (ThisType == '.js') {
|
|
|
|
|
+ fileObj = document.createElement('script')
|
|
|
|
|
+ fileObj.src = url
|
|
|
|
|
+ } else if (ThisType == '.css') {
|
|
|
|
|
+ fileObj = document.createElement('link')
|
|
|
|
|
+ fileObj.href = url
|
|
|
|
|
+ fileObj.type = 'text/css'
|
|
|
|
|
+ fileObj.rel = 'stylesheet'
|
|
|
|
|
+ } else if (ThisType == '.less') {
|
|
|
|
|
+ fileObj = document.createElement('link')
|
|
|
|
|
+ fileObj.href = url
|
|
|
|
|
+ fileObj.type = 'text/css'
|
|
|
|
|
+ fileObj.rel = 'stylesheet/less'
|
|
|
|
|
+ }
|
|
|
|
|
+ success = success || function () {}
|
|
|
|
|
+ fileObj.onload = fileObj.onreadystatechange = function () {
|
|
|
|
|
+ if (!this.readyState || 'loaded' === this.readyState || 'complete' === this.readyState) {
|
|
|
|
|
+ success()
|
|
|
|
|
+ classcodes.push(url)
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
+ document.getElementsByTagName('head')[0].appendChild(fileObj)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ success()
|
|
|
}
|
|
}
|
|
|
- /*获取文件类型,后缀名,小写*/
|
|
|
|
|
- function GetFileType(url) {
|
|
|
|
|
- if (url != null && url.length > 0) {
|
|
|
|
|
- return url.substr(url.lastIndexOf(".")).toLowerCase();
|
|
|
|
|
- }
|
|
|
|
|
- return "";
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ /*获取文件类型,后缀名,小写*/
|
|
|
|
|
+ function GetFileType(url) {
|
|
|
|
|
+ if (url != null && url.length > 0) {
|
|
|
|
|
+ return url.substr(url.lastIndexOf('.')).toLowerCase()
|
|
|
}
|
|
}
|
|
|
- /*文件是否已加载*/
|
|
|
|
|
- function FileIsExt(FileArray, _url) {
|
|
|
|
|
- if (FileArray != null && FileArray.length > 0) {
|
|
|
|
|
- var len = FileArray.length;
|
|
|
|
|
- for (var i = 0; i < len; i++) {
|
|
|
|
|
- if (FileArray[i] == _url) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return ''
|
|
|
|
|
+ }
|
|
|
|
|
+ /*文件是否已加载*/
|
|
|
|
|
+ function FileIsExt(FileArray, _url) {
|
|
|
|
|
+ if (FileArray != null && FileArray.length > 0) {
|
|
|
|
|
+ var len = FileArray.length
|
|
|
|
|
+ for (var i = 0; i < len; i++) {
|
|
|
|
|
+ if (FileArray[i] == _url) {
|
|
|
|
|
+ return true
|
|
|
}
|
|
}
|
|
|
- return false;
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-};
|
|
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
//获取页面url后面的参数
|
|
//获取页面url后面的参数
|
|
|
-Manage.prototype.number = function(variable) {
|
|
|
|
|
- var query = window.location.search.substring(1);
|
|
|
|
|
- var vars = query.split("&");
|
|
|
|
|
- for (var i=0;i<vars.length;i++) {
|
|
|
|
|
- var pair = vars[i].split("=");
|
|
|
|
|
- if(pair[0] == variable){return pair[1];}
|
|
|
|
|
- }
|
|
|
|
|
- return(false);
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
-Manage.prototype.loadWeixin = function() {
|
|
|
|
|
- var that = this;
|
|
|
|
|
- this.LoadJs(that.weixinURL+that.time,function(){ });
|
|
|
|
|
|
|
+Manage.prototype.number = function (variable) {
|
|
|
|
|
+ var query = window.location.search.substring(1)
|
|
|
|
|
+ var vars = query.split('&')
|
|
|
|
|
+ for (var i = 0; i < vars.length; i++) {
|
|
|
|
|
+ var pair = vars[i].split('=')
|
|
|
|
|
+ if (pair[0] == variable) {
|
|
|
|
|
+ return pair[1]
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return false
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
+Manage.prototype.loadWeixin = function () {
|
|
|
|
|
+ var that = this
|
|
|
|
|
+ this.LoadJs(that.weixinURL + that.time, function () {})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-Manage.prototype.loadAudio = function() { //相关:g_tourAudio \ g_playAudio
|
|
|
|
|
- g_bgAudio = new Audio;
|
|
|
|
|
- g_bgAudio.loop = true;
|
|
|
|
|
- g_bgAudio.autoplay = true;
|
|
|
|
|
- g_bgAudio.id = "bgaudio";
|
|
|
|
|
-
|
|
|
|
|
- //https://www.cnblogs.com/interdrp/p/4211883.html 部分资料
|
|
|
|
|
- g_bgAudio.load(); // iOS 9 还需要额外的 load 一下, 否则直接 play 无效
|
|
|
|
|
- var play = function(){
|
|
|
|
|
- //if(window.tourAudioSta) return;
|
|
|
|
|
-
|
|
|
|
|
- this.switchBgmState(true)
|
|
|
|
|
-
|
|
|
|
|
- document.removeEventListener("touchstart",play);
|
|
|
|
|
- document.removeEventListener("click",play);
|
|
|
|
|
- $('#player')[0].removeEventListener("touchstart", play);
|
|
|
|
|
- }.bind(this);
|
|
|
|
|
-
|
|
|
|
|
- g_bgAudio.oncanplay = ()=>{
|
|
|
|
|
|
|
+Manage.prototype.loadAudio = function () {
|
|
|
|
|
+ //相关:g_tourAudio \ g_playAudio
|
|
|
|
|
+ g_bgAudio = new Audio()
|
|
|
|
|
+ g_bgAudio.loop = true
|
|
|
|
|
+ g_bgAudio.autoplay = true
|
|
|
|
|
+ g_bgAudio.id = 'bgaudio'
|
|
|
|
|
+
|
|
|
|
|
+ //https://www.cnblogs.com/interdrp/p/4211883.html 部分资料
|
|
|
|
|
+ g_bgAudio.load() // iOS 9 还需要额外的 load 一下, 否则直接 play 无效
|
|
|
|
|
+ var play = function () {
|
|
|
|
|
+ //if(window.tourAudioSta) return;
|
|
|
|
|
+
|
|
|
|
|
+ this.switchBgmState(true)
|
|
|
|
|
+
|
|
|
|
|
+ document.removeEventListener('touchstart', play)
|
|
|
|
|
+ document.removeEventListener('click', play)
|
|
|
|
|
+ $('#player')[0].removeEventListener('touchstart', play)
|
|
|
|
|
+ }.bind(this)
|
|
|
|
|
+
|
|
|
|
|
+ g_bgAudio.oncanplay = () => {
|
|
|
|
|
+ this.switchBgmState(true)
|
|
|
|
|
+ }
|
|
|
|
|
+ document.addEventListener(
|
|
|
|
|
+ 'WeixinJSBridgeReady',
|
|
|
|
|
+ () => {
|
|
|
|
|
+ this.switchBgmState(true)
|
|
|
|
|
+ },
|
|
|
|
|
+ false
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ document.addEventListener('touchstart', play) //ios需要加个事件才能播放 不能自动播放;如果还有浏览器不行,换成别的交互事件
|
|
|
|
|
+ document.addEventListener('click', play)
|
|
|
|
|
+ $('#player')[0].addEventListener('touchstart', play)
|
|
|
|
|
+ g_bgAudio.addEventListener('ended', () => {
|
|
|
|
|
+ this.switchBgmState(true)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ $('#volume')
|
|
|
|
|
+ .find('a')
|
|
|
|
|
+ .on('click', () => {
|
|
|
|
|
+ if ($('#volume img')[0].src.indexOf('btn_on.png') > -1) {
|
|
|
this.switchBgmState(true)
|
|
this.switchBgmState(true)
|
|
|
|
|
+ } else if ($('#volume img')[0].src.indexOf('btn_off.png') > -1) {
|
|
|
|
|
+ this.switchBgmState(false)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+Manage.prototype.switchBgmState = function (state) {
|
|
|
|
|
+ if (!g_bgAudio || !g_bgAudio.src) return
|
|
|
|
|
+
|
|
|
|
|
+ var played = function () {
|
|
|
|
|
+ console.log('begin play bgm')
|
|
|
|
|
+ g_play = 1
|
|
|
|
|
+ g_playAudio = g_bgAudio
|
|
|
|
|
+ $('#volume a img').attr('src', './images/Volume btn_off.png')
|
|
|
|
|
+ $('#volume').attr('title', '关闭声音')
|
|
|
|
|
+ g_tourAudio && g_tourAudio.pause()
|
|
|
|
|
+ }
|
|
|
|
|
+ var paused = function () {
|
|
|
|
|
+ g_play = 0
|
|
|
|
|
+ g_playAudio == g_bgAudio && (g_playAudio = null)
|
|
|
|
|
+ $('#volume a img').attr('src', './images/Volume btn_on.png')
|
|
|
|
|
+ $('#volume').attr('title', '打开声音')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (state) {
|
|
|
|
|
+ g_bgAudio.play()
|
|
|
|
|
+ if (g_bgAudio.paused) {
|
|
|
|
|
+ paused()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ played()
|
|
|
|
|
+ return true
|
|
|
}
|
|
}
|
|
|
- document.addEventListener("WeixinJSBridgeReady", ()=> {
|
|
|
|
|
- this.switchBgmState(true)
|
|
|
|
|
- }, false);
|
|
|
|
|
-
|
|
|
|
|
- document.addEventListener("touchstart", play);//ios需要加个事件才能播放 不能自动播放;如果还有浏览器不行,换成别的交互事件
|
|
|
|
|
- document.addEventListener("click", play);
|
|
|
|
|
- $('#player')[0].addEventListener("touchstart", play);
|
|
|
|
|
- g_bgAudio.addEventListener('ended', ()=>{
|
|
|
|
|
- this.switchBgmState(true)
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- $("#volume").find("a").on("click", ()=> {
|
|
|
|
|
-
|
|
|
|
|
- if($("#volume img")[0].src.indexOf("btn_on.png")>-1)
|
|
|
|
|
- {
|
|
|
|
|
- this.switchBgmState(true);
|
|
|
|
|
- }
|
|
|
|
|
- else if($("#volume img")[0].src.indexOf("btn_off.png")>-1)
|
|
|
|
|
- {
|
|
|
|
|
- this.switchBgmState(false);
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
-Manage.prototype.switchBgmState = function(state){
|
|
|
|
|
- if(!g_bgAudio || !g_bgAudio.src) return;
|
|
|
|
|
-
|
|
|
|
|
- var played = function(){
|
|
|
|
|
- console.log('begin play bgm');
|
|
|
|
|
- g_play = 1;
|
|
|
|
|
- g_playAudio = g_bgAudio;
|
|
|
|
|
- $("#volume a img").attr("src", "./images/Volume btn_off.png")
|
|
|
|
|
- $("#volume").attr("title", "关闭声音");
|
|
|
|
|
- g_tourAudio && g_tourAudio.pause()
|
|
|
|
|
- }
|
|
|
|
|
- var paused = function(){
|
|
|
|
|
- g_play = 0;
|
|
|
|
|
- g_playAudio == g_bgAudio && (g_playAudio = null)
|
|
|
|
|
- $("#volume a img").attr("src", "./images/Volume btn_on.png")
|
|
|
|
|
- $("#volume").attr("title", "打开声音");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if(state ){
|
|
|
|
|
- g_bgAudio.play();
|
|
|
|
|
- if(g_bgAudio.paused){
|
|
|
|
|
- paused()
|
|
|
|
|
- }else{
|
|
|
|
|
- played()
|
|
|
|
|
- return true
|
|
|
|
|
- }
|
|
|
|
|
- }else{
|
|
|
|
|
- g_bgAudio.pause();
|
|
|
|
|
- paused()
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- g_bgAudio.pauseByHot = false
|
|
|
|
|
- g_bgAudio.pauseByTour = false
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ g_bgAudio.pause()
|
|
|
|
|
+ paused()
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
-Manage.prototype.weixinShare = function() {
|
|
|
|
|
- console.log("weixinShare")
|
|
|
|
|
- $.ajax({
|
|
|
|
|
- url: 'https://www.4dage.com/wechat/jssdk/share/',
|
|
|
|
|
- type: "post",
|
|
|
|
|
- data: {
|
|
|
|
|
- 'uri': location.href.split('#')[0], //当前页面地址
|
|
|
|
|
- 'name': "四维5号" //哪个公众号,对应上方的名称
|
|
|
|
|
- },
|
|
|
|
|
- dataType: "jsonp",
|
|
|
|
|
- jsonpCallback: "success_jsonp",
|
|
|
|
|
- success: function (data, textStatus) {
|
|
|
|
|
- wx.config({
|
|
|
|
|
- debug: false,
|
|
|
|
|
- appId: data.appId,
|
|
|
|
|
- timestamp: data.timestamp,
|
|
|
|
|
- nonceStr: data.nonceStr,
|
|
|
|
|
- signature: data.signature,
|
|
|
|
|
- jsApiList: ['checkJsApi', 'onMenuShareTimeline',
|
|
|
|
|
- 'onMenuShareAppMessage', 'onMenuShareQQ',
|
|
|
|
|
- 'onMenuShareWeibo']
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- error: function (XMLHttpRequest, textStatus, errorThrown) {
|
|
|
|
|
- console.log("jsonp.error:" + textStatus);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- var success_jsonp = function(json){
|
|
|
|
|
- console.log(json);
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- wx.ready(function(){
|
|
|
|
|
- // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行〿
|
|
|
|
|
- //对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中〿
|
|
|
|
|
- //分享到朋友圈
|
|
|
|
|
- console.log(g_weixinObj)
|
|
|
|
|
- wx.onMenuShareTimeline({
|
|
|
|
|
- title: g_weixinObj.title||'', // 分享标题
|
|
|
|
|
- link: g_weixinObj.lineLink||'', // 分享链接
|
|
|
|
|
- imgUrl: g_weixinObj.imgUrl||'', // 分享图标
|
|
|
|
|
- desc: g_weixinObj.desc||''
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- //获取“分享给朋友”按钮点击状态及自定义分享内容接叿
|
|
|
|
|
- wx.onMenuShareAppMessage({
|
|
|
|
|
- title: g_weixinObj.title, // 分享标题
|
|
|
|
|
- desc: g_weixinObj.desc, // 分享描述
|
|
|
|
|
- link: g_weixinObj.lineLink, // 分享链接
|
|
|
|
|
- imgUrl: g_weixinObj.imgUrl, // 分享图标
|
|
|
|
|
- type: '', // 分享类型,music、video或link,不填默认为link
|
|
|
|
|
- dataUrl: '' // 如果type是music或video,则要提供数据链接,默认为空
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- wx.onMenuShareWeibo({
|
|
|
|
|
- title: g_weixinObj.title, // 分享标题
|
|
|
|
|
- desc: g_weixinObj.desc, // 分享描述
|
|
|
|
|
- link: g_weixinObj.lineLink, // 分享链接
|
|
|
|
|
- imgUrl: g_weixinObj.imgUrl, // 分享图标
|
|
|
|
|
- success: function () {
|
|
|
|
|
- // 用户确认分享后执行的回调函数
|
|
|
|
|
- },
|
|
|
|
|
- cancel: function () {
|
|
|
|
|
- // 用户取消分享后执行的回调函数
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- wx.onMenuShareQZone({
|
|
|
|
|
- title: g_weixinObj.title, // 分享标题
|
|
|
|
|
- desc: g_weixinObj.desc, // 分享描述
|
|
|
|
|
- link: g_weixinObj.lineLink, // 分享链接
|
|
|
|
|
- imgUrl: g_weixinObj.imgUrl, // 分享图标
|
|
|
|
|
- success: function () {
|
|
|
|
|
- // 用户确认分享后执行的回调函数
|
|
|
|
|
- },
|
|
|
|
|
- cancel: function () {
|
|
|
|
|
- // 用户取消分享后执行的回调函数
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- wx.onMenuShareQQ({
|
|
|
|
|
- title: g_weixinObj.title, // 分享标题
|
|
|
|
|
- desc: g_weixinObj.desc, // 分享描述
|
|
|
|
|
- link: g_weixinObj.lineLink, // 分享链接
|
|
|
|
|
- imgUrl: g_weixinObj.imgUrl, // 分享图标
|
|
|
|
|
- success: function () {
|
|
|
|
|
- // 用户确认分享后执行的回调函数
|
|
|
|
|
- },
|
|
|
|
|
- cancel: function () {
|
|
|
|
|
- // 用户取消分享后执行的回调函数
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- wx.error(function(res){
|
|
|
|
|
- // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名〿
|
|
|
|
|
-
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ g_bgAudio.pauseByHot = false
|
|
|
|
|
+ g_bgAudio.pauseByTour = false
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-Manage.prototype.dealURL = function(src, type){
|
|
|
|
|
- //music: "///super.4dage.com/data/LYW/edit/20200928_151633415.mp3"
|
|
|
|
|
- //"https://super.4dage.com/data/LYW/edit/20200928_165319399.jpg"]
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- if(window.isLocal && settings.localPrefix!=void 0){//本地将线上的前缀替换
|
|
|
|
|
- var oldPrefixs = ["https://super.4dage.com/", "http://super.4dage.com/", "///super.4dage.com/"]
|
|
|
|
|
- for(let i=0;i<oldPrefixs.length;i++){
|
|
|
|
|
- if(src.includes(oldPrefixs[i])){
|
|
|
|
|
- return src.replace(oldPrefixs[i], settings.localPrefix)
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- console.error("没有找到合适的本地链接")
|
|
|
|
|
- return src
|
|
|
|
|
- }else{
|
|
|
|
|
- return src
|
|
|
|
|
|
|
+Manage.prototype.weixinShare = function () {
|
|
|
|
|
+ console.log('weixinShare')
|
|
|
|
|
+ $.ajax({
|
|
|
|
|
+ url: 'https://www.4dage.com/wechat/jssdk/share/',
|
|
|
|
|
+ type: 'post',
|
|
|
|
|
+ data: {
|
|
|
|
|
+ uri: location.href.split('#')[0], //当前页面地址
|
|
|
|
|
+ name: '四维5号' //哪个公众号,对应上方的名称
|
|
|
|
|
+ },
|
|
|
|
|
+ dataType: 'jsonp',
|
|
|
|
|
+ jsonpCallback: 'success_jsonp',
|
|
|
|
|
+ success: function (data, textStatus) {
|
|
|
|
|
+ wx.config({
|
|
|
|
|
+ debug: false,
|
|
|
|
|
+ appId: data.appId,
|
|
|
|
|
+ timestamp: data.timestamp,
|
|
|
|
|
+ nonceStr: data.nonceStr,
|
|
|
|
|
+ signature: data.signature,
|
|
|
|
|
+ jsApiList: ['checkJsApi', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo']
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ error: function (XMLHttpRequest, textStatus, errorThrown) {
|
|
|
|
|
+ console.log('jsonp.error:' + textStatus)
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ var success_jsonp = function (json) {
|
|
|
|
|
+ console.log(json)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ wx.ready(function () {
|
|
|
|
|
+ // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行〿
|
|
|
|
|
+ //对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中〿
|
|
|
|
|
+ //分享到朋友圈
|
|
|
|
|
+ console.log(g_weixinObj)
|
|
|
|
|
+ wx.onMenuShareTimeline({
|
|
|
|
|
+ title: g_weixinObj.title || '', // 分享标题
|
|
|
|
|
+ link: g_weixinObj.lineLink || '', // 分享链接
|
|
|
|
|
+ imgUrl: g_weixinObj.imgUrl || '', // 分享图标
|
|
|
|
|
+ desc: g_weixinObj.desc || ''
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ //获取“分享给朋友”按钮点击状态及自定义分享内容接叿
|
|
|
|
|
+ wx.onMenuShareAppMessage({
|
|
|
|
|
+ title: g_weixinObj.title, // 分享标题
|
|
|
|
|
+ desc: g_weixinObj.desc, // 分享描述
|
|
|
|
|
+ link: g_weixinObj.lineLink, // 分享链接
|
|
|
|
|
+ imgUrl: g_weixinObj.imgUrl, // 分享图标
|
|
|
|
|
+ type: '', // 分享类型,music、video或link,不填默认为link
|
|
|
|
|
+ dataUrl: '' // 如果type是music或video,则要提供数据链接,默认为空
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ wx.onMenuShareWeibo({
|
|
|
|
|
+ title: g_weixinObj.title, // 分享标题
|
|
|
|
|
+ desc: g_weixinObj.desc, // 分享描述
|
|
|
|
|
+ link: g_weixinObj.lineLink, // 分享链接
|
|
|
|
|
+ imgUrl: g_weixinObj.imgUrl, // 分享图标
|
|
|
|
|
+ success: function () {
|
|
|
|
|
+ // 用户确认分享后执行的回调函数
|
|
|
|
|
+ },
|
|
|
|
|
+ cancel: function () {
|
|
|
|
|
+ // 用户取消分享后执行的回调函数
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ wx.onMenuShareQZone({
|
|
|
|
|
+ title: g_weixinObj.title, // 分享标题
|
|
|
|
|
+ desc: g_weixinObj.desc, // 分享描述
|
|
|
|
|
+ link: g_weixinObj.lineLink, // 分享链接
|
|
|
|
|
+ imgUrl: g_weixinObj.imgUrl, // 分享图标
|
|
|
|
|
+ success: function () {
|
|
|
|
|
+ // 用户确认分享后执行的回调函数
|
|
|
|
|
+ },
|
|
|
|
|
+ cancel: function () {
|
|
|
|
|
+ // 用户取消分享后执行的回调函数
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ wx.onMenuShareQQ({
|
|
|
|
|
+ title: g_weixinObj.title, // 分享标题
|
|
|
|
|
+ desc: g_weixinObj.desc, // 分享描述
|
|
|
|
|
+ link: g_weixinObj.lineLink, // 分享链接
|
|
|
|
|
+ imgUrl: g_weixinObj.imgUrl, // 分享图标
|
|
|
|
|
+ success: function () {
|
|
|
|
|
+ // 用户确认分享后执行的回调函数
|
|
|
|
|
+ },
|
|
|
|
|
+ cancel: function () {
|
|
|
|
|
+ // 用户取消分享后执行的回调函数
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ wx.error(function (res) {
|
|
|
|
|
+ // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名〿
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+Manage.prototype.dealURL = function (src, type) {
|
|
|
|
|
+ //music: "///super.4dage.com/data1/LYW/edit/20200928_151633415.mp3"
|
|
|
|
|
+ //"https://super.4dage.com/data1//LYW/edit/20200928_165319399.jpg"]
|
|
|
|
|
+
|
|
|
|
|
+ if (window.isLocal && settings.localPrefix != void 0) {
|
|
|
|
|
+ //本地将线上的前缀替换
|
|
|
|
|
+ var oldPrefixs = ['https://super.4dage.com/', 'http://super.4dage.com/', '///super.4dage.com/']
|
|
|
|
|
+ for (let i = 0; i < oldPrefixs.length; i++) {
|
|
|
|
|
+ if (src.includes(oldPrefixs[i])) {
|
|
|
|
|
+ return src.replace(oldPrefixs[i], settings.localPrefix)
|
|
|
|
|
+ break
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ console.error('没有找到合适的本地链接')
|
|
|
|
|
+ return src
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return src
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-var manage = new Manage();
|
|
|
|
|
|
|
+var manage = new Manage()
|
|
|
|
|
|
|
|
//公用的函数
|
|
//公用的函数
|
|
|
|
|
|
|
|
-function getQueryVariable(variable)
|
|
|
|
|
-{
|
|
|
|
|
- var query = window.location.search.substring(1);
|
|
|
|
|
- var vars = query.split("&");
|
|
|
|
|
- for (var i=0;i<vars.length;i++) {
|
|
|
|
|
- var pair = vars[i].split("=");
|
|
|
|
|
- if(pair[0] == variable){return pair[1];}
|
|
|
|
|
- }
|
|
|
|
|
- return(false);
|
|
|
|
|
|
|
+function getQueryVariable(variable) {
|
|
|
|
|
+ var query = window.location.search.substring(1)
|
|
|
|
|
+ var vars = query.split('&')
|
|
|
|
|
+ for (var i = 0; i < vars.length; i++) {
|
|
|
|
|
+ var pair = vars[i].split('=')
|
|
|
|
|
+ if (pair[0] == variable) {
|
|
|
|
|
+ return pair[1]
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return false
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//隐藏公司Logo
|
|
//隐藏公司Logo
|
|
|
-function showLogo(){
|
|
|
|
|
- $("#myCompany").hide();
|
|
|
|
|
- $("#loaderCoBrandName").hide();
|
|
|
|
|
- $("#title-logo").hide();
|
|
|
|
|
- $(".title-container").css("justify-content","center")
|
|
|
|
|
|
|
+function showLogo() {
|
|
|
|
|
+ $('#myCompany').hide()
|
|
|
|
|
+ $('#loaderCoBrandName').hide()
|
|
|
|
|
+ $('#title-logo').hide()
|
|
|
|
|
+ $('.title-container').css('justify-content', 'center')
|
|
|
}
|
|
}
|
|
|
//czj 添加随机的时间
|
|
//czj 添加随机的时间
|
|
|
-function randomTime(){
|
|
|
|
|
- return new Date()
|
|
|
|
|
-};
|
|
|
|
|
-function matcher(data){
|
|
|
|
|
- if(!data || !g_version ) return data;
|
|
|
|
|
- delete data.model.vision_version;
|
|
|
|
|
- var _data = {
|
|
|
|
|
- files: {
|
|
|
|
|
- "templates": ["images/images{{number}}/{{filename}}"]
|
|
|
|
|
- },
|
|
|
|
|
- model :{
|
|
|
|
|
- sid :window.number,
|
|
|
|
|
- camera_start:
|
|
|
|
|
- data.model.images && data.model.images.length != 0 ?
|
|
|
|
|
- {
|
|
|
|
|
- camera: {
|
|
|
|
|
- zoom: "-1",
|
|
|
|
|
- quaternion: [
|
|
|
|
|
- JSON.parse(data.model.images[0].metadata).camera_quaternion.z,
|
|
|
|
|
- JSON.parse(data.model.images[0].metadata).camera_quaternion.w,
|
|
|
|
|
- JSON.parse(data.model.images[0].metadata).camera_quaternion.x,
|
|
|
|
|
- JSON.parse(data.model.images[0].metadata).camera_quaternion.y
|
|
|
|
|
- ]
|
|
|
|
|
- },
|
|
|
|
|
- pano: { uuid: JSON.parse(data.model.images[0].metadata).scan_id },
|
|
|
|
|
- mode: "0"
|
|
|
|
|
|
|
+function randomTime() {
|
|
|
|
|
+ return new Date()
|
|
|
|
|
+}
|
|
|
|
|
+function matcher(data) {
|
|
|
|
|
+ if (!data || !g_version) return data
|
|
|
|
|
+ delete data.model.vision_version
|
|
|
|
|
+ var _data = {
|
|
|
|
|
+ files: {
|
|
|
|
|
+ templates: ['images/images{{number}}/{{filename}}']
|
|
|
|
|
+ },
|
|
|
|
|
+ model: {
|
|
|
|
|
+ sid: window.number,
|
|
|
|
|
+ camera_start:
|
|
|
|
|
+ data.model.images && data.model.images.length != 0
|
|
|
|
|
+ ? {
|
|
|
|
|
+ camera: {
|
|
|
|
|
+ zoom: '-1',
|
|
|
|
|
+ quaternion: [
|
|
|
|
|
+ JSON.parse(data.model.images[0].metadata).camera_quaternion.z,
|
|
|
|
|
+ JSON.parse(data.model.images[0].metadata).camera_quaternion.w,
|
|
|
|
|
+ JSON.parse(data.model.images[0].metadata).camera_quaternion.x,
|
|
|
|
|
+ JSON.parse(data.model.images[0].metadata).camera_quaternion.y
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ pano: { uuid: JSON.parse(data.model.images[0].metadata).scan_id },
|
|
|
|
|
+ mode: '0'
|
|
|
}
|
|
}
|
|
|
- : ''
|
|
|
|
|
- },
|
|
|
|
|
- sid: window.number,
|
|
|
|
|
- hoticon: {
|
|
|
|
|
- default: "https://super.4dage.com/images/4dagePoint2.png",
|
|
|
|
|
- higt: "https://super.4dage.com/images/4dagePoint.png"
|
|
|
|
|
- },
|
|
|
|
|
- special: "false",
|
|
|
|
|
- weixinDesc: ""
|
|
|
|
|
- };
|
|
|
|
|
- $.extend(true,data,_data)
|
|
|
|
|
- return data;
|
|
|
|
|
|
|
+ : ''
|
|
|
|
|
+ },
|
|
|
|
|
+ sid: window.number,
|
|
|
|
|
+ hoticon: {
|
|
|
|
|
+ default: 'https://super.4dage.com/images/4dagePoint2.png',
|
|
|
|
|
+ higt: 'https://super.4dage.com/images/4dagePoint.png'
|
|
|
|
|
+ },
|
|
|
|
|
+ special: 'false',
|
|
|
|
|
+ weixinDesc: ''
|
|
|
|
|
+ }
|
|
|
|
|
+ $.extend(true, data, _data)
|
|
|
|
|
+ return data
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function hotMatcher(data){
|
|
|
|
|
- if(!data || !g_version) return data;
|
|
|
|
|
- data.tourAudio = data.audio;
|
|
|
|
|
- return data;
|
|
|
|
|
|
|
+function hotMatcher(data) {
|
|
|
|
|
+ if (!data || !g_version) return data
|
|
|
|
|
+ data.tourAudio = data.audio
|
|
|
|
|
+ return data
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
//兼容一代的場景
|
|
//兼容一代的場景
|
|
|
//請求地址統一管理
|
|
//請求地址統一管理
|
|
|
-var g_onePregix = "https://bigscene.4dage.com/" //对应一代 http://www.4dmodel.com/SuperPanoramic/index.html?m=55
|
|
|
|
|
-var g_version = manage.number("version");
|
|
|
|
|
-g_version === "one" ? g_Prefix = g_onePregix : '';
|
|
|
|
|
-
|
|
|
|
|
|
|
+var g_onePregix = 'https://bigscene.4dage.com/' //对应一代 http://www.4dmodel.com/SuperPanoramic/index.html?m=55
|
|
|
|
|
+var g_version = manage.number('version')
|
|
|
|
|
+g_version === 'one' ? (g_Prefix = g_onePregix) : ''
|