layui首页

北城余情 提交于 2019-11-29 18:19:06

 

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>小区物业管理系统</title>
    <!--<meta name="renderer" content="webkit">-->
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="shortcut icon" href="../layuiadmin/layui/images/favicon.ico" />
    <link rel="stylesheet" href="../layuiadmin/layui/css/layui.css"  media="all">
    <link rel="stylesheet" href="../layuiadmin/style/admin.css"  media="all">
    <script src="../layuiadmin/jquery-1.8.0.min.js"></script>
    <script src="../layuiadmin/layui/layui.js"></script>
    <script src="../layuiadmin/configure.js"></script>
</head>
<body class="layui-layout-body">

<div id="LAY_app">
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header">
            <!-- 头部区域 -->
            <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">

                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;">
                        <cite id="loginName"></cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd><a lay-href="password.html">修改密码</a></dd>
                    </dl>
                </li>

                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="javascript:;" layadmin-event="fullscreen">
                        <dd layadmin-event="logout" style="text-align: center;" id="logout"><a>退出</a></dd>
                    </a>
                </li>

            </ul>
        </div>

        <!-- 侧边菜单 -->
        <div class="layui-side layui-side-menu">
            <div class="layui-side-scroll">
                <div class="layui-logo" lay-href="user.html">
                    <span>小区物业管理系统</span>
                </div>

                <div class="layui-side layui-bg-black">
                    <div class="layui-side-scroll" id="view">
                        <!-- 左侧导航区域(可配合layui已有的垂直导航) -->
                        <script id="menus_item" type="text/html">
                            <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu">
                                {{#  layui.each(d, function(index, item){ }}
                                <li data-name="home" class="layui-nav-item "  id="menuList">  <!--class中加 layui-nav-itemed 展开-->

                                    <a href="{{ item.url }}">{{ item.name }}</a>
                                    <dl class="layui-nav-child">
                                        {{#  if(item.children.length> 0){ }}
                                        {{#  layui.each(item.children, function(index, item){ }}
                                        <dd>
                                            <a lay-href="{{ item.url }}.html">{{ item.name }}</a>
                                        </dd>
                                        {{#  }); }}
                                    </dl>
                                    {{#  } }}
                                </li>
                                {{#  }); }}
                                {{#  if(d.length === 0){ }}
                                无数据
                                {{#  } }}
                            </ul>
                        </script>
                    </div>
                </div>


            </div>
        </div>

        <!-- 页面标签 -->
        <div class="layadmin-pagetabs" id="LAY_app_tabs">
            <div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-down">
                <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:;"></a>
                        <dl class="layui-nav-child layui-anim-fadein">
                            <dd layadmin-event="closeThisTabs"><a href="javascript:;">关闭当前标签页</a></dd>
                            <dd layadmin-event="closeOtherTabs"><a href="javascript:;">关闭其它标签页</a></dd>
                            <dd layadmin-event="closeAllTabs"><a href="javascript:;">关闭全部标签页</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>
            <div class="layui-tab" lay-unauto lay-allowClose="true" lay-filter="layadmin-layout-tabs">
                <ul class="layui-tab-title" id="LAY_app_tabsheader">
                    <li lay-id="company.html" lay-attr="company.html" class="layui-this"><i class="layui-icon layui-icon-home"></i></li>
                </ul>
            </div>
        </div>


        <!-- 主体内容 -->
        <div class="layui-body" id="LAY_app_body">
            <div class="layadmin-tabsbody-item layui-show">
                <iframe src="instructions.html" frameborder="0" class="layadmin-iframe" name="main_self_frame"></iframe>
            </div>
        </div>

        <!-- 辅助元素,一般用于移动设备下遮罩 -->
        <div class="layadmin-body-shade" layadmin-event="shade"></div>
    </div>
</div>


<script>
    var phone = sessionStorage.getItem('phone');
    var password = sessionStorage.getItem('password');
    var userName = sessionStorage.getItem('userName');



    var manageAreaId = sessionStorage.getItem('manageAreaId');
    var manageAreaName = sessionStorage.getItem('manageAreaName');
    var companyId = sessionStorage.getItem('companyId');
    var companyName = sessionStorage.getItem('companyName');

    if (manageAreaName=="null"){
        manageAreaName="总公司"
    }
    $('#loginName').html(companyName+"-"+manageAreaName+"-"+userName);
    ///$('#menuList').addClass('layui-nav-itemed');//列表中class加格式

    layui.config({
        base: '../layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table', 'form', 'laydate', 'upload'], function () {
        var table = layui.table;
        var layer = layui.layer;
        var form = layui.form;
        var laydate = layui.laydate;
        var upload = layui.upload;


//    $('#name').html(user_userName);

        $.ajax({
            url:Url+"/menu/select",
            type:'GET',
            data:{
                userPhone:phone,
                userPassword:password
            },
            dataType:'json',
            contentType:'application/x-www-form-urlencoded',
            success:function(data){
                console.log(data);
                if(data.code == 200){
                    layui.use(["laytpl", "element"], function() {
                        var laytpl = layui.laytpl,
                            $ = layui.jquery,
                            element = layui.element;
                        var mneus = data.data;
                        var getTpl = menus_item.innerHTML,
                            view = document.getElementById('view');
                        laytpl(getTpl).render(mneus, function(html) {
                            view.innerHTML = html;
                            element.render();
                        });
                    });
                }
            }
        });


        $("#userPassword").on("click", function () {
            layer.open({
                type: 1,
                title: "修改密码",
                area: ['600px', '400px'],
                content: $("#updata_Password")//引用的弹出层的页面层的方式加载修改界面表单
            });
        });

        //修改密码
        $("#updataOrder").on('click',function(){
            var phone0 = $('#phone0').val();
            var password0 = $('#password0').val();
            var password = $('#password').val();
            var passwordTwo = $('#passwordTwo').val();
            if(password == ''){
                layer.msg('请输入新密码!', {icon: 5});
                return;
            }else if(passwordTwo == ''){
                layer.msg('请确认密码!', {icon: 5});
                return;
            }else if(password != passwordTwo){
                layer.msg('两次输入的密码不一致!', {icon: 5});
                return;
            }else {
                $.ajax({
                    url: Url + "/user/resetPassword",
                    type: 'POST',
                    data: {

                        phone: phone0,//账号
                        password1: password0,//原密码
                        password2: passwordTwo,//新密码

                        userPhone:phone,
                        userPassword:password

                    },
                    dataType: 'json',
                    contentType: 'application/x-www-form-urlencoded',
                    success: function (data) {
                        if (data.code == 200) {
                            location.href = "../login.html"
                            //location.href = "login.html"
                        }
                    }
                });

            }


        });


        var active={
            tabAdd:function(url,id,name){
                element.tabAdd('layadmin-layout-tabs',{
                    title:name,
                    content:'<iframe data-frameid="'+id+'" scrolling="auto" frameborder="0" src="'+url+'" style="width:100%; height:99%"></iframe>',
                    id:id
                });
                iframeWH();
            },
            tabChange:function(id){
                element.tabChange('layadmin-layout-tabs',id);
            },
            tabDelete:function(id){
                element.tabDelete('layadmin-layout-tabs',id);
            },
            tabDeleteAll:function(ids){
                $.each(ids,function(index,item){
                    element.tabDelete('layadmin-layout-tabs',item);
                });
            }
        };

        $("#logout").on('click',function(){
            $.ajax({
                url: Url + "/login/loginout",
                type: 'POST',
                data: {
                    phone: phone
                },
                dataType: 'json',
                contentType: 'application/x-www-form-urlencoded',
                success: function (data) {
                    console.log("============"+data)
                    if (data.code == 200) {
                        sessionStorage.setItem('phone', '');
                        sessionStorage.setItem('password', '');
                        sessionStorage.clear();//清空所有缓存
                        location.href = "../login.html"
                    }else{
                        layer.msg('退出失败!' + data.msg, {
                            offset: '125px'
                            , icon: 1
                            , time: 1000 //1秒后跳转
                        });
                    }
                },
                error:function (data){
                    layer.msg('退出失败!' + data.msg, {
                        offset: '125px'
                        , icon: 1
                        , time: 1000 //1秒后跳转
                    });
                }
            })
        });


//    $("#logout").on('click',function(){//user_Id
//      $.ajax({
//        url:Url+"logout",
//        type:'POST',
//        headers: {
//          'token': token
//        },
//        data:{
//          id:user_Id
//        },
//        dataType:'json',
//        contentType:'application/x-www-form-urlencoded',
//        success:function(data){
//          if(data.code == 200){
//            sessionStorage.setItem('token','');
//            sessionStorage.setItem('user_Id','');
//            sessionStorage.setItem('user_userName','');
//            sessionStorage.setItem('roleId','');
//            layer.msg('退出成功!', {
//              offset: '125px'
//              ,icon: 1
//              ,time:200 //1秒后跳转
//            },function(){
//              location.href = "login.html"
//            });
//
//          }
//        }
//      });
//
//    });

        function iframeWH(){
            var H = $(window).height()-80;
            $("iframe").css("height",H+"px");
        }
        $(window).resize(function(){
            iframeWH();
        });

        //当点击展开一个导航栏时,关闭其他的导航栏。
        $('.layui-nav-item').click(function(){
            $(this).siblings('li').attr('class','layui-nav-item');
        })


    });
</script>
</body>
</html>

  

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!