📖 File Reader
<?php /*a:1:{s:64:"/www/wwwroot/hljrlsj.com/app/admin/view/config/basic_config.html";i:1742462934;}*/ ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 注意:项目正式环境请勿引用该地址 -->
<link href="/public/layui-v2.9.14/layui/css/layui.css" rel="stylesheet">
<script src="/public/layui-v2.9.14/layui/layui.js"></script>
<script src="/public/admin/js/jquery-2.2.0.min.js"></script>
</head>
<style>
.layui-form-label {width: 100px;}
.layui-input-block {margin-left: 130px;}
</style>
<body style="background-color: #FFFFFF;">
<div style="margin:20px 1% 0 1%;" class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
<ul class="layui-tab-title">
<a href="<?php echo Url('Config/basic_config',array('type'=>1)); ?>">
<li <?php if($type == 1): ?>class="layui-this"<?php endif; ?>>平台设置</li>
</a>
<!-- <a href="<?php echo Url('Config/basic_config',array('type'=>2)); ?>">-->
<!-- <li <?php if($type == 2): ?>class="layui-this"<?php endif; ?>>业绩规则设置</li>-->
<!-- </a>-->
<!-- <a href="<?php echo Url('Config/basic_config',array('type'=>7)); ?>">-->
<!-- <li <?php if($type == 7): ?>class="layui-this"<?php endif; ?>>平台充值设置</li>-->
<!-- </a>-->
<!-- <a href="<?php echo Url('Config/basic_config',array('type'=>3)); ?>">-->
<!-- <li <?php if($type == 3): ?>class="layui-this"<?php endif; ?>>微信支付配置</li>-->
<!-- </a>-->
<!-- <a href="<?php echo Url('Config/basic_config',array('type'=>4)); ?>">-->
<!-- <li <?php if($type == 4): ?>class="layui-this"<?php endif; ?>>支付宝支付配置</li>-->
<!-- </a>-->
<!-- <a href="<?php echo Url('Config/basic_config',array('type'=>5)); ?>">-->
<!-- <li <?php if($type == 5): ?>class="layui-this"<?php endif; ?>>银豹收银配置</li>-->
<!-- </a>-->
<!-- <a href="<?php echo Url('Config/basic_config',array('type'=>8)); ?>">-->
<!-- <li <?php if($type == 8): ?>class="layui-this"<?php endif; ?>>汇付支付设置</li>-->
<!-- </a>-->
</ul>
</div>
<!--<?php if($type == 1): ?>-->
<!--<div class="help-block m-b-none" style="color:#999999;font-size:12px; margin-left:20px!important; padding-top:10px!important;">-->
<!-- 小提示:-->
<!--</div>-->
<!--<?php endif; ?>-->
<div style="margin:50px 10% 0 8%;">
<form method="post" onSubmit="return chkform(this)" name="form" id="form" action="" enctype="multipart/form-data" onkeydown="if(event.keyCode==13)return false;" onSubmit="return checkSubmit();" class="layui-form" >
<?php if(is_array($list) || $list instanceof \think\Collection || $list instanceof \think\Paginator): if( count($list)==0 ) : echo "" ;else: foreach($list as $key=>$list): if($list['type_field'] == 'text'): ?>
<div class="layui-form-item">
<label class="layui-form-label"><?php echo htmlentities($list['name']); ?></label>
<div class="layui-input-block">
<input type="text" name="<?php echo htmlentities($list['field_name']); ?>" value="<?php echo htmlentities($list['value']); ?>" placeholder="请输入<?php echo htmlentities($list['name']); ?>" class="layui-input">
<span class="help-block m-b-none" style="color:#999999;font-size:12px;"><?php echo htmlentities($list['describe']); ?></span>
</div>
</div>
<?php endif; if($list['type_field'] == 'radio'): ?>
<div class="layui-form-item">
<label class="layui-form-label"><?php echo htmlentities($list['name']); ?></label>
<div class="layui-input-block">
<input type="radio" name="<?php echo htmlentities($list['field_name']); ?>" value="1" title="是" <?php if($list['value'] == 1): ?>checked<?php endif; ?>>
<input type="radio" name="<?php echo htmlentities($list['field_name']); ?>" value="0" title="否" <?php if($list['value'] == 0): ?>checked<?php endif; ?>>
</div>
<span class="help-block m-b-none" style="color:#999999;font-size:12px;"><?php echo htmlentities($list['describe']); ?></span>
</div>
<?php endif; if($list['type_field'] == 'textarea'): ?>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label"><?php echo htmlentities($list['name']); ?></label>
<div class="layui-input-block">
<textarea placeholder="请输入<?php echo htmlentities($list['name']); ?>" name="<?php echo htmlentities($list['field_name']); ?>" class="layui-textarea"><?php echo htmlentities($list['value']); ?></textarea>
<span class="help-block m-b-none" style="color:#999999;font-size:12px;"><?php echo htmlentities($list['describe']); ?></span>
</div>
</div>
<?php endif; if($list['type_field'] == 'file'): ?>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label"><?php echo htmlentities($list['name']); ?></label>
<div class="layui-input-block">
<div class="upload">
<input type="file" class="test" name="<?php echo htmlentities($list['field_name']); ?>" value="">
<div class="img_center">
<?php if($list['value'] == ''): ?>
<img src="/public/admin/img/tianjia.png" class="img1-img">
<?php endif; if($list['value'] != ''): ?>
<img src="<?php echo htmlentities($list['value']); ?>" class="img1-img">
<?php endif; ?>
</div>
</div>
<span class="help-block m-b-none" style="color:#999999;font-size:12px;"><?php echo htmlentities($list['describe']); ?></span>
</div>
</div>
<?php endif; if($list['type_field'] == 'region'): ?>
<div class="layui-form-item">
<label class="layui-form-label"><?php echo htmlentities($list['name']); ?></label>
<div class="layui-input-block">
<input type="text" name="<?php echo htmlentities($list['field_name']); ?>" value="<?php echo htmlentities($list['value']); ?>" readonly placeholder="请选择<?php echo htmlentities($list['name']); ?>" onclick="onregion('<?php echo htmlentities($list['field_name']); ?>')"
class="layui-input">
<span class="help-block m-b-none" style="color:#999999;font-size:12px;"><?php echo htmlentities($list['describe']); ?></span>
</div>
</div>
<?php endif; ?>
<?php endforeach; endif; else: echo "" ;endif; ?>
<div class="layui-form-item">
<div class="layui-input-block">
<input type="hidden" name="type" value="<?php echo htmlentities($type); ?>"/>
<button type="button" class="layui-btn" onclick="submit1()">保存</button>
</div>
</div>
</form>
</div>
<style>
.upload{border: 1px dashed #c9c7c7;width: 100px;height: 100px;position: relative;
border-radius: 6px;overflow: hidden;}
.upload .test{position: absolute;left: 0;top: 0;width: 100%;height: 100%;opacity: 0;outline: none;}
.img_center{width: 100%;height: 100%;}
.img_center img{width: 100%;height: 100%;}
</style>
<script>
//获取图片路劲的方法,兼容多种浏览器,通过createObjectURL实现
function getObjectURL(file){
var url = null;
if(window.createObjectURL != undefined){
url = window.createObjectURL(file);//basic
}else if(window.URL != undefined){
url = window.URL.createObjectURL(file);
}else if(window.webkitURL != undefined){
url = window.webkitURL.createObjectURL(file);
}
return url;
}
//实现功能代码
$(function(){
$(".test").change(function(){
var path = $(".test").value;
var objUrl = getObjectURL(this.files[0]);
if(objUrl){
// $('.img1-img').attr("src",objUrl);
$(this).parents('.upload').find('.img1-img').attr("src",objUrl);
}
});
})
//表单提交
function submit1(){
var formData =new FormData($('#form')[0])
$.ajax({
type:'post',
url:'<?php echo url("Config/basic_config"); ?>',
data:formData,
cache: false,
contentType: false,
processData: false,
dataType: "json",
success: function(res) {
if (res.code == 200){
layer.msg(res.msg,{
icon:1,
time:1800,
end:function () {
location.reload();
}
})
}else{
layer.msg(res.msg, {icon: 2,time:1800});
}
}
});
}
/*表单提交成功*/
function Fromsucceed(){
location.reload();
}
/*地区选择*/
function onregion(field_name=''){
parent.layer.open({
type: 2,
title: '选择地区',
shadeClose: true,
shade: 0.5,
maxmin: true, //开启最大化最小化按钮
area: ['40%','50%'],
content:'/admin/Config/basic_config_region_update?field_name='+field_name,
end:function(res,err) {
}
});
}
</script>
</body>
</html>