2021-01-30 20:59:12 +08:00

140 lines
4.5 KiB
HTML

{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form body-content">
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray2">登录账号</td>
<td>
<input type="hidden" name="id" value="{$user.id}">
{$user.username}
</td>
<td class="layui-td-gray2">用户昵称</td>
<td>
<input type="text" name="nickname" placeholder="请输入用户昵称" autocomplete="off" class="layui-input" value="{$user.nickname}">
</td>
<td class="layui-td-gray2">真实姓名</td>
<td>
<input type="text" name="name" placeholder="请输入真实姓名" autocomplete="off" class="layui-input" value="{$user.name}">
</td>
</tr>
<tr>
<td class="layui-td-gray2">性别</td>
<td>
<input type="radio" name="sex" value="1" title="男" {eq name="$user.sex" value="1" }checked{/eq}>
<input type="radio" name="sex" value="2" title="女" {eq name="$user.sex" value="2" }checked{/eq}>
</td>
<td class="layui-td-gray2">手机号码</td>
<td>
<input type="text" name="mobile" placeholder="请输入手机" autocomplete="off" class="layui-input" value="{$user.mobile}">
</td>
<td class="layui-td-gray2">电子邮箱</td>
<td>
<input type="text" name="email" placeholder="请输入电子邮箱" autocomplete="off" class="layui-input" value="{$user.email}">
</td>
</tr>
<tr>
<td class="layui-td-gray2">个人简介</td>
<td colspan="5">
<textarea name="desc" placeholder="请输入个人简介" class="layui-textarea">{$user.desc}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray2">国家</td>
<td>
<input type="text" name="country" placeholder="请输入所在国家" autocomplete="off" class="layui-input" value="{$user.country}">
</td>
<td class="layui-td-gray2">省份</td>
<td>
<input type="text" name="province" placeholder="请输入所在省份" autocomplete="off" class="layui-input" value="{$user.province}">
</td>
<td class="layui-td-gray2">城市</td>
<td>
<input type="text" name="city" placeholder="请输入所在城市" autocomplete="off" class="layui-input" value="{$user.city}">
</td>
</tr>
<tr>
<td class="layui-td-gray2">所在企业</td>
<td>
<input type="text" name="company" placeholder="请输入所在企业" autocomplete="off" class="layui-input" value="{$user.company}">
</td>
<td class="layui-td-gray2">所在部门</td>
<td>
<input type="text" name="depament" placeholder="请输入所在部门" autocomplete="off" class="layui-input" value="{$user.depament}">
</td>
<td class="layui-td-gray2">所在职位</td>
<td>
<input type="text" name="position" placeholder="请输入所在职位" autocomplete="off" class="layui-input" value="{$user.position}">
</td>
</tr>
<tr>
<td class="layui-td-gray2">企业地址</td>
<td colspan="5">
<input type="text" name="address" placeholder="请输入企业地址" autocomplete="off" class="layui-input" value="{$user.address}">
</td>
</tr>
</table>
<div style="padding: 10px 0">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
<button lay-event="back" class="layui-btn layui-btn-primary">返回</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
function init(layui) {
var form = layui.form
, layer = layui.layer
, upload = layui.upload;
//头像上传
var uploadInst = upload.render({
elem: '#test1'
, url: '/admin/api/upload'
, done: function (res) {
//如果上传失败
if (res.code == 0) {
return layer.msg('上传失败');
}
//上传成功
$('#demo1 input').attr('value', res.data.filepath);
$('#demo1 img').attr('src', res.data.filepath);
}
});
//监听提交
form.on('submit(webform)', function (data) {
$.ajax({
url: "/admin/user/post_submit",
type: 'post',
data: data.field,
success: function (e) {
if (e.code == 1) {
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
history.back(-1);
layer.close(index);
});
} else {
layer.msg(e.msg);
}
}
})
return false;
});
//监听返回
$('.body-content').on('click', '[lay-event="back"]', function () {
history.back(-1);
return false;
});
}
</script>
{include file="common/layui" base='base' extend="[]" use="['upload','form']" callback="init" /}
{/block}
<!-- /脚本 -->