wupengfei 1 rok temu
rodzic
commit
81545c3e98
2 zmienionych plików z 83 dodań i 5 usunięć
  1. 2 1
      .idea/workspace.xml
  2. 81 4
      application/user/view/message/form.html

+ 2 - 1
.idea/workspace.xml

@@ -2,6 +2,7 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="1a36929e-c054-4875-a943-593a74e55fa4" name="Default Changelist" comment="">
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/application/user/view/message/form.html" beforeDir="false" afterPath="$PROJECT_DIR$/application/user/view/message/form.html" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
@@ -393,7 +394,7 @@
       <workItem from="1691543042280" duration="23354000" />
       <workItem from="1691629430810" duration="15054000" />
       <workItem from="1691715404380" duration="18567000" />
-      <workItem from="1691801870842" duration="10326000" />
+      <workItem from="1691801870842" duration="11697000" />
     </task>
     <servers />
   </component>

+ 81 - 4
application/user/view/message/form.html

@@ -20,19 +20,32 @@
                 </div>
             </div>
 
-            <div class="module_div" {if !isset($vo.type) ||  $vo.type == 2}style="display:none"{/if}>
+            <div class="module_div" {if !isset($vo.type) ||  $vo.type == 2}style="display:none" {/if}>
                 <div class="layui-form-item">
                     <label class="layui-form-label label-required">模块</label>
                     <div class="layui-input-inline">
                         <select name="module" lay-filter ="module">
                             {foreach $module_arr as $ck=>$cv}
-                                <option  {if isset($vo.module) && $vo.module == $ck } selected {/if} value="{$ck}">{$cv}</option>
+                                <option  data-sel_module="{$ck}" {if isset($vo.module) && $vo.module == $ck } selected {/if} value="{$ck}">{$cv}</option>
                             {/foreach}
                         </select>
                     </div>
                 </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">
+
+                        </select>
+                    </div>
 
+                    <div class="layui-input-inline second_div">
+                        <select name="second_id" id="second_id"  lay-filter ="second_id">
+
+                        </select>
+                    </div>
+                </div>
+            </div>
 
             <div class="layui-form-item">
                 <label class="layui-form-label label-required">推送内容</label>
@@ -49,7 +62,6 @@
         </div>
     </form>
     <script>
-        window.form.render();
         form.on('select(type)', function(data){
             if(data.value == 3) {
                 $(".module_div").show();
@@ -58,5 +70,70 @@
             }
             window.form.render();
         })
+
+        var sel_first = {:isset($vo['first_id']) ? $vo['first_id']:0};
+        var sel_second  = {:isset($vo['second_id']) ? $vo['second_id']:0};
+        var module_list  = {:json_encode($module_list)};
+        // 分类选择监听
+        var arr = ['video','article','datum'];
+        first(1);
+        form.on('select(module)', function(data){
+            first(2)
+        })
+        // 详情关联监听
+        form.on('select(first_id)', function(data){
+            second(2);
+        })
+
+        function first(source) {
+            sel_module = $("select[name='module']").find("option:selected").data('sel_module');
+            if(arr.indexOf(sel_module) != -1) {
+                $(".second_div").show();
+            }else{
+                $(".second_div").hide();
+            }
+            var cl_html = '<option value="0">请选择</option>';
+            if(sel_module == '') {
+                $("select[name='first_id']").html(cl_html);
+                $("select[name='second_id']").html(cl_html);
+                window.form.render();
+                return true;
+            }else{
+                $.each(module_list,function (ck,cv) {
+                    if(cv.module == sel_module) {
+                        if(source == 1 && sel_first == cv.id) {
+                            cl_html +='<option selected value="'+cv.id+'">'+cv.title+'</option>';
+                        }else{
+                            cl_html +='<option value="'+cv.id+'">'+cv.title+'</option>';
+                        }
+                    }
+                })
+                $("select[name='first_id']").html(cl_html);
+                $("select[name='second_id']").html('');
+            }
+            second(source);
+            window.form.render();
+        }
+        function second(source) {
+            var cl_html = '<option value="0">请选择</option>';
+            sel_module = $("select[name='module']").find("option:selected").data('sel_module');
+            first_id = $("select[name='first_id']").find("option:selected").val();
+            $.each(module_list,function (ck,cv) {
+                if(sel_module == cv.module && first_id == cv.id && arr.indexOf(sel_module) != -1) {
+                    $.each(cv.children,function (sk,sv) {
+                        if(source == 1 && sel_second == sv.id) {
+                            cl_html +='<option selected value="'+sv.id+'">'+sv.title+'</option>';
+                        }else{
+                            cl_html +='<option value="'+sv.id+'">'+sv.title+'</option>';
+                        }
+                    })
+                    $("select[name='second_id']").html(cl_html);
+                    $(".second_div").show();
+                    form.render();
+                }
+            })
+        }
+
+
     </script>
 </div>