ThinkAdmin/application/admin/view/config.file.html
2017-02-22 14:10:25 +08:00

97 lines
5.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{extend name="extra@admin/content"}
{block name="content"}
<div class="row">
<div class="col-lg-12">
<form class=" layui-form" data-auto="" method="post">
<fieldset class="layui-elem-field layui-box">
<legend>文件存储</legend>
<div class="layui-field-box" style="padding-right:35px">
<div class="layui-form-item layui-box">
<label class="layui-form-label">Storage</label>
<div class="layui-input-block">
<select name="storage_type" lay-filter="storage_type" required="required">
<option {if sysconf('storage_type')!=='qiniu'}selected{/if} value='local'>本地服务器</option>
<option {if sysconf('storage_type')==='qiniu'}selected{/if} value='qiniu'>七牛云存储</option>
</select>
<div data-storage-type="qiniu" class="layui-form-mid layui-word-aux">
若还没有帐号,请点击<a target="_blank" href="https://portal.qiniu.com/signup?code=3lhz6nmnwbple">免费申请10G存储空间</a>申请成功后添加公开bucket空间
</div>
</div>
</div>
<div class="layui-form-item layui-box" data-storage-type="qiniu">
<label class="layui-form-label">https</label>
<div class="layui-input-inline" style='width:50px'>
<input type="hidden" name="storage_qiniu_is_https" value="0">
{if sysconf('storage_qiniu_is_https')==1}
<input type="checkbox" name="storage_qiniu_is_https" lay-skin="switch" checked required="required" title="https" value="1">
{else/}
<input type="checkbox" name="storage_qiniu_is_https" lay-skin="switch" required="required" title="https" value="1">
{/if}
</div>
<div class="layui-form-mid layui-word-aux">是否启用https访问资源</div>
</div>
<div class="layui-form-item layui-box" data-storage-type="qiniu">
<label class="layui-form-label">bucket</label>
<div class="layui-input-block">
<input type="text" name="storage_qiniu_bucket" required="required" title="请输入七牛云 Bucket" placeholder="请输入七牛云 Bucket" value="{:sysconf('storage_qiniu_bucket')}" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">填写七牛云bucket名称static</div>
</div>
<div class="layui-form-item layui-box" data-storage-type="qiniu">
<label class="layui-form-label">domain</label>
<div class="layui-input-block">
<input type="text" name="storage_qiniu_domain" required="required" title="请输入七牛云 Domain" placeholder="请输入七牛云 Domain" value="{:sysconf('storage_qiniu_domain')}" class="layui-input">
<div class="layui-form-mid layui-word-aux">只需填写域名static.cdn.cuci.cc</div>
</div>
</div>
<div class="layui-form-item layui-box" data-storage-type="qiniu">
<label class="layui-form-label">access key</label>
<div class="layui-input-block">
<input type="text" name="storage_qiniu_access_key" required="required" title="请输入七牛云 AccessKey" placeholder="请输入七牛云 AccessKey" value="{:sysconf('storage_qiniu_access_key')}" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-box" data-storage-type="qiniu">
<label class="layui-form-label">secret key</label>
<div class="layui-input-block">
<input type="password" name="storage_qiniu_secret_key" required="required" title="请输入七牛云 SecretKey" placeholder="请输入七牛云 SecretKey" value="{:sysconf('storage_qiniu_secret_key')}" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item layui-box text-center">
<button class="layui-btn" type="submit">立即提交</button>
</div>
</fieldset>
</form>
</div>
</div>
{/block}
{block name="script"}
<script>
$(function () {
// 默认初始化布局
initLayout($('[name="storage_type"]').val());
// 表单动态渲染
window.form.render();
/*! 兼听 select 的值变化 */
window.form.on('select(storage_type)', function (data) {
// 重新初始化布局
initLayout(data.value);
});
// 表单初始化布局
function initLayout(storage_type) {
$("[data-storage-type]").not($("[data-storage-type='" + storage_type + "']").show()).hide();
}
});
</script>
{/block}