storage-alioss.html 5.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <form onsubmit="return false" data-auto="true" action="{:request()->url()}" method="post" class='layui-form layui-card' autocomplete="off">
  2. <div class="layui-card-body padding-top-20">
  3. <div class="color-text margin-left-40 margin-bottom-20 layui-code text-center layui-bg-gray" style="border-left-width:1px">
  4. <p class="margin-bottom-5 font-w7">文件将上传到阿里云 OSS 存储,需要配置 OSS 公开访问及跨域策略</p>
  5. <p>需要配置跨域访问 CORS 规则,设置:来源 Origin 为 *,允许 Methods 为 POST,允许 Headers 为 *</p>
  6. </div>
  7. {include file='config/storage-0'}
  8. <div class="layui-form-item">
  9. <label class="layui-form-label label-required">
  10. <span class="color-green font-w7">访问协议</span><br><span class="nowrap color-desc">Protocol</span>
  11. </label>
  12. <div class="layui-input-block">
  13. {if !sysconf('storage.alioss_http_protocol')}{php}sysconf('storage.alioss_http_protocol','http');{/php}{/if}
  14. {foreach ['http'=>'HTTP','https'=>'HTTPS','auto'=>"AUTO"] as $protocol=>$remark}
  15. <label class="think-radio">
  16. {if sysconf('storage.alioss_http_protocol') eq $protocol}
  17. <input checked type="radio" name="storage.alioss_http_protocol" value="{$protocol}" lay-ignore> {$remark}
  18. {else}
  19. <input type="radio" name="storage.alioss_http_protocol" value="{$protocol}" lay-ignore> {$remark}
  20. {/if}
  21. </label>
  22. {/foreach}
  23. <p class="help-block">阿里云OSS存储访问协议,其中 HTTPS 需要配置证书才能使用(AUTO 为相对协议)</p>
  24. </div>
  25. </div>
  26. <div class="layui-form-item">
  27. <label class="layui-form-label">
  28. <span class="color-green font-w7">存储区域</span><br><span class="nowrap color-desc label-required">Region</span>
  29. </label>
  30. <div class="layui-input-block">
  31. <select class="layui-select" name="storage.alioss_point" lay-search>
  32. {foreach $points as $point => $title}
  33. {if sysconf('storage.alioss_point') eq $point}
  34. <option selected value="{$point}">{$title}( {$point} )</option>
  35. {else}
  36. <option value="{$point}">{$title}( {$point} )</option>
  37. {/if}{/foreach}
  38. </select>
  39. <p class="help-block">阿里云OSS存储空间所在区域,需要严格对应储存所在区域才能上传文件</p>
  40. </div>
  41. </div>
  42. <div class="layui-form-item">
  43. <label class="layui-form-label" for="storage.alioss_bucket">
  44. <span class="color-green font-w7">空间名称</span><br><span class="nowrap color-desc">Bucket</span>
  45. </label>
  46. <div class="layui-input-block">
  47. <input id="storage.alioss_bucket" type="text" name="storage.alioss_bucket" required value="{:sysconf('storage.alioss_bucket')}" placeholder="请输入阿里云OSS存储 Bucket (空间名称)" class="layui-input">
  48. <p class="help-block">填写阿里云OSS存储空间名称,如:think-admin-oss(需要是全区唯一的值,不存在时会自动创建)</p>
  49. </div>
  50. </div>
  51. <div class="layui-form-item">
  52. <label class="layui-form-label" for="storage.alioss_http_domain">
  53. <span class="color-green font-w7">访问域名</span><br><span class="nowrap color-desc">Domain</span>
  54. </label>
  55. <div class="layui-input-block">
  56. <input id="storage.alioss_http_domain" type="text" name="storage.alioss_http_domain" required value="{:sysconf('storage.alioss_http_domain')}" placeholder="请输入阿里云OSS存储 Domain (访问域名)" class="layui-input">
  57. <p class="help-block">填写阿里云OSS存储外部访问域名,如:static.thinkadmin.top</p>
  58. </div>
  59. </div>
  60. <div class="layui-form-item">
  61. <label class="layui-form-label" for="storage.alioss_access_key">
  62. <span class="color-green font-w7">访问密钥</span><br><span class="nowrap color-desc">AccessKey</span>
  63. </label>
  64. <div class="layui-input-block">
  65. <input id="storage.alioss_access_key" type="text" name="storage.alioss_access_key" required value="{:sysconf('storage.alioss_access_key')}" placeholder="请输入阿里云OSS存储 AccessKey (访问密钥)" class="layui-input">
  66. <p class="help-block">可以在 [ 阿里云 > 个人中心 ] 设置并获取到访问密钥</p>
  67. </div>
  68. </div>
  69. <div class="layui-form-item">
  70. <label class="layui-form-label" for="storage.alioss_secret_key">
  71. <span class="color-green font-w7">安全密钥</span><br><span class="nowrap color-desc">SecretKey</span>
  72. </label>
  73. <div class="layui-input-block">
  74. <input id="storage.alioss_secret_key" type="text" name="storage.alioss_secret_key" required value="{:sysconf('storage.alioss_secret_key')}" maxlength="43" placeholder="请输入阿里云OSS存储 SecretKey (安全密钥)" class="layui-input">
  75. <p class="help-block">可以在 [ 阿里云 > 个人中心 ] 设置并获取到安全密钥</p>
  76. </div>
  77. </div>
  78. <div class="hr-line-dashed margin-left-40"></div>
  79. <input type="hidden" name="storage.type" value="alioss">
  80. <div class="layui-form-item text-center padding-left-40">
  81. <button class="layui-btn" type="submit">保存配置</button>
  82. <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消修改吗?" data-close>取消修改</button>
  83. </div>
  84. <script>form.render()</script>
  85. </div>
  86. </form>