@extends('admin/layout') @section('header') @endsection @section('content') <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-content"> <form method="get" class="form-horizontal" id="form"> <div class="form-group"> <label class="control-label" for="username_new"> 变量名:</label> <input type="text" placeholder="" class="form-control" id="variable" name="variable" value="{{$info->variable??''}}"> </div> <div class="form-group"> <label class="control-label" for="username_new"> 标签名:</label> <input type="text" placeholder="" class="form-control" id="tag" name="tag" value="{{$info->tag??''}}"> </div> <div class="form-group"> <label class="control-label" for="username_new"> 排序编号:</label> <input type="text" placeholder="" class="form-control" id="sort" name="sort" value="{{$info->sort??''}}"> </div> <div class="form-group"> <label class="control-label" for="username_new"> 描述:</label> <textarea class="form-control" rows="5" placeholder="" id="memo" name="memo">{{$info->memo??''}}</textarea> </div> <div class="form-group"> <label class="control-label"> 输入类型:</label> <div class=" "> <select class="form-control form-control-select" id="input_type" name="input_type" onchange="onchangeImages()"> <option value="text" @if(!empty($info->input_type) && $info->input_type=='text') selected @endif> 单行文本 </option> <option value="textarea" @if(!empty($info->input_type) && $info->input_type=='textarea') selected @endif> 多行文本 </option> <option value="richtext" @if(!empty($info->input_type) && $info->input_type=='richtext') selected @endif> 富文本 </option> <option value="taginput" @if(!empty($info->input_type) && $info->input_type=='taginput') selected @endif> Tag Input </option> <option value="select" @if(!empty($info->input_type) && $info->input_type=='select') selected @endif> 下拉菜单 </option> <option value="checkbox" @if(!empty($info->input_type) && $info->input_type=='checkbox') selected @endif> 复选框 </option> <option value="radio" @if(!empty($info->input_type) && $info->input_type=='radio') selected @endif> 单选钮 </option> <option value="date" @if(!empty($info->input_type) && $info->input_type=='date') selected @endif> 日期 </option> <option value="file" @if(!empty($info->input_type) && $info->input_type=='file') selected @endif> 文件上传 </option> <option value="image" @if(!empty($info->input_type) && $info->input_type=='image') selected @endif> 图片上传 </option> <option value="resource" @if(!empty($info->input_type) && $info->input_type=='resource') selected @endif> 资源选择器 </option> </select> </div> </div> <div class="form-group input_opts"> <label class="control-label"> 输入选项:</label> <textarea class="form-control" rows="5" placeholder="" id="input_opts" name="input_opts">{{$info->input_opts??''}}</textarea> </div> <div class="form-group limit"> <label class="control-label"> 数量限制:</label> <input type="text" placeholder="" class="form-control" id="input_length" name="input_length" value="{{$info->input_length??''}}"> </div> <div class="form-group images"> <label class="control-label"> 图片宽度:</label> <input type="text" placeholder="" class="form-control" id="width" name="width" value="{{$info->width??''}}"> </div> <div class="form-group images"> <label class="control-label"> 图片高度:</label> <input type="text" placeholder="" class="form-control" id="height" name="height" value="{{$info->height??''}}"> </div> <div class="form-group images"> <label class="control-label"> 图片大小:</label> <input type="text" placeholder="" class="form-control" id="size" name="size" value="{{$info->size??''}}"> </div> <div class="form-group"> <label class="control-label"> 默认值:</label> <textarea class="form-control" rows="5" placeholder="" id="input_value" name="input_value">{{$info->input_value??''}}</textarea> </div> <div class="form-group"> <label class="control-label"> 正则检查:</label> <input type="text" placeholder="" class="form-control" id="regex_match" name="regex_match" value="{{$info->regex_match??''}}"> </div> <div class="form-group"> <label class="control-label"> 检查提示:</label> <input type="text" placeholder="" class="form-control" id="regex_error" name="regex_error" value="{{$info->regex_error??''}}"> </div> <div class="form-group"> <div class="col-sm-4 col-sm-offset-2"> <button class="btn btn-primary" type="button" data-id="{{$info->id??0}}" id="save"> 保存 </button> <button class="btn btn-white" type="button" id="cancel">取消</button> </div> </div> </form> </div> </div> </div> </div> </div> </body> @endsection @section('footer') <script> onchangeImages(); $(document).on('click', '#cancel', function () { tips.closeParentLayer(); }); $(document).on('click', '#save', function () { var data = tips.getFormValues('#form'); var id = $(this).data('id'); var url = '/admin/templateLibrary/addVariable/' + id; var type = 'post'; var ajaxConfig = { url: url, type: type, data: data, success: function (result) { layer.msg(result.message, {icon: 6, time: 1500}, function () { tips.closeParentLayer(); //window.parent.tips.tableRefresh('#table'); window.parent.location.reload(); }); } }; tips.ajax(ajaxConfig); }); function onchangeImages() { var input_type = $('#input_type').val(); if (input_type === 'image') { $(".images").css("display", "block"); $(".limit").css("display", "block"); } else { $(".images").css("display", "none"); $(".limit").css("display", "none"); } if (input_type === 'select' || input_type === 'radio' || input_type === 'checkbox') { $(".input_opts").css("display", "block"); $(".limit").css("display", "none"); } if (input_type === 'text' || input_type === 'textarea' || input_type === 'richtext' || input_type === 'date' || input_type === 'file' || input_type === 'taginput') { $(".input_opts").css("display", "none"); $(".limit").css("display", "none"); } if (input_type === 'resource') { $(".input_opts").css("display", "none"); $(".limit").css("display", "block"); } } </script> @endsection