var spaceConsole = {}; /** * 回收TOKEN * @param {Object} removeUrl url * @param {Object} param tokenList */ spaceConsole.recycleToken = function (removeUrl, param) { $.ajax({ type: "post", url: removeUrl, async: true, data: param }); } /** * 业务程序组件 */ spaceConsole.appWindow = { // 显示 show: function (setting) { if (!this.vaildation(setting)) { this.close(); return; } this.hideBackBtn(); this.winSetting = setting; space.plugin.loading.show(); setting.position = space.utils.isNull(setting.position) ? "bottom" : setting.position; space.vue.$data.appWindow.position = setting.position; // 设置父窗口对象 this.windowMap.set(space.vue.$data.appWindow.index, setting); // 解析 param if (setting.param) { var keys = Object.keys(setting.param); for (var i = 0; i < keys.length; i++) { setting.url += ("&" + keys[i] + "=" + setting.param[keys[i]]); } } space.vue.$data.appWindow.appWindowTitle = setting.title; space.vue.$data.appWindow.appWindowUrl = setting.url; space.vue.$data.appWindow.isShowAppWindow = true; }, // 判断是否显示返回按钮 autoControlBackBtn: function () { return false; // var appWin = this.getAppWindowObject(); // if (!appWin) { // this.hideBackBtn(); // return false; // } // try { // var laySize = appWin.space.plugin.layer.getLayCount(); // if (laySize == 0) { // this.hideBackBtn(); // } // else { // $("#appWindow-back").show(); // } // } catch (error) { // this.hideBackBtn(); // console.error(" autoControlBackBtn Error! " + error); // } }, // 隐藏掉返回按钮 hideBackBtn: function () { $("#appWindow-back").hide(); }, // 关闭 AppWindow 里面的弹出层 closeAppWinLayer: function () { try { var appWin = this.getAppWindowObject(); if (appWin) { appWin.space.plugin.layer.autoClose(); } else { this.autoControlBackBtn(); } } catch (error) { console.log(error); this.close({ type: 'cancel' }); } }, // 获取 APP Window Frame 对象 getAppWindowObject: function () { var appWindowFrame = $("#appWindow-iframe"); if (appWindowFrame.length == 0) { return undefined; } return $(appWindowFrame)[0].contentWindow; }, // 获取父窗口对象 getAppWinParentWin: function () { var winSetting = this.windowMap.get(space.vue.$data.appWindow.index); return winSetting == undefined ? undefined : winSetting.parentWin; }, // 取消 cancel: function () { try { var appWin = this.getAppWindowObject(); if (!appWin) { return false; } // 逐一关闭 AppWin 的子页面,最后再关闭 AppWin 窗口 var laySize = appWin.space.plugin.layer.getLayCount(); if (laySize == 0) { this.close({ type: 'cancel' }); } else { this.closeAppWinLayer(); } } catch (error) { console.log(error); this.closeAppWinLayer(); } }, // 关闭,需清理掉 iframe 的 src close: function (params) { var contentWindow = $("#appWindow-iframe")[0].contentWindow; contentWindow.$("body").html("