Vue.component("origin-list-box", { props: ["v-primary-origins", "v-backup-origins", "v-server-type", "v-params"], data: function () { return { primaryOrigins: this.vPrimaryOrigins, backupOrigins: this.vBackupOrigins } }, methods: { createPrimaryOrigin: function () { teaweb.popup("/servers/server/settings/origins/addPopup?originType=primary&" + this.vParams, { width: "45em", height: "27em", callback: function (resp) { teaweb.success("保存成功", function () { window.location.reload() }) } }) }, createBackupOrigin: function () { teaweb.popup("/servers/server/settings/origins/addPopup?originType=backup&" + this.vParams, { width: "45em", height: "27em", callback: function (resp) { teaweb.success("保存成功", function () { window.location.reload() }) } }) }, updateOrigin: function (originId, originType) { teaweb.popup("/servers/server/settings/origins/updatePopup?originType=" + originType + "&" + this.vParams + "&originId=" + originId, { width: "45em", height: "27em", callback: function (resp) { teaweb.success("保存成功", function () { window.location.reload() }) } }) }, deleteOrigin: function (originId, originAddr, originType) { let that = this teaweb.confirm("确定要删除此源站(" + originAddr + ")吗?", function () { Tea.action("/servers/server/settings/origins/delete?" + that.vParams + "&originId=" + originId + "&originType=" + originType) .post() .success(function () { teaweb.success("删除成功", function () { window.location.reload() }) }) }) }, updateOriginIsOn: function (originId, originAddr, isOn) { let message let resultMessage if (isOn) { message = "确定要启用此源站(" + originAddr + ")吗?" resultMessage = "启用成功" } else { message = "确定要停用此源站(" + originAddr + ")吗?" resultMessage = "停用成功" } let that = this teaweb.confirm(message, function () { Tea.action("/servers/server/settings/origins/updateIsOn?" + that.vParams + "&originId=" + originId + "&isOn=" + (isOn ? 1 : 0)) .post() .success(function () { teaweb.success(resultMessage, function () { window.location.reload() }) }) }) } }, template: `

主要源站 [添加主要源站]

暂时还没有主要源站。

备用源站 [添加备用源站]

暂时还没有备用源站。

` }) Vue.component("origin-list-table", { props: ["v-origins", "v-origin-type"], data: function () { let hasMatchedDomains = false let origins = this.vOrigins if (origins != null && origins.length > 0) { origins.forEach(function (origin) { if (origin.domains != null && origin.domains.length > 0) { hasMatchedDomains = true } }) } return { hasMatchedDomains: hasMatchedDomains } }, methods: { deleteOrigin: function (originId, originAddr) { this.$emit("delete-origin", originId, originAddr, this.vOriginType) }, updateOrigin: function (originId) { this.$emit("update-origin", originId, this.vOriginType) }, updateOriginIsOn: function (originId, originAddr, isOn) { this.$emit("update-origin-is-on", originId, originAddr, isOn) } }, template: `
源站地址 权重 状态 操作
{{origin.addr}}  
对象存储 {{origin.name}} 证书 主机名: {{origin.host}} 端口跟随 HTTP/2 匹配: {{domain}} 匹配: 所有域名
{{origin.weight}} 修改   停用启用   删除
` })