storage-oss.html 5.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <form onsubmit="return false;" data-auto="true" action="{:url()}" method="post" class='layui-form layui-card' autocomplete="off">
  2. <div class="layui-card-body">
  3. <div class="color-text margin-left-40 margin-bottom-20 layui-code" style="border-left-width:1px;background:none">
  4. <p class="margin-bottom-5 font-w7">文件将上传到阿里云OSS空间,需要配置OSS公开访问及跨域策略!</p>
  5. 目前已实现自动创建空间及配置访问策略!<a target="_blank" href="https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=08p1pddw">我要免费申请</a>
  6. </div>
  7. <div class="layui-form-item">
  8. <label class="layui-form-label">AllowExts<br><span class="nowrap color-desc">允许类型</span></label>
  9. <div class="layui-input-block">
  10. <input type="text" name="storage_local_exts" required value="{:sysconf('storage_local_exts')}" placeholder="请输入系统文件上传后缀" class="layui-input">
  11. <p class="help-block">设置系统允许上传文件的后缀,多个以英文逗号隔开。如:png,jpg,rar,doc</p>
  12. </div>
  13. </div>
  14. <div class="layui-form-item">
  15. <label class="layui-form-label label-required">Protocol<br><span class="nowrap color-desc">访问协议</span></label>
  16. <div class="layui-input-block">
  17. {foreach ['http','https','auto'] as $pro}
  18. <label class="think-radio">
  19. {if sysconf('storage_oss_is_https') eq $pro}
  20. <input checked type="radio" name="storage_oss_is_https" value="{$pro}" lay-ignore> {$pro}
  21. {else}
  22. <input type="radio" name="storage_oss_is_https" value="{$pro}" lay-ignore> {$pro}
  23. {/if}
  24. </label>
  25. {/foreach}
  26. <p class="help-block">阿里云对象存储访问协议(http、https、auto),其中 https 需要配置证书才能使用,auto 为相对协议自动根据域名切换http与https。</p>
  27. </div>
  28. </div>
  29. <div class="layui-form-item">
  30. <label class="layui-form-label">Bucket<br><span class="nowrap color-desc">空间名称</span></label>
  31. <div class="layui-input-block">
  32. <input type="text" name="storage_oss_bucket" required value="{:sysconf('storage_oss_bucket')}" placeholder="请输入OSS Bucket (空间名称)" class="layui-input">
  33. <p class="help-block">填写OSS存储空间名称,如:think-admin-oss(需要是全区唯一的值,不存在时会自动创建)</p>
  34. </div>
  35. </div>
  36. <div class="layui-form-item">
  37. <label class="layui-form-label">EndPoint<br><span class="nowrap color-desc">数据中心</span></label>
  38. <div class="layui-input-block">
  39. <select required name="storage_oss_endpoint" class="layui-select" lay-search>
  40. {foreach $ossPoints as $k=>$p}
  41. {if sysconf('storage_oss_endpoint') eq $k}
  42. <option selected value="{$k}">{$p} <span class="font-s10 color-desc">({$k})</span></option>
  43. {else}
  44. <option value="{$k}">{$p} <span class="font-s10 color-desc">({$k})</span></option>
  45. {/if}
  46. {/foreach}
  47. </select>
  48. <p class="help-block">请选择OSS数据中心访问节点,有效值如:oss-cn-shenzhen.aliyuncs.com</p>
  49. </div>
  50. </div>
  51. <div class="layui-form-item">
  52. <label class="layui-form-label">AccessKey<br><span class="nowrap color-desc">访问密钥</span></label>
  53. <div class="layui-input-block">
  54. <input type="text" name="storage_oss_keyid" required value="{:sysconf('storage_oss_keyid')}" maxlength="16" placeholder="请输入OSS AccessKey (访问密钥)" class="layui-input">
  55. <p class="help-block">可以在 [ 阿里云 > 个人中心 ] 设置并获取到访问密钥。</p>
  56. </div>
  57. </div>
  58. <div class="layui-form-item">
  59. <label class="layui-form-label">SecretKey<br><span class="nowrap color-desc">安全密钥</span></label>
  60. <div class="layui-input-block">
  61. <input type="text" name="storage_oss_secret" required value="{:sysconf('storage_oss_secret')}" maxlength="30" placeholder="请输入OSS SecretKey (安全密钥)" class="layui-input">
  62. <p class="help-block">可以在 [ 阿里云 > 个人中心 ] 设置并获取到安全密钥。</p>
  63. </div>
  64. </div>
  65. <div class="layui-form-item">
  66. <label class="layui-form-label">Domain<br><span class="nowrap color-desc">访问域名</span></label>
  67. <div class="layui-input-block">
  68. <input type="text" name="storage_oss_domain" value="{:sysconf('storage_oss_domain')}" placeholder="请输入OSS存储 Domain (访问域名)" class="layui-input">
  69. <p class="help-block">填写OSS存储外部访问域名,如:think-admin-oss.oss-cn-shenzhen.aliyuncs.com(正常情况下是自动获取的)</p>
  70. </div>
  71. </div>
  72. <div class="hr-line-dashed margin-left-40"></div>
  73. <div class="layui-form-item text-center padding-left-40">
  74. <input type="hidden" name="storage_type" value="oss">
  75. <button class="layui-btn" type="submit">保存配置</button>
  76. <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消修改吗?" data-close>取消修改</button>
  77. </div>
  78. </div>
  79. <script>form.render()</script>
  80. </form>