diff --git a/public/components/frame/nav2/nav2.js b/public/components/frame/nav2/nav2.js index 3375a7091..11d49f3ec 100644 --- a/public/components/frame/nav2/nav2.js +++ b/public/components/frame/nav2/nav2.js @@ -209,28 +209,7 @@ }, _navJumpToIot: function () { //获取用户名 - let param = { - params:{ - targetUrl: '/', - communityId:vc.getCurrentCommunity().communityId - } - }; - //发送get请求 - vc.http.apiGet('/iot.getIotToken', - param, - function (json, res) { - let _json = JSON.parse(json); - if (_json.code != 0) { - vc.toast(_json.msg); - return; - } - let _url = _json.data.url; - window.open(_url); - }, - function () { - console.log('请求失败处理'); - } - ); + vc.jumpToIot('/'); }, _emitMsg: function (_param) { vm._settingActiveCatalog(_param); diff --git a/public/pages/property/parkingAreaManage/parkingAreaManage.js b/public/pages/property/parkingAreaManage/parkingAreaManage.js index 62d3a0107..cf972b482 100644 --- a/public/pages/property/parkingAreaManage/parkingAreaManage.js +++ b/public/pages/property/parkingAreaManage/parkingAreaManage.js @@ -136,32 +136,7 @@ vc.jumpToPage('/#/pages/property/parkingAreaText?paId=' + _parkingArea.paId) }, _openParkingAreaTotalControl: function (_parkingArea) { - - //获取用户名 - let param = { - params:{ - targetUrl: encodeURIComponent('/#/pages/car/parkingAreaTotalControl?paId=' + _parkingArea.paId), - communityId:vc.getCurrentCommunity().communityId - } - }; - //发送get请求 - vc.http.apiGet('/iot.getIotToken', - param, - function (json, res) { - let _json = JSON.parse(json); - if (_json.code != 0) { - vc.toast(_json.msg); - return; - } - let _url = _json.data.url; - window.open(_url); - }, - function () { - console.log('请求失败处理'); - } - ); - - //vc.jumpToPage('/#/pages/property/parkingAreaTotalControl?paId=' + _parkingArea.paId); + vc.jumpToIot('/#/pages/car/parkingAreaTotalControl?paId=' + _parkingArea.paId); } } }); diff --git a/public/pages/property/parkingBoxManage/parkingBoxManage.js b/public/pages/property/parkingBoxManage/parkingBoxManage.js index 16716a846..178b8def1 100644 --- a/public/pages/property/parkingBoxManage/parkingBoxManage.js +++ b/public/pages/property/parkingBoxManage/parkingBoxManage.js @@ -91,32 +91,7 @@ vc.jumpToPage('/#/pages/property/parkingBoxAreaManage?boxId=' + _parkingBox.boxId + "&boxName=" + _parkingBox.boxName); }, _openParkingAreaControl: function (_parkingBox) { - //vc.jumpToPage('/#/pages/property/parkingAreaControl?boxId=' + _parkingBox.boxId + "&paId=" + _parkingBox.paId); - - //获取用户名 - let param = { - params:{ - targetUrl: encodeURIComponent('/#/pages/car/parkingAreaControl?boxId=' + _parkingBox.boxId + "&paId=" + _parkingBox.paId), - communityId:vc.getCurrentCommunity().communityId - - } - }; - //发送get请求 - vc.http.apiGet('/iot.getIotToken', - param, - function (json, res) { - let _json = JSON.parse(json); - if (_json.code != 0) { - vc.toast(_json.msg); - return; - } - let _url = _json.data.url; - window.open(_url); - }, - function () { - console.log('请求失败处理'); - } - ); + vc.jumpToIot('/#/pages/property/parkingAreaControl?boxId=' + _parkingBox.boxId + "&paId=" + _parkingBox.paId); } } }); diff --git a/public/vcCore/vcFramework.js b/public/vcCore/vcFramework.js index 2bc7f0b9d..1ff7391bb 100644 --- a/public/vcCore/vcFramework.js +++ b/public/vcCore/vcFramework.js @@ -1301,7 +1301,6 @@ //绑定跳转函数 vcFramework.jumpToPage = function (url) { //判断 url 的模板是否 和当前url 模板一个 - console.log('jumpToPage', url); if (url.indexOf('#') < 0) { window.location.href = url; return; @@ -1320,6 +1319,57 @@ //vcFramework.reBuilderVcTree(); }; + //跳转至物联网 + vcFramework.jumpToIot = function (url) { + let param = { + params:{ + targetUrl: encodeURIComponent(url), + communityId:vc.getCurrentCommunity().communityId + } + }; + //发送get请求 + vc.http.apiGet('/iot.getIotToken', + param, + function (json, res) { + let _json = JSON.parse(json); + if (_json.code != 0) { + vc.toast(_json.msg); + return; + } + let _url = _json.data.url; + window.open(_url); + }, + function () { + console.log('请求失败处理'); + } + ); + }; + //跳转至物联网 + vcFramework.jumpToPlugin = function (url) { + let param = { + params:{ + targetUrl: encodeURIComponent(url), + communityId:vc.getCurrentCommunity().communityId + } + }; + //发送get请求 + vc.http.apiGet('/plugin.getPluginToken', + param, + function (json, res) { + let _json = JSON.parse(json); + if (_json.code != 0) { + vc.toast(_json.msg); + return; + } + let _url = _json.data.url; + window.open(_url); + }, + function () { + console.log('请求失败处理'); + } + ); + }; + refreshVcFramework = function () { $that.$destroy(); let _vmOptions = {