<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Admin.Master" AutoEventWireup="true" CodeBehind="menu_my.aspx.cs" Inherits="Math.admin.menu_my" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">





 <fieldset class="layui-elem-field layui-field-title"  style="margin-top: 20px;">
  <legend>1.配置我的菜单</legend>
</fieldset> 
<div id="mymenu"></div>

 <div class="layui-btn-container" style="margin:20px;">
  <button type="button" lay-submit class="layui-btn" lay-filter="saveMenu">保存菜单</button>
 
</div>


    <hr />



    <script>
 
        layui.use(function () {
            var $ = layui.$,
              form = layui.form,
                transfer = layui.transfer; 

            $.ajax({
                url: "ajax/menu_action.aspx",
                data: { t: "getMenu" },
                type: "post",
                cache: false,
                anysc:true,
                dataType:"json",
                success: function (data1) { 
                 
                    transfer.render({
                        title: ["可用菜单", "选择菜单"],
                        elem: '#mymenu',
                        id: "mymenu",
                        data: data1
                    });

                 
                    form.on("submit(saveMenu)", function () {

                        var data = transfer.getData("mymenu");
                        var texts = "";
                        var values = "";

                        $.each(data, function (index, v) {
                            texts += v.title + ";";
                            values += v.value + ";";
                        });

                        $.ajax({
                            url: "ajax/menu_action.aspx",
                            data: { t: "saveMenu", texts: encodeURIComponent(texts), values: encodeURIComponent(values) },
                            type: "post",
                            cache: false,
                            success: function ()
                            {
                                layer.msg("保存成功");
                            }

                        });

                    })

                }
            }); 
         
         
        });
    </script>



    
    


</asp:Content>

