add_variable.blade.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. @extends('admin/layout')
  2. @section('header')
  3. @endsection
  4. @section('content')
  5. <body class="gray-bg">
  6. <div class="wrapper wrapper-content animated fadeInRight">
  7. <div class="row">
  8. <div class="col-sm-12">
  9. <div class="ibox float-e-margins">
  10. <div class="ibox-content">
  11. <form method="get" class="form-horizontal" id="form">
  12. <div class="form-group">
  13. <label class="control-label" for="username_new">
  14. 变量名:</label>
  15. <input type="text" placeholder="" class="form-control" id="variable"
  16. name="variable" value="{{$info->variable??''}}">
  17. </div>
  18. <div class="form-group">
  19. <label class="control-label" for="username_new">
  20. 标签名:</label>
  21. <input type="text" placeholder="" class="form-control" id="tag"
  22. name="tag" value="{{$info->tag??''}}">
  23. </div>
  24. <div class="form-group">
  25. <label class="control-label" for="username_new">
  26. 排序编号:</label>
  27. <input type="text" placeholder="" class="form-control" id="sort"
  28. name="sort" value="{{$info->sort??''}}">
  29. </div>
  30. <div class="form-group">
  31. <label class="control-label" for="username_new">
  32. 描述:</label>
  33. <textarea class="form-control" rows="5" placeholder="" id="memo"
  34. name="memo">{{$info->memo??''}}</textarea>
  35. </div>
  36. <div class="form-group">
  37. <label class="control-label">
  38. 输入类型:</label>
  39. <div class=" ">
  40. <select class="form-control form-control-select"
  41. id="input_type" name="input_type" onchange="onchangeImages()">
  42. <option value="text"
  43. @if(!empty($info->input_type) && $info->input_type=='text') selected @endif>
  44. 单行文本
  45. </option>
  46. <option value="textarea"
  47. @if(!empty($info->input_type) && $info->input_type=='textarea') selected @endif>
  48. 多行文本
  49. </option>
  50. <option value="richtext"
  51. @if(!empty($info->input_type) && $info->input_type=='richtext') selected @endif>
  52. 富文本
  53. </option>
  54. <option value="taginput"
  55. @if(!empty($info->input_type) && $info->input_type=='taginput') selected @endif>
  56. Tag Input
  57. </option>
  58. <option value="select"
  59. @if(!empty($info->input_type) && $info->input_type=='select') selected @endif>
  60. 下拉菜单
  61. </option>
  62. <option value="checkbox"
  63. @if(!empty($info->input_type) && $info->input_type=='checkbox') selected @endif>
  64. 复选框
  65. </option>
  66. <option value="radio"
  67. @if(!empty($info->input_type) && $info->input_type=='radio') selected @endif>
  68. 单选钮
  69. </option>
  70. <option value="date"
  71. @if(!empty($info->input_type) && $info->input_type=='date') selected @endif>
  72. 日期
  73. </option>
  74. <option value="file"
  75. @if(!empty($info->input_type) && $info->input_type=='file') selected @endif>
  76. 文件上传
  77. </option>
  78. <option value="image"
  79. @if(!empty($info->input_type) && $info->input_type=='image') selected @endif>
  80. 图片上传
  81. </option>
  82. <option value="resource"
  83. @if(!empty($info->input_type) && $info->input_type=='resource') selected @endif>
  84. 资源选择器
  85. </option>
  86. </select>
  87. </div>
  88. </div>
  89. <div class="form-group input_opts">
  90. <label class="control-label">
  91. 输入选项:</label>
  92. <textarea class="form-control" rows="5" placeholder="" id="input_opts"
  93. name="input_opts">{{$info->input_opts??''}}</textarea>
  94. </div>
  95. <div class="form-group limit">
  96. <label class="control-label">
  97. 数量限制:</label>
  98. <input type="text" placeholder="" class="form-control" id="input_length"
  99. name="input_length" value="{{$info->input_length??''}}">
  100. </div>
  101. <div class="form-group images">
  102. <label class="control-label">
  103. 图片宽度:</label>
  104. <input type="text" placeholder="" class="form-control" id="width"
  105. name="width" value="{{$info->width??''}}">
  106. </div>
  107. <div class="form-group images">
  108. <label class="control-label">
  109. 图片高度:</label>
  110. <input type="text" placeholder="" class="form-control" id="height"
  111. name="height" value="{{$info->height??''}}">
  112. </div>
  113. <div class="form-group images">
  114. <label class="control-label">
  115. 图片大小:</label>
  116. <input type="text" placeholder="" class="form-control" id="size"
  117. name="size" value="{{$info->size??''}}">
  118. </div>
  119. <div class="form-group">
  120. <label class="control-label">
  121. 默认值:</label>
  122. <textarea class="form-control" rows="5" placeholder="" id="input_value"
  123. name="input_value">{{$info->input_value??''}}</textarea>
  124. </div>
  125. <div class="form-group">
  126. <label class="control-label">
  127. 正则检查:</label>
  128. <input type="text" placeholder="" class="form-control" id="regex_match"
  129. name="regex_match" value="{{$info->regex_match??''}}">
  130. </div>
  131. <div class="form-group">
  132. <label class="control-label">
  133. 检查提示:</label>
  134. <input type="text" placeholder="" class="form-control" id="regex_error"
  135. name="regex_error" value="{{$info->regex_error??''}}">
  136. </div>
  137. <div class="form-group">
  138. <div class="col-sm-4 col-sm-offset-2">
  139. <button class="btn btn-primary" type="button" data-id="{{$info->id??0}}"
  140. id="save">
  141. 保存
  142. </button>
  143. <button class="btn btn-white" type="button" id="cancel">取消</button>
  144. </div>
  145. </div>
  146. </form>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. </div>
  152. </body>
  153. @endsection
  154. @section('footer')
  155. <script>
  156. onchangeImages();
  157. $(document).on('click', '#cancel', function () {
  158. tips.closeParentLayer();
  159. });
  160. $(document).on('click', '#save', function () {
  161. var data = tips.getFormValues('#form');
  162. var id = $(this).data('id');
  163. var url = '/admin/templateLibrary/addVariable/' + id;
  164. var type = 'post';
  165. var ajaxConfig = {
  166. url: url,
  167. type: type,
  168. data: data,
  169. success: function (result) {
  170. layer.msg(result.message, {icon: 6, time: 1500}, function () {
  171. tips.closeParentLayer();
  172. //window.parent.tips.tableRefresh('#table');
  173. window.parent.location.reload();
  174. });
  175. }
  176. };
  177. tips.ajax(ajaxConfig);
  178. });
  179. function onchangeImages() {
  180. var input_type = $('#input_type').val();
  181. if (input_type === 'image') {
  182. $(".images").css("display", "block");
  183. $(".limit").css("display", "block");
  184. } else {
  185. $(".images").css("display", "none");
  186. $(".limit").css("display", "none");
  187. }
  188. if (input_type === 'select' || input_type === 'radio' || input_type === 'checkbox') {
  189. $(".input_opts").css("display", "block");
  190. $(".limit").css("display", "none");
  191. }
  192. if (input_type === 'text' || input_type === 'textarea' || input_type === 'richtext' || input_type === 'date' || input_type === 'file' || input_type === 'taginput') {
  193. $(".input_opts").css("display", "none");
  194. $(".limit").css("display", "none");
  195. }
  196. if (input_type === 'resource') {
  197. $(".input_opts").css("display", "none");
  198. $(".limit").css("display", "block");
  199. }
  200. }
  201. </script>
  202. @endsection