|
@@ -0,0 +1,145 @@
|
|
|
+{extend name="base"/}
|
|
|
+{block name="resources"}
|
|
|
+<style>
|
|
|
+ .ns-form {margin-top: 0;}
|
|
|
+</style>
|
|
|
+{/block}
|
|
|
+{block name="main"}
|
|
|
+<div class="layui-form ns-form">
|
|
|
+ <div class="layui-form-item">
|
|
|
+ <label class="layui-form-label"><span class="required">*</span>广告位置名:</label>
|
|
|
+ <div class="layui-input-block">
|
|
|
+ <input name="ap_name" type="text" value="{$info.ap_name}" lay-verify="required" class="layui-input ns-len-long">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="layui-form-item">
|
|
|
+ <label class="layui-form-label"><span class="required">*</span>广告关键字:</label>
|
|
|
+ <div class="layui-input-block">
|
|
|
+ <input name="{$info.keyword}" type="text" lay-verify="required" class="layui-input ns-len-long">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="layui-form-item">
|
|
|
+ <label class="layui-form-label">广告位简介:</label>
|
|
|
+ <div class="layui-input-block ns-len-long">
|
|
|
+ <textarea name="ap_intro" class="layui-textarea">{$info.ap_intro}</textarea>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="layui-form-item">
|
|
|
+ <label class="layui-form-label">广告位宽度:</label>
|
|
|
+ <div class="layui-input-block">
|
|
|
+ <input name="ap_width" value="{$info.ap_width}" type="number" lay-verify="int" class="layui-input ns-len-short">
|
|
|
+ </div>
|
|
|
+ <div class="ns-word-aux">单位:px 宽度值不能小于0(例:首页轮播图一般为650px * 280px)</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="layui-form-item">
|
|
|
+ <label class="layui-form-label">广告位高度:</label>
|
|
|
+ <div class="layui-input-block">
|
|
|
+ <input name="ap_height" value="{$info.ap_height}" type="number" lay-verify="int" class="layui-input ns-len-short">
|
|
|
+ </div>
|
|
|
+ <div class="ns-word-aux">单位:px 高度值不能小于0(例:首页轮播图一般为650px * 280px)</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="layui-form-item">
|
|
|
+ <label class="layui-form-label">广告位类型:</label>
|
|
|
+ <div class="layui-input-inline" id="type">
|
|
|
+ <input type="radio" name="type" lay-filter="type" value="1" title="pc端" {if condition="$info.type == 1"}checked{/if}>
|
|
|
+ <input type="radio" name="type" lay-filter="type" value="2" title="手机端" {if condition="$info.type == 2"}checked{/if}>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="layui-form-item">
|
|
|
+ <label class="layui-form-label">广告位背景色:</label>
|
|
|
+ <div class="layui-input-inline">
|
|
|
+ <div id="font_color"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="ns-form-row">
|
|
|
+ <button class="layui-btn ns-bg-color" lay-submit lay-filter="save">保存</button>
|
|
|
+ <button class="layui-btn layui-btn-primary" onclick="back()">返回</button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <input type="hidden" name="ap_id" value="{$info.ap_id}" />
|
|
|
+ <input type="hidden" name="ap_background_color" id="ap_background_color" value="{$info.ap_background_color}" />
|
|
|
+</div>
|
|
|
+{/block}
|
|
|
+{block name="script"}
|
|
|
+<script>
|
|
|
+ var colorN = $("#ap_background_color").val();
|
|
|
+
|
|
|
+ layui.use(['form', 'colorpicker'], function () {
|
|
|
+ var form = layui.form,
|
|
|
+ colorpicker = layui.colorpicker,
|
|
|
+ repeat_flag = false; //防重复标识
|
|
|
+ form.render();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 颜色
|
|
|
+ */
|
|
|
+ colorpicker.render({
|
|
|
+ elem: '#font_color', //绑定元素
|
|
|
+ color: colorN,
|
|
|
+ done: function(color) {
|
|
|
+ $(".tdrag-name").css("color", color);
|
|
|
+ $("#ap_background_color").val(color);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 监听提交
|
|
|
+ */
|
|
|
+ form.on('submit(save)', function(data) {
|
|
|
+ if (repeat_flag) return;
|
|
|
+ repeat_flag = true;
|
|
|
+
|
|
|
+ $.ajax({
|
|
|
+ url: ns.url("admin/adv/editPosition"),
|
|
|
+ data: data.field,
|
|
|
+ dataType: 'JSON',
|
|
|
+ type: 'POST',
|
|
|
+ success: function(res) {
|
|
|
+ repeat_flag = false;
|
|
|
+
|
|
|
+ if (res.code == 0) {
|
|
|
+ layer.confirm('编辑成功', {
|
|
|
+ title:'操作提示',
|
|
|
+ btn: ['返回列表', '继续操作'],
|
|
|
+ yes: function() {
|
|
|
+ location.href = ns.url("admin/adv/index")
|
|
|
+ },
|
|
|
+ btn2: function() {
|
|
|
+ location.reload();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ layer.msg(res.message);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 表单验证
|
|
|
+ */
|
|
|
+ form.verify({
|
|
|
+ int: function (value) {
|
|
|
+ console.log(value);
|
|
|
+ if (value == '') {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (value < 0 || value%1 != 0) {
|
|
|
+ return '请输入0或正整数!'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ function back() {
|
|
|
+ location.href = ns.url("admin/adv/index")
|
|
|
+ }
|
|
|
+</script>
|
|
|
+{/block}
|