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

@ -514,6 +514,40 @@
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) {
this.tipShow();
@ -535,7 +569,7 @@
location.href = this.context + "/"
},
// 打开一个新Tab
toOpenTab: function (tab) {
tabOpen: function (tab) {
if (window.index) {
window.index.addTab(tab)
} else if (window.parent.index) {
@ -543,7 +577,7 @@
}
},
// 关闭Tab
toCloseTab: function (tabName) {
tabClose: function (tabName) {
if (window.index) {
window.index.removeTab(tabName)
} else if (window.parent.index) {
@ -551,42 +585,15 @@
}
},
// 关闭当前Tab
toCloseCurTab: function () {
tabCloseCur: function () {
if (window.index) {
window.index.removeTab(window.index.activeTabName)
} else if (window.parent.index) {
window.parent.index.removeTab(window.parent.index.activeTabName)
}
},
// 滚动屏蔽至顶部
scrollToTop: 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 () {
// 全屏
screenFull: function () {
var el = document.documentElement;
var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullScreen;
@ -601,7 +608,8 @@
}
}
},
cancelFullScreen: function () {
// 取消全屏
screenNotFull: function () {
var el = document;
var cfs = el.cancelFullScreen || el.webkitCancelFullScreen || el.mozCancelFullScreen || el.exitFullScreen;
@ -616,24 +624,22 @@
}
}
},
// 添加Cookie
setCookie: function (name, value, expiretime) {
var exdate = new Date();
exdate.setDate(exdate.getTime() + expiretime);
document.cookie = name + "=" + encodeURIComponent(value) + ";expires=" + exdate.toGMTString() + ";path=/";
},
// 获取Cookie
getCookie: function (name) {
if (document.cookie.length > 0) {
c_start = document.cookie.indexOf(name + "=")
if (c_start != -1) {
c_start = c_start + name.length + 1
c_end = document.cookie.indexOf(";", c_start)
if (c_end == -1)
c_end = document.cookie.length
return decodeURIComponent(document.cookie.substring(c_start, c_end))
}
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
if (arr = document.cookie.match(reg)) {
return decodeURIComponent(arr[2]);
} else {
return "";
}
return ""
},
// 删除Cookie
clearCookie: function (name) {
this.setCookie(name, "", -1);
}

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

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

Loading…
Cancel
Save

Powered by TurnKey Linux.