add.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. {extend name="layout/content" /}
  2. {block name="header"}
  3. <title>编辑冻结</title>
  4. <link href="__STATIC__/lib/layui_formSelect/formSelects-v4.css" rel="stylesheet" type="text/css">
  5. <link rel="stylesheet" href="__STATIC__/css/FuzzySearch.css?v={$Think.STATIC_VERSION}">
  6. <style>
  7. .layui-form-label {
  8. width: 180px;
  9. }
  10. .select2 + .layui-form-select {
  11. display: none;
  12. }
  13. img#local_preview {
  14. width: 100px;
  15. height: 100px;
  16. }
  17. .xm-select-parent .xm-form-select dl {
  18. z-index: 999999;
  19. }
  20. .layui-form-item .layui-input-inline {
  21. width: 210px;
  22. }
  23. .layui-form-select dl {
  24. z-index: 8999999;
  25. }
  26. </style>
  27. {/block}
  28. {block name="content"}
  29. <div class="x-body">
  30. <form class="layui-form" action="{:url('save')}" method="post" id= "myForm"
  31. enctype="multipart/form-data">
  32. <div class="layui-form-item">
  33. <label class="layui-form-label"> <span class="x-red">*</span>游戏:</label>
  34. <div class="layui-input-inline">
  35. <select name="game_id" id="game_id" lay-search="true" required="" lay-verify="required">
  36. {volist name="game_list" id="vo"}
  37. <option value="{$vo.id}" {if condition="isset($data.game_id) && $data.game_id == $vo.id" }
  38. selected="selected" {/if} >{$vo.name}</option>
  39. {/volist}
  40. </select>
  41. <!-- <input type="hidden" name="game_id" id="unitInput" autocomplete="off" class="layui-input"-->
  42. <!-- placeholder="单位">-->
  43. </div>
  44. </div>
  45. <div class="layui-form-item">
  46. <label class="layui-form-label"> <span class="x-red">*</span>推广员:</label>
  47. <div class="layui-input-inline" style="width: 40%">
  48. <div id="school"></div>
  49. </div>
  50. </div>
  51. <div class="layui-form-item">
  52. <label for="" class="layui-form-label">操作:</label>
  53. <div class="layui-input-block">
  54. <button class="layui-btn" lay-submit type="button" onclick= "submitForm();" lay-filter="formDemo" id="J_submit_btn">提交</button>
  55. <button type="button" onClick="javascript:history.back(-1);" class="layui-btn layui-btn-primary">返回
  56. </button>
  57. </div>
  58. </div>
  59. </form>
  60. </div>
  61. {/block}
  62. {block name="footer"}
  63. <script type="text/javascript" charset="utf-8"
  64. <script type="text/javascript" charset="utf-8" src="__STATIC__/ueditor/lang/zh-cn/zh-cn.js"></script>
  65. <script type="text/javascript" charset="utf-8" src="__STATIC__/lib/layui_formSelect/formSelects-v4.min.js"></script>
  66. <script type="text/javascript" charset="utf-8" src="__STATIC__/js/FuzzySearch.js?v={$Think.STATIC_VERSION}"></script>
  67. <script type="text/javascript" charset="utf-8" src="__STATIC__/lib/xm-select.js"></script>
  68. <script type="text/javascript">
  69. var tagData1 = {:json_encode($channel)}; // 获取到后台给出的数据-PHP写法
  70. var tagIns1 = xmSelect.render({
  71. el: '#school', // div的id值
  72. toolbar: { // 工具条【‘全选’,‘清空’】
  73. show: true, // 开启工具条
  74. showIcon: false, // 隐藏工具条的图标
  75. },
  76. autoRow: true,
  77. // tips: '选择校区', // 让默认值不是“请选择”,而是“选择校区”
  78. filterable: true, // 开启搜索模式,默认按照name进行搜索
  79. paging: true, // 启用分页
  80. pageSize: 10, // 每页的数据个数
  81. data: tagData1,
  82. prop: { // 也许你的数据库返回的并不是name和value, 也许你提交的时候不止name和value, 怎么办? 自定义就行
  83. name: 'name',
  84. value: 'id'
  85. },
  86. })
  87. function validate() {
  88. var school = tagIns1.getValue('value');
  89. if(school.length == 0){
  90. alert('请选择推广员')
  91. return false ;
  92. }
  93. if($('#game_id').val() == 0){
  94. alert('请选择游戏')
  95. return false ;
  96. }
  97. return true;
  98. }
  99. function submitForm() {
  100. if (validate()) {
  101. document.getElementById( "myForm" ).submit();
  102. }
  103. }
  104. </script>
  105. {/block}