修改页面,完成单页模式新增首页返回上一页按钮

This commit is contained in:
2026-08-31 14:48:32 +08:00
parent aaed0584b1
commit 15b301b358
363 changed files with 10895 additions and 213 deletions
+1
View File
@@ -0,0 +1 @@
.selectY-box{position:relative;height:30px}.selectY-box .show{position:relative;height:28px;line-height:28px;padding:0 25px 0 10px;min-width:30px;display:inline-block;background-color:#fff;cursor:pointer}.selectY-box .show:after{font-family:layui-icon!important;content:"";color:#e6e6e6;position:absolute;top:0;right:5px}.selectY-box .show i{color:#e6e6e6;padding:0 5px}.selectY-box .pop{position:absolute;z-index:99;top:29px;left:0;display:none;box-shadow:0 2px 5px #0000001a}.selectY-box .show,.selectY-box .pop ul{border:1px solid #e6e6e6}.selectY-box .pop ul{background-color:#fff;min-width:160px;height:237px;padding:5px 0;float:left;margin-left:-1px;overflow:auto}.selectY-box .pop ul:first-child{margin-left:0}.selectY-box .pop ul li{padding:5px 30px 5px 20px;position:relative;cursor:pointer}.selectY-box .pop ul li.child-row:after{font-family:layui-icon!important;content:"";color:#e6e6e6;position:absolute;top:5px;right:10px}.selectY-box .pop ul li:hover{background-color:#f8f8f8}.selectY-box .pop ul li.active{color:red}
+1
View File
@@ -0,0 +1 @@
layui.define("layer",function(w){var s=layui.$,p=layui.layer,g=function(n){this.c={elem:"",data:"",url:"",placeholder:"请选择:",disabledTips:"",success:function(){}},this.c=s.extend(this.c,n),this.getData=function(e){var a;return s.ajax({url:e,type:"get",dataType:"json",async:!1,success:function(l){a=l.data||p.msg("数据接口错误,请正确配置")},error:function(){p.msg("数据接口错误,请正确配置"),a=""}}),a},this.getChild=function(e,a){for(var l=[],t=0;t<e.length;t++)e[t].pid==a&&l.push(e[t]);return l},this.createChild=function(e){for(var a=this,l="<ul>",t=0;t<e.length;t++){var i=a.getChild(a.data,e[t].id);i=i.length!=0?"child-row":"";var r=e[t].off?"layui-disabled":"";l+='<li class ="'+i+" "+r+'" data-id="'+e[t].id+'">'+e[t].name+"</li>"}return l+="</ul>",l},this.setValue=function(e){for(var a=this,l=a.data,t=[],i=0;i<l.length;i++)for(var r=0;r<e.length;r++)e[r]==l[i].name&&t.push(l[i].id);return t},this.showPopup=function(e,a){var l=this,t=l.getChild(e,a);if(t.length!=0){var i=l.createChild(t);s(l.c.elem).parent().find(".pop").append(i)}},this.scroll=function(){for(var e=this,a=e.c,l=a.elem,t=s(l).parent().find(".pop ul"),i=0;i<t.length;i++){var r=t.eq(i).children("li.active");if(r[0]){var c=r.position().top,d=t.eq(i).height(),o=r.height();c>d&&t.eq(i).scrollTop(c+t.eq(i).scrollTop()-d+o+3),c<0&&t.eq(i).scrollTop(c+t.eq(i).scrollTop()-5)}}},this.data=this.c.url?this.getData(this.c.url):this.c.data};g.prototype.render=function(){var n=this,e=n.c,a=e.elem,l='<div class="selectY-box"></div>',t='<span class="show"><span class="cl-exp">'+e.placeholder+"</span></span>",i='<div class="pop"></div>';if(s(a).wrap(l),s(a).after(t+i),n.showPopup(n.data,0),s(a).val()!=""){var r=s(a).val().split("/"),c=r.join("<i>/</i>");s(a).parent().find(".show").html(c);for(var d=this.setValue(r),o=0;o<d.length;o++){n.showPopup(n.data,d[o]);var C=s(a).parent().find(".pop ul");C.eq(o).find("li[data-id="+d[o]+"]").addClass("active")}}s(a).parent().find(".pop").on("click","ul li",function(f){if(s(this).hasClass("layui-disabled"))return p.msg(e.disabledTips),!1;s(this).addClass("active").siblings().removeClass("active"),s(this).parent().nextAll("ul").remove();var q=s(this).data("id");if(n.showPopup(n.data,q),!s(this).hasClass("child-row")){s(a).parent().find(".pop").hide();for(var u=s(a).parent().find(".pop li.active"),v=[],y=[],h=0;h<u.length;h++)v.push(u.eq(h).html()),y.push(u.eq(h).data("id"));var m=v.join("/"),T=v.join("<i>/</i>");if(s(a).val(m),s(a).parent().find(".show").html(T),typeof e.success=="function"){var b={data:m,ids:y};e.success(b)}}layui.stope(f)}),s(a).parent().find(".show").on("click",function(f){s(a).parent().find(".pop").show(),n.scroll(),layui.stope(f)}),s(document).on("click",function(){s(a).parent().find(".pop").hide()})},w("selectY",function(n){var e=new g(n);e.render()})}).link(layui.cache.base+"selectY/selectY.css?v="+new Date().getTime());
+1
View File
@@ -0,0 +1 @@
layui.define("layer",function(x){var n=layui.$,y=layui.layer,T=function(e){this.c={elem:"",data:"",url:"",placeholder:"请选择:",disabledTips:"",success:function(){}},this.c=n.extend(this.c,e),this.init()};T.prototype={init:function(){this.data=this.c.url?this.getData(this.c.url):this.c.data,this.render()},getData:function(e){var t;return n.ajax({url:e,type:"get",dataType:"json",async:!1,success:function(a){t=a.data||y.msg("数据接口错误,请正确配置")},error:function(){y.msg("数据接口错误,请正确配置"),t=""}}),t},getChild:function(e,t){for(var a=[],i=0;i<e.length;i++)e[i].pid==t&&a.push(e[i]);return a},createChild:function(e){for(var t=this,a="<ul>",i=0;i<e.length;i++){var r=t.getChild(t.data,e[i].id);r=r.length!=0?"child-row":"";var l=e[i].off?"layui-disabled":"";a+='<li class="'+r+" "+l+'" data-id="'+e[i].id+'">'+e[i].name+"</li>"}return a+="</ul>",a},setValue:function(e){var t=this,a=t.data,i=n(t.c.elem),r=i.parent();r.find(".pop").empty(),r.find(".show").html(t.c.placeholder),i.val("");for(var l=[],s=t.getChild(a,0),d=0;d<e.length;d++){for(var c=!1,o=0;o<s.length;o++)if(s[o].name===e[d]){l.push(s[o]),s=t.getChild(a,s[o].id),c=!0;break}if(!c)break}if(l.length>0){r.find(".pop").empty();for(var h=0;h<l.length;h++){var v=t.getChild(a,h===0?0:l[h-1].id),C=t.createChild(v);r.find(".pop").append(C);var g=r.find(".pop ul").eq(h);g.find('li[data-id="'+l[h].id+'"]').addClass("active")}var f=l[l.length-1],m=t.getChild(a,f.id);if(m.length>0){var u=t.createChild(m);r.find(".pop").append(u)}var w=l.map(function(p){return p.name}).join("<i>/</i>"),q=l.map(function(p){return p.name}).join("/");if(r.find(".show").html(w),i.val(q),typeof t.c.success=="function"){var b=l.map(function(p){return p.id}),Y=l.map(function(p){return p.name});t.c.success({data:Y,ids:b})}return l.map(function(p){return p.id})}return[]},showPopup:function(e,t){var a=this,i=a.getChild(e,t);if(i.length!=0){var r=a.createChild(i);n(a.c.elem).parent().find(".pop").append(r)}},scroll:function(){for(var e=this,t=e.c,a=t.elem,i=n(a).parent().find(".pop ul"),r=0;r<i.length;r++){var l=i.eq(r).children("li.active");if(l[0]){var s=l.position().top,d=i.eq(r).height(),c=l.height();s>d&&i.eq(r).scrollTop(s+i.eq(r).scrollTop()-d+c+3),s<0&&i.eq(r).scrollTop(s+i.eq(r).scrollTop()-5)}}},render:function(){var e=this,t=e.c,a=t.elem,i='<div class="selectY-box"></div>',r='<span class="show"><span class="cl-exp">'+t.placeholder+"</span></span>",l='<div class="pop"></div>';if(n(a).wrap(i),n(a).after(r+l),e.showPopup(e.data,0),n(a).val()!=""){var s=n(a).val().split("/"),d=s.join("<i>/</i>");n(a).parent().find(".show").html(d);for(var c=e.setValue(s),o=0;o<c.length;o++){e.showPopup(e.data,c[o]);var h=n(a).parent().find(".pop ul");h.eq(o).find("li[data-id="+c[o]+"]").addClass("active")}}n(a).parent().find(".pop").on("click","ul li",function(v){if(n(this).hasClass("layui-disabled"))return y.msg(t.disabledTips),!1;n(this).addClass("active").siblings().removeClass("active"),n(this).parent().nextAll("ul").remove();var C=n(this).data("id");if(e.showPopup(e.data,C),!n(this).hasClass("child-row")){n(a).parent().find(".pop").hide();for(var g=n(a).parent().find(".pop li.active"),f=[],m=[],u=0;u<g.length;u++)f.push(g.eq(u).html()),m.push(g.eq(u).data("id"));var w=f.join("/"),q=f.join("<i>/</i>");if(n(a).val(w),n(a).parent().find(".show").html(q),typeof t.success=="function"){var b={data:f,ids:m};t.success(b)}}layui.stope(v)}),n(a).parent().find(".show").on("click",function(v){n(a).parent().find(".pop").show(),e.scroll(),layui.stope(v)}),n(document).on("click",function(){n(a).parent().find(".pop").hide()})}},x("selectY2",function(e){return new T(e)})}).link(layui.cache.base+"selectY/selectY.css?v="+new Date().getTime());