// 认证设置 Vue.component("http-auth-config-box", { props: ["v-auth-config", "v-is-location"], data: function () { let authConfig = this.vAuthConfig if (authConfig == null) { authConfig = { isPrior: false, isOn: false } } if (authConfig.policyRefs == null) { authConfig.policyRefs = [] } return { authConfig: authConfig } }, methods: { isOn: function () { return (!this.vIsLocation || this.authConfig.isPrior) && this.authConfig.isOn }, add: function () { let that = this teaweb.popup("/servers/server/settings/access/createPopup", { callback: function (resp) { that.authConfig.policyRefs.push(resp.data.policyRef) }, height: "28em" }) }, update: function (index, policyId) { let that = this teaweb.popup("/servers/server/settings/access/updatePopup?policyId=" + policyId, { callback: function (resp) { teaweb.success("保存成功", function () { teaweb.reload() }) }, height: "28em" }) }, remove: function (index) { this.authConfig.policyRefs.$remove(index) }, methodName: function (methodType) { switch (methodType) { case "basicAuth": return "BasicAuth" case "subRequest": return "子请求" } return "" } }, template: `
启用认证

认证方式

名称 认证方法 参数 状态 操作
{{ref.authPolicy.name}} {{methodName(ref.authPolicy.type)}} {{ref.authPolicy.params.users.length}}个用户 [{{ref.authPolicy.params.method}}] {{ref.authPolicy.params.url}} 修改   删除
` })