jquery实现微信公众号后台添加菜单效果

代码语言:html

所属分类:布局界面

代码描述:jquery实现微信公众号后台添加菜单效果

代码标签: 公众 后台 添加 菜单 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<html >
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<style>
    @charset "UTF-8";
ul,li{
    list-style: none;
    padding: 0;
    margin: 0;
}
body{
    line-height: 24px;
    font: 14px Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif;
    color: #666;
}
.fluid{
    box-sizing: border-box;
    padding: 15px;
    margin: 0 auto;
    position: relative;
}
.pannel{
    background-color: #ffffff;
}
.fluid-btn{
    display: inline-block;
    padding: 8px 12px;
    background-color: #1b8bf5;
    border-radius: 3px;
    color: #fff;
    text-align: center;
    font-size: 12px;
    transition: .3s all;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    line-height: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    margin-right: 8px;
}
.fluid-btn.big-btn{
    line-height: 1.2rem;
    padding: 8px 1.5rem;
}
.fluid-btn i{
    padding-right: 3px;
}
.fluid-btn:hover{
    color: #fff;
    /*color: rgba(255,255,255,.8);*/
    background-color: #00bcd4;
}
.triangle {
    display: block;
    width: 0;
    height: 0;
    border-width: 10px 11px 0;
    border-style: solid;
    border-color: #e8e8e8 transparent transparent;
    position: absolute;
    bottom: -10px;
    left: 50%;
    margin-left: -10px;
}

.triangle em {
    display: block;
    width: 0;
    height: 0;
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: #fafafa transparent transparent;
    position: absolute;
    top: -10px;
    left: -8px;
}
.wx-card{
    position: relative;
}
.wx-card:before,
.wx-card:after{
    content: ' ';
    display: block;
    clear: both;
}
.wx-box {
    width: 320px;
    height: 550px;
    background-color: #f3f3f3;
    position: relative;
    float: left;
    /* border: 1px solid #e8e8e8; */
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 1px 5px #a9a9a9;
}
.wx-box .wx-head {
    height: 68px;
    line-height: 68px;
    background-color: #464646;
    text-align: center;
    color: #fff;
    user-select: none;
    position: relative;
}
.wx-box .wx-head .left-icon {
    position: absolute;
    left: 16px;
    top: 28px;
    color: #fff;
}
.wx-footer{
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 46px;
    box-sizing: border-box;
    border-top: 1px solid #e8e8e8;
}
.wx-footer .menu-item,.add-menu{
    display: block;
    width: 33.33333%;
    height: 100%;
    float: left;
    text-align: center;
    line-height: 46px;
    box-sizing: border-box;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    font-size: 12px;
    position: relative;
    background-color: #ffffff;
}
.wx-footer .menu-item:before{
    content: ' ';
    display: block;
    height: 100%;
    position: absolute;
    right: -1px;
    border-left: 1px solid #e8e8e8;
    z-index: 1;
}
.wx-footer .menu-item:last-child:before{
    content: '';
}
.add-menu i{
    line-height: 46px;
    color: #777;
}
.wx-footer .menu-item.ac{
    background-color: #f1f1f1;
}
.wx-footer .menu-item:last-child{
    border-right: 0;
}
.wx-footer .menu-item:hover{
    background-color: #f1f1f1;
}
.wx-footer .menu-item .item-text{
    display: block;
    width: 100%;
    height: 100%;
}
.wx-footer .menu-item.ac .menu-child-list{
    display: block;
}
.menu-child-list{
    position: absolute;
    bottom: 58px;
    left: 0;
    width: 100%;
    background-color: #fafafa;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    border-radius: 3px;
    display: none;
}
.child-menu-item{
    border-bottom: 1px solid #e8e8e8;
    box-sizing: border-box;
}
.child-menu-item.active{
    background-color: #f1f1f1;
}
.child-menu-item:last-child{
    border-bottom: 0;
}
.child-menu-item .item-text{
    display: block;
}
.wx-editor {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    right: 0;
    margin-left: 332px;
    background-color: #f1f1f1;
    box-sizing: border-box;
    padding: 12px;
    border-radius: 5px;
    box-shadow: 0 1px 5px #a9a9a9;
}
.wx-editor-show{
    width: 100%;
    height: 100%;
    display: none;
}
.wx-editor .wx-editor-head{
    padding-bottom: 8px;
    padding-left: 10px;
    border-bottom: 1px solid #e8e8e8;
}
.wx-editor .wx-editor-head .menu-delete{
    float: right;
    font-size: 12px;
    color: #DE5044;
    cursor: pointer;
}
.wx-editor-body{
    padding: 12px 0;
}
.content-tips{
    font-size: 12px;
    text-align: center;
    line-height: 450px;
    color: #777;
    user-select: none;
}
.editor-tips{
    height: 38px;
    line-height: 38px;
    position: absolute;
    right: 45%;
    top: 0;
    bottom: 0;
    margin: auto;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
.editor-load{
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    width: 50px;
    height: 50px;
    margin: auto;
    display: block;
    z-index: 1;
    display: none;
}
.editor-load i{
    font-size: 50px;
    color: #fff;
    text-align: center;
    line-height: 50px;
    animation: editor-load 1s infinite;
}
@keyframes editor-load{
    from {
        transform: rotate(0);
    }
    to {
        transform: rotate(360deg);
    }
}

/*表单UI*/
.cjb-form-group{
    margin-bottom: 12px;
    line-height: 36px;
    position: relative;
}
.cjb-form-group:before,
.cjb-form-group:after{
    content: ' ';
    display: block;
    clear: both;
}
.cjb-input-tips{
    margin-top: 5px;
    color: #777;
    font-size: 12px;
    line-height: 1.5;
    margin-bottom: 12px;
}
.cjb-form-group:last-child{
    /*margin-bottom: 0;*/
}
.cjb-form-group label{
    float: left;
    width: 90px;
    text-align: right;
}
.big-group{
    line-height: 38px;
}
.big-group .layui-form-radio{
    margin: 0 10px;
}
.cjb-form-group .cjb-input-block{
    margin-left: 100px;
}
.cjb-input-line{
    margin: 0;
    width: 100%;
}
.cjb-input-line .cjb-input{
    line-height: 1.3;
    height: 36px;
    width: 100%;
    padding-left: 10px;
    box-sizing: border-box;
    border: 1px solid #d2d2d2;
    background-color: #fff;
    border-radius: 2px;
}
.cjb-form-group .cjb-input-block .cjb-input{
    line-height: 1.3;
    height: 36px;
    width: 66%;
    padding-left: 10px;
    box-sizing: border-box;
    border: 1px solid #d2d2d2;
    background-color: #fff;
    border-radius: 2px;
}
.media-scope{
    width: 120px;
    height: 80px;
    border: 1px solid #c5c5c5;
    text-align: center;
    border-radius: 2px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    cursor: pointer;
    color: #777;
}
.media-scope i{
    padding-top: 20px;
}
.media-scope p{
    line-height: 1;
    padding-top: 10px;
}
.cjb-radio{
    position: relative;
    padding-left: 25px;
    box-sizing: border-box;
    float: left;
    margin-right: 12px;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    transition: .4s all;
}
.cjb-radio:before{
    content: ' ';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    margin: auto;
    width: 16px;
    height: 16px;
    border: 1px solid #009688;
    border-radius: 50%;
}
.cjb-radio.select:after{
    content: ' ';
}
.cjb-radio:after{
    position: absolute;
    left: 4px;
    top: 0;
    bottom: 0;
    margin: auto;
    width: 10px;
    height: 10px;
    background-color: #009688;
    border-radius: 50%;
}
pre {
    white-space: pre-wrap;
    word-wrap: break-word;
}
#json{
    color: #666;
    padding: 12px;
    box-sizing: border-box;
    background-color: #f1f1f1;
    font-size: 12px;
    line-height: 1.5;
    border-radius: 5px;
}
</style>
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/font-awesome-4.7.0/css/font-awesome.min.css">

</head>
<body>

    <div class="fluid">
        <div class="pannel">
            <div class="wx-card">
                <div class="wx-box">
                    <div class="wx-head"><a href="javascript:;" class="left-icon"><i class="fa fa-chevron-left"></i></a>微信公众号</div>
                    <div class="wx-body">
                        <p class="content-tips">内容区域</p>
                        <div class="wx-footer">
                            <li class="add-menu"><i class="fa fa-plus"></i></li>
                        </div>
                    </div>
                </div>
                <div class="wx-editor">
                    <a href="javascript:;" class="editor-load"><i class="fa fa-spinner"></i></a>
                    <span class="editor-tips">请点击左侧菜单</span>
                    <div class="wx-editor-show">
                        <div class="wx-editor-head">菜单一<a class="menu-delete">删除该菜单</a></div>
                        <div class="wx-editor-body">

                            <div class="cjb-form-group">
                                <label for="">菜单名称:</label>
                                <div class="cjb-input-block">
                                    <input type="text" class="cjb-input" name="cjb-name" placeholder="菜单名称">
                                </div>
                            </div>
                            <div class="cjb-form-group cjb-radio-group">
                                <label for="">菜单类型:</label>
                                <div class="cjb-input-block">
                                    <li class="cjb-radio select" type="view">跳转链接</li>
                                    <li class="cjb-radio" type="click">发送消息</li>
                                </div>
                            </div>
                            <div class="cjb-form-group cjb-val-group">
                                <label for="">菜单值:</label>
                                <div class="cjb-input-block">
                                    <input type="text" class="cjb-input" name="cjb-val" placeholder="菜单包含的值">
                                    <p class="cjb-input-tips">请输入包含http://或者https://的完整链接</p>
                                </div>
                            </div>
                            <div class="cjb-form-group">
                                <div class="cjb-input-block">
                                    <a class="set_menu fluid-btn">确认修改</a>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
            </div>
            <p style="text-align: center"><a class="big-btn fluid-btn create_menu">保存</a> <a class="big-btn fluid-btn" style="background-color: #ccc">取消</a></p>
            <span style="font-size: 12px;">得到的json数据:</span>
            <pre id="json"></pre>
        </div>
    </div>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery.17.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/layer.js"></script>
    <script >
        
        // 当前正在编辑的菜单对象
var ot = null;
// 一级菜单点击事件
$(document).off().on('cl.........完整代码请登录后点击上方下载按钮下载查看

网友评论0