// 认证设置 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) that.change() }, 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) this.change() }, methodName: function (methodType) { switch (methodType) { case "basicAuth": return "BasicAuth" case "subRequest": return "子请求" case "typeA": return "URL鉴权A" case "typeB": return "URL鉴权B" case "typeC": return "URL鉴权C" case "typeD": return "URL鉴权D" } return "" }, change: function () { let that = this setTimeout(function () { // 延时通知,是为了让表单有机会变更数据 that.$emit("change", this.authConfig) }, 100) } }, template: `
启用鉴权

鉴权方式

名称 鉴权方法 参数 状态 操作
{{ref.authPolicy.name}} {{methodName(ref.authPolicy.type)}} {{ref.authPolicy.params.users.length}}个用户 [{{ref.authPolicy.params.method}}] {{ref.authPolicy.params.url}} {{ref.authPolicy.params.signParamName}}/有效期{{ref.authPolicy.params.life}}秒 有效期{{ref.authPolicy.params.life}}秒 有效期{{ref.authPolicy.params.life}}秒 {{ref.authPolicy.params.signParamName}}/{{ref.authPolicy.params.timestampParamName}}/有效期{{ref.authPolicy.params.life}}秒
扩展名:{{ext}} 域名:{{domain}}
修改   删除
` })