Former-commit-id: a2273a2c0b6cb246c4d8e8964e6bf15f8afacf9e
master
王兵 5 years ago
parent 6d7e7dcec7
commit 0c39560fd2

@ -514,6 +514,40 @@
onClose: callback onClose: callback
}); });
}, },
boxYes: function (title, message, callback) {
this.$alert(message, title, {
confirmButtonText: '确定'
}).then(function () {
callback ? callback(true) : '';
}).catch(function () {
callback ? callback(false) : '';
});
},
boxYesNo: function (title, message, callback) {
this.$confirm(message, title, {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(function () {
callback ? callback(true) : '';
}).catch(function () {
callback ? callback(false) : '';
});
},
boxInput: function (title, message, callback) {
this.$prompt(message, title, {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(function (value) {
callback ? callback(value.value) : '';
}).catch(function () {
});
},
boxHtml: function (title, html) {
this.$alert(html, title, {
dangerouslyUseHTMLString: true
});
},
// 本标签打开 // 本标签打开
toOpen: function (url) { toOpen: function (url) {
this.tipShow(); this.tipShow();
@ -535,7 +569,7 @@
location.href = this.context + "/" location.href = this.context + "/"
}, },
// 打开一个新Tab // 打开一个新Tab
toOpenTab: function (tab) { tabOpen: function (tab) {
if (window.index) { if (window.index) {
window.index.addTab(tab) window.index.addTab(tab)
} else if (window.parent.index) { } else if (window.parent.index) {
@ -543,7 +577,7 @@
} }
}, },
// 关闭Tab // 关闭Tab
toCloseTab: function (tabName) { tabClose: function (tabName) {
if (window.index) { if (window.index) {
window.index.removeTab(tabName) window.index.removeTab(tabName)
} else if (window.parent.index) { } else if (window.parent.index) {
@ -551,42 +585,15 @@
} }
}, },
// 关闭当前Tab // 关闭当前Tab
toCloseCurTab: function () { tabCloseCur: function () {
if (window.index) { if (window.index) {
window.index.removeTab(window.index.activeTabName) window.index.removeTab(window.index.activeTabName)
} else if (window.parent.index) { } else if (window.parent.index) {
window.parent.index.removeTab(window.parent.index.activeTabName) window.parent.index.removeTab(window.parent.index.activeTabName)
} }
}, },
// 滚动屏蔽至顶部 // 全屏
scrollToTop: function () { screenFull: function () {
var distance = document.documentElement.scrollTop || document.body.scrollTop;
var step = distance / 10;
(function jump() {
if (distance > 0) {
distance -= step;
window.scrollTo(0, distance);
setTimeout(jump, 10)
}
})();
},
// 控制任一目标滚动到顶部
scrollToTop: function (select) {
var distance = $(select).scrollTop();
var step = distance / 10;
(function jump() {
if (distance > 0) {
distance -= step;
$(select).scrollTop(distance);
setTimeout(jump, 10)
} else {
$(select).scrollTop(distance);
}
})();
},
setFullScreen: function () {
var el = document.documentElement; var el = document.documentElement;
var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullScreen; var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullScreen;
@ -601,7 +608,8 @@
} }
} }
}, },
cancelFullScreen: function () { // 取消全屏
screenNotFull: function () {
var el = document; var el = document;
var cfs = el.cancelFullScreen || el.webkitCancelFullScreen || el.mozCancelFullScreen || el.exitFullScreen; var cfs = el.cancelFullScreen || el.webkitCancelFullScreen || el.mozCancelFullScreen || el.exitFullScreen;
@ -616,24 +624,22 @@
} }
} }
}, },
// 添加Cookie
setCookie: function (name, value, expiretime) { setCookie: function (name, value, expiretime) {
var exdate = new Date(); var exdate = new Date();
exdate.setDate(exdate.getTime() + expiretime); exdate.setDate(exdate.getTime() + expiretime);
document.cookie = name + "=" + encodeURIComponent(value) + ";expires=" + exdate.toGMTString() + ";path=/"; document.cookie = name + "=" + encodeURIComponent(value) + ";expires=" + exdate.toGMTString() + ";path=/";
}, },
// 获取Cookie
getCookie: function (name) { getCookie: function (name) {
if (document.cookie.length > 0) { var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
c_start = document.cookie.indexOf(name + "=") if (arr = document.cookie.match(reg)) {
if (c_start != -1) { return decodeURIComponent(arr[2]);
c_start = c_start + name.length + 1 } else {
c_end = document.cookie.indexOf(";", c_start) return "";
if (c_end == -1)
c_end = document.cookie.length
return decodeURIComponent(document.cookie.substring(c_start, c_end))
}
} }
return ""
}, },
// 删除Cookie
clearCookie: function (name) { clearCookie: function (name) {
this.setCookie(name, "", -1); this.setCookie(name, "", -1);
} }

@ -380,6 +380,8 @@
onCommand: function (cmd) { onCommand: function (cmd) {
switch (cmd) { switch (cmd) {
case "logout": case "logout":
nav.boxYesNo("注销提示", "是否注销当前登录账户?" ,function (result) {
if (result){
new Ajax("system", "User").method("logout").post({}, function (response) { new Ajax("system", "User").method("logout").post({}, function (response) {
if (response.errors.length > 0) { if (response.errors.length > 0) {
nav.e(response.errors[0].message); nav.e(response.errors[0].message);
@ -388,6 +390,8 @@
nav.toOpen("/login.htm"); nav.toOpen("/login.htm");
} }
}.bind(this)); }.bind(this));
}
}.bind(this))
break; break;
default: default:
nav.w("未找到对应的命令"); nav.w("未找到对应的命令");
@ -397,9 +401,9 @@
switchFullScreen:function(){ switchFullScreen:function(){
this.prop.full = !this.prop.full; this.prop.full = !this.prop.full;
if (this.prop.full) { if (this.prop.full) {
nav.setFullScreen() nav.screenFull()
} else { } else {
nav.cancelFullScreen() nav.screenNotFull()
} }
} }
}, },
@ -408,9 +412,9 @@
mounted: function () { mounted: function () {
this.onHome();//页面初始好后打开首页 this.onHome();//页面初始好后打开首页
if (this.prop.full) { if (this.prop.full) {
nav.setFullScreen() nav.screenFull()
} else { } else {
nav.cancelFullScreen() nav.screenNotFull()
} }
}, },
watch: {} watch: {}

@ -281,6 +281,9 @@
nav.e(response.errors[0].message); nav.e(response.errors[0].message);
} else { } else {
this.treeData = response.result; this.treeData = response.result;
for (var i = 0; i < response.result.length; i++) {
this.treeData[i].disabled = this.treeData[i].free;
}
} }
}.bind(this)) }.bind(this))
}, },

Loading…
Cancel
Save

Powered by TurnKey Linux.