config.html 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. {extend name="app/admin/view/base.html"/}
  2. {block name="resources"}
  3. <style>
  4. .ns-form {margin-top: 0;}
  5. </style>
  6. {/block}
  7. {block name="main"}
  8. <div class="layui-form ns-form">
  9. <div class="layui-form-item">
  10. <label class="layui-form-label">是否开启:</label>
  11. <div class="layui-input-block" id="isOpen">
  12. <input type="checkbox" name="status" lay-filter="isOpen" value="1" lay-skin="switch" {if condition="$info.is_use == 1"} checked {/if} />
  13. </div>
  14. <div class="ns-word-aux">当前使用阿里云上传配置</div>
  15. </div>
  16. <div class="layui-form-item">
  17. <label class="layui-form-label"><span class="required">*</span>AccessKeyID:</label>
  18. <div class="layui-input-block">
  19. <input type="text" name="access_key_id" lay-verify="required" placeholder="请输入Access Key ID" value="{$info.value.access_key_id ?? ''}" autocomplete="off" class="layui-input ns-len-long">
  20. </div>
  21. <div class="ns-word-aux">填写阿里云Access Key管理的(ID)。</div>
  22. </div>
  23. <div class="layui-form-item">
  24. <label class="layui-form-label"><span class="required">*</span>AccessKeySecret:</label>
  25. <div class="layui-input-block">
  26. <input type="text" name="access_key_secret" lay-verify="required" placeholder="请输入Access Key Secret" value="{$info.value.access_key_secret ?? ''}" autocomplete="off" class="layui-input ns-len-long">
  27. </div>
  28. <div class="ns-word-aux">Access Key Secret是您访问阿里云API的密钥,具有该账户完全的权限,请您妥善保管。(填写完Access Key ID 和 Access Key Secret 后请选择bucket)</div>
  29. </div>
  30. <div class="layui-form-item">
  31. <label class="layui-form-label"><span class="required">*</span>Bucket:</label>
  32. <div class="layui-input-block">
  33. <input type="text" name="bucket" lay-verify="required" placeholder="请输入存储空间的名称" value="{$info.value.bucket ?? ''}" autocomplete="off" class="layui-input ns-len-long">
  34. </div>
  35. <div class="ns-word-aux">与阿里云OSS开通对象名称一致</div>
  36. </div>
  37. <div class="layui-form-item">
  38. <label class="layui-form-label"><span class="required">*</span>endpoint:</label>
  39. <div class="layui-input-block">
  40. <input type="text" name="endpoint" lay-verify="required" placeholder="请输入domain" value="{$info.value.endpoint ?? ''}" autocomplete="off" class="layui-input ns-len-long">
  41. </div>
  42. <div class="ns-word-aux">官方建议开启绑定域名,域名格式:http://xx.xxxx.com/(不可绑定当前网站域名,建议新开二级域名)</div>
  43. </div>
  44. <!-- 表单操作 -->
  45. <div class="ns-form-row">
  46. <button class="layui-btn ns-bg-color" lay-submit lay-filter="save">保存</button>
  47. <button class="layui-btn layui-btn-primary" onclick="back()">返回</button>
  48. </div>
  49. </div>
  50. {/block}
  51. {block name="script"}
  52. <script>
  53. layui.use('form', function() {
  54. var form = layui.form,
  55. repeat_flag = false; //防重复标识
  56. form.render();
  57. form.on('submit(save)', function(data) {
  58. if (repeat_flag) return;
  59. repeat_flag = true;
  60. $.ajax({
  61. url: ns.url("alioss://admin/config/config"),
  62. data: data.field,
  63. dataType: 'JSON',
  64. type: 'POST',
  65. success: function(res) {
  66. repeat_flag = false;
  67. if (res.code >= 0) {
  68. layer.confirm('编辑成功', {
  69. title:'操作提示',
  70. btn: ['返回列表', '继续操作'],
  71. yes: function(){
  72. location.href = ns.url("admin/upload/oss")
  73. },
  74. btn2: function() {
  75. location.reload();
  76. }
  77. });
  78. }else{
  79. layer.msg(res.message);
  80. }
  81. }
  82. });
  83. });
  84. });
  85. function back() {
  86. location.href = ns.url("admin/upload/oss");
  87. }
  88. </script>
  89. {/block}