123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- {Template header}
- <style type="text/css">
- .tjtop {width:100%;line-height:50px;text-align: center;}.tjtop font {width:200px;line-height:50px;text-align: center;color:#2084db;border: 2px solid #2084db;margin-top:10px;border-radius:10px;font-size: 16px;cursor: pointer;display: inline-block;}
- .coursedata{min-width: 900px;width: 94%;max-width: 1024px;font-size: 14px;margin: 0px auto;padding-top:50px} .coursedata ul {width:100%;}.coursedata li{line-height:40px;padding-top:0px;padding-bottom:3px;position: relative;float:none;width:100%;}.coursedata .flg{padding-left:30px;}.coursedata .edit {width:100%;line-height:40px;border-left: 1px dashed #ccc;border-bottom: 1px dashed #ccc;padding-left:20px;cursor: pointer;display: inline-block;}.coursedata .edit:hover{background-color: #ECECEC;}.coursedata .edit i {padding-right:8px;}.coursedata .del{margin-top:6px;display: inline-block;width:70px;line-height:26px;text-align: center;border: 1px solid #ccc;border-radius: 5px;font-size: 12px;color:#555;margin-right:2px;position: absolute;top:0px;right:1%;cursor: pointer;}.coursedata .del:hover{border: 1px solid #000;color:#000}.coursedata .span {padding-right:5px;position: relative;left: 0;top: 2px;}.coursedata .generatetree {padding-left: 25px;background-image: url(../img/line.gif);background-repeat: no-repeat;background-position: 0px 0px;}.coursedata ul li {width:calc(100% - 28px);margin-left:28px;}.coursedata label{width: auto;line-height:40px;padding-left: 30px;margin-left: 10px;}.coursedata li ul label{background-image: url(../img/line.gif);background-repeat: no-repeat;background-position: 10px 0px;}.coursesee{min-width: 900px;width: 94%;max-width: 1024px;font-size: 14px;margin: 0px auto;padding: 50px 0px 10px;}.coursesee li{padding-left: 28px;line-height:40px;padding-top:0px;padding-bottom:3px;position: relative;float:none;width:98%;}.coursesee li ul{display: none;}.coursesee li strong{font-size: 20px;font-weight: bold;padding-right:8px;color:#333}.coursesee li div {cursor: pointer;}.coursesee li ul div {padding-left:25px;background-image: url(../img/line.gif);background-repeat: no-repeat;background-position: 0px 12px;}.coursesee li i{padding-right:10px;}.fds {position: absolute;left: -110px;top: 15px;}.fdx {position: absolute;left: -30px;top: 15px;}.fdgd {position: absolute;left: -30px;top: 15px;}
- </style>
- <body>
- <div class="warp">
- <div class="tjtop" style="height:80px;">
- <div style="width:100%;height:80px;background-color: #f5f5f5;position: fixed;z-index: 1;">
- <font class="courseadd window" data-h="/classid/add/" data-t="添 加">添 加</font>
- </div></div>
- <div class="coursedata" style="padding-top:0px;"></div>
- <div style="clear:both;"></div>
- </div>
- <script>var dataurl = "/classid";
- $(document).ready(function () {
- loadidcourse();
- });
- $(".coursedata").on('click',".del",function() {
- $(".express p:eq(0)").html("是否删除 "+$(this).data("t")+" ?");
- $(".express p:eq(1)").html("<font class='coursedel' data-d='"+$(this).data("d")+"'>确 定</font><font class='esc'>取 消</font>");
- $(".express").show();
- });
- function loadidcourse() {
- $(".coursedata").html("");
- layx.load('loadId','数据加载中');
- $.ajax({
- url: "/classid/rows",
- data: "rows=1",
- type: "POST",
- dataType: "json",
- success: function(c)
- {
- layx.destroy('loadId');
- if(c.data.length > 0)
- {
- var showlist = $("<ul class='td'></ul>");
- showall(c.data, showlist);
- $(".coursedata").append(showlist);
- /** 拖动开始 **/
- $( ".coursedata .td" ).sortable({
- update: function (event, ui) {
- px();
- }
- })
- /** 拖动结束 **/
- }
- else
- {
- $(".coursedata").html("<div style='font-size: 22px;text-align: center;color:#555;padding-top:10%;'>没有内容,请先添加</div>");
- }
- }
- });
- }
- function showall(menu_list, parent) {
- for (var menu in menu_list) {
- var t = '';var c = '';var kc = '';
- if(menu_list[menu].pp == 1)
- {
- var kc = '(SKU匹配 ID:'+menu_list[menu].id+') - ';
- }
- var data = '<div class="edit window" data-h="/classid/edit/'+menu_list[menu].id+'" data-t="修改" id="'+menu_list[menu].id+'"><font>'+kc+' '+menu_list[menu].title+'</font></div><font class="del" data-t="'+menu_list[menu].title+'" data-d="'+menu_list[menu].id+'">删除</font>';
- //如果有子节点,则遍历该子节点
- t = "<i class='fa fa-chevron-up fds'></i><i class='fa fa-chevron-down fdx'></i>";
- c = "class='sx'";
-
- //创建一个子节点li
- var li = $("<li id='"+menu_list[menu].id+"' "+c+" data-id='"+menu_list[menu].id+"'></li>");
- //将li的文本设置好,并马上添加一个空白的ul子节点,并且将这个li添加到父亲节点中
- $(li).append(data).append("<ul></ul>").appendTo(parent);
- //将空白的ul作为下一个递归遍历的父亲节点传入
- showall(menu_list[menu].children, $(li).children("ul").eq(0));
-
- //如果该节点没有子节点,则直接将该节点li以及文本创建好直接添加到父亲节点中
-
- }
- }
- $(".coursedata").on('click',"li .fa-chevron-up",function() {
- var parentsDiv = $(this).parents(".coursedata ul li");
- var prev = parentsDiv.prev();
- if(prev.html()!=undefined){
- prev.before(parentsDiv);
- }
- px();
- });
- $(".coursedata").on('click',"li .fa-chevron-down",function() {
- var parentsDiv = $(this).parents(".coursedata ul li");
- var prev = parentsDiv.next();
- if(prev.html()!=undefined){
- prev.after(parentsDiv);
- }
- px();
- });
- function px()
- {
- var f = '';
- $(".sx").each(function() {
- f = f + $(this).data("id") + "|";
- });
- $.ajax({
- url: "/classid/px",
- data: "data="+f,
- type: "POST",
- dataType: "json",
- success: function(c)
- {
- if (c && c.success) {
- } else {
- $(".ts p").html(c.msg);
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 1000);
- }
- }
- });
- }
- </script>
- {Template footer}
|