layui.use(["form","layer","jquery"],function(){function e(e="local"){var c=s('input[type="radio"][name="type"]');"local"==e?(s("legend").text("本地存储 - 配置"),c.eq(0).prop("checked",!0),c.eq(1).prop("checked",!1),s(".LocalConfig").removeClass("layui-hide"),s(".OssConfig").addClass("layui-hide"),s(".bucket,.endpoint,.accessKeyId,.accessKeySecret").removeAttr("lay-verify")):(s("legend").text("OSS存储 - 配置"),c.eq(0).prop("checked",!1),c.eq(1).prop("checked",!0),s(".LocalConfig").addClass("layui-hide"),s(".OssConfig").removeClass("layui-hide"),s(".endpoint").attr("lay-verify","url"),s(".bucket,.accessKeyId,.accessKeySecret").attr("lay-verify","required")),a.render()}var a=layui.form,c=void 0===parent.layer?layui.layer:top.layer,s=layui.jquery;s.ajax({url:"../../ajax.php?act=systemParameter",type:"get",dataType:"json",success:function(a){var c=a.data;s(".name").val(c.name),e(c.type),s(".localhost").val(c.localhost),s(".bucket").val(c.bucket),s(".endpoint").val(c.endpoint),s(".accessKeyId").val(c.accessKeyId),s(".accessKeySecret").val(c.accessKeySecret),s(".ossdomain").val(c.ossdomain),s(".indexpass").val(c.indexpass),s(".record").val(c.record)}}),a.on("submit(WebConfig)",function(e){var a=s(".name").val(),t=s("input[name='type']:checked").val(),o=s(".localhost").val(),l=s(".bucket").val(),n=s(".endpoint").val(),i=s(".accessKeyId").val(),r=s(".accessKeySecret").val(),d=s(".ossdomain").val(),y=s(".indexpass").val(),p=s(".record").val(),u=c.msg("数据提交中，请稍候",{icon:16,time:!1,shade:.8});return s.ajax({url:"../../ajax.php?act=webconfig",type:"post",data:{name:a,type:t,localhost:o,bucket:l,endpoint:n,accessKeyId:i,accessKeySecret:r,ossdomain:d,indexpass:y,record:p},dataType:"json",success:function(e){setTimeout(function(){c.close(u),c.msg(e.data.msg,{icon:1,time:1e3})},500)}}),!1}),a.on("radio()",function(a){e(a.value)})});