Tea.context(function () { if (typeof this.keywordInput == "undefined") { this.keywordInput = ""; } if (typeof this.keyword == "undefined") { this.keyword = ""; } if (typeof this.domains == "undefined") { this.domains = []; } this.keywordInput = this.keyword; this.doSearch = function () { this.keyword = this.keywordInput.trim(); }; this.clearSearch = function () { this.keywordInput = ""; this.keyword = ""; }; this.filteredDomains = function () { let keyword = this.keyword.trim().toLowerCase(); if (keyword.length == 0) { return this.domains; } return this.domains.filter(function (domain) { let name = (domain.name || "").toLowerCase(); return name.indexOf(keyword) >= 0; }); }; this.bindDomain = function () { teaweb.popup("/httpdns/apps/domains/createPopup?appId=" + this.app.id, { height: "12em", width: "36em", title: "添加域名", callback: function () { teaweb.success("保存成功", function () { teaweb.reload(); }); } }); }; this.deleteApp = function () { let that = this; teaweb.confirm("确定要删除当前应用吗?", function () { that.$post("/httpdns/apps/delete") .params({ appId: that.app.id }) .success(function () { window.location = "/httpdns/apps"; }); }); }; this.deleteDomain = function (domainId) { let that = this; teaweb.confirm("确定要解绑这个域名吗?", function () { that.$post("/httpdns/apps/domains/delete") .params({ domainId: domainId }) .refresh(); }); }; });