📖 File Reader
{include file="public/top"/}
{include file="public/vue"/}
<link href="__PUBLIC__/layui-v2.9.14/layui/css/layui.css" rel="stylesheet">
<style>
.control-label{
font-weight:normal!important;
}
.col-sm-10{
padding-left:0px;
}
.form-control{
height: 38px;
line-height: 1.3;
}
.bixuan{
color:red;
}
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-sm-12">
<div class="ibox float-e-margins">
<div class="ibox-title" style="position: relative;">
<h5>基本资料 <small></small></h5>
</div>
<div class="ibox-content" style="padding-top:30px;">
<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="form-horizontal">
<div class="form-group">
<label class="col-sm-2 control-label">账号</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="user_name" value="{$admin_info.user_name}"
disabled="disabled">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">角色</label>
<div class="col-sm-10">
<select class="form-control" name="role_id" disabled style="width:20%;">
<option value="0">请选择</option>
{foreach name="role_list" item="role_list"}
<option value="{$role_list.id}" {if $admin_info.role_id== $role_list.id}selected{/if}>{$role_list.name}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">密码</label>
<div class="col-sm-10">
<input type="password" placeholder="请确输入密码" class="form-control" name="password"
value="">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">确认密码</label>
<div class="col-sm-10">
<input type="password" placeholder="请确认密码" name="password2" class="form-control">
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-2">
<button class="btn btn-primary" type="button" onclick="submit1()">保存内容</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</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);
}
});
})
</script>
<!-- 全局js -->
<script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.7"></script>
<!-- iCheck -->
<script src="__PUBLIC__/admin/js/plugins/iCheck/icheck.min.js"></script>
<script>
$(document).ready(function () {
$('.i-checks').iCheck({
checkboxClass: 'icheckbox_square-green',
radioClass: 'iradio_square-green',
});
});
//表单提交
function submit1() {
var formData = new FormData($('#form')[0])
$.ajax({
type: 'post',
url: '{:url("Admin/admin_basic")}',
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});
}
}
});
}
</script>
</body>
</html>