From 615e873d0753d31cd77c532e7bcadba34a140a5e Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Sat, 9 Oct 2021 17:30:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=81=E4=B9=A6=E4=B8=8A=E4=BC=A0=E6=97=B6?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E9=80=89=E6=8B=A9=E8=BE=93=E5=85=A5=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/servers/certs/updatePopup.go | 41 +- .../default/servers/certs/uploadPopup.go | 55 +- web/public/js/vue.tea.js | 3385 ++++++++++++----- web/views/@default/servers/certs/index.html | 2 +- web/views/@default/servers/certs/index.js | 4 +- .../@default/servers/certs/updatePopup.html | 11 +- .../@default/servers/certs/updatePopup.js | 5 + .../@default/servers/certs/uploadPopup.html | 11 +- .../@default/servers/certs/uploadPopup.js | 5 + 9 files changed, 2617 insertions(+), 902 deletions(-) diff --git a/internal/web/actions/default/servers/certs/updatePopup.go b/internal/web/actions/default/servers/certs/updatePopup.go index 3ce04410..3a5f1860 100644 --- a/internal/web/actions/default/servers/certs/updatePopup.go +++ b/internal/web/actions/default/servers/certs/updatePopup.go @@ -7,6 +7,7 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs" "github.com/iwind/TeaGo/actions" + timeutil "github.com/iwind/TeaGo/utils/time" ) type UpdatePopupAction struct { @@ -45,6 +46,8 @@ func (this *UpdatePopupAction) RunGet(params struct { func (this *UpdatePopupAction) RunPost(params struct { CertId int64 + TextMode bool + Name string IsCA bool Description string @@ -53,6 +56,9 @@ func (this *UpdatePopupAction) RunPost(params struct { CertFile *actions.File KeyFile *actions.File + CertText string + KeyText string + Must *actions.Must }) { // 创建日志 @@ -82,18 +88,31 @@ func (this *UpdatePopupAction) RunPost(params struct { Field("name", params.Name). Require("请输入证书说明") - if params.CertFile != nil { - certConfig.CertData, err = params.CertFile.Read() - if err != nil { - this.Fail("读取证书文件内容错误,请重新上传") + if params.TextMode { + if len(params.CertText) > 0 { + certConfig.CertData = []byte(params.CertText) } - } - if !params.IsCA { - if params.KeyFile != nil { - certConfig.KeyData, err = params.KeyFile.Read() + if !params.IsCA { + if len(params.KeyText) > 0 { + certConfig.KeyData = []byte(params.KeyText) + } + } + } else { + + if params.CertFile != nil { + certConfig.CertData, err = params.CertFile.Read() if err != nil { - this.Fail("读取密钥文件内容错误,请重新上传") + this.FailField("certFile", "读取证书文件内容错误,请重新上传") + } + } + + if !params.IsCA { + if params.KeyFile != nil { + certConfig.KeyData, err = params.KeyFile.Read() + if err != nil { + this.FailField("keyFile", "读取私钥文件内容错误,请重新上传") + } } } } @@ -109,6 +128,10 @@ func (this *UpdatePopupAction) RunPost(params struct { } } + if len(timeutil.Format("Y", certConfig.TimeEnd())) != 4 { + this.Fail("证书格式错误:无法读取到证书有效期") + } + // 保存 _, err = this.RPC().SSLCertRPC().UpdateSSLCert(this.AdminContext(), &pb.UpdateSSLCertRequest{ SslCertId: params.CertId, diff --git a/internal/web/actions/default/servers/certs/uploadPopup.go b/internal/web/actions/default/servers/certs/uploadPopup.go index 4d0a4d7e..08221907 100644 --- a/internal/web/actions/default/servers/certs/uploadPopup.go +++ b/internal/web/actions/default/servers/certs/uploadPopup.go @@ -7,6 +7,7 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs" "github.com/iwind/TeaGo/actions" + timeutil "github.com/iwind/TeaGo/utils/time" ) type UploadPopupAction struct { @@ -22,6 +23,7 @@ func (this *UploadPopupAction) RunGet(params struct{}) { } func (this *UploadPopupAction) RunPost(params struct { + TextMode bool Name string IsCA bool Description string @@ -30,6 +32,9 @@ func (this *UploadPopupAction) RunPost(params struct { CertFile *actions.File KeyFile *actions.File + CertText string + KeyText string + Must *actions.Must }) { params.Must. @@ -39,22 +44,37 @@ func (this *UploadPopupAction) RunPost(params struct { certData := []byte{} keyData := []byte{} - if params.CertFile == nil { - this.Fail("请选择要上传的证书文件") - } - var err error - certData, err = params.CertFile.Read() - if err != nil { - this.Fail("读取证书文件内容错误,请重新上传") - } + if params.TextMode { + if len(params.CertText) == 0 { + this.FailField("certText", "请输入证书内容") + } - if !params.IsCA { - if params.KeyFile == nil { - this.Fail("请选择要上传的私钥文件") - } else { - keyData, err = params.KeyFile.Read() - if err != nil { - this.Fail("读取密钥文件内容错误,请重新上传") + if !params.IsCA { + if len(params.KeyText) == 0 { + this.FailField("keyText", "请输入私钥内容") + } + } + + certData = []byte(params.CertText) + keyData = []byte(params.KeyText) + } else { + if params.CertFile == nil { + this.FailField("certFile", "请选择要上传的证书文件") + } + var err error + certData, err = params.CertFile.Read() + if err != nil { + this.FailField("certFile", "读取证书文件内容错误,请重新上传") + } + + if !params.IsCA { + if params.KeyFile == nil { + this.FailField("keyFile", "请选择要上传的私钥文件") + } else { + keyData, err = params.KeyFile.Read() + if err != nil { + this.FailField("keyFile", "读取密钥文件内容错误,请重新上传") + } } } } @@ -65,7 +85,7 @@ func (this *UploadPopupAction) RunPost(params struct { CertData: certData, KeyData: keyData, } - err = sslConfig.Init() + err := sslConfig.Init() if err != nil { if params.IsCA { this.Fail("证书校验错误:" + err.Error()) @@ -73,6 +93,9 @@ func (this *UploadPopupAction) RunPost(params struct { this.Fail("证书或密钥校验错误:" + err.Error()) } } + if len(timeutil.Format("Y", sslConfig.TimeEnd())) != 4 { + this.Fail("证书格式错误:无法读取到证书有效期") + } // 保存 createResp, err := this.RPC().SSLCertRPC().CreateSSLCert(this.AdminContext(), &pb.CreateSSLCertRequest{ diff --git a/web/public/js/vue.tea.js b/web/public/js/vue.tea.js index 6811c14c..c65fb034 100644 --- a/web/public/js/vue.tea.js +++ b/web/public/js/vue.tea.js @@ -1,186 +1,1849 @@ /* Array.js v0.0.3 | https://github.com/iwind/Array.js */ -Array.$nil={};Array.prototype.$contains=function(a){var c=this;if(c==null){return false}for(var b=0;bthis.length){a=this.length}return this.splice(this.length-a,a)};Array.prototype.$keepIf=function(b){var c=this;if(c==null){return 0}var a=c.length;var d=c.$findAll(b);c.$replace(d);return a-c.length};Array.prototype.$replace=function(a){var b=this;if(b==null){return false}if(!Array.isArray(a)){return false}b.splice.apply(b,[0,b.length].concat(a));return true};Array.prototype.$clear=function(){var a=this;if(a==null){return true}if(a.length==0){return true}a.splice(0,a.length);return true};Array.prototype.$each=function(b){var d=this;if(d==null){return true}if(typeof(b)!="function"){return true}var c=d.length;for(var a=0;ab.length-1){return null}return b[a]};Array.prototype.$getAll=function(e){var d=this;if(d==null){return[]}var b=[];for(var c=0;cb.length-1){return false}b[a]=c;return true};Array.prototype.$copy=function(){var c=this;if(c==null){return c}var a=[];for(var b=0;b-1){return}if(c.call(d,f,e)){b=f;a=e}});return a};Array.prototype.$findAll=function(b){var c=this;if(c==null){return[]}if(typeof(b)=="undefined"){return c.$copy()}var a=[];c.$each(function(e,d){if(b.call(c,e,d)){a.push(d)}});return a};Array.prototype.$filter=function(a){var b=this;if(b==null){return[]}return b.$findAll(a)};Array.prototype.$exist=function(a){return this.$findAll(a).length>0};Array.prototype.$reject=function(b){var c=this;if(c==null){return[]}if(typeof(b)=="undefined"){return[]}var a=[];c.$each(function(e,d){if(!b.call(c,e,d)){a.push(d)}});return a};Array.prototype.$grep=function(b){var a=this;if(a==null){return[]}return a.$findAll(function(d,c){if(c==null){return false}return b.test(c.toString())})};Array.prototype.$keys=function(e,a){var d=this;if(d==null){return[]}if(arguments.length==0){return Array.$range(0,d.length-1)}var c=[];if(typeof(a)=="undefined"){a=false}for(var b=0;bc){return 1}else{if(d==c){return 0}else{return -1}}}}b.sort(a);return true};Array.prototype.$rsort=function(a){var b=this;if(b==null){return false}this.$sort(a);b.reverse();return true};Array.prototype.$asort=function(a){var e=this;if(e==null){return[]}var c=[];for(var d=0;df){return 1}return 0}}for(d=0;d0&&a(e[b-1],e[b])>0){e.$swap(b,b-1);c.$swap(b,b-1)}}}return c};Array.prototype.$arsort=function(a){var c=this;if(c==null){return[]}var b=c.$asort(a);c.reverse();b.reverse();return b};Array.prototype.$diff=function(c){var b=this;if(b==null){return[]}var a=[];b.$each(function(e,d){if(!c.$contains(d)){a.push(d)}});return a};Array.prototype.$intersect=function(c){var b=this;if(b==null){return[]}var a=[];b.$each(function(e,d){if(c.$contains(d)){a.push(d)}});return a};Array.prototype.$max=function(a){var c=this;if(c==null){return null}if(c.length>0){var b=c.$copy();b.$rsort(a);return b.$get(0)}return null};Array.prototype.$min=function(a){var c=this;if(c==null){return null}if(c.length>0){var b=c.$copy();b.$sort(a);return b.$get(0)}return null};Array.prototype.$swap=function(e,d){var c=this;if(c==null){return false}var b=c.$get(e);var a=c.$get(d);c.$set(e,a);c.$set(d,b);return true};Array.prototype.$sum=function(b){var c=this;if(c==null){return 0}var a=0;c.$each(function(e,d){if(typeof(b)=="function"){d=b.call(c,e,d)}if(typeof(d)=="number"){a+=d}else{if(typeof(d)=="string"){var f=parseFloat(d);if(!isNaN(f)){a+=f}}}});return a};Array.prototype.$product=function(b){var c=this;if(c==null){return 0}var a=1;c.$each(function(e,d){if(typeof(b)=="function"){d=b.call(c,e,d)}if(typeof(d)=="number"){a*=d}else{if(typeof(d)=="string"){var f=parseFloat(d);if(!isNaN(f)){a*=f}}}});return a};Array.prototype.$chunk=function(c){var d=this;if(d==null){return[]}if(typeof(c)=="undefined"){c=1}c=parseInt(c);if(isNaN(c)||c<1){return[]}var a=[];for(var b=0;bc[b]){return 1}if(d[b]==c[b]){return 0}return -1}return 0})};Array.prototype.$desc=function(b){var a=this;if(a==null){return false}return a.$sort(function(d,c){if(typeof(d)=="object"&&typeof(c)=="object"){if(d[b]>c[b]){return -1}if(d[b]==c[b]){return 0}return 1}return 0})};Array.prototype.$equal=function(c){var b=this;if(b==null){return false}if(!Array.$isArray(c)){return false}if(b.length!=c.length){return false}for(var a=0;ab.length-1){this.index=0}a.call(b,this.index,b[this.index],this);return this.index},sleep:function(c){var d=this;setTimeout(function(){d.next()},c)}});return true};Array.prototype.$asJSON=function(){return JSON.stringify(this)};Array.$range=function(e,a,c){var d=[];if(typeof(c)=="undefined"){c=1}if(e=a;b-=c){d.push(b)}}return d};Array.$isArray=function(a){return Object.prototype.toString.call(a)==="[object Array]"};if(!Array.from){Array.from=(function(){var d=Object.prototype.toString;var e=function(g){return typeof g==="function"||d.call(g)==="[object Function]"};var c=function(h){var g=Number(h);if(isNaN(g)){return 0}if(g===0||!isFinite(g)){return g}return(g>0?1:-1)*Math.floor(Math.abs(g))};var b=Math.pow(2,53)-1;var a=function(h){var g=c(h);return Math.min(Math.max(g,0),b)};return function f(p){var g=this;var o=Object(p);if(p==null){throw new TypeError("Array.from requires an array-like object - not null or undefined")}var m=arguments.length>1?arguments[1]:void undefined;var i;if(typeof m!=="undefined"){if(!e(m)){throw new TypeError("Array.from: when provided, the second argument must be a function")}if(arguments.length>2){i=arguments[2]}}var n=a(o.length);var h=e(g)?Object(new g(n)):new Array(n);var j=0;var l;while(j this.length) { + a = this.length + } + return this.splice(this.length - a, a) +}; +Array.prototype.$keepIf = function (b) { + var c = this; + if (c == null) { + return 0 + } + var a = c.length; + var d = c.$findAll(b); + c.$replace(d); + return a - c.length +}; +Array.prototype.$replace = function (a) { + var b = this; + if (b == null) { + return false + } + if (!Array.isArray(a)) { + return false + } + b.splice.apply(b, [0, b.length].concat(a)); + return true +}; +Array.prototype.$clear = function () { + var a = this; + if (a == null) { + return true + } + if (a.length == 0) { + return true + } + a.splice(0, a.length); + return true +}; +Array.prototype.$each = function (b) { + var d = this; + if (d == null) { + return true + } + if (typeof (b) != "function") { + return true + } + var c = d.length; + for (var a = 0; a < c; a++) { + b.call(d, a, d[a]) + } + return true +}; +Array.prototype.$unique = function (d) { + var e = this; + if (e == null) { + return true + } + var a = []; + var b = []; + e.$each(function (h, g) { + if (typeof (d) == "function") { + g = d.call(e, h, g) + } + if (!a.$contains(g)) { + a.push(g); + b.push(h) + } + }); + var f = e.$copy(); + e.$clear(); + for (var c = 0; c < b.length; c++) { + e.push(f[b[c]]) + } + return true +}; +Array.prototype.$get = function (a) { + var b = this; + if (b == null) { + return null + } + if (a > b.length - 1) { + return null + } + return b[a] +}; +Array.prototype.$getAll = function (e) { + var d = this; + if (d == null) { + return [] + } + var b = []; + for (var c = 0; c < arguments.length; c++) { + var a = arguments[c]; + if (Array.$isArray(a)) { + b.$pushAll(d.$getAll.apply(d, a)) + } else { + if (typeof (a) == "number" && a < d.length) { + b.$push(d.$get(a)) + } else { + if (typeof (a) == "string" && /^\\d+$/.test(a)) { + a = parseInt(a); + if (a < d.length) { + b.$push(d.$get(a)) + } + } + } + } + } + return b +}; +Array.prototype.$set = function (a, c) { + var b = this; + if (b == null) { + return false + } + if (a > b.length - 1) { + return false + } + b[a] = c; + return true +}; +Array.prototype.$copy = function () { + var c = this; + if (c == null) { + return c + } + var a = []; + for (var b = 0; b < c.length; b++) { + a.push(c[b]) + } + return a +}; +Array.prototype.$isEmpty = function () { + var a = this; + if (a == null) { + return true + } + return (a.length == 0) +}; +Array.prototype.$all = function (b) { + var c = this; + if (c == null) { + return false + } + for (var a = 0; a < c.length; a++) { + if (!b.call(c, a, c[a])) { + return false + } + } + return true +}; +Array.prototype.$any = function (b) { + var c = this; + if (c == null) { + return false + } + for (var a = 0; a < c.length; a++) { + if (b.call(c, a, c[a])) { + return true + } + } + return false +}; +Array.prototype.$map = function (d) { + var e = this; + if (e == null) { + return [] + } + var b = []; + for (var c = 0; c < e.length; c++) { + var a = d.call(e, c, e[c]); + if (a === Array.$nil) { + continue + } + b.push(a) + } + return b +}; +Array.prototype.$reduce = function (a) { + var b = this; + if (b == null) { + return null + } + var c = null; + b.$each(function (e, d) { + c = a.call(b, e, d, c) + }); + return c +}; +Array.prototype.$collect = function (a) { + var b = this; + if (b == null) { + return [] + } + return b.$map(a) +}; +Array.prototype.$find = function (c) { + var d = this; + if (d == null) { + return -1 + } + if (typeof (c) == "undefined") { + return d.$get(0) + } + var b = -1; + var a = null; + d.$each(function (f, e) { + if (b > -1) { + return + } + if (c.call(d, f, e)) { + b = f; + a = e + } + }); + return a +}; +Array.prototype.$findAll = function (b) { + var c = this; + if (c == null) { + return [] + } + if (typeof (b) == "undefined") { + return c.$copy() + } + var a = []; + c.$each(function (e, d) { + if (b.call(c, e, d)) { + a.push(d) + } + }); + return a +}; +Array.prototype.$filter = function (a) { + var b = this; + if (b == null) { + return [] + } + return b.$findAll(a) +}; +Array.prototype.$exist = function (a) { + return this.$findAll(a).length > 0 +}; +Array.prototype.$reject = function (b) { + var c = this; + if (c == null) { + return [] + } + if (typeof (b) == "undefined") { + return [] + } + var a = []; + c.$each(function (e, d) { + if (!b.call(c, e, d)) { + a.push(d) + } + }); + return a +}; +Array.prototype.$grep = function (b) { + var a = this; + if (a == null) { + return [] + } + return a.$findAll(function (d, c) { + if (c == null) { + return false + } + return b.test(c.toString()) + }) +}; +Array.prototype.$keys = function (e, a) { + var d = this; + if (d == null) { + return [] + } + if (arguments.length == 0) { + return Array.$range(0, d.length - 1) + } + var c = []; + if (typeof (a) == "undefined") { + a = false + } + for (var b = 0; b < d.length; b++) { + if ((a && e === d[b]) || (!a && e == d[b])) { + c.push(b) + } + } + return c +}; +Array.prototype.$indexesOf = function (c, a) { + var b = this; + if (b == null) { + return [] + } + if (arguments.length == 0) { + return Array.$range(0, b.length - 1) + } + return b.$keys(c, a) +}; +Array.prototype.$sort = function (a) { + var b = this; + if (b == null) { + return false + } + if (typeof (a) == "undefined") { + a = function (d, c) { + if (d > c) { + return 1 + } else { + if (d == c) { + return 0 + } else { + return -1 + } + } + } + } + b.sort(a); + return true +}; +Array.prototype.$rsort = function (a) { + var b = this; + if (b == null) { + return false + } + this.$sort(a); + b.reverse(); + return true +}; +Array.prototype.$asort = function (a) { + var e = this; + if (e == null) { + return [] + } + var c = []; + for (var d = 0; d < e.length; d++) { + c.push(d) + } + if (typeof (a) == "undefined") { + a = function (g, f) { + if (g < f) { + return -1 + } + if (g > f) { + return 1 + } + return 0 + } + } + for (d = 0; d < e.length; d++) { + for (var b = 0; b < e.length; b++) { + if (b > 0 && a(e[b - 1], e[b]) > 0) { + e.$swap(b, b - 1); + c.$swap(b, b - 1) + } + } + } + return c +}; +Array.prototype.$arsort = function (a) { + var c = this; + if (c == null) { + return [] + } + var b = c.$asort(a); + c.reverse(); + b.reverse(); + return b +}; +Array.prototype.$diff = function (c) { + var b = this; + if (b == null) { + return [] + } + var a = []; + b.$each(function (e, d) { + if (!c.$contains(d)) { + a.push(d) + } + }); + return a +}; +Array.prototype.$intersect = function (c) { + var b = this; + if (b == null) { + return [] + } + var a = []; + b.$each(function (e, d) { + if (c.$contains(d)) { + a.push(d) + } + }); + return a +}; +Array.prototype.$max = function (a) { + var c = this; + if (c == null) { + return null + } + if (c.length > 0) { + var b = c.$copy(); + b.$rsort(a); + return b.$get(0) + } + return null +}; +Array.prototype.$min = function (a) { + var c = this; + if (c == null) { + return null + } + if (c.length > 0) { + var b = c.$copy(); + b.$sort(a); + return b.$get(0) + } + return null +}; +Array.prototype.$swap = function (e, d) { + var c = this; + if (c == null) { + return false + } + var b = c.$get(e); + var a = c.$get(d); + c.$set(e, a); + c.$set(d, b); + return true +}; +Array.prototype.$sum = function (b) { + var c = this; + if (c == null) { + return 0 + } + var a = 0; + c.$each(function (e, d) { + if (typeof (b) == "function") { + d = b.call(c, e, d) + } + if (typeof (d) == "number") { + a += d + } else { + if (typeof (d) == "string") { + var f = parseFloat(d); + if (!isNaN(f)) { + a += f + } + } + } + }); + return a +}; +Array.prototype.$product = function (b) { + var c = this; + if (c == null) { + return 0 + } + var a = 1; + c.$each(function (e, d) { + if (typeof (b) == "function") { + d = b.call(c, e, d) + } + if (typeof (d) == "number") { + a *= d + } else { + if (typeof (d) == "string") { + var f = parseFloat(d); + if (!isNaN(f)) { + a *= f + } + } + } + }); + return a +}; +Array.prototype.$chunk = function (c) { + var d = this; + if (d == null) { + return [] + } + if (typeof (c) == "undefined") { + c = 1 + } + c = parseInt(c); + if (isNaN(c) || c < 1) { + return [] + } + var a = []; + for (var b = 0; b < d.length / c; b++) { + a.$push(d.slice(b * c, (b + 1) * c)) + } + return a +}; +Array.prototype.$combine = function (f) { + var e = this; + if (e == null) { + return [] + } + var b = e.$chunk(1); + for (var d = 0; d < arguments.length; d++) { + var a = arguments[d]; + if (Array.$isArray(a)) { + for (var c = 0; c < e.length; c++) { + b[c].$push(a.$get(c)) + } + } + } + return b +}; +Array.prototype.$pad = function (d, b) { + var c = this; + if (c == null) { + return false + } + if (typeof (b) == "undefined") { + b = 1 + } + if (b < 1) { + return false + } + for (var a = 0; a < b; a++) { + c.push(d) + } + return true +}; +Array.prototype.$fill = function (e, d) { + var c = this; + if (c == null) { + return false + } + if (typeof (d) == "undefined") { + d = c.length + } + if (d < c.length) { + return false + } + if (d == c.length) { + return true + } + var b = d - c.length; + for (var a = 0; a < b; a++) { + c.push(e) + } + return true +}; +Array.prototype.$shuffle = function () { + var a = this; + if (a == null) { + return false + } + a.$sort(function () { + return Math.random() - 0.5 + }); + return true +}; +Array.prototype.$rand = function (a) { + var b = this; + if (b == null) { + return false + } + if (typeof (a) == "undefined") { + a = 1 + } + var c = b.$copy(); + c.$shuffle(); + return c.slice(0, a) +}; +Array.prototype.$size = function (a) { + if (typeof a == "function") { + return this.$findAll(a).length + } + var b = this; + if (b == null) { + return 0 + } + return b.length +}; +Array.prototype.$count = function (a) { + return this.$size(a) +}; +Array.prototype.$first = function () { + var a = this; + if (a == null) { + return null + } + if (a.length == 0) { + return null + } + return a.$get(0) +}; +Array.prototype.$last = function () { + var a = this; + if (a == null) { + return null + } + if (a.length == 0) { + return null + } + return a[a.length - 1] +}; +Array.prototype.$push = function () { + var a = this; + if (a == null) { + return 0 + } + return Array.prototype.push.apply(a, arguments) +}; +Array.prototype.$pushAll = function (b) { + var a = this; + if (a == null) { + return 0 + } + return Array.prototype.push.apply(a, b) +}; +Array.prototype.$insert = function (b, e) { + var d = this; + if (d == null) { + return false + } + var a = []; + if (arguments.length == 0) { + return false + } + for (var c = 1; c < arguments.length; c++) { + a.push(arguments[c]) + } + if (b < 0) { + b = d.length + b + 1 + } + d.splice.apply(d, [b, 0].concat(a)); + return true +}; +Array.prototype.$asc = function (b) { + var a = this; + if (a == null) { + return false + } + return a.$sort(function (d, c) { + if (typeof (d) == "object" && typeof (c) == "object") { + if (d[b] > c[b]) { + return 1 + } + if (d[b] == c[b]) { + return 0 + } + return -1 + } + return 0 + }) +}; +Array.prototype.$desc = function (b) { + var a = this; + if (a == null) { + return false + } + return a.$sort(function (d, c) { + if (typeof (d) == "object" && typeof (c) == "object") { + if (d[b] > c[b]) { + return -1 + } + if (d[b] == c[b]) { + return 0 + } + return 1 + } + return 0 + }) +}; +Array.prototype.$equal = function (c) { + var b = this; + if (b == null) { + return false + } + if (!Array.$isArray(c)) { + return false + } + if (b.length != c.length) { + return false + } + for (var a = 0; a < b.length; a++) { + if (b[a] != c[a]) { + return false + } + } + return true +}; +Array.prototype.$loop = function (a) { + var b = this; + if (b == null) { + return false + } + if (b.length == 0) { + return false + } + a.call(b, 0, b[0], { + index: 0, next: function () { + this.index++; + if (this.index > b.length - 1) { + this.index = 0 + } + a.call(b, this.index, b[this.index], this); + return this.index + }, sleep: function (c) { + var d = this; + setTimeout(function () { + d.next() + }, c) + } + }); + return true +}; +Array.prototype.$asJSON = function () { + return JSON.stringify(this) +}; +Array.$range = function (e, a, c) { + var d = []; + if (typeof (c) == "undefined") { + c = 1 + } + if (e < a) { + for (var b = e; b <= a; b += c) { + d.push(b) + } + } else { + for (var b = e; b >= a; b -= c) { + d.push(b) + } + } + return d +}; +Array.$isArray = function (a) { + return Object.prototype.toString.call(a) === "[object Array]" +}; +if (!Array.from) { + Array.from = (function () { + var d = Object.prototype.toString; + var e = function (g) { + return typeof g === "function" || d.call(g) === "[object Function]" + }; + var c = function (h) { + var g = Number(h); + if (isNaN(g)) { + return 0 + } + if (g === 0 || !isFinite(g)) { + return g + } + return (g > 0 ? 1 : -1) * Math.floor(Math.abs(g)) + }; + var b = Math.pow(2, 53) - 1; + var a = function (h) { + var g = c(h); + return Math.min(Math.max(g, 0), b) + }; + return function f(p) { + var g = this; + var o = Object(p); + if (p == null) { + throw new TypeError("Array.from requires an array-like object - not null or undefined") + } + var m = arguments.length > 1 ? arguments[1] : void undefined; + var i; + if (typeof m !== "undefined") { + if (!e(m)) { + throw new TypeError("Array.from: when provided, the second argument must be a function") + } + if (arguments.length > 2) { + i = arguments[2] + } + } + var n = a(o.length); + var h = e(g) ? Object(new g(n)) : new Array(n); + var j = 0; + var l; + while (j < n) { + l = o[j]; + if (m) { + h[j] = typeof i === "undefined" ? m(l, j) : m.call(i, l, j) + } else { + h[j] = l + } + j += 1 + } + h.length = n; + return h + } + }()) +} +; /* axios v0.18.0 | (c) 2018 by Matt Zabriskie */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.axios=t():e.axios=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e){var t=new s(e),n=i(s.prototype.request,t);return o.extend(n,s.prototype,t),o.extend(n,t),n}var o=n(2),i=n(3),s=n(5),u=n(6),a=r(u);a.Axios=s,a.create=function(e){return r(o.merge(u,e))},a.Cancel=n(23),a.CancelToken=n(24),a.isCancel=n(20),a.all=function(e){return Promise.all(e)},a.spread=n(25),e.exports=a,e.exports.default=a},function(e,t,n){"use strict";function r(e){return"[object Array]"===R.call(e)}function o(e){return"[object ArrayBuffer]"===R.call(e)}function i(e){return"undefined"!=typeof FormData&&e instanceof FormData}function s(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function u(e){return"string"==typeof e}function a(e){return"number"==typeof e}function c(e){return"undefined"==typeof e}function f(e){return null!==e&&"object"==typeof e}function p(e){return"[object Date]"===R.call(e)}function d(e){return"[object File]"===R.call(e)}function l(e){return"[object Blob]"===R.call(e)}function h(e){return"[object Function]"===R.call(e)}function m(e){return f(e)&&h(e.pipe)}function y(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function w(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function g(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function v(e,t){if(null!==e&&"undefined"!=typeof e)if("object"!=typeof e&&(e=[e]),r(e))for(var n=0,o=e.length;n * @license MIT */ - e.exports=function(e){return null!=e&&(n(e)||r(e)||!!e._isBuffer)}},function(e,t,n){"use strict";function r(e){this.defaults=e,this.interceptors={request:new s,response:new s}}var o=n(6),i=n(2),s=n(17),u=n(18);r.prototype.request=function(e){"string"==typeof e&&(e=i.merge({url:arguments[0]},arguments[1])),e=i.merge(o,{method:"get"},this.defaults,e),e.method=e.method.toLowerCase();var t=[u,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},i.forEach(["delete","get","head","options"],function(e){r.prototype[e]=function(t,n){return this.request(i.merge(n||{},{method:e,url:t}))}}),i.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(i.merge(r||{},{method:e,url:t,data:n}))}}),e.exports=r},function(e,t,n){"use strict";function r(e,t){!i.isUndefined(e)&&i.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function o(){var e;return"undefined"!=typeof XMLHttpRequest?e=n(8):"undefined"!=typeof process&&(e=n(8)),e}var i=n(2),s=n(7),u={"Content-Type":"application/x-www-form-urlencoded"},a={adapter:o(),transformRequest:[function(e,t){return s(t,"Content-Type"),i.isFormData(e)||i.isArrayBuffer(e)||i.isBuffer(e)||i.isStream(e)||i.isFile(e)||i.isBlob(e)?e:i.isArrayBufferView(e)?e.buffer:i.isURLSearchParams(e)?(r(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):i.isObject(e)?(r(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};a.headers={common:{Accept:"application/json, text/plain, */*"}},i.forEach(["delete","get","head"],function(e){a.headers[e]={}}),i.forEach(["post","put","patch"],function(e){a.headers[e]=i.merge(u)}),e.exports=a},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t){r.forEach(e,function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])})}},function(e,t,n){"use strict";var r=n(2),o=n(9),i=n(12),s=n(13),u=n(14),a=n(10),c="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||n(15);e.exports=function(e){return new Promise(function(t,f){var p=e.data,d=e.headers;r.isFormData(p)&&delete d["Content-Type"];var l=new XMLHttpRequest,h="onreadystatechange",m=!1;if("undefined"==typeof window||!window.XDomainRequest||"withCredentials"in l||u(e.url)||(l=new window.XDomainRequest,h="onload",m=!0,l.onprogress=function(){},l.ontimeout=function(){}),e.auth){var y=e.auth.username||"",w=e.auth.password||"";d.Authorization="Basic "+c(y+":"+w)}if(l.open(e.method.toUpperCase(),i(e.url,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,l[h]=function(){if(l&&(4===l.readyState||m)&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in l?s(l.getAllResponseHeaders()):null,r=e.responseType&&"text"!==e.responseType?l.response:l.responseText,i={data:r,status:1223===l.status?204:l.status,statusText:1223===l.status?"No Content":l.statusText,headers:n,config:e,request:l};o(t,f,i),l=null}},l.onerror=function(){f(a("Network Error",e,null,l)),l=null},l.ontimeout=function(){f(a("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",l)),l=null},r.isStandardBrowserEnv()){var g=n(16),v=(e.withCredentials||u(e.url))&&e.xsrfCookieName?g.read(e.xsrfCookieName):void 0;v&&(d[e.xsrfHeaderName]=v)}if("setRequestHeader"in l&&r.forEach(d,function(e,t){"undefined"==typeof p&&"content-type"===t.toLowerCase()?delete d[t]:l.setRequestHeader(t,e)}),e.withCredentials&&(l.withCredentials=!0),e.responseType)try{l.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&l.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){l&&(l.abort(),f(e),l=null)}),void 0===p&&(p=null),l.send(p)})}},function(e,t,n){"use strict";var r=n(10);e.exports=function(e,t,n){var o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";var r=n(11);e.exports=function(e,t,n,o,i){var s=new Error(e);return r(s,t,n,o,i)}},function(e,t){"use strict";e.exports=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e}},function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=n(2);e.exports=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(o.isURLSearchParams(t))i=t.toString();else{var s=[];o.forEach(t,function(e,t){null!==e&&"undefined"!=typeof e&&(o.isArray(e)?t+="[]":e=[e],o.forEach(e,function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),s.push(r(t)+"="+r(e))}))}),i=s.join("&")}return i&&(e+=(e.indexOf("?")===-1?"?":"&")+i),e}},function(e,t,n){"use strict";var r=n(2),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,i,s={};return e?(r.forEach(e.split("\n"),function(e){if(i=e.indexOf(":"),t=r.trim(e.substr(0,i)).toLowerCase(),n=r.trim(e.substr(i+1)),t){if(s[t]&&o.indexOf(t)>=0)return;"set-cookie"===t?s[t]=(s[t]?s[t]:[]).concat([n]):s[t]=s[t]?s[t]+", "+n:n}}),s):s}},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){function e(e){var t=e;return n&&(o.setAttribute("href",t),t=o.href),o.setAttribute("href",t),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var t,n=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return t=e(window.location.href),function(n){var o=r.isString(n)?e(n):n;return o.protocol===t.protocol&&o.host===t.host}}():function(){return function(){return!0}}()},function(e,t){"use strict";function n(){this.message="String contains an invalid character"}function r(e){for(var t,r,i=String(e),s="",u=0,a=o;i.charAt(0|u)||(a="=",u%1);s+=a.charAt(63&t>>8-u%1*8)){if(r=i.charCodeAt(u+=.75),r>255)throw new n;t=t<<8|r}return s}var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.prototype=new Error,n.prototype.code=5,n.prototype.name="InvalidCharacterError",e.exports=r},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,o,i,s){var u=[];u.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(o)&&u.push("path="+o),r.isString(i)&&u.push("domain="+i),s===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,n){"use strict";function r(){this.handlers=[]}var o=n(2);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e,t,n){"use strict";function r(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var o=n(2),i=n(19),s=n(20),u=n(6),a=n(21),c=n(22);e.exports=function(e){r(e),e.baseURL&&!a(e.url)&&(e.url=c(e.baseURL,e.url)),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),o.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]});var t=e.adapter||u.adapter;return t(e).then(function(t){return r(e),t.data=i(t.data,t.headers,e.transformResponse),t},function(t){return s(t)||(r(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,n){"use strict";function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new o(e),t(n.reason))})}var o=n(23);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e,t=new r(function(t){e=t});return{token:t,cancel:e}},e.exports=r},function(e,t){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}}])}); + e.exports = function (e) { + return null != e && (n(e) || r(e) || !!e._isBuffer) + } + }, function (e, t, n) { + "use strict"; + + function r(e) { + this.defaults = e, this.interceptors = {request: new s, response: new s} + } + + var o = n(6), i = n(2), s = n(17), u = n(18); + r.prototype.request = function (e) { + "string" == typeof e && (e = i.merge({url: arguments[0]}, arguments[1])), e = i.merge(o, {method: "get"}, this.defaults, e), e.method = e.method.toLowerCase(); + var t = [u, void 0], n = Promise.resolve(e); + for (this.interceptors.request.forEach(function (e) { + t.unshift(e.fulfilled, e.rejected) + }), this.interceptors.response.forEach(function (e) { + t.push(e.fulfilled, e.rejected) + }); t.length;) n = n.then(t.shift(), t.shift()); + return n + }, i.forEach(["delete", "get", "head", "options"], function (e) { + r.prototype[e] = function (t, n) { + return this.request(i.merge(n || {}, {method: e, url: t})) + } + }), i.forEach(["post", "put", "patch"], function (e) { + r.prototype[e] = function (t, n, r) { + return this.request(i.merge(r || {}, {method: e, url: t, data: n})) + } + }), e.exports = r + }, function (e, t, n) { + "use strict"; + + function r(e, t) { + !i.isUndefined(e) && i.isUndefined(e["Content-Type"]) && (e["Content-Type"] = t) + } + + function o() { + var e; + return "undefined" != typeof XMLHttpRequest ? e = n(8) : "undefined" != typeof process && (e = n(8)), e + } + + var i = n(2), s = n(7), u = {"Content-Type": "application/x-www-form-urlencoded"}, a = { + adapter: o(), + transformRequest: [function (e, t) { + return s(t, "Content-Type"), i.isFormData(e) || i.isArrayBuffer(e) || i.isBuffer(e) || i.isStream(e) || i.isFile(e) || i.isBlob(e) ? e : i.isArrayBufferView(e) ? e.buffer : i.isURLSearchParams(e) ? (r(t, "application/x-www-form-urlencoded;charset=utf-8"), e.toString()) : i.isObject(e) ? (r(t, "application/json;charset=utf-8"), JSON.stringify(e)) : e + }], + transformResponse: [function (e) { + if ("string" == typeof e) try { + e = JSON.parse(e) + } catch (e) { + } + return e + }], + timeout: 0, + xsrfCookieName: "XSRF-TOKEN", + xsrfHeaderName: "X-XSRF-TOKEN", + maxContentLength: -1, + validateStatus: function (e) { + return e >= 200 && e < 300 + } + }; + a.headers = {common: {Accept: "application/json, text/plain, */*"}}, i.forEach(["delete", "get", "head"], function (e) { + a.headers[e] = {} + }), i.forEach(["post", "put", "patch"], function (e) { + a.headers[e] = i.merge(u) + }), e.exports = a + }, function (e, t, n) { + "use strict"; + var r = n(2); + e.exports = function (e, t) { + r.forEach(e, function (n, r) { + r !== t && r.toUpperCase() === t.toUpperCase() && (e[t] = n, delete e[r]) + }) + } + }, function (e, t, n) { + "use strict"; + var r = n(2), o = n(9), i = n(12), s = n(13), u = n(14), a = n(10), + c = "undefined" != typeof window && window.btoa && window.btoa.bind(window) || n(15); + e.exports = function (e) { + return new Promise(function (t, f) { + var p = e.data, d = e.headers; + r.isFormData(p) && delete d["Content-Type"]; + var l = new XMLHttpRequest, h = "onreadystatechange", m = !1; + if ("undefined" == typeof window || !window.XDomainRequest || "withCredentials" in l || u(e.url) || (l = new window.XDomainRequest, h = "onload", m = !0, l.onprogress = function () { + }, l.ontimeout = function () { + }), e.auth) { + var y = e.auth.username || "", w = e.auth.password || ""; + d.Authorization = "Basic " + c(y + ":" + w) + } + if (l.open(e.method.toUpperCase(), i(e.url, e.params, e.paramsSerializer), !0), l.timeout = e.timeout, l[h] = function () { + if (l && (4 === l.readyState || m) && (0 !== l.status || l.responseURL && 0 === l.responseURL.indexOf("file:"))) { + var n = "getAllResponseHeaders" in l ? s(l.getAllResponseHeaders()) : null, + r = e.responseType && "text" !== e.responseType ? l.response : l.responseText, i = { + data: r, + status: 1223 === l.status ? 204 : l.status, + statusText: 1223 === l.status ? "No Content" : l.statusText, + headers: n, + config: e, + request: l + }; + o(t, f, i), l = null + } + }, l.onerror = function () { + f(a("Network Error", e, null, l)), l = null + }, l.ontimeout = function () { + f(a("timeout of " + e.timeout + "ms exceeded", e, "ECONNABORTED", l)), l = null + }, r.isStandardBrowserEnv()) { + var g = n(16), + v = (e.withCredentials || u(e.url)) && e.xsrfCookieName ? g.read(e.xsrfCookieName) : void 0; + v && (d[e.xsrfHeaderName] = v) + } + if ("setRequestHeader" in l && r.forEach(d, function (e, t) { + "undefined" == typeof p && "content-type" === t.toLowerCase() ? delete d[t] : l.setRequestHeader(t, e) + }), e.withCredentials && (l.withCredentials = !0), e.responseType) try { + l.responseType = e.responseType + } catch (t) { + if ("json" !== e.responseType) throw t + } + "function" == typeof e.onDownloadProgress && l.addEventListener("progress", e.onDownloadProgress), "function" == typeof e.onUploadProgress && l.upload && l.upload.addEventListener("progress", e.onUploadProgress), e.cancelToken && e.cancelToken.promise.then(function (e) { + l && (l.abort(), f(e), l = null) + }), void 0 === p && (p = null), l.send(p) + }) + } + }, function (e, t, n) { + "use strict"; + var r = n(10); + e.exports = function (e, t, n) { + var o = n.config.validateStatus; + n.status && o && !o(n.status) ? t(r("Request failed with status code " + n.status, n.config, null, n.request, n)) : e(n) + } + }, function (e, t, n) { + "use strict"; + var r = n(11); + e.exports = function (e, t, n, o, i) { + var s = new Error(e); + return r(s, t, n, o, i) + } + }, function (e, t) { + "use strict"; + e.exports = function (e, t, n, r, o) { + return e.config = t, n && (e.code = n), e.request = r, e.response = o, e + } + }, function (e, t, n) { + "use strict"; + + function r(e) { + return encodeURIComponent(e).replace(/%40/gi, "@").replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]") + } + + var o = n(2); + e.exports = function (e, t, n) { + if (!t) return e; + var i; + if (n) i = n(t); else if (o.isURLSearchParams(t)) i = t.toString(); else { + var s = []; + o.forEach(t, function (e, t) { + null !== e && "undefined" != typeof e && (o.isArray(e) ? t += "[]" : e = [e], o.forEach(e, function (e) { + o.isDate(e) ? e = e.toISOString() : o.isObject(e) && (e = JSON.stringify(e)), s.push(r(t) + "=" + r(e)) + })) + }), i = s.join("&") + } + return i && (e += (e.indexOf("?") === -1 ? "?" : "&") + i), e + } + }, function (e, t, n) { + "use strict"; + var r = n(2), + o = ["age", "authorization", "content-length", "content-type", "etag", "expires", "from", "host", "if-modified-since", "if-unmodified-since", "last-modified", "location", "max-forwards", "proxy-authorization", "referer", "retry-after", "user-agent"]; + e.exports = function (e) { + var t, n, i, s = {}; + return e ? (r.forEach(e.split("\n"), function (e) { + if (i = e.indexOf(":"), t = r.trim(e.substr(0, i)).toLowerCase(), n = r.trim(e.substr(i + 1)), t) { + if (s[t] && o.indexOf(t) >= 0) return; + "set-cookie" === t ? s[t] = (s[t] ? s[t] : []).concat([n]) : s[t] = s[t] ? s[t] + ", " + n : n + } + }), s) : s + } + }, function (e, t, n) { + "use strict"; + var r = n(2); + e.exports = r.isStandardBrowserEnv() ? function () { + function e(e) { + var t = e; + return n && (o.setAttribute("href", t), t = o.href), o.setAttribute("href", t), { + href: o.href, + protocol: o.protocol ? o.protocol.replace(/:$/, "") : "", + host: o.host, + search: o.search ? o.search.replace(/^\?/, "") : "", + hash: o.hash ? o.hash.replace(/^#/, "") : "", + hostname: o.hostname, + port: o.port, + pathname: "/" === o.pathname.charAt(0) ? o.pathname : "/" + o.pathname + } + } + + var t, n = /(msie|trident)/i.test(navigator.userAgent), o = document.createElement("a"); + return t = e(window.location.href), function (n) { + var o = r.isString(n) ? e(n) : n; + return o.protocol === t.protocol && o.host === t.host + } + }() : function () { + return function () { + return !0 + } + }() + }, function (e, t) { + "use strict"; + + function n() { + this.message = "String contains an invalid character" + } + + function r(e) { + for (var t, r, i = String(e), s = "", u = 0, a = o; i.charAt(0 | u) || (a = "=", u % 1); s += a.charAt(63 & t >> 8 - u % 1 * 8)) { + if (r = i.charCodeAt(u += .75), r > 255) throw new n; + t = t << 8 | r + } + return s + } + + var o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + n.prototype = new Error, n.prototype.code = 5, n.prototype.name = "InvalidCharacterError", e.exports = r + }, function (e, t, n) { + "use strict"; + var r = n(2); + e.exports = r.isStandardBrowserEnv() ? function () { + return { + write: function (e, t, n, o, i, s) { + var u = []; + u.push(e + "=" + encodeURIComponent(t)), r.isNumber(n) && u.push("expires=" + new Date(n).toGMTString()), r.isString(o) && u.push("path=" + o), r.isString(i) && u.push("domain=" + i), s === !0 && u.push("secure"), document.cookie = u.join("; ") + }, read: function (e) { + var t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)")); + return t ? decodeURIComponent(t[3]) : null + }, remove: function (e) { + this.write(e, "", Date.now() - 864e5) + } + } + }() : function () { + return { + write: function () { + }, read: function () { + return null + }, remove: function () { + } + } + }() + }, function (e, t, n) { + "use strict"; + + function r() { + this.handlers = [] + } + + var o = n(2); + r.prototype.use = function (e, t) { + return this.handlers.push({fulfilled: e, rejected: t}), this.handlers.length - 1 + }, r.prototype.eject = function (e) { + this.handlers[e] && (this.handlers[e] = null) + }, r.prototype.forEach = function (e) { + o.forEach(this.handlers, function (t) { + null !== t && e(t) + }) + }, e.exports = r + }, function (e, t, n) { + "use strict"; + + function r(e) { + e.cancelToken && e.cancelToken.throwIfRequested() + } + + var o = n(2), i = n(19), s = n(20), u = n(6), a = n(21), c = n(22); + e.exports = function (e) { + r(e), e.baseURL && !a(e.url) && (e.url = c(e.baseURL, e.url)), e.headers = e.headers || {}, e.data = i(e.data, e.headers, e.transformRequest), e.headers = o.merge(e.headers.common || {}, e.headers[e.method] || {}, e.headers || {}), o.forEach(["delete", "get", "head", "post", "put", "patch", "common"], function (t) { + delete e.headers[t] + }); + var t = e.adapter || u.adapter; + return t(e).then(function (t) { + return r(e), t.data = i(t.data, t.headers, e.transformResponse), t + }, function (t) { + return s(t) || (r(e), t && t.response && (t.response.data = i(t.response.data, t.response.headers, e.transformResponse))), Promise.reject(t) + }) + } + }, function (e, t, n) { + "use strict"; + var r = n(2); + e.exports = function (e, t, n) { + return r.forEach(n, function (n) { + e = n(e, t) + }), e + } + }, function (e, t) { + "use strict"; + e.exports = function (e) { + return !(!e || !e.__CANCEL__) + } + }, function (e, t) { + "use strict"; + e.exports = function (e) { + return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e) + } + }, function (e, t) { + "use strict"; + e.exports = function (e, t) { + return t ? e.replace(/\/+$/, "") + "/" + t.replace(/^\/+/, "") : e + } + }, function (e, t) { + "use strict"; + + function n(e) { + this.message = e + } + + n.prototype.toString = function () { + return "Cancel" + (this.message ? ": " + this.message : "") + }, n.prototype.__CANCEL__ = !0, e.exports = n + }, function (e, t, n) { + "use strict"; + + function r(e) { + if ("function" != typeof e) throw new TypeError("executor must be a function."); + var t; + this.promise = new Promise(function (e) { + t = e + }); + var n = this; + e(function (e) { + n.reason || (n.reason = new o(e), t(n.reason)) + }) + } + + var o = n(23); + r.prototype.throwIfRequested = function () { + if (this.reason) throw this.reason + }, r.source = function () { + var e, t = new r(function (t) { + e = t + }); + return {token: t, cancel: e} + }, e.exports = r + }, function (e, t) { + "use strict"; + e.exports = function (e) { + return function (t) { + return e.apply(null, t) + } + } + }]) +}); //# sourceMappingURL=axios.min.map -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ES6Promise=e()}(this,function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}function n(t){B=t}function r(t){G=t}function o(){return function(){return process.nextTick(a)}}function i(){return"undefined"!=typeof z?function(){z(a)}:c()}function s(){var t=0,e=new J(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}function c(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;t 0) { - var context = {}; - context.Tea = window.Tea; + if (contextFunctions.length > 0) { + var context = {}; + context.Tea = window.Tea; - // 内置方法 - for (var methodName in innerMethods) { - if (innerMethods.hasOwnProperty(methodName)) { - context[methodName] = innerMethods[methodName]; - } - } + // 内置方法 + for (var methodName in innerMethods) { + if (innerMethods.hasOwnProperty(methodName)) { + context[methodName] = innerMethods[methodName]; + } + } - for (key in data) { - if (!data.hasOwnProperty(key)) { - continue; - } - context[key] = data[key]; - } + for (key in data) { + if (!data.hasOwnProperty(key)) { + continue; + } + context[key] = data[key]; + } - for (var i = 0; i < contextFunctions.length; i ++) { - var contextFn = contextFunctions[i]; - if (typeof(contextFn) != "function") { - continue; - } - contextFn.call(context); - for (var key in context) { - if (!context.hasOwnProperty(key)) { - continue; - } - if (typeof(key) != "string") { - continue; - } + for (var i = 0; i < contextFunctions.length; i++) { + var contextFn = contextFunctions[i]; + if (typeof (contextFn) != "function") { + continue; + } + contextFn.call(context); + for (var key in context) { + if (!context.hasOwnProperty(key)) { + continue; + } + if (typeof (key) != "string") { + continue; + } - // 跳过自定义方法 - if (key.length > 0 && key[0] == "$") { - continue; - } + // 跳过自定义方法 + if (key.length > 0 && key[0] == "$") { + continue; + } - var value = context[key]; - if (typeof(value) === "function") { - context[key] = function (value) { - return function () { - if (window.Tea.Vue == null) { - return value.apply(innerMethods, arguments); - } - else { - return value.apply(window.Tea.Vue, arguments); - } - }; - }(value); - } - } - } + var value = context[key]; + if (typeof (value) === "function") { + context[key] = function (value) { + return function () { + if (window.Tea.Vue == null) { + return value.apply(innerMethods, arguments); + } else { + return value.apply(window.Tea.Vue, arguments); + } + }; + }(value); + } + } + } - // 清除context中的预定义变量 - for (var methodName in innerMethods) { - if (innerMethods.hasOwnProperty(methodName)) { - delete(context[methodName]); - } - } + // 清除context中的预定义变量 + for (var methodName in innerMethods) { + if (innerMethods.hasOwnProperty(methodName)) { + delete (context[methodName]); + } + } - window.Tea.Vue = new Vue({ - el: vueElement, - data: context, + window.Tea.Vue = new Vue({ + el: vueElement, + data: context, - // 内置方法 - methods: innerMethods - }); - } - else { - var context = { - Tea: window.Tea - }; - for (key in data) { - if (!data.hasOwnProperty(key)) { - continue; - } - context[key] = data[key]; - } + // 内置方法 + methods: innerMethods + }); + } else { + var context = { + Tea: window.Tea + }; + for (key in data) { + if (!data.hasOwnProperty(key)) { + continue; + } + context[key] = data[key]; + } - window.Tea.Vue = new Vue({ - el: vueElement, - data: context, + window.Tea.Vue = new Vue({ + el: vueElement, + data: context, - // 内置方法 - methods: { - $delay: Tea.delay, - $get: function (action) { - return Tea.action(action).get(); - }, - $post: function (action) { - return Tea.action(action).post(); - }, - $go: Tea.go, - $url: Tea.url, - $find: Tea.element - } - }); - } - }; + // 内置方法 + methods: { + $delay: Tea.delay, + $get: function (action) { + return Tea.action(action).get(); + }, + $post: function (action) { + return Tea.action(action).post(); + }, + $go: Tea.go, + $url: Tea.url, + $find: Tea.element + } + }); + } + }; - document.addEventListener("DOMContentLoaded", function () { - that.load(); + document.addEventListener("DOMContentLoaded", function () { + that.load(); - if (document.body) { - Tea.activate(document.body); - } - }); + if (document.body) { + Tea.activate(document.body); + } + }); })(); /** @@ -193,86 +1856,86 @@ Array.$nil={};Array.prototype.$contains=function(a){var c=this;if(c==null){retur * @returns {*} */ window.Tea.serialize = function (a, traditional) { - var prefix, - s = [], - add = function (key, valueOrFunction) { + var prefix, + s = [], + add = function (key, valueOrFunction) { - // If value is a function, invoke it and use its return value - var value = (typeof(valueOrFunction) === "function") ? - valueOrFunction() : - valueOrFunction; + // If value is a function, invoke it and use its return value + var value = (typeof (valueOrFunction) === "function") ? + valueOrFunction() : + valueOrFunction; - s[s.length] = encodeURIComponent(key) + "=" + - encodeURIComponent(value == null ? "" : value); - }; + s[s.length] = encodeURIComponent(key) + "=" + + encodeURIComponent(value == null ? "" : value); + }; - var - rbracket = /\[]$/; + var + rbracket = /\[]$/; - var buildParams = function (prefix, obj, traditional, add) { - var name; - if (Array.isArray(obj)) { - // Serialize array item. - for (var i in obj) { - if (!obj.hasOwnProperty(i)) { - continue; - } - var v = obj[i]; - if (traditional || rbracket.test(prefix)) { + var buildParams = function (prefix, obj, traditional, add) { + var name; + if (Array.isArray(obj)) { + // Serialize array item. + for (var i in obj) { + if (!obj.hasOwnProperty(i)) { + continue; + } + var v = obj[i]; + if (traditional || rbracket.test(prefix)) { - // Treat each array item as a scalar. - add(prefix, v); + // Treat each array item as a scalar. + add(prefix, v); - } else { + } else { - // Item is non-scalar (array or object), encode its numeric index. - buildParams( - prefix + "[" + (typeof v === "object" && v != null ? i : "") + "]", - v, - traditional, - add - ); - } - } + // Item is non-scalar (array or object), encode its numeric index. + buildParams( + prefix + "[" + (typeof v === "object" && v != null ? i : "") + "]", + v, + traditional, + add + ); + } + } - } else if (!traditional && typeof(obj) === "object") { + } else if (!traditional && typeof (obj) === "object") { - // Serialize object item. - for (name in obj) { - buildParams(prefix + "[" + name + "]", obj[name], traditional, add); - } + // Serialize object item. + for (name in obj) { + buildParams(prefix + "[" + name + "]", obj[name], traditional, add); + } - } else { + } else { - // Serialize scalar item. - add(prefix, obj); - } - }; + // Serialize scalar item. + add(prefix, obj); + } + }; - // If an array was passed in, assume that it is an array of form elements. - if (Array.isArray(a)) { - // Serialize the form elements - for (key in a) { - if (!a.hasOwnProperty(key)) { - continue; - } - add(key, a[key]); - } + // If an array was passed in, assume that it is an array of form elements. + if (Array.isArray(a)) { + // Serialize the form elements + for (key in a) { + if (!a.hasOwnProperty(key)) { + continue; + } + add(key, a[key]); + } - } else { + } else { - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for (prefix in a) { - if (!a.hasOwnProperty(prefix)) { - continue; - } - buildParams(prefix, a[prefix], traditional, add); - } - } + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for (prefix in a) { + if (!a.hasOwnProperty(prefix)) { + continue; + } + buildParams(prefix, a[prefix], traditional, add); + } + } - // Return the resulting serialization - return s.join("&"); + // Return the resulting serialization + return s.join("&"); }; /** @@ -289,83 +1952,75 @@ window.Tea.url = function (action, params, hashParams) { action = window.location.pathname; } - var config = window.TEA.ACTION; - var controller = config.parent; - var module = config.module; - var base = config.base; - var actionParam = config.actionParam; + var config = window.TEA.ACTION; + var controller = config.parent; + var module = config.module; + var base = config.base; + var actionParam = config.actionParam; - var url; - if (action.match(/\//)) {//支持URL - url = action; + var url; + if (action.match(/\//)) {//支持URL + url = action; - if (typeof(params) === "object") { - var query = Tea.serialize(params); - if (query.length > 0) { - url += "?" + query; - } - } - if (!url.match(/^(http|https|ftp):/i)) { - url = base + ((url.substr(0, 1) === "/") ? "" : "/") + url; - } - } - else { - if (action.substr(0, 2) === "..") { - var pos = controller.lastIndexOf("."); - if (pos === -1) { - action = action.substr(2); - } - else { - action = controller.substr(0, pos) + action.substr(1); - } - if (module !== "") { - action = "@" + module + "." + action; - } - } - else if (action.substr(0, 1) === ".") { - action = controller + action; - if (module !== "") { - action = "@" + module + "." + action; - } - } - else if (module !== "") { - if (action === "@") { - action = "@" + module; - } - else { - action = action.replace("@.", "@" + module + "."); - } - } - action = action.replace(/\.$/, ""); - if (actionParam) { - var path = action.replace(/[.\/]+/g, "/"); - if (path.substr(0, 1) !== "/") { - path = "/" + path; - } - url = base + "?__ACTION__=" + path; - } - else { - url = base + "/" + action.replace(/[.\/]+/g, "/").replace(/^\//, ""); - } - if (typeof(params) === "object") { - params = Tea.serialize(params); - if (params.length > 0) { - if (url.indexOf("?") === -1) { - url += "?" + params; - } - else { - url += "&" + params; - } - } - } - if (typeof(hashParams) === "string") { - url += "#" + hashParams; - } - else if (typeof(hashParams) === "object") { - url += "#" + Tea.serialize(hashParams); - } - } - return url; + if (typeof (params) === "object") { + var query = Tea.serialize(params); + if (query.length > 0) { + url += "?" + query; + } + } + if (!url.match(/^(http|https|ftp):/i)) { + url = base + ((url.substr(0, 1) === "/") ? "" : "/") + url; + } + } else { + if (action.substr(0, 2) === "..") { + var pos = controller.lastIndexOf("."); + if (pos === -1) { + action = action.substr(2); + } else { + action = controller.substr(0, pos) + action.substr(1); + } + if (module !== "") { + action = "@" + module + "." + action; + } + } else if (action.substr(0, 1) === ".") { + action = controller + action; + if (module !== "") { + action = "@" + module + "." + action; + } + } else if (module !== "") { + if (action === "@") { + action = "@" + module; + } else { + action = action.replace("@.", "@" + module + "."); + } + } + action = action.replace(/\.$/, ""); + if (actionParam) { + var path = action.replace(/[.\/]+/g, "/"); + if (path.substr(0, 1) !== "/") { + path = "/" + path; + } + url = base + "?__ACTION__=" + path; + } else { + url = base + "/" + action.replace(/[.\/]+/g, "/").replace(/^\//, ""); + } + if (typeof (params) === "object") { + params = Tea.serialize(params); + if (params.length > 0) { + if (url.indexOf("?") === -1) { + url += "?" + params; + } else { + url += "&" + params; + } + } + } + if (typeof (hashParams) === "string") { + url += "#" + hashParams; + } else if (typeof (hashParams) === "object") { + url += "#" + Tea.serialize(hashParams); + } + } + return url; }; /** @@ -376,12 +2031,12 @@ window.Tea.url = function (action, params, hashParams) { * @param hash 附带的锚点参数 */ window.Tea.go = function (action, params, hash) { - var url = Tea.url(action, params); - if (hash && hash.length > 0) { - url += "#" + hash; - } + var url = Tea.url(action, params); + if (hash && hash.length > 0) { + url += "#" + hash; + } - window.location.href = url; + window.location.href = url; }; /** @@ -391,16 +2046,14 @@ window.Tea.go = function (action, params, hash) { * @returns {*} */ window.Tea.formatBytes = function (bytes) { - if (bytes < 1024) { - return "< 1kb"; - } - else if (bytes < 1024 * 1024) { - return Math.round(bytes / 1024 * 100) / 100 + " kb"; - } - else if (bytes < 1024 * 1024 * 1024) { - return Math.round(bytes / 1024 / 1024 * 100) / 100 + " mb"; - } - return Math.round(bytes / 1024 / 1024 / 1024 * 100) / 100 + " gb"; + if (bytes < 1024) { + return "< 1kb"; + } else if (bytes < 1024 * 1024) { + return Math.round(bytes / 1024 * 100) / 100 + " kb"; + } else if (bytes < 1024 * 1024 * 1024) { + return Math.round(bytes / 1024 / 1024 * 100) / 100 + " mb"; + } + return Math.round(bytes / 1024 / 1024 / 1024 * 100) / 100 + " gb"; }; /** @@ -413,39 +2066,39 @@ window.Tea.formatBytes = function (bytes) { * @returns {number} */ window.Tea.versionCompare = function compare(a, b) { - if (a === b) { - return 0; - } + if (a === b) { + return 0; + } - var a_components = a.split("."); - var b_components = b.split("."); + var a_components = a.split("."); + var b_components = b.split("."); - var len = Math.min(a_components.length, b_components.length); + var len = Math.min(a_components.length, b_components.length); - // loop while the components are equal - for (var i = 0; i < len; i++) { - // A bigger than B - if (parseInt(a_components[i]) > parseInt(b_components[i])) { - return 1; - } + // loop while the components are equal + for (var i = 0; i < len; i++) { + // A bigger than B + if (parseInt(a_components[i]) > parseInt(b_components[i])) { + return 1; + } - // B bigger than A - if (parseInt(a_components[i]) < parseInt(b_components[i])) { - return -1; - } - } + // B bigger than A + if (parseInt(a_components[i]) < parseInt(b_components[i])) { + return -1; + } + } - // If one's a prefix of the other, the longer one is greater. - if (a_components.length > b_components.length) { - return 1; - } + // If one's a prefix of the other, the longer one is greater. + if (a_components.length > b_components.length) { + return 1; + } - if (a_components.length < b_components.length) { - return -1; - } + if (a_components.length < b_components.length) { + return -1; + } - // Otherwise they are the same. - return 0; + // Otherwise they are the same. + return 0; }; @@ -456,12 +2109,12 @@ window.Tea.versionCompare = function compare(a, b) { * @param ms 延时长度 */ window.Tea.delay = function (fn, ms) { - if (typeof(ms) === "undefined") { - ms = 10; - } - setTimeout(function () { - fn.call(Tea.Vue); - }, ms); + if (typeof (ms) === "undefined") { + ms = 10; + } + setTimeout(function () { + fn.call(Tea.Vue); + }, ms); }; /** @@ -472,203 +2125,197 @@ window.Tea.delay = function (fn, ms) { * @constructor */ window.Tea.Action = function (action, params) { - var _action = action; - var _params = params; - var _successFn; - var _failFn; - var _errorFn; - var _doneFn; - var _method = "POST"; - var _timeout = 30; - var _delay = 0; - var _progressFn; - var _refresh = false; + var _action = action; + var _params = params; + var _successFn; + var _failFn; + var _errorFn; + var _doneFn; + var _method = "POST"; + var _timeout = 30; + var _delay = 0; + var _progressFn; + var _refresh = false; - this.params = function (params) { - _params = params; - return this; - }; + this.params = function (params) { + _params = params; + return this; + }; - this.form = function (form) { - _params = new FormData(form); - return this; - }; + this.form = function (form) { + _params = new FormData(form); + return this; + }; - this.success = function (successFn) { - _successFn = successFn; - return this; - }; + this.success = function (successFn) { + _successFn = successFn; + return this; + }; - this.fail = function (failFn) { - _failFn = failFn; - return this; - }; + this.fail = function (failFn) { + _failFn = failFn; + return this; + }; - this.error = function (errorFn) { - _errorFn = errorFn; - return this; - }; + this.error = function (errorFn) { + _errorFn = errorFn; + return this; + }; - this.done = function (doneFn) { - _doneFn = doneFn; - return this; - }; + this.done = function (doneFn) { + _doneFn = doneFn; + return this; + }; - this.timeout = function (timeout) { - _timeout = timeout; - return this; - }; + this.timeout = function (timeout) { + _timeout = timeout; + return this; + }; - this.delay = function (delay) { - _delay = delay; - return this; - }; + this.delay = function (delay) { + _delay = delay; + return this; + }; - this.progress = function (progressFn) { - _progressFn = progressFn; - return this; - }; + this.progress = function (progressFn) { + _progressFn = progressFn; + return this; + }; - this.refresh = function () { - _refresh = true; - return this; - }; + this.refresh = function () { + _refresh = true; + return this; + }; - this.post = function () { - _method = "POST"; - setTimeout(this._post); + this.post = function () { + _method = "POST"; + setTimeout(this._post); - return this; - }; + return this; + }; - this.get = function () { - _method = "GET"; - setTimeout(this._post); + this.get = function () { + _method = "GET"; + setTimeout(this._post); - return this; - }; + return this; + }; - this._post = function () { - var params = _params; + this._post = function () { + var params = _params; - // 参数配置:https://github.com/axios/axios#request-config - var config = { - method: _method, - url: Tea.url(_action), - timeout: _timeout * 1000, - headers: { - "X-Requested-With": "XMLHttpRequest" - } - }; + // 参数配置:https://github.com/axios/axios#request-config + var config = { + method: _method, + url: Tea.url(_action), + timeout: _timeout * 1000, + headers: { + "X-Requested-With": "XMLHttpRequest" + } + }; - if (_progressFn != null && typeof(_progressFn) == "function") { - config["onUploadProgress"] = function (event) { - _progressFn.call(Tea.Vue, event.loaded, event.total, event); - }; - } + if (_progressFn != null && typeof (_progressFn) == "function") { + config["onUploadProgress"] = function (event) { + _progressFn.call(Tea.Vue, event.loaded, event.total, event); + }; + } - if (_method === "GET") { - config["params"] = params; - } - else { - if (typeof(params) === "object" && params instanceof FormData) { - Array.from(params).$each(function (name, object) { - if (object != null && object instanceof File) { - if (object.size === 0 && object.name.length === 0) { - params.delete(name); - } - } - }); - config["data"] = params; - } - else { - var formData = new FormData(); - for (var key in params) { - if (!params.hasOwnProperty(key)) { - continue; - } + if (_method === "GET") { + config["params"] = params; + } else { + if (typeof (params) === "object" && params instanceof FormData) { + Array.from(params).$each(function (name, object) { + if (object != null && object instanceof File) { + if (object.size === 0 && object.name.length === 0) { + params.delete(name); + } + } + }); + config["data"] = params; + } else { + var formData = new FormData(); + for (var key in params) { + if (!params.hasOwnProperty(key)) { + continue; + } - if (params[key] == null) { - formData.append(key, ""); - } - else { - if (typeof(params[key]) == "object" && (params[key] instanceof Array)) { - for (var i = 0; i < params[key].length; i ++) { - formData.append(key, params[key][i]); - } - } else { - formData.append(key, params[key]); - } - } - } + if (params[key] == null) { + formData.append(key, ""); + } else { + if (typeof (params[key]) == "object" && (params[key] instanceof Array)) { + for (var i = 0; i < params[key].length; i++) { + formData.append(key, params[key][i]); + } + } else { + formData.append(key, params[key]); + } + } + } - config["data"] = formData; - } - } + config["data"] = formData; + } + } - axios(config) - .then(function (response) { - response = response.data; + axios(config) + .then(function (response) { + response = response.data; - setTimeout(function () { - if (typeof(response) !== "object" || typeof(response.code) === "undefined") { - if (typeof(_errorFn) === "function") { - _errorFn.call(Tea.Vue, {}); - } - return; - } + setTimeout(function () { + if (typeof (response) !== "object" || typeof (response.code) === "undefined") { + if (typeof (_errorFn) === "function") { + _errorFn.call(Tea.Vue, {}); + } + return; + } - var code = parseInt(response.code, 10); - if (code === 200) { - if (typeof(_successFn) === "function") { - var result = _successFn.call(Tea.Vue, response); - if (typeof(result) === "boolean" && !result) { - return; - } - } + var code = parseInt(response.code, 10); + if (code === 200) { + if (typeof (_successFn) === "function") { + var result = _successFn.call(Tea.Vue, response); + if (typeof (result) === "boolean" && !result) { + return; + } + } - if (response.message != null && response.message.length > 0) { - alert(response.message); - } + if (response.message != null && response.message.length > 0) { + alert(response.message); + } - if (response.next != null && typeof(response.next) === "object") { - if (response.next.action === "*refresh") { - window.location.reload(); - } - else { - Tea.go(response.next.action, response.next.params, response.next.hash); - } - } + if (response.next != null && typeof (response.next) === "object") { + if (response.next.action === "*refresh") { + window.location.reload(); + } else { + Tea.go(response.next.action, response.next.params, response.next.hash); + } + } - // 自动刷新 - if (_refresh) { - window.location.reload(); - } - } - else { - if (typeof(_failFn) === "function") { - _failFn.call(Tea.Vue, response); - } - else { - Tea.failResponse(response); - } - } - }); - }) - .catch(function (error) { - console.log(error); + // 自动刷新 + if (_refresh) { + window.location.reload(); + } + } else { + if (typeof (_failFn) === "function") { + _failFn.call(Tea.Vue, response); + } else { + Tea.failResponse(response); + } + } + }); + }) + .catch(function (error) { + console.log(error); - if (typeof(_errorFn) === "function") { - _errorFn.call(Tea.Vue, {}); - } - }) - .then(function () { - // console.log("done"); - if (typeof(_doneFn) == "function") { - _doneFn.call(Tea.Vue, {}); - } - }); - }; + if (typeof (_errorFn) === "function") { + _errorFn.call(Tea.Vue, {}); + } + }) + .then(function () { + // console.log("done"); + if (typeof (_doneFn) == "function") { + _doneFn.call(Tea.Vue, {}); + } + }); + }; }; /** @@ -678,7 +2325,7 @@ window.Tea.Action = function (action, params) { * @returns {Window.Tea.Action} */ window.Tea.action = function (action) { - return new this.Action(action); + return new this.Action(action); }; /** @@ -696,32 +2343,31 @@ window.Tea.action = function (action) { * - data-tea-progress */ window.Tea.activate = function (element) { - var nodes = Tea.element("*[data-tea-action]", element); - if (nodes.length === 0) { - return; - } - for (var i = 0; i < nodes.length; i++) { - var node = nodes[i]; + var nodes = Tea.element("*[data-tea-action]", element); + if (nodes.length === 0) { + return; + } + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; - if (node.tagName.toUpperCase() === "FORM") { - Tea.element(node).unbind("submit").bind("submit", function (e) { - Tea.runActionOn(this); + if (node.tagName.toUpperCase() === "FORM") { + Tea.element(node).unbind("submit").bind("submit", function (e) { + Tea.runActionOn(this); - e.preventDefault(); - e.stopPropagation(); - }); - } - else { - Tea.element(node).unbind("click").bind("click", function (e) { - Tea.runActionOn(this); + e.preventDefault(); + e.stopPropagation(); + }); + } else { + Tea.element(node).unbind("click").bind("click", function (e) { + Tea.runActionOn(this); - e.preventDefault(); - e.stopPropagation(); + e.preventDefault(); + e.stopPropagation(); - return false; - }); - } - } + return false; + }); + } + } }; /** @@ -730,327 +2376,326 @@ window.Tea.activate = function (element) { * @param element 元素 */ window.Tea.runActionOn = function (element) { - var form = Tea.element(element); - var action = form.attr("data-tea-action"); - var timeout = form.attr("data-tea-timeout"); - var confirm = form.attr("data-tea-confirm"); - var beforeFn = form.attr("data-tea-before"); - var successFn = form.attr("data-tea-success"); - var failFn = form.attr("data-tea-fail"); - var errorFn = form.attr("data-tea-error"); - var progressFn = form.attr("data-tea-progress"); - var doneFn = form.attr("data-tea-done"); - if (confirm != null && confirm.length > 0 && !window.confirm(confirm)) { - return; - } + var form = Tea.element(element); + var action = form.attr("data-tea-action"); + var timeout = form.attr("data-tea-timeout"); + var confirm = form.attr("data-tea-confirm"); + var beforeFn = form.attr("data-tea-before"); + var successFn = form.attr("data-tea-success"); + var failFn = form.attr("data-tea-fail"); + var errorFn = form.attr("data-tea-error"); + var progressFn = form.attr("data-tea-progress"); + var doneFn = form.attr("data-tea-done"); + if (confirm != null && confirm.length > 0 && !window.confirm(confirm)) { + return; + } - //执行前调用beforeFn - if (beforeFn != null && beforeFn.length > 0) { - beforeFn = beforeFn.split("(")[0].trim(); - if (typeof(Tea.Vue[beforeFn]) === "function") { - var result = Tea.Vue[beforeFn].call(Tea.Vue, form); - if (typeof(result) === "boolean" && !result) { - return; - } - } - } + //执行前调用beforeFn + if (beforeFn != null && beforeFn.length > 0) { + beforeFn = beforeFn.split("(")[0].trim(); + if (typeof (Tea.Vue[beforeFn]) === "function") { + var result = Tea.Vue[beforeFn].call(Tea.Vue, form); + if (typeof (result) === "boolean" && !result) { + return; + } + } + } - //请求对象 - var actionObject = Tea.action(action) - .post(); + //请求对象 + var actionObject = Tea.action(action) + .post(); - if (successFn != null && successFn.length > 0) { - if (typeof(Tea.Vue[successFn]) === "function") { - actionObject.success(function (resp) { - Tea.Vue[successFn].call(Tea.Vue, resp); - }); - } - } + if (successFn != null && successFn.length > 0) { + if (typeof (Tea.Vue[successFn]) === "function") { + actionObject.success(function (resp) { + Tea.Vue[successFn].call(Tea.Vue, resp); + }); + } + } - if (failFn != null && failFn.length > 0) { - if (typeof(Tea.Vue[failFn]) === "function") { - actionObject.fail(function (resp) { - Tea.Vue[failFn].call(Tea.Vue, resp); - }); - } - } + if (failFn != null && failFn.length > 0) { + if (typeof (Tea.Vue[failFn]) === "function") { + actionObject.fail(function (resp) { + Tea.Vue[failFn].call(Tea.Vue, resp); + }); + } + } - if (errorFn != null && errorFn.length > 0) { - if (typeof(Tea.Vue[errorFn]) === "function") { - actionObject.error(function () { - Tea.Vue[errorFn].call(Tea.Vue); - }); - } - } + if (errorFn != null && errorFn.length > 0) { + if (typeof (Tea.Vue[errorFn]) === "function") { + actionObject.error(function () { + Tea.Vue[errorFn].call(Tea.Vue); + }); + } + } - if (progressFn != null && progressFn.length > 0) { - if (typeof(Tea.Vue[progressFn]) === "function") { - actionObject.progress(function () { - Tea.Vue[progressFn].apply(Tea.Vue, arguments); - }); - } - } + if (progressFn != null && progressFn.length > 0) { + if (typeof (Tea.Vue[progressFn]) === "function") { + actionObject.progress(function () { + Tea.Vue[progressFn].apply(Tea.Vue, arguments); + }); + } + } - if (doneFn != null && doneFn.length > 0) { - if (typeof(Tea.Vue[doneFn]) === "function") { - actionObject.done(function () { - Tea.Vue[doneFn].apply(Tea.Vue, arguments); - }); - } - } + if (doneFn != null && doneFn.length > 0) { + if (typeof (Tea.Vue[doneFn]) === "function") { + actionObject.done(function () { + Tea.Vue[doneFn].apply(Tea.Vue, arguments); + }); + } + } - //超时时间 - if (timeout != null) { - timeout = parseFloat(timeout); - if (!isNaN(timeout)) { - actionObject.timeout(timeout); - } - } + //超时时间 + if (timeout != null) { + timeout = parseFloat(timeout); + if (!isNaN(timeout)) { + actionObject.timeout(timeout); + } + } - //参数 - if (element.tagName.toUpperCase() === "FORM") { - actionObject.form(element); - } - else { - var attributes = element.attributes; - var params = {}; - for (var i = 0; i < attributes.length; i++) { - var attr = attributes[i]; - var match = attr.name.toString().match(/^data-(.+)$/); - if (match && !match[1].match(/^tea-/)) { - var pieces = match[1].split("-"); - for (var j = 1; j < pieces.length; j++) { - pieces[j] = pieces[j][0].toUpperCase() + pieces[j].substr(1); - } - var name = pieces.join(""); - params[name] = attr.value; - } - } - actionObject.params(params); - } + //参数 + if (element.tagName.toUpperCase() === "FORM") { + actionObject.form(element); + } else { + var attributes = element.attributes; + var params = {}; + for (var i = 0; i < attributes.length; i++) { + var attr = attributes[i]; + var match = attr.name.toString().match(/^data-(.+)$/); + if (match && !match[1].match(/^tea-/)) { + var pieces = match[1].split("-"); + for (var j = 1; j < pieces.length; j++) { + pieces[j] = pieces[j][0].toUpperCase() + pieces[j].substr(1); + } + var name = pieces.join(""); + params[name] = attr.value; + } + } + actionObject.params(params); + } }; var teaEventListeners = {}; // element => { event => [ callback1, ... ] } function TeaElementObjects(elements) { - var that = this; + var that = this; - elements.$each(function (index, element) { - that[index] = element; - }); + elements.$each(function (index, element) { + that[index] = element; + }); - this.bind = function (event, listener) { - elements.$each(function (_, element) { - if (typeof(teaEventListeners[element]) == "undefined") { - teaEventListeners[element] = {}; - } - if (typeof(teaEventListeners[element][event]) == "undefined") { - teaEventListeners[element][event] = []; - } - teaEventListeners[element][event].push(listener); - element.addEventListener(event, listener) - }); + this.bind = function (event, listener) { + elements.$each(function (_, element) { + if (typeof (teaEventListeners[element]) == "undefined") { + teaEventListeners[element] = {}; + } + if (typeof (teaEventListeners[element][event]) == "undefined") { + teaEventListeners[element][event] = []; + } + teaEventListeners[element][event].push(listener); + element.addEventListener(event, listener) + }); - return this; - }; + return this; + }; - this.unbind = function (event) { - elements.$each(function (_, element) { - if (typeof(teaEventListeners[element]) == "undefined") { - return; - } - if (typeof(teaEventListeners[element][event]) == "undefined") { - return; - } - teaEventListeners[element][event].$each(function (_, listener) { - element.removeEventListener(event, listener); - }); - teaEventListeners[element][event] = []; - var hasListeners = false; - for (var k in teaEventListeners[element]) { - if (!teaEventListeners[element].hasOwnProperty(k)) { - continue; - } + this.unbind = function (event) { + elements.$each(function (_, element) { + if (typeof (teaEventListeners[element]) == "undefined") { + return; + } + if (typeof (teaEventListeners[element][event]) == "undefined") { + return; + } + teaEventListeners[element][event].$each(function (_, listener) { + element.removeEventListener(event, listener); + }); + teaEventListeners[element][event] = []; + var hasListeners = false; + for (var k in teaEventListeners[element]) { + if (!teaEventListeners[element].hasOwnProperty(k)) { + continue; + } - if (teaEventListeners[element][k] instanceof Array && teaEventListeners[element][k].length > 0) { - hasListeners = true; - } - } + if (teaEventListeners[element][k] instanceof Array && teaEventListeners[element][k].length > 0) { + hasListeners = true; + } + } - if (!hasListeners) { - delete(teaEventListeners[element]); - } - }); + if (!hasListeners) { + delete (teaEventListeners[element]); + } + }); - return this; - }; + return this; + }; - this.first = function () { - var first = elements.$first(); - if (first != null) { - return Tea.element(first); - } - return new TeaElementObjects([]); - }; + this.first = function () { + var first = elements.$first(); + if (first != null) { + return Tea.element(first); + } + return new TeaElementObjects([]); + }; - this.last = function () { - var last = elements.$last(); - if (last != null) { - return Tea.element(last); - } - return new TeaElementObjects([]); - }; + this.last = function () { + var last = elements.$last(); + if (last != null) { + return Tea.element(last); + } + return new TeaElementObjects([]); + }; - this.attrs = function () { - var first = this.first(); - if (first.length === 0) { - return {}; - } + this.attrs = function () { + var first = this.first(); + if (first.length === 0) { + return {}; + } - var attrs = {}; - var node = first[0]; - for (var i = 0; i < node.attributes.length; i ++) { - var attr = node.attributes[i]; - attrs[attr.name] = attr.value; - } - return attrs; - }; + var attrs = {}; + var node = first[0]; + for (var i = 0; i < node.attributes.length; i++) { + var attr = node.attributes[i]; + attrs[attr.name] = attr.value; + } + return attrs; + }; - this.attr = function (name, value) { - if (arguments.length === 0) { - return ""; - } + this.attr = function (name, value) { + if (arguments.length === 0) { + return ""; + } - if (arguments.length === 1) { - var attrs = this.attrs(); - if (typeof(attrs[name]) !== "undefined") { - return attrs[name]; - } - return ""; - } + if (arguments.length === 1) { + var attrs = this.attrs(); + if (typeof (attrs[name]) !== "undefined") { + return attrs[name]; + } + return ""; + } - var first = this.first(); - if (first.length > 0) { - first[0].setAttribute(name, value); - } + var first = this.first(); + if (first.length > 0) { + first[0].setAttribute(name, value); + } - return this; - }; + return this; + }; - this.tagName = function () { - var first = this.first(); - if (first.length === 0) { - return ""; - } - return first[0].tagName; - }; + this.tagName = function () { + var first = this.first(); + if (first.length === 0) { + return ""; + } + return first[0].tagName; + }; - this.focus = function () { - var first = this.first(); - if (first.length === 0) { - return; - } - first[0].focus(); - }; + this.focus = function () { + var first = this.first(); + if (first.length === 0) { + return; + } + first[0].focus(); + }; - this.blur = function () { - this.each(function (k, v) { - v.blur(); - }); - }; + this.blur = function () { + this.each(function (k, v) { + v.blur(); + }); + }; - this.each = function (iterator) { - elements.$each(function (index, element) { - iterator(index, element); - }); + this.each = function (iterator) { + elements.$each(function (index, element) { + iterator(index, element); + }); - return this; - }; + return this; + }; - this.find = function (selector) { - if (this.length == 0) { - return new TeaElementObjects([]); - } - return Tea.element(selector, this.first()[0]); - }; + this.find = function (selector) { + if (this.length == 0) { + return new TeaElementObjects([]); + } + return Tea.element(selector, this.first()[0]); + }; - this.hide = function () { - this.each(function (_, element) { - element.style.display = "none"; - }); - return this; - }; + this.hide = function () { + this.each(function (_, element) { + element.style.display = "none"; + }); + return this; + }; - this.show = function () { - this.each(function (_, element) { - element.style.display = "block"; - }); - return this; - }; + this.show = function () { + this.each(function (_, element) { + element.style.display = "block"; + }); + return this; + }; - this.text = function () { - if (arguments.length > 0) { - var text = arguments[0]; - this.each(function (_, element) { - if (typeof(element.textContent) != "undefined") { - element.textContent = text; - } - if (typeof(element.innerText) != "undefined") { - element.innerText = text; - } - }); - return this; - } + this.text = function () { + if (arguments.length > 0) { + var text = arguments[0]; + this.each(function (_, element) { + if (typeof (element.textContent) != "undefined") { + element.textContent = text; + } + if (typeof (element.innerText) != "undefined") { + element.innerText = text; + } + }); + return this; + } - if (this.length == 0) { - return ""; - } - if (typeof(elements[0].textContent) == "string") { - return elements[0].textContent; - } - return elements[0].innerText; - }; + if (this.length == 0) { + return ""; + } + if (typeof (elements[0].textContent) == "string") { + return elements[0].textContent; + } + return elements[0].innerText; + }; - this.html = function () { - if (arguments.length > 0) { - var html = arguments[0]; - this.each(function (_, element) { - element.innerHTML = html; - }); - return this; - } + this.html = function () { + if (arguments.length > 0) { + var html = arguments[0]; + this.each(function (_, element) { + element.innerHTML = html; + }); + return this; + } - if (this.length == 0) { - return ""; - } - return elements[0].innerHTML; - }; + if (this.length == 0) { + return ""; + } + return elements[0].innerHTML; + }; - this.val = function () { - if (arguments.length > 0) { - var value = arguments[0]; - this.each(function (_, element) { - element.value = value; - }); - return this; - } + this.val = function () { + if (arguments.length > 0) { + var value = arguments[0]; + this.each(function (_, element) { + element.value = value; + }); + return this; + } - if (this.length == 0) { - return ""; - } - return elements[0].value; - }; + if (this.length == 0) { + return ""; + } + return elements[0].value; + }; - this.remove = function () { - this.each(function (_, element) { - var parent = element.parentNode; - if (parent != null) { - parent.removeChild(element); - } - }); - return this; - }; + this.remove = function () { + this.each(function (_, element) { + var parent = element.parentNode; + if (parent != null) { + parent.removeChild(element); + } + }); + return this; + }; - this.length = elements.length; + this.length = elements.length; } /** @@ -1061,22 +2706,20 @@ function TeaElementObjects(elements) { * @returns {*} */ window.Tea.element = function (selector, parent) { - var elements = []; - if (typeof(selector) === "object" && /(function|object) \w+Element\b/.test(selector.constructor.toString())) { - elements = [selector]; - } - else if (typeof(selector) === "object" && /function TeaElementObjects/.test(TeaElementObjects.constructor.toString())) { - return selector; - } - else if (typeof(selector) === "string") { - if (typeof(parent) === "object") { - elements = Array.from(parent.querySelectorAll(selector)); - } else { - elements = Array.from(document.querySelectorAll(selector)); - } - } + var elements = []; + if (typeof (selector) === "object" && /(function|object) \w+Element\b/.test(selector.constructor.toString())) { + elements = [selector]; + } else if (typeof (selector) === "object" && /function TeaElementObjects/.test(TeaElementObjects.constructor.toString())) { + return selector; + } else if (typeof (selector) === "string") { + if (typeof (parent) === "object") { + elements = Array.from(parent.querySelectorAll(selector)); + } else { + elements = Array.from(document.querySelectorAll(selector)); + } + } - return new TeaElementObjects(elements); + return new TeaElementObjects(elements); }; /** @@ -1084,35 +2727,42 @@ window.Tea.element = function (selector, parent) { * @returns {number} */ window.Tea.key = function () { - return Math.random() + return Math.random() }; // 失败的响应处理 window.Tea.failResponse = function (response) { - //消息提示 - var hasMessage = false; - if (response.message != null && response.message.length > 0) { - hasMessage = true; - Tea.alert(response.message); - return; - } + //消息提示 + var hasMessage = false; + if (response.message != null && response.message.length > 0) { + hasMessage = true; + Tea.alert(response.message, function () { + if (typeof (response.errors) === "object" && response.errors != null && response.errors.length > 0) { + var fieldName = response.errors[0].param; + var element = Tea.element("*[name='" + fieldName + "']"); + if (element) { + element.focus(); + } + } + }); + return; + } - if (typeof(response.errors) === "object" && response.errors != null && response.errors.length > 0) { - /** - * errors: [ - * [field1, [ error1, error2, ....] - * ... - * ] - * error: [ rule, message ] - */ - var fieldName = response.errors[0].param; - var error = response.errors[0].messages[0]; - var callback = function () { + if (typeof (response.errors) === "object" && response.errors != null && response.errors.length > 0) { + /** + * errors: [ + * [field1, [ error1, error2, ....] + * ... + * ] + * error: [ rule, message ] + */ + var fieldName = response.errors[0].param; + var error = response.errors[0].messages[0]; + var callback = function () { var element = Tea.element("*[name='" + fieldName + "']"); if (element) { element.focus(); - } - else { + } else { var match = fieldName.match(/^(.+)\[(\d+)]$/); if (match != null) { var index = parseInt(match[2], 10); @@ -1123,33 +2773,36 @@ window.Tea.failResponse = function (response) { } } }; - if (!hasMessage) { - Tea.alert(error, callback); - } else { - callback(); - } - } -}; - -window.Tea.alert = function (message, callback) { - if (typeof(teaweb) != null) { - teaweb.warn(message, function () { - if (typeof(callback) == "function") { - callback(); - } - }); - } else { - alert(message); - if (typeof(callback) == "function") { + if (!hasMessage) { + Tea.alert(error, callback); + } else { callback(); } } }; -if (typeof(window.console) === "undefined") { - window.console = { - log: function () {}, - error: function () {}, - group: function () {} - }; +window.Tea.alert = function (message, callback) { + if (typeof (teaweb) != null) { + teaweb.warn(message, function () { + if (typeof (callback) == "function") { + callback(); + } + }); + } else { + alert(message); + if (typeof (callback) == "function") { + callback(); + } + } +}; + +if (typeof (window.console) === "undefined") { + window.console = { + log: function () { + }, + error: function () { + }, + group: function () { + } + }; } \ No newline at end of file diff --git a/web/views/@default/servers/certs/index.html b/web/views/@default/servers/certs/index.html index a7646291..37bb2846 100644 --- a/web/views/@default/servers/certs/index.html +++ b/web/views/@default/servers/certs/index.html @@ -44,7 +44,7 @@ {{cert.name}}
- CA + CA
ACME diff --git a/web/views/@default/servers/certs/index.js b/web/views/@default/servers/certs/index.js index 26bfe239..df2603fe 100644 --- a/web/views/@default/servers/certs/index.js +++ b/web/views/@default/servers/certs/index.js @@ -2,7 +2,7 @@ Tea.context(function () { // 上传证书 this.uploadCert = function () { teaweb.popup("/servers/certs/uploadPopup", { - height: "28em", + height: "30em", callback: function () { teaweb.success("上传成功", function () { window.location.reload() @@ -34,7 +34,7 @@ Tea.context(function () { // 修改证书 this.updateCert = function (certId) { teaweb.popup("/servers/certs/updatePopup?certId=" + certId, { - height: "28em", + height: "30em", callback: function () { teaweb.success("上传成功", function () { window.location.reload() diff --git a/web/views/@default/servers/certs/updatePopup.html b/web/views/@default/servers/certs/updatePopup.html index ff7a1abb..b56d7a55 100644 --- a/web/views/@default/servers/certs/updatePopup.html +++ b/web/views/@default/servers/certs/updatePopup.html @@ -4,6 +4,7 @@
+ @@ -24,15 +25,17 @@ diff --git a/web/views/@default/servers/certs/updatePopup.js b/web/views/@default/servers/certs/updatePopup.js index 5e6a55a7..7d1f2a2d 100644 --- a/web/views/@default/servers/certs/updatePopup.js +++ b/web/views/@default/servers/certs/updatePopup.js @@ -1,4 +1,9 @@ Tea.context(function () { this.success = NotifyPopup this.isCA = this.certConfig.isCA ? 1 : 0 + this.textMode = false + + this.switchTextMode = function () { + this.textMode = !this.textMode + } }) \ No newline at end of file diff --git a/web/views/@default/servers/certs/uploadPopup.html b/web/views/@default/servers/certs/uploadPopup.html index e45ba4b6..275c3474 100644 --- a/web/views/@default/servers/certs/uploadPopup.html +++ b/web/views/@default/servers/certs/uploadPopup.html @@ -3,6 +3,7 @@

上传证书

+
证书说明 *
选择证书文件 - -

内容中通常含有"-----BEGIN CERTIFICATE-----"类似的信息。

+ + +

[输入内容上传文件]。文件内容中通常含有"-----BEGIN CERTIFICATE-----"类似的信息。

选择私钥文件 - -

内容中通常含有"-----BEGIN RSA PRIVATE KEY-----"类似的信息。

+ + +

[输入内容上传文件]。文件内容中通常含有"-----BEGIN RSA PRIVATE KEY-----"类似的信息。

@@ -23,15 +24,17 @@ diff --git a/web/views/@default/servers/certs/uploadPopup.js b/web/views/@default/servers/certs/uploadPopup.js index fbdcfddd..bc78183a 100644 --- a/web/views/@default/servers/certs/uploadPopup.js +++ b/web/views/@default/servers/certs/uploadPopup.js @@ -1,4 +1,9 @@ Tea.context(function () { this.success = NotifyPopup this.isCA = 0 + this.textMode = false + + this.switchTextMode = function () { + this.textMode = !this.textMode + } }) \ No newline at end of file
证书说明 *
选择证书文件 * - -

内容中通常含有"-----BEGIN CERTIFICATE-----"类似的信息。

+ + +

[输入内容上传文件]。文件内容中通常含有"-----BEGIN CERTIFICATE-----"类似的信息。

选择私钥文件 * - -

内容中通常含有"-----BEGIN RSA PRIVATE KEY-----"类似的信息。

+ + +

[输入内容上传文件]。文件内容中通常含有"-----BEGIN RSA PRIVATE KEY-----"类似的信息。