You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

179 lines
6.3 KiB

2 years ago
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>添加会员-WeAdmin Frame型后台管理系统-WeAdmin 1.0</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.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="../../static/css/font.css">
<link rel="stylesheet" href="../../static/css/weadmin.css">
<!-- 让IE8/9支持媒体查询从而兼容栅格 -->
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
#check_identity {
margin-top: 8px;
}
.identity {
margin-right: 25px;
}
.identity div {
margin-top: 0 !important;
}
#global .layui-form-label {
width: 100px !important;
}
</style>
</head>
<body>
<div class="weadmin-body">
<form class="layui-form" id="global">
<div class="layui-form-item">
<label for="global_name" class="layui-form-label">
<span class="we-red">*</span>全局变量名称
</label>
<div class="layui-input-inline textinput">
<input type="text" id="global_name" name="global_name" lay-verify="required|contentLength" max="32"
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label for="global_value" class="layui-form-label">
<span class="we-red">*</span>全局变量值
</label>
<div class="layui-input-inline textinput">
<input type="text" id="global_value" name="global_value" lay-verify="required|string|contentLength"
max="255" autocomplete="" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label for="global_code" class="layui-form-label">
<span class="we-red">*</span>全局变量代码
</label>
<div class="layui-input-inline textinput">
<input type="text" id="global_code" name="global_code" lay-verify="required|string|contentLength" min="2"
max="32" autocomplete="" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label for="" class="layui-form-label">
<span class="we-red">*</span>全局变量类型
</label>
<div class="layui-input-inline textinput" id="global_type"></div>
<script type="text/html" id="global_type_script">
<select name="global_type" lay-filter="global_type" lay-verify="selectVerify">
<option value="0">请选择</option>
{{#layui.each(d,function(index,item){ }}
<option value={{item.global_type_id}}>{{item.global_type_name}}</option>
{{# }) }}
</select>
</script>
</div>
<div class="layui-form-item">
<label for="" class="layui-form-label">
</label>
<button class="layui-btn" lay-filter="add" lay-submit="" id="save">确定</button>
</div>
</form>
</div>
<script src="../../lib/layui/layui.js" charset="utf-8"></script>
<script>
layui.extend({
admin: '{/}../../static/js/admin'
});
layui.use(['form', 'jquery', 'laytpl', 'admin', 'layer'], function () {
var form = layui.form,
$ = layui.jquery,
admin = layui.admin,
layer = layui.layer,
laytpl = layui.laytpl;
$(function () {
//定位焦点
$("#global_name").focus();
var selType = "";
// 获取分类
$.ajax({
type: "GET",
async: false,
dataType: "json",
url: "/FengHuang/global/getGlobalType",
success: function (data) {
var getTpl = global_type_script.innerHTML
, global_type = document.getElementById('global_type');
laytpl(getTpl).render(data.data, function (html) {
global_type.innerHTML = html;
});
}
})
form.render();
});
//验证分类下拉框
form.verify({
selectVerify: function (value) {
if (value == "0") {
return "请选择类型!";
}
}
});
verifyLength();
//监听提交
form.on('submit(add)', function (data) {
var f = data.field;
$.ajax({
type: "POST",
async: false,
dataType: "json",
url: "/FengHuang/global/addGlobal",
data: {
"global_type_id": f.global_type,
"global_code": f.global_code,
"global_value": f.global_value,
"global_name": f.global_name
},
success: function (data) {
if (data.success) {
layer.msg("增加成功", {icon: 1, time: 1000, shade: [0.5, '#000', true]}, function () {
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
parent.layui.table.reload('idTest', {
page: {
curr: 1
}
});
});
} else {
layer.alert(data.message, {icon: 0});
return false;
}
}
})
return false;
});
});
</script>
</body>
</html>