8d1fdd4060d42b6bebf3c76a20e33a66.php 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php /*a:1:{s:63:"D:\project\gyx\gaoyixia\application\user\view\message\form.html";i:1709606242;}*/ ?>
  2. <div class="think-box-shadow"><form class="layui-form layui-card" action="<?php echo request()->url(); ?>" data-auto="true" method="post" autocomplete="off"><div class="layui-card-body"><div class="layui-form-item"><label class="layui-form-label label-required">推送类型</label><div class="layui-input-inline"><select name="type" lay-filter ="type"><?php foreach([2=>'搜索标签',3=>'模块详情',4=>'智能标签'] as $ck=>$cv): if(isset($vo['type'])): ?><option <?php if($vo['type'] == $ck): ?> selected <?php endif; ?> value="<?php echo htmlentities($ck); ?>"><?php echo htmlentities($cv); ?></option><?php else: ?><option <?php if($ck == 2): ?> selected <?php endif; ?> value="<?php echo htmlentities($ck); ?>"><?php echo htmlentities($cv); ?></option><?php endif; ?><?php endforeach; ?></select></div></div><div class="layui-form-item"><label class="layui-form-label ">标签</label><div class="layui-input-block"><input name="label" value='<?php echo htmlentities((isset($vo['label']) && ($vo['label'] !== '')?$vo['label']:"")); ?>' placeholder="请输入标签 不填默认全部发送" class="layui-input"></div></div><div class="layui-form-item"><label class="layui-form-label label-required">标题</label><div class="layui-input-block"><input name="title" required value='<?php echo htmlentities((isset($vo['title']) && ($vo['title'] !== '')?$vo['title']:"")); ?>' placeholder="请输入推送标题" class="layui-input"></div></div><div class="label_div layui-form-item" <?php if(!isset($vo['type']) || $vo['type'] !== 4): ?>style="display:none" <?php endif; ?>><label class="layui-form-label label-required">智能标签</label><div class="layui-input-block"><div id="demo1"></div></div></div><div class="module_div" <?php if(!isset($vo['type']) || $vo['type'] == 2): ?>style="display:none" <?php endif; ?>><div class="layui-form-item"><label class="layui-form-label label-required">模块</label><div class="layui-input-inline"><select name="module" lay-filter ="module"><?php foreach($module_arr as $ck=>$cv): ?><option data-sel_module="<?php echo htmlentities($ck); ?>" <?php if(isset($vo['module']) && $vo['module'] == $ck): ?> selected <?php endif; ?> value="<?php echo htmlentities($ck); ?>"><?php echo htmlentities($cv); ?></option><?php endforeach; ?></select></div></div><div class="layui-form-item"><label class="layui-form-label label-required">详情</label><div class="layui-input-inline"><select name="first_id" id="first_id" lay-filter ="first_id" lay-search=""></select></div><div class="layui-input-inline second_div"><select name="second_id" id="second_id" lay-filter ="second_id" lay-search=""></select></div></div></div><div class="layui-form-item"><label class="layui-form-label label-required">推送内容</label><div class="layui-input-block"><textarea name="content" required rows="10" cols="98"><?php echo htmlentities((isset($vo['content']) && ($vo['content'] !== '')?$vo['content']:'')); ?></textarea></div></div><div class="layui-form-item"><label class="layui-form-label label-required">是否定时推送</label><div class="layui-input-inline"><select name="is_regular" lay-filter ="is_regular"><?php if(isset($vo['is_regular'])): ?><option <?php if($vo['type'] == 1): ?> selected <?php endif; ?> value="1">否</option><option <?php if($vo['type'] == 0): ?> selected <?php endif; ?> value="0">是</option><?php else: ?><option selected value="1">否</option><option value="0">是</option><?php endif; ?></select></div></div><div class="layui-form-item push_time" <?php if(!isset($vo['is_regular']) || $vo['is_regular'] == 1): ?>style="display:none"<?php endif; ?>><label class="layui-form-label label-required">推送时间</label><div class="layui-input-block"><input name="push_time" id="push_time" required class="layui-input" placeholder="" value="<?php echo htmlentities((isset($vo['push_time']) && ($vo['push_time'] !== '')?$vo['push_time']:'')); ?>"></div></div><?php if(!(empty($vo['id']) || (($vo['id'] instanceof \think\Collection || $vo['id'] instanceof \think\Paginator ) && $vo['id']->isEmpty()))): ?><input type='hidden' value='<?php echo htmlentities($vo['id']); ?>' name='id'><?php endif; ?><div class="layui-form-item text-center"><button class="layui-btn" type='submit'>保 存</button><button class="layui-btn layui-btn-danger" type='button' data-close>取消编辑</button></div></div></form><!-- <script src="/static/xm-select.js"></script>--><script type="text/javascript" src="https://webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script><script src="https://webapi.amap.com/maps?v=1.4.15&key=5295cbb966c063bde1ed33c1de7ed6bd&callback=init"></script><script type="text/javascript" src="https://cache.amap.com/lbs/static/addToolbar.js"></script><script> layui.use('form', function () {
  3. var form = layui.form;
  4. //日期时间范围
  5. laydate.render({
  6. elem: '#push_time'
  7. ,type: 'datetime'
  8. });
  9. //监听指定开关
  10. })
  11. form.on('select(is_regular)', function(data) {
  12. if (data.value == 0) {
  13. $(".push_time").show();
  14. } else {
  15. $(".push_time").hide();
  16. }
  17. })
  18. </script><script> var user_label = <?php echo json_encode($user_label); ?>;
  19. console.log(user_label);
  20. var demo1 = xmSelect.render({
  21. el: '#demo1',
  22. language: 'zn',
  23. filterable: true,
  24. data: user_label
  25. })
  26. </script><script> form.on('select(type)', function(data){
  27. if(data.value == 3) {
  28. $(".module_div").show();
  29. }else{
  30. $(".module_div").hide();
  31. }
  32. if(data.value == 4) {
  33. $(".label_div").show();
  34. $(".module_div").show();
  35. }else{
  36. $(".label_div").hide();
  37. }
  38. window.form.render();
  39. })
  40. var sel_first = <?php echo isset($vo['first_id']) ? $vo['first_id']:0; ?>;
  41. var sel_second = <?php echo isset($vo['second_id']) ? $vo['second_id']:0; ?>;
  42. var module_list = <?php echo json_encode($module_list); ?>;
  43. // 分类选择监听
  44. var arr = ['video','article','datum','supplier','recruit','mall'];
  45. first(1);
  46. form.on('select(module)', function(data){
  47. first(2)
  48. })
  49. // 详情关联监听
  50. form.on('select(first_id)', function(data){
  51. second(2);
  52. })
  53. function first(source) {
  54. sel_module = $("select[name='module']").find("option:selected").data('sel_module');
  55. if(arr.indexOf(sel_module) != -1) {
  56. $(".second_div").show();
  57. }else{
  58. $(".second_div").hide();
  59. }
  60. var cl_html = '<option value="0">请选择</option>';
  61. if(sel_module == '') {
  62. $("select[name='first_id']").html(cl_html);
  63. $("select[name='second_id']").html(cl_html);
  64. window.form.render();
  65. return true;
  66. }else{
  67. $.each(module_list,function (ck,cv) {
  68. if(cv.module == sel_module) {
  69. if(source == 1 && sel_first == cv.id) {
  70. cl_html +='<option selected value="'+cv.id+'">'+cv.title+'</option>';
  71. }else{
  72. cl_html +='<option value="'+cv.id+'">'+cv.title+'</option>';
  73. }
  74. }
  75. })
  76. $("select[name='first_id']").html(cl_html);
  77. $("select[name='second_id']").html('');
  78. }
  79. second(source);
  80. window.form.render();
  81. }
  82. function second(source) {
  83. var cl_html = '<option value="0">请选择</option>';
  84. sel_module = $("select[name='module']").find("option:selected").data('sel_module');
  85. first_id = $("select[name='first_id']").find("option:selected").val();
  86. $.each(module_list,function (ck,cv) {
  87. if(sel_module == cv.module && first_id == cv.id && arr.indexOf(sel_module) != -1) {
  88. $.each(cv.children,function (sk,sv) {
  89. if(source == 1 && sel_second == sv.id) {
  90. cl_html +='<option selected value="'+sv.id+'">'+sv.title+'</option>';
  91. }else{
  92. cl_html +='<option value="'+sv.id+'">'+sv.title+'</option>';
  93. }
  94. })
  95. $("select[name='second_id']").html(cl_html);
  96. $(".second_div").show();
  97. form.render();
  98. }
  99. })
  100. }
  101. </script></div>