Update: (步骤备份)更新 Pear Admin 框架版本与 Pear Admin Layui 一致,尝试重写页面

This commit is contained in:
wojiaoyishang
2025-01-19 20:03:18 +08:00
parent 43370ad078
commit d4a1b0ec57
63 changed files with 105722 additions and 2633 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,977 @@
.pear-container {
padding: 10px;
margin: 0px;
box-sizing: border-box;
background-color: transparent;
width: 100%;
}
*::-webkit-scrollbar {
width: 0px;
height: 0px;
}
*::-webkit-scrollbar {
width: 6px;
height: 6px;
}
*::-webkit-scrollbar-track {
background: transparent;
}
*::-webkit-scrollbar-thumb {
background: #E6E6E6;
border-radius: 4px;
}
*::-webkit-scrollbar-thumb:hover {
background: #E6E6E6;
}
*::-webkit-scrollbar-corner {
background: #f6f6f6;
}
.pear-row::after,
.pear-row::before {
content: "";
display: table;
clear: both;
}
.pear-col {
float: left;
min-height: 1px;
}
.pear-row * {
box-sizing: border-box
}
.pear-col-md1 {
width: 4.16%;
}
.pear-col-md2 {
width: 8.33%;
}
.pear-col-md3 {
width: 12.5%;
}
.pear-col-md4 {
width: 16.66%;
}
.pear-col-md5 {
width: 20.83%;
}
.pear-col-md6 {
width: 25%;
}
.pear-col-md7 {
width: 29.16%;
}
.pear-col-md8 {
width: 33.33%;
}
.pear-col-md9 {
width: 37.5%;
}
.pear-col-md10 {
width: 41.66%;
}
.pear-col-md11 {
width: 45.83%;
}
.pear-col-md12 {
width: 50%;
}
.pear-col-md13 {
width: 54.16%;
}
.pear-col-md14 {
width: 58.33%;
}
.pear-col-md15 {
width: 62.5%;
}
.pear-col-md16 {
width: 66.66%;
}
.pear-col-md17 {
width: 70.83%;
}
.pear-col-md18 {
width: 75%;
}
.pear-col-md19 {
width: 79.16%;
}
.pear-col-md20 {
width: 83.33%;
}
.pear-col-md21 {
width: 87.5%;
}
.pear-col-md22 {
width: 91.66%;
}
.pear-col-md23 {
width: 95.83%;
}
.pear-col-md24 {
width: 100%;
}
.pear-col-md-offset1 {
margin-left: 4.16%;
}
.pear-col-md-offset2 {
margin-left: 8.33%;
}
.pear-col-md-offset3 {
margin-left: 12.5%;
}
.pear-col-md-offset4 {
margin-left: 16.66%;
}
.pear-col-md-offset5 {
margin-left: 20.83%;
}
.pear-col-md-offset6 {
margin-left: 25%;
}
.pear-col-md-offset7 {
margin-left: 29.16%;
}
.pear-col-md-offset8 {
margin-left: 33.33%;
}
.pear-col-md-offset9 {
margin-left: 37.5%;
}
.pear-col-md-offset10 {
margin-left: 41.66%;
}
.pear-col-md-offset11 {
margin-left: 45.83%;
}
.pear-col-md-offset12 {
margin-left: 50%;
}
.pear-col-md-offset13 {
margin-left: 54.16%;
}
.pear-col-md-offset14 {
margin-left: 58.33%;
}
.pear-col-md-offset15 {
margin-left: 62.5%;
}
.pear-col-md-offset16 {
margin-left: 66.66%;
}
.pear-col-md-offset17 {
margin-left: 70.83%;
}
.pear-col-md-offset18 {
margin-left: 75%;
}
.pear-col-md-offset19 {
margin-left: 79.16%;
}
.pear-col-md-offset20 {
margin-left: 83.33%;
}
.pear-col-md-offset21 {
margin-left: 87.5%;
}
.pear-col-md-offset22 {
margin-left: 91.66%;
}
.pear-col-md-offset23 {
margin-left: 95.83%;
}
.pear-col-md-offset24 {
margin-left: 100%;
}
@media all and (max-width:768px) {
.pear-col-xs1 {
width: 4.16%;
}
.pear-col-xs2 {
width: 8.33%;
}
.pear-col-xs3 {
width: 12.5%;
}
.pear-col-xs4 {
width: 16.66%;
}
.pear-col-xs5 {
width: 20.83%;
}
.pear-col-xs6 {
width: 25%;
}
.pear-col-xs7 {
width: 29.16%;
}
.pear-col-xs8 {
width: 33.33%;
}
.pear-col-xs9 {
width: 37.5%;
}
.pear-col-xs10 {
width: 41.66%;
}
.pear-col-xs11 {
width: 45.83%;
}
.pear-col-xs12 {
width: 50%;
}
.pear-col-xs13 {
width: 54.16%;
}
.pear-col-xs14 {
width: 58.33%;
}
.pear-col-xs15 {
width: 62.5%;
}
.pear-col-xs16 {
width: 66.66%;
}
.pear-col-xs17 {
width: 70.83%;
}
.pear-col-xs18 {
width: 75%;
}
.pear-col-xs19 {
width: 79.16%;
}
.pear-col-xs20 {
width: 83.33%;
}
.pear-col-xs21 {
width: 87.5%;
}
.pear-col-xs22 {
width: 91.66%;
}
.pear-col-xs23 {
width: 95.83%;
}
.pear-col-xs24 {
width: 100%;
}
.pear-col-xs-offset1 {
margin-left: 4.16%;
}
.pear-col-xs-offset2 {
margin-left: 8.33%;
}
.pear-col-xs-offset3 {
margin-left: 12.5%;
}
.pear-col-xs-offset4 {
margin-left: 16.66%;
}
.pear-col-xs-offset5 {
margin-left: 20.83%;
}
.pear-col-xs-offset6 {
margin-left: 25%;
}
.pear-col-xs-offset7 {
margin-left: 29.16%;
}
.pear-col-xs-offset8 {
margin-left: 33.33%;
}
.pear-col-xs-offset9 {
margin-left: 37.5%;
}
.pear-col-xs-offset10 {
margin-left: 41.66%;
}
.pear-col-xs-offset11 {
margin-left: 45.83%;
}
.pear-col-xs-offset12 {
margin-left: 50%;
}
.pear-col-xs-offset13 {
margin-left: 54.16%;
}
.pear-col-xs-offset14 {
margin-left: 58.33%;
}
.pear-col-xs-offset15 {
margin-left: 62.5%;
}
.pear-col-xs-offset16 {
margin-left: 66.66%;
}
.pear-col-xs-offset17 {
margin-left: 70.83%;
}
.pear-col-xs-offset18 {
margin-left: 75%;
}
.pear-col-xs-offset19 {
margin-left: 79.16%;
}
.pear-col-xs-offset20 {
margin-left: 83.33%;
}
.pear-col-xs-offset21 {
margin-left: 87.5%;
}
.pear-col-xs-offset22 {
margin-left: 91.66%;
}
.pear-col-xs-offset23 {
margin-left: 95.83%;
}
.pear-col-xs-offset24 {
margin-left: 100%;
}
}
@media all and (min-width:768px) and (max-width:992px) {
.pear-col-sm1 {
width: 4.16%;
}
.pear-col-sm2 {
width: 8.33%;
}
.pear-col-sm3 {
width: 12.5%;
}
.pear-col-sm4 {
width: 16.66%;
}
.pear-col-sm5 {
width: 20.83%;
}
.pear-col-sm6 {
width: 25%;
}
.pear-col-sm7 {
width: 29.16%;
}
.pear-col-sm8 {
width: 33.33%;
}
.pear-col-sm9 {
width: 37.5%;
}
.pear-col-sm10 {
width: 41.66%;
}
.pear-col-sm11 {
width: 45.83%;
}
.pear-col-sm12 {
width: 50%;
}
.pear-col-sm13 {
width: 54.16%;
}
.pear-col-sm14 {
width: 58.33%;
}
.pear-col-sm15 {
width: 62.5%;
}
.pear-col-sm16 {
width: 66.66%;
}
.pear-col-sm17 {
width: 70.83%;
}
.pear-col-sm18 {
width: 75%;
}
.pear-col-sm19 {
width: 79.16%;
}
.pear-col-sm20 {
width: 83.33%;
}
.pear-col-sm21 {
width: 87.5%;
}
.pear-col-sm22 {
width: 91.66%;
}
.pear-col-sm23 {
width: 95.83%;
}
.pear-col-sm24 {
width: 100%;
}
.pear-col-sm-offset1 {
margin-left: 4.16%;
}
.pear-col-sm-offset2 {
margin-left: 8.33%;
}
.pear-col-sm-offset3 {
margin-left: 12.5%;
}
.pear-col-sm-offset4 {
margin-left: 16.66%;
}
.pear-col-sm-offset5 {
margin-left: 20.83%;
}
.pear-col-sm-offset6 {
margin-left: 25%;
}
.pear-col-sm-offset7 {
margin-left: 29.16%;
}
.pear-col-sm-offset8 {
margin-left: 33.33%;
}
.pear-col-sm-offset9 {
margin-left: 37.5%;
}
.pear-col-sm-offset10 {
margin-left: 41.66%;
}
.pear-col-sm-offset11 {
margin-left: 45.83%;
}
.pear-col-sm-offset12 {
margin-left: 50%;
}
.pear-col-sm-offset13 {
margin-left: 54.16%;
}
.pear-col-sm-offset14 {
margin-left: 58.33%;
}
.pear-col-sm-offset15 {
margin-left: 62.5%;
}
.pear-col-sm-offset16 {
margin-left: 66.66%;
}
.pear-col-sm-offset17 {
margin-left: 70.83%;
}
.pear-col-sm-offset18 {
margin-left: 75%;
}
.pear-col-sm-offset19 {
margin-left: 79.16%;
}
.pear-col-sm-offset20 {
margin-left: 83.33%;
}
.pear-col-sm-offset21 {
margin-left: 87.5%;
}
.pear-col-sm-offset22 {
margin-left: 91.66%;
}
.pear-col-sm-offset23 {
margin-left: 95.83%;
}
.pear-col-sm-offset24 {
margin-left: 100%;
}
}
@media all and (min-width:1200px) {
.pear-col-lg1 {
width: 4.16%;
}
.pear-col-lg2 {
width: 8.33%;
}
.pear-col-lg3 {
width: 12.5%;
}
.pear-col-lg4 {
width: 16.66%;
}
.pear-col-lg5 {
width: 20.83%;
}
.pear-col-lg6 {
width: 25%;
}
.pear-col-lg7 {
width: 29.16%;
}
.pear-col-lg8 {
width: 33.33%;
}
.pear-col-lg9 {
width: 37.5%;
}
.pear-col-lg10 {
width: 41.66%;
}
.pear-col-lg11 {
width: 45.83%;
}
.pear-col-lg12 {
width: 50%;
}
.pear-col-lg13 {
width: 54.16%;
}
.pear-col-lg14 {
width: 58.33%;
}
.pear-col-lg15 {
width: 62.5%;
}
.pear-col-lg16 {
width: 66.66%;
}
.pear-col-lg17 {
width: 70.83%;
}
.pear-col-lg18 {
width: 75%;
}
.pear-col-lg19 {
width: 79.16%;
}
.pear-col-lg20 {
width: 83.33%;
}
.pear-col-lg21 {
width: 87.5%;
}
.pear-col-lg22 {
width: 91.66%;
}
.pear-col-lg23 {
width: 95.83%;
}
.pear-col-lg24 {
width: 100%;
}
.pear-col-lg-offset1 {
margin-left: 4.16%;
}
.pear-col-lg-offset2 {
margin-left: 8.33%;
}
.pear-col-lg-offset3 {
margin-left: 12.5%;
}
.pear-col-lg-offset4 {
margin-left: 16.66%;
}
.pear-col-lg-offset5 {
margin-left: 20.83%;
}
.pear-col-lg-offset6 {
margin-left: 25%;
}
.pear-col-lg-offset7 {
margin-left: 29.16%;
}
.pear-col-lg-offset8 {
margin-left: 33.33%;
}
.pear-col-lg-offset9 {
margin-left: 37.5%;
}
.pear-col-lg-offset10 {
margin-left: 41.66%;
}
.pear-col-lg-offset11 {
margin-left: 45.83%;
}
.pear-col-lg-offset12 {
margin-left: 50%;
}
.pear-col-lg-offset13 {
margin-left: 54.16%;
}
.pear-col-lg-offset14 {
margin-left: 58.33%;
}
.pear-col-lg-offset15 {
margin-left: 62.5%;
}
.pear-col-lg-offset16 {
margin-left: 66.66%;
}
.pear-col-lg-offset17 {
margin-left: 70.83%;
}
.pear-col-lg-offset18 {
margin-left: 75%;
}
.pear-col-lg-offset19 {
margin-left: 79.16%;
}
.pear-col-lg-offset20 {
margin-left: 83.33%;
}
.pear-col-lg-offset21 {
margin-left: 87.5%;
}
.pear-col-lg-offset22 {
margin-left: 91.66%;
}
.pear-col-lg-offset23 {
margin-left: 95.83%;
}
.pear-col-lg-offset24 {
margin-left: 100%;
}
}
.pear-col-space1 {
margin: -.5px
}
.pear-col-space1>* {
padding: .5px
}
.pear-col-space2 {
margin: -1px
}
.pear-col-space2>* {
padding: 1px
}
.pear-col-space4 {
margin: -2px
}
.pear-col-space4>* {
padding: 2px
}
.pear-col-space5 {
margin: -2.5px
}
.pear-col-space5>* {
padding: 2.5px
}
.pear-col-space6 {
margin: -3px
}
.pear-col-space6>* {
padding: 3px
}
.pear-col-space8 {
margin: -4px
}
.pear-col-space8>* {
padding: 4px
}
.pear-col-space10 {
margin: -5px
}
.pear-col-space10>* {
padding: 5px
}
.pear-col-space12 {
margin: -6px
}
.pear-col-space12>* {
padding: 6px
}
.pear-col-space14 {
margin: -7px
}
.pear-col-space14>* {
padding: 7px
}
.pear-col-space15 {
margin: -7.5px
}
.pear-col-space15>* {
padding: 7.5px
}
.pear-col-space16 {
margin: -8px
}
.pear-col-space16>* {
padding: 8px
}
.pear-col-space18 {
margin: -9px
}
.pear-col-space18>* {
padding: 9px
}
.pear-col-space20 {
margin: -10px
}
.pear-col-space20>* {
padding: 10px
}
.pear-col-space22 {
margin: -11px
}
.pear-col-space22>* {
padding: 11px
}
.pear-col-space24 {
margin: -12px
}
.pear-col-space24>* {
padding: 12px
}
.pear-col-space25 {
margin: -12.5px
}
.pear-col-space25>* {
padding: 12.5px
}
.pear-col-space26 {
margin: -13px
}
.pear-col-space26>* {
padding: 13px
}
.pear-col-space28 {
margin: -14px
}
.pear-col-space28>* {
padding: 14px
}
.pear-col-space30 {
margin: -15px
}
.pear-col-space30>* {
padding: 15px
}
@@ -1,7 +1,5 @@
.pear-container {
margin: 10px;
background-color: whitesmoke;
width: calc(100vw - 20px);
}
body::-webkit-scrollbar {
@@ -16,7 +16,7 @@
line-height: 48px;
}
.pear-nav-tree .layui-nav-item>a .layui-nav-more {
.pear-nav-tree .layui-nav-item>a .layui-nav-more {
padding: 0px;
}
@@ -24,7 +24,8 @@
width: 0px;
height: 0px;
}
.pear-side-scroll{
.pear-side-scroll {
width: 230px;
}
@@ -33,7 +34,7 @@
.layui-nav-tree .layui-this,
.layui-nav-tree .layui-this>a,
.layui-nav-tree .layui-this>a:hover {
background-color: #5FB878;
background-color: var(--global-primary-color);
}
.pear-nav-tree .toast {
@@ -100,7 +101,7 @@
font-size: 14px;
}
.pear-nav-control.pc li{
.pear-nav-control.pc li {
display: inline-block;
}
@@ -112,15 +113,15 @@
background-color: whitesmoke;
}
.pear-nav-control.pc *{
color: darkslategray!important;
.pear-nav-control.pc * {
color: darkslategray !important;
}
.pear-nav-control.pc .layui-nav-bar{
display: none!important;
.pear-nav-control.pc .layui-nav-bar {
display: none !important;
}
.pear-nav-control .layui-nav-child{
.pear-nav-control .layui-nav-child {
border: 1px solid whitesmoke;
border-radius: 6px;
width: 150px;
@@ -134,6 +135,7 @@
display: block !important;
background: transparent !important;
}
.pear-nav-tree .layui-nav-hover:before {
content: '';
position: absolute;
@@ -147,66 +149,73 @@
display: block;
box-shadow: 0px 0px 3px lightgray;
}
.pear-nav-tree .layui-nav-hover a span {
display: inline-block !important;
}
.pear-nav-tree .layui-nav-hover a i {
display: none;
}
.pear-nav-tree .layui-nav-child dd a span {
margin-left: 26px !important;
}
.pear-nav-tree .layui-nav-child dd a i {
display: none;
}
.pear-nav-tree .layui-nav-hover dd a span {
margin-left: 0px !important;
}
.pear-nav-tree dl {
padding-top: 0;
padding-bottom: 0;
}
/** 亮 样 式*/
.dark-theme .layui-nav-tree{
background-color: #28333E!important;
.dark-theme .layui-nav-tree {
background-color: #28333E !important;
}
.light-theme{
background-color: white!important;
.light-theme {
background-color: white !important;
}
.light-theme .pear-nav-tree,
.light-theme .pear-nav-tree .layui-nav-hover:before,
.light-theme .pear-nav-tree .layui-nav-child{
background-color: white!important;
.light-theme .pear-nav-tree .layui-nav-child {
background-color: white !important;
}
.light-theme .pear-nav-tree a,
.light-theme .pear-nav-tree .layui-nav-more{
color: dimgray!important;
.light-theme .pear-nav-tree .layui-nav-more {
color: dimgray !important;
border-top-color: dimgray;
}
.light-theme .pear-nav-tree .layui-nav-itemed>a>.layui-nav-more{
border-top-color: white!important;
border-bottom-color: dimgray!important;
.light-theme .pear-nav-tree .layui-nav-itemed>a>.layui-nav-more {
border-top-color: white !important;
border-bottom-color: dimgray !important;
}
.light-theme .pear-nav-tree .layui-this a,
.light-theme .pear-nav-tree .layui-this{
color: white!important;
background-color: #5FB878!important;
.light-theme .pear-nav-tree .layui-this {
color: white !important;
background-color: var(--global-primary-color) !important;
}
.light-theme .pear-nav-tree .layui-this a:hover{
background-color: #5FB878!important;
.light-theme .pear-nav-tree .layui-this a:hover {
background-color: var(--global-primary-color) !important;
}
.light-theme .pear-nav-tree .layui-nav-bar{
.light-theme .pear-nav-tree .layui-nav-bar {
display: none;
}
/** 下 拉 图 标 */
@@ -247,6 +256,7 @@
width: 12px;
text-align: center;
}
.pear-nav-tree.arrow .layui-nav-child.layui-nav-hover>dd>a>.layui-nav-more {
display: inline-block !important;
transform: rotate(270deg);
@@ -264,4 +274,4 @@
content: '\e61a';
display: inline-block;
vertical-align: middle;
}
}
@@ -0,0 +1,90 @@
/* 搜索面板 */
.menu-search-content .layui-input {
padding-left: 30px;
}
.menu-search-content .layui-input:focus {
border: 1px solid var(--global-primary-color)!important;
box-shadow: none;
}
.menu-search-content {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.menu-search-input-wrapper {
width: 100%;
padding: 15px 15px;
}
.menu-search-no-data {
display: flex;
justify-content: center;
width: 100%;
height: 122px;
align-items: center;
}
.menu-search-list {
width: 100%;
padding: 5px 15px;
}
.menu-search-list li {
position: relative;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: nowrap;
height: 50px;
margin-bottom: 8px;
padding: 0px 10px;
color: currentColor;
font-size: 14px;
border-radius: 4px;
box-shadow: 0 1px 3px #d4d9e1;
cursor: pointer;
background-color: #fff;
}
.menu-search-list li.this,
.menu-search-list li:hover {
background-color: var(--global-primary-color);
color: white;
}
.menu-search-tips {
margin-bottom: 15px;
padding: 0 15px;
width: 100%
}
.menu-search-tips>div {
display: flex;
align-items: center;
justify-content: flex-end;
font-size: 12px;
}
.menu-search-tips .mr-1 {
margin-right: 4px;
}
.menu-search-tips .mr-5 {
margin-right: 20px;
}
.menu-search-tips .w-5 {
width: 14px;
}
.menu-search-tips kbd {
line-height: 1.5;
border: 1px solid #e5e7eb;
font-size: 10px;
text-align: center;
padding: 2px 6px;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;
border-radius: 5px;
}
@@ -0,0 +1,39 @@
.pear-message-center {
width: 360px;
height: 100%;
}
.pear-message-center .layui-tab .layui-tab-title{
display: flex;
}
.pear-message-center .layui-tab .layui-tab-title .layui-this::after {
display: none;
}
.pear-message-center .layui-tab .layui-tab-title li {
flex: 1;
}
.pear-message-center .message-item img {
margin-left: 8px;
width: 33px !important;
height: 33px !important;
border-radius: 50px;
margin-right: 15px;
}
.pear-message-center .message-item {
height: 64px !important;
line-height: 45px !important;
padding-right: 20px;
padding-left: 20px;
border-bottom: 1px solid whitesmoke;
padding-top: 10px;
padding-bottom: 15px;
}
.pear-message-center .message-item .extra {
float: right;
right: 10px;
}
@@ -4,7 +4,7 @@
}
#nprogress .bar {
background: #29d;
background: var(--global-primary-color);
position: fixed;
z-index: 999999;
@@ -22,7 +22,7 @@
right: 0px;
width: 100px;
height: 100%;
box-shadow: 0 0 10px #29d, 0 0 5px #29d;
box-shadow: 0 0 10px var(--global-primary-color), 0 0 5px var(--global-primary-color);
opacity: 1.0;
-webkit-transform: rotate(3deg) translate(0px, -4px);
@@ -45,8 +45,8 @@
box-sizing: border-box;
border: solid 2px transparent;
border-top-color: #29d;
border-left-color: #29d;
border-top-color: var(--global-primary-color);
border-left-color: var(--global-primary-color);
border-radius: 50%;
-webkit-animation: nprogress-spinner 400ms linear infinite;
@@ -0,0 +1,154 @@
.pear-page {
width: 100%;
position: relative;
overflow-y: auto;
height: 100%;
}
.pear-page .dot {
width: 5px;
height: 24px;
background-color: #5FB878;
margin-top: 8px;
margin-left: 15px;
border-radius: 2px;
display: inline-block;
}
.pear-page .pear-page-title {
height: 40px;
line-height: 40px;
background-color: white;
border: whitesmoke 1px solid;
}
.pear-page .pear-page-content,
.pear-page .pear-page-content iframe {
width: 100%;
height: calc(100% - 0px) !important;
}
.pear-page .pear-page-content iframe {
height: calc(100% - 4px) !important;
}
.pear-page-loading {
position: absolute;
display: none;
width: 100%;
height: calc(100% - 0px) !important;
background-color: #fff;
top: 0px;
z-index: 19;
}
.pear-page-loading.close {
animation: close 1s;
-webkit-animation: close 1s;
animation-fill-mode: forwards;
}
.ball-loader {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%)
}
.ball-loader>span,
.signal-loader>span {
background-color: #4aca85;
display: inline-block
}
.ball-loader>span:nth-child(1),
.ball-loader.sm>span:nth-child(1),
.signal-loader>span:nth-child(1),
.signal-loader.sm>span:nth-child(1) {
-webkit-animation-delay: 0s;
animation-delay: 0s
}
.ball-loader>span:nth-child(2),
.ball-loader.sm>span:nth-child(2),
.signal-loader>span:nth-child(2),
.signal-loader.sm>span:nth-child(2) {
-webkit-animation-delay: .1s;
animation-delay: .1s
}
.ball-loader>span:nth-child(3),
.ball-loader.sm>span:nth-child(3),
.signal-loader>span:nth-child(3),
.signal-loader.sm>span:nth-child(3) {
-webkit-animation-delay: .15s;
animation-delay: .15s
}
.ball-loader>span:nth-child(4),
.ball-loader.sm>span:nth-child(4),
.signal-loader>span:nth-child(4),
.signal-loader.sm>span:nth-child(4) {
-webkit-animation-delay: .2s;
animation-delay: .2s
}
.ball-loader>span {
width: 20px;
height: 20px;
margin: 0 3px;
border-radius: 50%;
transform: scale(0);
-ms-transform: scale(0);
-webkit-transform: scale(0);
animation: ball-load 1s ease-in-out infinite;
-webkit-animation: 1s ball-load ease-in-out infinite
}
@-webkit-keyframes ball-load {
0% {
transform: scale(0);
-webkit-transform: scale(0)
}
50% {
transform: scale(1);
-webkit-transform: scale(1)
}
100% {
transform: scale(0);
-webkit-transform: scale(0)
}
}
@keyframes ball-load {
0% {
transform: scale(0);
-webkit-transform: scale(0)
}
50% {
transform: scale(1);
-webkit-transform: scale(1)
}
100% {
transform: scale(0);
-webkit-transform: scale(0)
}
}
@-webkit-keyframes close {
0% {
opacity: 1;
/*display: block;*/
}
100% {
opacity: 0;
/*display: none;*/
}
}
@@ -0,0 +1,314 @@
.pear-tab-page {
margin: 0px;
overflow: hidden;
height: 100% !important;
}
.pear-tab-page .layui-tab-content {
height: calc(100% - 42px) !important;
}
.pear-tab-page .layui-tab-content .layui-tab-item {
overflow-y: auto;
height: 100%;
}
.pear-tab-page-menu{
box-shadow: none;
border-radius: 4px!important;
overflow: hidden;
box-shadow: 2px 0 6px rgba(0, 21, 41, .10);
}
.pear-tab-page-menu .item{
height: 20px;
padding-left: 18px;
padding-top: 7px;
padding-bottom: 7px;
color: #333;
font-size: 13.5px;
line-height: 20px;
cursor:pointer;
}
.pear-tab-page-menu .item:hover{
background: var(--global-primary-color);
color: white;
}
.pear-tab-page .layui-tab-content {
padding: 0px;
}
.pear-tab-page > .layui-tab-title {
border: none;
border: 1px solid whitesmoke;
background-color: white;
}
.pear-tab-page > .layui-tab-title li {
border-right: 1px solid whitesmoke;
color: dimgray;
font-size: 13.5px;
}
.pear-tab-page > .layui-tab-title .layui-tab-bar {
display: none;
}
.pear-tab-page .layui-nav-more {
display: none;
}
.pear-tab-page > .layui-tab-title .layui-this:after {
display: none;
}
.pear-tab-page > .layui-tab-title .pear-tab-page-active {
display: inline-block;
background-color: lightgray;
width: 8px;
height: 8px;
border-radius: 30px;
margin-right: 12px;
}
.pear-tab-page > .layui-tab-title .layui-this .pear-tab-page-active {
background-color: var(--global-primary-color) !important;
}
.pear-tab-page > .layui-tab-title .layui-tab-close:hover {
background-color: white;
line-height: 19px;
color: gray;
}
.pear-tab-page > .layui-tab-title .disable-close+.layui-tab-close {
display: none;
}
.pear-tab-page > .layui-tab-title .able-close+.layui-tab-close {
display: inline-block;
}
.pear-tab-page .layui-tab-close{
font-size: 13px;
}
.pear-tab-page .layui-tab-control>li {
position: absolute;
top: 0px;
height: 40px;
line-height: 40px;
width: 40px;
background-color: white;
border-top: whitesmoke 1px solid;
border-bottom: whitesmoke 1px solid;
text-align: center;
}
.pear-tab-page .layui-tab-prev {
left: 0px;
border-right: whitesmoke 1px solid;
}
.pear-tab-page .layui-tab-next {
right: 40px;
border-left: 1px solid whitesmoke;
}
.pear-tab-page .layui-tab-tool {
right: 0px;
border-left: 1px solid whitesmoke;
}
.pear-tab-page .layui-tab-control .layui-tab-tool,
.pear-tab-page .layui-tab-control .layui-tab-prev,
.pear-tab-page .layui-tab-control .layui-tab-next {
display: none;
}
.pear-tab-page.layui-tab-roll .layui-tab-control .layui-tab-prev,
.pear-tab-page.layui-tab-roll .layui-tab-control .layui-tab-next {
display: block;
}
.pear-tab-page.layui-tab-roll .layui-tab-control .layui-tab-next {
right: 0px;
border-right: 1px solid whitesmoke;
}
.pear-tab-page.layui-tab-roll .layui-tab-title {
padding-left: 40px;
padding-right: 40px;
}
.pear-tab-page.layui-tab-tool .layui-tab-control .layui-tab-tool {
display: block;
}
.pear-tab-page.layui-tab-tool .layui-tab-title {
padding-left: 0px;
padding-right: 40px;
}
.pear-tab-page.layui-tab-rollTool > .layui-tab-title {
padding-left: 40px;
padding-right: 80px;
}
.pear-tab-page.layui-tab-rollTool .layui-tab-control .layui-tab-prev,
.pear-tab-page.layui-tab-rollTool .layui-tab-control .layui-tab-next,
.pear-tab-page.layui-tab-rollTool .layui-tab-control .layui-tab-tool {
display: block;
}
.pear-tab-page .layui-tab-tool .layui-nav {
position: absolute;
height: 43px !important;
top: 0;
width: 100%;
height: 100%;
padding: 0;
background: 0 0;
}
.pear-tab-page .layui-tab-tool .layui-nav-item {
height: 40px;
}
.pear-tab-page .layui-tab-tool .layui-nav-bar {
display: none;
}
.pear-tab-page .layui-tab-tool .layui-nav-child {
left: auto;
top: 45px;
right: 3px;
width: 120px;
border: 1px solid whitesmoke;
}
.pear-tab-page .layui-tab-tool .layui-this a {
background-color: #009688;
}
.pear-tab-page-loading {
position: absolute;
display: none;
width: 100%;
height: calc(100% - 42px);
top: 42px;
z-index: 19;
background-color: #fff
}
.pear-tab-page-loading.close {
animation: close 1s;
-webkit-animation: close 1s;
animation-fill-mode: forwards;
}
.ball-loader {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%)
}
.ball-loader>span,
.signal-loader>span {
background-color: var(--global-primary-color) !important;
display: inline-block
}
.ball-loader>span:nth-child(1),
.ball-loader.sm>span:nth-child(1),
.signal-loader>span:nth-child(1),
.signal-loader.sm>span:nth-child(1) {
-webkit-animation-delay: 0s;
animation-delay: 0s
}
.ball-loader>span:nth-child(2),
.ball-loader.sm>span:nth-child(2),
.signal-loader>span:nth-child(2),
.signal-loader.sm>span:nth-child(2) {
-webkit-animation-delay: .1s;
animation-delay: .1s
}
.ball-loader>span:nth-child(3),
.ball-loader.sm>span:nth-child(3),
.signal-loader>span:nth-child(3),
.signal-loader.sm>span:nth-child(3) {
-webkit-animation-delay: .15s;
animation-delay: .15s
}
.ball-loader>span:nth-child(4),
.ball-loader.sm>span:nth-child(4),
.signal-loader>span:nth-child(4),
.signal-loader.sm>span:nth-child(4) {
-webkit-animation-delay: .2s;
animation-delay: .2s
}
.ball-loader>span {
width: 20px;
height: 20px;
margin: 0 3px;
border-radius: 50%;
transform: scale(0);
-ms-transform: scale(0);
-webkit-transform: scale(0);
animation: ball-load 1s ease-in-out infinite;
-webkit-animation: 1s ball-load ease-in-out infinite
}
@-webkit-keyframes ball-load {
0% {
transform: scale(0);
-webkit-transform: scale(0)
}
50% {
transform: scale(1);
-webkit-transform: scale(1)
}
100% {
transform: scale(0);
-webkit-transform: scale(0)
}
}
@keyframes ball-load {
0% {
transform: scale(0);
-webkit-transform: scale(0)
}
50% {
transform: scale(1);
-webkit-transform: scale(1)
}
100% {
transform: scale(0);
-webkit-transform: scale(0)
}
}
@-webkit-keyframes close {
0% {
opacity: 1;
/*display: block;*/
}
100% {
opacity: 0;
/*display: none;*/
}
}
+11 -24
View File
@@ -1,30 +1,17 @@
/* Pear Admin layui */
@import url("../../layui/css/layui.css");
@import url("../font/iconfont.css");
@import url("module/nprogress.css");
@import url("module/messageCenter.css");
@import url("module/global.css");
@import url("module/menu.css");
@import url("module/menuSearch.css");
@import url("module/page.css");
@import url("module/tabPage.css");
@import url("module/toast.css");
/* Pear Admin Flask */
@import url("module/dtree/font/dtreefont.css");
@import url("module/dtree/dtree.css");
@import url("module/iconPicker.css");
@import url("module/treetable.css");
@import url("module/nprogress.css");
@import url("module/message.css");
@import url("module/cropper.css");
@import url("module/loading.css");
@import url("module/topBar.css");
@import url("module/select.css");
@import url("module/layout.css");
@import url("module/notice.css");
@import url("module/button.css");
@import url("module/table.css");
@import url("module/frame.css");
@import url("module/layer.css");
@import url("module/toast.css");
@import url("module/menu.css");
@import url("module/form.css");
@import url("module/link.css");
@import url("module/code.css");
@import url("module/step.css");
@import url("module/card.css");
@import url("module/tab.css");
@import url("module/tag.css");
@import url("module/fullscreen.css");
@import url("module/popover.min.css");
@import url("module/layout.css");
File diff suppressed because it is too large Load Diff
+32 -26
View File
@@ -1,53 +1,59 @@
layui.define(['jquery'], function(exports) {
layui.define(['jquery'], function (exports) {
"use strict";
/**
* @since Pear Admin 4.0
*
* Button component
* */
var MOD_NAME = 'button',
$ = layui.jquery;
var button = function(opt) {
var button = function (opt) {
this.option = opt;
};
/**
/**
* @since Pear Admin 4.0
*
* Button start loading
* */
button.prototype.load = function(opt) {
var option = {
button.prototype.load = function (opt) {
var options = {
elem: opt.elem,
time: opt.time ? opt.time : false,
done: opt.done ? opt.done : function(){}
done: opt.done ? opt.done : function () { }
}
var text = $(option.elem).html();
$(option.elem).html("<i class='layui-anim layui-anim-rotate layui-icon layui-anim-loop layui-icon-loading'/>");
$(option.elem).attr("disabled", "disabled");
var buttons = $(option.elem);
if (option.time != "" || option.time !=false) {
setTimeout(function() {
$(option.elem).attr("disabled", false);
buttons.html(text);
option.done();
}, option.time);
var text = $(options.elem).html();
$(options.elem).html("<i class='layui-anim layui-anim-rotate layui-icon layui-anim-loop layui-icon-loading'/>");
$(options.elem).attr("disabled", "disabled");
var $button = $(options.elem);
if (options.time != "" || options.time != false) {
setTimeout(function () {
$button.attr("disabled", false);
$button.html(text);
options.done();
}, options.time);
}
option.text = text;
return new button(option);
options.text = text;
return new button(options);
}
/**
* @since Pear Admin 4.0
*
* Button stop loaded
* */
button.prototype.stop = function(success) {
button.prototype.stop = function (success) {
$(this.option.elem).attr("disabled", false);
$(this.option.elem).html(this.option.text);
success && success();
}
}
exports(MOD_NAME, new button());
});
@@ -0,0 +1,37 @@
layui.define(['jquery', 'element'], function(exports) {
"use strict";
var MOD_NAME = 'count',
$ = layui.jquery,
element = layui.element;
var count = new function() {
this.up = function(targetEle, options) {
options = options || {};
var $this = document.getElementById(targetEle),
time = options.time,
finalNum = options.num,
regulator = options.regulator,
step = finalNum / (time / regulator),
count = 0.00,
initial = 0;
var timer = setInterval(function() {
count = count + step;
if (count >= finalNum) {
clearInterval(timer);
count = finalNum;
}
var t = count.toFixed(options.bit?options.bit:0);;
if (t == initial) return;
initial = t;
$this.innerHTML = initial;
}, 30);
}
}
exports(MOD_NAME, count);
});
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,450 @@
layui.define(function (exports) {
exports('echartsTheme',
{
"color": [
"#3fb1e3",
"#6be6c1",
"#626c91",
"#a0a7e6",
"#c4ebad",
"#96dee8"
],
"backgroundColor": "rgba(252,252,252,0)",
"textStyle": {},
"title": {
"textStyle": {
"color": "#666666"
},
"subtextStyle": {
"color": "#999999"
}
},
"line": {
"itemStyle": {
"borderWidth": "3"
},
"lineStyle": {
"width": "4"
},
"symbolSize": "10",
"symbol": "emptyCircle",
"smooth": true
},
"radar": {
"itemStyle": {
"borderWidth": "3"
},
"lineStyle": {
"width": "4"
},
"symbolSize": "10",
"symbol": "emptyCircle",
"smooth": true
},
"bar": {
"itemStyle": {
"barBorderWidth": 0,
"barBorderColor": "#ccc"
},
"emphasis": {
"itemStyle": {
"barBorderWidth": 0,
"barBorderColor": "#ccc"
}
}
},
"pie": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"scatter": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"boxplot": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"parallel": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"sankey": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"funnel": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"gauge": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"candlestick": {
"itemStyle": {
"color": "#e6a0d2",
"color0": "transparent",
"borderColor": "#e6a0d2",
"borderColor0": "#3fb1e3",
"borderWidth": "2"
}
},
"graph": {
"itemStyle": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"lineStyle": {
"width": "1",
"color": "#cccccc"
},
"symbolSize": "10",
"symbol": "emptyCircle",
"smooth": true,
"color": [
"#3fb1e3",
"#6be6c1",
"#626c91",
"#a0a7e6",
"#c4ebad",
"#96dee8"
],
"label": {
"color": "#ffffff"
}
},
"map": {
"itemStyle": {
"areaColor": "#eeeeee",
"borderColor": "#aaaaaa",
"borderWidth": 0.5
},
"label": {
"color": "#ffffff"
},
"emphasis": {
"itemStyle": {
"areaColor": "rgba(63,177,227,0.25)",
"borderColor": "#3fb1e3",
"borderWidth": 1
},
"label": {
"color": "rgb(63,177,227)"
}
}
},
"geo": {
"itemStyle": {
"areaColor": "#eeeeee",
"borderColor": "#aaaaaa",
"borderWidth": 0.5
},
"label": {
"color": "#ffffff"
},
"emphasis": {
"itemStyle": {
"areaColor": "rgba(63,177,227,0.25)",
"borderColor": "#3fb1e3",
"borderWidth": 1
},
"label": {
"color": "rgb(63,177,227)"
}
}
},
"categoryAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#cccccc"
}
},
"axisTick": {
"show": false,
"lineStyle": {
"color": "#333"
}
},
"axisLabel": {
"show": true,
"color": "#999999"
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#eeeeee"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.05)",
"rgba(200,200,200,0.02)"
]
}
}
},
"valueAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#cccccc"
}
},
"axisTick": {
"show": false,
"lineStyle": {
"color": "#333"
}
},
"axisLabel": {
"show": true,
"color": "#999999"
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#eeeeee"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.05)",
"rgba(200,200,200,0.02)"
]
}
}
},
"logAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#cccccc"
}
},
"axisTick": {
"show": false,
"lineStyle": {
"color": "#333"
}
},
"axisLabel": {
"show": true,
"color": "#999999"
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#eeeeee"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.05)",
"rgba(200,200,200,0.02)"
]
}
}
},
"timeAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#cccccc"
}
},
"axisTick": {
"show": false,
"lineStyle": {
"color": "#333"
}
},
"axisLabel": {
"show": true,
"color": "#999999"
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#eeeeee"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.05)",
"rgba(200,200,200,0.02)"
]
}
}
},
"toolbox": {
"iconStyle": {
"borderColor": "#999999"
},
"emphasis": {
"iconStyle": {
"borderColor": "#666666"
}
}
},
"legend": {
"textStyle": {
"color": "#999999"
}
},
"tooltip": {
"axisPointer": {
"lineStyle": {
"color": "#cccccc",
"width": 1
},
"crossStyle": {
"color": "#cccccc",
"width": 1
}
}
},
"timeline": {
"lineStyle": {
"color": "#626c91",
"width": 1
},
"itemStyle": {
"color": "#626c91",
"borderWidth": 1
},
"controlStyle": {
"color": "#626c91",
"borderColor": "#626c91",
"borderWidth": 0.5
},
"checkpointStyle": {
"color": "#3fb1e3",
"borderColor": "rgba(63,177,227,0.15)"
},
"label": {
"color": "#626c91"
},
"emphasis": {
"itemStyle": {
"color": "#626c91"
},
"controlStyle": {
"color": "#626c91",
"borderColor": "#626c91",
"borderWidth": 0.5
},
"label": {
"color": "#626c91"
}
}
},
"visualMap": {
"color": [
"#2a99c9",
"#afe8ff"
]
},
"dataZoom": {
"backgroundColor": "rgba(255,255,255,0)",
"dataBackgroundColor": "rgba(222,222,222,1)",
"fillerColor": "rgba(114,230,212,0.25)",
"handleColor": "#cccccc",
"handleSize": "100%",
"textStyle": {
"color": "#999999"
}
},
"markPoint": {
"label": {
"color": "#ffffff"
},
"emphasis": {
"label": {
"color": "#ffffff"
}
}
}
});
});
@@ -0,0 +1,503 @@
/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
* @license MIT */
;(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(factory);
} else if (typeof exports === 'object') {
module.exports = factory();
} else {
root.NProgress = factory();
}
})(this, function() {
var NProgress = {};
NProgress.version = '0.2.0';
var Settings = NProgress.settings = {
minimum: 0.08,
easing: 'linear',
positionUsing: '',
speed: 200,
trickle: true,
trickleSpeed: 200,
showSpinner: true,
barSelector: '[role="bar"]',
spinnerSelector: '[role="spinner"]',
parent: 'body',
template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
};
/**
* Updates configuration.
*
* NProgress.configure({
* minimum: 0.1
* });
*/
NProgress.configure = function(options) {
var key, value;
for (key in options) {
value = options[key];
if (value !== undefined && options.hasOwnProperty(key)) Settings[key] = value;
}
return this;
};
/**
* Last number.
*/
NProgress.status = null;
/**
* Sets the progress bar status, where `n` is a number from `0.0` to `1.0`.
*
* NProgress.set(0.4);
* NProgress.set(1.0);
*/
NProgress.set = function(n) {
var started = NProgress.isStarted();
n = clamp(n, Settings.minimum, 1);
NProgress.status = (n === 1 ? null : n);
var progress = NProgress.render(!started),
bar = progress.querySelector(Settings.barSelector),
speed = Settings.speed,
ease = Settings.easing;
progress.offsetWidth; /* Repaint */
queue(function(next) {
// Set positionUsing if it hasn't already been set
if (Settings.positionUsing === '') Settings.positionUsing = NProgress.getPositioningCSS();
// Add transition
css(bar, barPositionCSS(n, speed, ease));
if (n === 1) {
// Fade out
css(progress, {
transition: 'none',
opacity: 1
});
progress.offsetWidth; /* Repaint */
setTimeout(function() {
css(progress, {
transition: 'all ' + speed + 'ms linear',
opacity: 0
});
setTimeout(function() {
NProgress.remove();
next();
}, speed);
}, speed);
} else {
setTimeout(next, speed);
}
});
return this;
};
NProgress.isStarted = function() {
return typeof NProgress.status === 'number';
};
/**
* Shows the progress bar.
* This is the same as setting the status to 0%, except that it doesn't go backwards.
*
* NProgress.start();
*
*/
NProgress.start = function() {
if (!NProgress.status) NProgress.set(0);
var work = function() {
setTimeout(function() {
if (!NProgress.status) return;
NProgress.trickle();
work();
}, Settings.trickleSpeed);
};
if (Settings.trickle) work();
return this;
};
/**
* Hides the progress bar.
* This is the *sort of* the same as setting the status to 100%, with the
* difference being `done()` makes some placebo effect of some realistic motion.
*
* NProgress.done();
*
* If `true` is passed, it will show the progress bar even if its hidden.
*
* NProgress.done(true);
*/
NProgress.done = function(force) {
if (!force && !NProgress.status) return this;
return NProgress.inc(0.3 + 0.5 * Math.random()).set(1);
};
/**
* Increments by a random amount.
*/
NProgress.inc = function(amount) {
var n = NProgress.status;
if (!n) {
return NProgress.start();
} else if(n > 1) {
return;
} else {
if (typeof amount !== 'number') {
if (n >= 0 && n < 0.2) { amount = 0.1; }
else if (n >= 0.2 && n < 0.5) { amount = 0.04; }
else if (n >= 0.5 && n < 0.8) { amount = 0.02; }
else if (n >= 0.8 && n < 0.99) { amount = 0.005; }
else { amount = 0; }
}
n = clamp(n + amount, 0, 0.994);
return NProgress.set(n);
}
};
NProgress.trickle = function() {
return NProgress.inc();
};
/**
* Waits for all supplied jQuery promises and
* increases the progress as the promises resolve.
*
* @param $promise jQUery Promise
*/
(function() {
var initial = 0, current = 0;
NProgress.promise = function($promise) {
if (!$promise || $promise.state() === "resolved") {
return this;
}
if (current === 0) {
NProgress.start();
}
initial++;
current++;
$promise.always(function() {
current--;
if (current === 0) {
initial = 0;
NProgress.done();
} else {
NProgress.set((initial - current) / initial);
}
});
return this;
};
})();
/**
* (Internal) renders the progress bar markup based on the `template`
* setting.
*/
NProgress.render = function(fromStart) {
if (NProgress.isRendered()) return document.getElementById('nprogress');
addClass(document.documentElement, 'nprogress-busy');
var progress = document.createElement('div');
progress.id = 'nprogress';
progress.innerHTML = Settings.template;
var bar = progress.querySelector(Settings.barSelector),
perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0),
parent = isDOM(Settings.parent)
? Settings.parent
: document.querySelector(Settings.parent),
spinner
css(bar, {
transition: 'all 0 linear',
transform: 'translate3d(' + perc + '%,0,0)'
});
if (!Settings.showSpinner) {
spinner = progress.querySelector(Settings.spinnerSelector);
spinner && removeElement(spinner);
}
if (parent != document.body) {
addClass(parent, 'nprogress-custom-parent');
}
parent.appendChild(progress);
return progress;
};
/**
* Removes the element. Opposite of render().
*/
NProgress.remove = function() {
removeClass(document.documentElement, 'nprogress-busy');
var parent = isDOM(Settings.parent)
? Settings.parent
: document.querySelector(Settings.parent)
removeClass(parent, 'nprogress-custom-parent')
var progress = document.getElementById('nprogress');
progress && removeElement(progress);
};
/**
* Checks if the progress bar is rendered.
*/
NProgress.isRendered = function() {
return !!document.getElementById('nprogress');
};
/**
* Determine which positioning CSS rule to use.
*/
NProgress.getPositioningCSS = function() {
// Sniff on document.body.style
var bodyStyle = document.body.style;
// Sniff prefixes
var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' :
('MozTransform' in bodyStyle) ? 'Moz' :
('msTransform' in bodyStyle) ? 'ms' :
('OTransform' in bodyStyle) ? 'O' : '';
if (vendorPrefix + 'Perspective' in bodyStyle) {
// Modern browsers with 3D support, e.g. Webkit, IE10
return 'translate3d';
} else if (vendorPrefix + 'Transform' in bodyStyle) {
// Browsers without 3D support, e.g. IE9
return 'translate';
} else {
// Browsers without translate() support, e.g. IE7-8
return 'margin';
}
};
/**
* Helpers
*/
function isDOM (obj) {
if (typeof HTMLElement === 'object') {
return obj instanceof HTMLElement
}
return (
obj &&
typeof obj === 'object' &&
obj.nodeType === 1 &&
typeof obj.nodeName === 'string'
)
}
function clamp(n, min, max) {
if (n < min) return min;
if (n > max) return max;
return n;
}
/**
* (Internal) converts a percentage (`0..1`) to a bar translateX
* percentage (`-100%..0%`).
*/
function toBarPerc(n) {
return (-1 + n) * 100;
}
/**
* (Internal) returns the correct CSS for changing the bar's
* position given an n percentage, and speed and ease from Settings
*/
function barPositionCSS(n, speed, ease) {
var barCSS;
if (Settings.positionUsing === 'translate3d') {
barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };
} else if (Settings.positionUsing === 'translate') {
barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' };
} else {
barCSS = { 'margin-left': toBarPerc(n)+'%' };
}
barCSS.transition = 'all '+speed+'ms '+ease;
return barCSS;
}
/**
* (Internal) Queues a function to be executed.
*/
var queue = (function() {
var pending = [];
function next() {
var fn = pending.shift();
if (fn) {
fn(next);
}
}
return function(fn) {
pending.push(fn);
if (pending.length == 1) next();
};
})();
/**
* (Internal) Applies css properties to an element, similar to the jQuery
* css method.
*
* While this helper does assist with vendor prefixed property names, it
* does not perform any manipulation of values prior to setting styles.
*/
var css = (function() {
var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
cssProps = {};
function camelCase(string) {
return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) {
return letter.toUpperCase();
});
}
function getVendorProp(name) {
var style = document.body.style;
if (name in style) return name;
var i = cssPrefixes.length,
capName = name.charAt(0).toUpperCase() + name.slice(1),
vendorName;
while (i--) {
vendorName = cssPrefixes[i] + capName;
if (vendorName in style) return vendorName;
}
return name;
}
function getStyleProp(name) {
name = camelCase(name);
return cssProps[name] || (cssProps[name] = getVendorProp(name));
}
function applyCss(element, prop, value) {
prop = getStyleProp(prop);
element.style[prop] = value;
}
return function(element, properties) {
var args = arguments,
prop,
value;
if (args.length == 2) {
for (prop in properties) {
value = properties[prop];
if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value);
}
} else {
applyCss(element, args[1], args[2]);
}
}
})();
/**
* (Internal) Determines if an element or space separated list of class names contains a class name.
*/
function hasClass(element, name) {
var list = typeof element == 'string' ? element : classList(element);
return list.indexOf(' ' + name + ' ') >= 0;
}
/**
* (Internal) Adds a class to an element.
*/
function addClass(element, name) {
var oldList = classList(element),
newList = oldList + name;
if (hasClass(oldList, name)) return;
// Trim the opening space.
element.className = newList.substring(1);
}
/**
* (Internal) Removes a class from an element.
*/
function removeClass(element, name) {
var oldList = classList(element),
newList;
if (!hasClass(element, name)) return;
// Replace the class name.
newList = oldList.replace(' ' + name + ' ', ' ');
// Trim the opening and closing spaces.
element.className = newList.substring(1, newList.length - 1);
}
/**
* (Internal) Gets a space separated list of the class names on the element.
* The list is wrapped with a single space on each end to facilitate finding
* matches within the list.
*/
function classList(element) {
return (' ' + (element && element.className || '') + ' ').replace(/\s+/gi, ' ');
}
/**
* (Internal) Removes an element from the DOM.
*/
function removeElement(element) {
element && element.parentNode && element.parentNode.removeChild(element);
}
return NProgress;
});
layui.define([], function(exports) {
exports('nprogress', NProgress);
});
@@ -0,0 +1,47 @@
layui.define(['layer'], function(exports) {
"use strict";
var MOD_NAME = 'popup',
layer = layui.layer;
var popup = new function() {
this.success = function(msg) {
layer.msg(msg, {
icon: 1,
time: 1000
})
},
this.failure = function(msg) {
layer.msg(msg, {
icon: 2,
time: 1000
})
},
this.warning = function(msg) {
layer.msg(msg, {
icon: 3,
time: 1000
})
},
this.success = function(msg, callback) {
layer.msg(msg, {
icon: 1,
time: 1000
}, callback);
},
this.failure = function(msg, callback) {
layer.msg(msg, {
icon: 2,
time: 1000
}, callback);
},
this.warming = function(msg, callback) {
layer.msg(msg, {
icon: 3,
time: 1000
}, callback);
}
};
exports(MOD_NAME, popup);
})
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,35 +1,39 @@
layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'menu', 'frame', 'theme', 'convert'],
function(exports) {
"use strict";
layui.define(['jquery', 'element'],
function (exports) {
var $ = layui.jquery;
var defer = $.Deferred();
var fullScreen = new function() {
var fullScreen = new function () {
this.func = null;
this.onFullchange = function(func){
this.onFullchange = function (func) {
this.func = func;
var evts = ['fullscreenchange','webkitfullscreenchange','mozfullscreenchange','MSFullscreenChange'];
for(var i=0;i<evts.length && func;i++) {
var evts = ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'];
for (var i = 0; i < evts.length && func; i++) {
window.addEventListener(evts[i], this.func);
}
}
this.fullScreen = function(dom){
var docElm = dom && document.querySelector(dom) || document.documentElement;
if (docElm.requestFullscreen) {
docElm.requestFullscreen();
} else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen();
} else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen();
} else if (docElm.msRequestFullscreen) {
docElm.msRequestFullscreen();
}else{
defer.reject("");
}
defer.resolve("返回值");
this.fullScreen = function (dom) {
var docElm = dom && document.querySelector(dom) || document.documentElement;
if (docElm.requestFullscreen) {
docElm.requestFullscreen();
} else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen();
} else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen();
} else if (docElm.msRequestFullscreen) {
docElm.msRequestFullscreen();
} else {
defer.reject("");
}
defer.resolve("返回值");
return defer.promise();
}
this.fullClose = function(){
if(this.isFullscreen()) {
this.fullClose = function () {
if (this.isFullscreen()) {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) {
@@ -43,12 +47,14 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
defer.resolve("返回值");
return defer.promise();
}
this.isFullscreen = function(){
this.isFullscreen = function () {
return document.fullscreenElement ||
document.msFullscreenElement ||
document.mozFullScreenElement ||
document.webkitFullscreenElement || false;
}
};
exports('fullscreen', fullScreen);
})
+43 -81
View File
@@ -5,15 +5,15 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
$ = layui.jquery,
element = layui.element;
var pearMenu = function (opt) {
var menu = function (opt) {
this.option = opt;
};
pearMenu.prototype.render = function (opt) {
menu.prototype.render = function (opt) {
var option = {
elem: opt.elem,
async: opt.async,
async: typeof opt.async === 'undefined' ? true : opt.async,
parseData: opt.parseData,
url: opt.url,
method: opt.method ? opt.method : "GET",
@@ -21,16 +21,18 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
defaultSelect: opt.defaultSelect,
control: opt.control,
controlWidth: opt.controlWidth ? opt.controlWidth : "auto",
defaultMenu: opt.defaultMenu,
defaultMenu: opt.defaultMenu || 0,
accordion: opt.accordion,
height: opt.height,
theme: opt.theme,
height: opt.height || "100%",
theme: opt.theme || "dark-theme",
data: opt.data ? opt.data : [],
change: opt.change ? opt.change : function () { },
done: opt.done ? opt.done : function () { }
}
var tempDone = option.done;
option.done = function(){
option.done = function () {
if (option.control) {
rationalizeHeaderControlWidthAuto(option);
}
@@ -50,11 +52,9 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
});
}
} else {
// 延时返回,和 javascript 执行时序关联
window.setTimeout(function () { renderMenu(option); }, 500);
}
// 处理高度
$("#" + opt.elem).height(option.height)
setTimeout(function () {
@@ -83,10 +83,14 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
});
}, 1000)
return new pearMenu(option);
return new menu(option);
}
pearMenu.prototype.click = function (clickEvent) {
menu.prototype.cache = function () {
return this.option.data;
}
menu.prototype.click = function (clickEvent) {
var _this = this;
$("body").on("click", "#" + _this.option.elem + " .site-demo-active", function () {
var dom = $(this);
@@ -96,7 +100,8 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
menuPath: dom.attr("menu-title"),
menuIcon: dom.attr("menu-icon"),
menuUrl: dom.attr("menu-url"),
openType: dom.attr("open-type")
menuType: dom.attr("menu-type"),
menuOpenType: dom.attr("menu-open-type")
};
var doms = hash(dom);
if (doms != null) {
@@ -139,14 +144,14 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
return d;
}
pearMenu.prototype.skin = function (skin) {
menu.prototype.skin = function (skin) {
var menu = $(".pear-nav-tree[lay-filter='" + this.option.elem + "']").parent();
menu.removeClass("dark-theme");
menu.removeClass("light-theme");
menu.addClass(skin);
}
pearMenu.prototype.selectItem = function (pearId) {
menu.prototype.selectItem = function (pearId) {
if (this.option.control != false) {
$("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents(".layui-side-scroll ").find("ul").css({
display: "none"
@@ -209,7 +214,7 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
}
var activeMenus;
pearMenu.prototype.collapse = function (time) {
menu.prototype.collapse = function (time) {
var elem = this.option.elem;
var config = this.option;
if ($("#" + this.option.elem).is(".pear-nav-mini")) {
@@ -223,12 +228,12 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
isHoverMenu(false, config);
var that = this;
$("#" + this.option.elem)
.promise()
.done(function () {
if (that.option.control) {
rationalizeHeaderControlWidth(that.option);
}
})
.promise()
.done(function () {
if (that.option.control) {
rationalizeHeaderControlWidth(that.option);
}
})
} else {
activeMenus = $("#" + this.option.elem).find(".layui-nav-itemed>a");
$("#" + this.option.elem).find(".layui-nav-itemed").removeClass("layui-nav-itemed");
@@ -238,13 +243,13 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
}, 400);
var that = this;
$("#" + this.option.elem)
.promise()
.done(function () {
isHoverMenu(true, config);
if (that.option.control) {
rationalizeHeaderControlWidth(that.option);
}
})
.promise()
.done(function () {
isHoverMenu(true, config);
if (that.option.control) {
rationalizeHeaderControlWidth(that.option);
}
})
}
}
@@ -278,13 +283,12 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
}
}
element.init();
downShow(option);
option.done();
}
function createMenu(option) {
var menuHtml = '<div style="height:100%!important;" class="pear-side-scroll layui-side-scroll ' + option.theme + '"><ul lay-filter="' + option.elem +
'" class="layui-nav arrow pear-menu layui-nav-tree pear-nav-tree">'
'" class="layui-nav arrow pear-menu layui-nav-tree pear-nav-tree" ' + (option.accordion ? "lay-accordion" : "") + '>'
$.each(option.data, function (i, item) {
var content = '<li class="layui-nav-item" >';
if (i == option.defaultOpen) {
@@ -304,7 +308,7 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
'" ' + target + '><i class="' + item.icon + '"></i><span>' + item.title +
'</span></a>';
} else if (item.type == 1) {
content += '<a class="' + className + '" menu-type="' + item.type + '" menu-url="' + item.href + '" menu-id="' +
content += '<a class="' + className + '" menu-type="' + item.type + '" menu-open-type="' + item.openType + '" menu-url="' + item.href + '" menu-id="' +
item.id +
'" menu-title="' + item.title + '" href="' + href + '" ' + target + '><i class="' + item.icon +
'"></i><span>' + item.title + '</span></a>';
@@ -374,7 +378,7 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
'</span></a>';
} else if (note.type == 1) {
// 创 建 菜 单 结 构
content += '<a ' + target + ' class="' + className + '" menu-type="' + note.type + '" menu-url="' + note.href +
content += '<a ' + target + ' class="' + className + '" menu-open-type="' + note.openType + '" menu-type="' + note.type + '" menu-url="' + note.href +
'" menu-id="' + note.id +
'" menu-title="' + note.title + '" href="' + href + '"><i class="' + note.icon +
'"></i><span>' + note.title + '</span></a>';
@@ -433,7 +437,7 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
'"><i class="' + note.icon + '"></i><span>' + note.title + '</span></a>';
} else if (note.type == 1) {
// 创 建 菜 单 结 构
content += '<a ' + target + ' class="' + className + '" menu-type="' + note.type + '" menu-url="' + note.href +
content += '<a ' + target + ' class="' + className + '" menu-open-type="' + note.openType + '" menu-type="' + note.type + '" menu-url="' + note.href +
'" menu-id="' + note.id + '" menu-title="' + note.title + '" menu-icon="' + note.icon + '" href="' + href +
'" ><i class="' + note.icon + '"></i><span>' + note.title + '</span></a>';
}
@@ -450,49 +454,6 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
return content;
}
function downShow(option) {
$("body #" + option.elem).on("click", "a[menu-type='0']", function () {
if (!$("#" + option.elem).is(".pear-nav-mini")) {
var superEle = $(this).parent();
var ele = $(this).next('.layui-nav-child');
var heights = ele.children("dd").length * 48;
if ($(this).parent().is(".layui-nav-itemed")) {
if (option.accordion) {
var currentDom = $(this).parent().siblings('.layui-nav-itemed').children('.layui-nav-child');
currentDom.animate({
height: '0px'
}, 240, function () {
currentDom.css({
height: "auto",
});
$(this).parent().removeClass("layui-nav-itemed");
$(this).find('.layui-nav-itemed').removeClass("layui-nav-itemed");
});
}
ele.height(0);
ele.animate({
height: heights + "px"
}, 240, function () {
ele.css({
height: "auto"
});
});
} else {
$(this).parent().addClass("layui-nav-itemed");
ele.animate({
height: "0px"
}, 240, function () {
ele.css({
height: "auto"
});
$(this).parent().removeClass("layui-nav-itemed");
});
}
}
})
}
/** 二 级 悬 浮 菜 单*/
function isHoverMenu(b, option) {
if (b) {
@@ -557,15 +518,16 @@ layui.define(['table', 'jquery', 'element'], function (exports) {
$("#" + option.control + " .control").css({ "width": rationalizeWidth, "transition": "width .15s" });
}
function rationalizeHeaderControlWidthAuto(option){
function rationalizeHeaderControlWidthAuto(option) {
$(window).on('resize', function () {
rationalizeHeaderControlWidth(option);
})
$(document).ready(function () {
rationalizeHeaderControlWidth(option);
setTimeout(() => {
rationalizeHeaderControlWidth(option);
}, 1000);
});
}
exports(MOD_NAME, new pearMenu());
})
exports(MOD_NAME, new menu());
})
@@ -0,0 +1,233 @@
layui.define(['jquery', 'tools'], function (exports) {
"use strict";
/**
* @since Pear Admin 4.0
*
* Button component
* */
var MOD_NAME = 'menuSearch',
tools = layui.tools,
$ = layui.jquery;
var menuSearch = function (opt) {
this.option = opt;
};
/**
* @since Pear Admin 4.0
*
* Button start loading
* */
menuSearch.prototype.render = function (opt) {
var options = {
select: opt.select,
elem: opt.elem,
dataProvider: opt.dataProvider,
}
$('body').on("click", options.elem, function () {
var _html = [
`<div class="menu-search-content">
<div class="layui-form menu-search-input-wrapper">
<div class=" layui-input-wrap layui-input-wrap-prefix">
<div class="layui-input-prefix">
<i class="layui-icon layui-icon-search"></i>
</div>
<input type="text" name="menuSearch" value="" placeholder="搜索菜单" autocomplete="off" class="layui-input" lay-affix="clear">
</div>
</div>
<div class="menu-search-no-data">暂 无 信 息</div>
<ul class="menu-search-list">
</ul>
<div class="menu-search-tips">
<div>
<span class="mr-1">选择</span><kbd class="mr-1 w-5"> ↑ </kbd><kbd class="mr-5 w-5"> ↓ </kbd>
<span class="mr-1">确定</span><kbd class="mr-5"> Enter </kbd><span class="mr-1">关闭</span><kbd class="mr-1"> Esc </kbd>
</div>
</div>
</div>`
].join('');
layer.open({
type: 1,
offset: "10%",
area: ['600px'],
title: false,
closeBtn: 0,
shadeClose: true,
anim: 0,
move: false,
content: _html,
success: function (layero, layeridx) {
var $layer = layero;
var $content = $(layero).children('.layui-layer-content');
var $input = $(".menu-search-input-wrapper input");
var $noData = $(".menu-search-no-data");
var $list = $(".menu-search-list");
var menuData = options.dataProvider();
$layer.css("border-radius", "6px");
$input.off("focus").focus();
// 搜索输入事件
$input.off("input").on("input", tools.debounce(function () {
var keywords = $input.val().trim();
var filteredMenus = filterHandle(menuData, keywords);
if (filteredMenus.length) {
var tiledMenus = tiledHandle(filteredMenus);
var listHtml = createList(tiledMenus);
$noData.css("display", "none");
$list.html("").append(listHtml).children(":first").addClass("this")
} else {
$list.html("");
$noData.css("display", "flex");
}
var currentHeight = $(".menu-search-content").outerHeight()
$layer.css("height", currentHeight);
$content.css("height", currentHeight);
}, 500)
)
// 列表点击事件
$list.off("click").on("click", "li", function () {
var id = $(this).attr("smenu-id");
var title = $(this).attr("smenu-title");
var url = $(this).attr("smenu-url");
var type = $(this).attr("smenu-type");
var openType = $(this).attr("smenu-open-type");
options.select({ id, title, url, type, openType });
layer.close(layeridx);
})
$list.off('mouseenter').on("mouseenter", "li", function () {
$(".menu-search-list li.this").removeClass("this");
$(this).addClass("this");
}).off("mouseleave").on("mouseleave", "li", function () {
$(this).removeClass("this");
})
// 监听键盘事件
$('.menu-search-content').off("keydown").keydown(function (e) {
if (e.keyCode === 13 || e.keyCode === 32) {
e.preventDefault();
var that = $(".menu-search-list li.this");
var id = that.attr("smenu-id");
var title = that.attr("smenu-title");
var url = that.attr("smenu-url");
var type = that.attr("smenu-type");
var openType = that.attr("smenu-open-type");
options.select({ id, title, url, type, openType });
layer.close(layeridx);
} else if (e.keyCode === 38) {
e.preventDefault();
var prevEl = $(".menu-search-list li.this").prev();
$(".menu-search-list li.this").removeClass("this");
if (prevEl.length !== 0) {
prevEl.addClass("this");
} else {
$list.children().last().addClass("this");
}
} else if (e.keyCode === 40) {
e.preventDefault();
var nextEl = $(".menu-search-list li.this").next();
$(".menu-search-list li.this").removeClass("this");
if (nextEl.length !== 0) {
nextEl.addClass("this");
} else {
$list.children().first().addClass("this");
}
} else if (e.keyCode === 27) {
e.preventDefault();
layer.close(layeridx);
}
})
}
})
});
return new menuSearch(options);
}
/**
* @since Pear Admin 4.0
*
* 创建结果列表
*/
var createList = function (data) {
var listHtml = '';
$.each(data, function (index, item) {
listHtml += `<li smenu-open-type="${item.info.openType}" smenu-id="${item.info.id}" smenu-icon="'${item.info.icon}" smenu-url="${item.info.href}" smenu-title="${item.info.title}" smenu-type="${item.info.type}">
<span><i style="margin-right:10px" class="${item.info.icon}"></i>${item.path}</span>
<i class="layui-icon layui-icon-right"></i>
</li>`
})
return listHtml;
}
/**
* @since Pear Admin 4.0
*
* Tree 转 path 列表
*/
var tiledHandle = function (data) {
var tiledMenus = [];
var treeTiled = function (data, content) {
var path = "";
var separator = " / ";
if (!content) content = "";
$.each(data, function (index, item) {
if (item.children && item.children.length) {
path += content + item.title + separator;
var childPath = treeTiled(item.children, path);
path += childPath;
if (!childPath) path = ""; // 重置路径
} else {
path += content + item.title
tiledMenus.push({ path: path, info: item });
path = ""; //重置路径
}
})
return path;
};
treeTiled(data);
return tiledMenus;
}
/**
* @since Pear Admin 4.0
*
* 查询匹配算法
*/
var filterHandle = function (filterData, val) {
if (!val) return [];
var filteredMenus = [];
filterData = $.extend(true, {}, filterData);
$.each(filterData, function (index, item) {
if (item.children && item.children.length) {
var children = filterHandle(item.children, val)
var obj = $.extend({}, item, { children: children });
if (children && children.length) {
filteredMenus.push(obj);
} else if (item.title.indexOf(val) >= 0) {
item.children = []; // 父级匹配但子级不匹配,就去除子级
filteredMenus.push($.extend({}, item));
}
} else if (item.title.indexOf(val) >= 0) {
filteredMenus.push(item);
}
})
return filteredMenus;
}
exports(MOD_NAME, new menuSearch());
});
@@ -0,0 +1,85 @@
layui.define(['table', 'jquery', 'element', 'dropdown'], function (exports) {
"use strict";
var MOD_NAME = 'messageCenter',
$ = layui.jquery,
dropdown = layui.dropdown;
var message = function (opt) {
this.option = opt;
};
message.prototype.render = function (opt) {
var option = {
elem: opt.elem,
url: opt.url ? opt.url : false,
height: opt.height,
data: opt.data
}
if (option.url != false) {
$.get(option.url, function (result) {
const { code, success, data } = result;
$(`${opt.elem}`).append(`<li class="layui-nav-item" lay-unselect="">
<a href="#" class="notice layui-icon layui-icon-notice"></a>
</li>`);
if (code == 200 || success) {
option.data = data;
dropdown.render({
elem: option.elem,
align: "center",
content: createHtml(option),
})
}
});
}
return new message(option);
}
message.prototype.click = function (callback) {
$("*[notice-id]").click(function (event) {
event.preventDefault();
var id = $(this).attr("notice-id");
var title = $(this).attr("notice-title");
var context = $(this).attr("notice-context");
var form = $(this).attr("notice-form");
callback(id, title, context, form);
})
}
function createHtml(option) {
var count = 0;
var notice = '<div class="pear-message-center"><div class="layui-tab layui-tab-brief">'
var noticeTitle = '<ul class="layui-tab-title">';
var noticeContent = '<div class="layui-tab-content" style="height:' + option.height + ';overflow-x: hidden;padding:0px;">';
$.each(option.data, function (i, item) {
noticeTitle += `<li class="${i === 0 ? 'layui-this' : ''}">${item.title}</li>`;
noticeContent += '<div class="layui-tab-item layui-show">';
$.each(item.children, function (i, note) {
count++;
noticeContent += '<div class="message-item" notice-form="' + note.form + '" notice-context="' + note.context +
'" notice-title="' + note.title + '" notice-id="' + note.id + '">';
noticeContent += '<img src="' + note.avatar + '"/><div style="display:inline-block;">' + note.title + '</div>' +
'<div class="extra">' + note.time + '</div>' +
'</div>';
})
noticeContent += '</div>';
})
noticeTitle += '</ul>';
noticeContent += '</div>';
notice += noticeTitle;
notice += noticeContent;
notice += "</div></div>"
return notice;
}
exports(MOD_NAME, new message());
})
+119
View File
@@ -0,0 +1,119 @@
layui.define(['jquery', 'element'], function (exports) {
"use strict";
var $ = layui.jquery;
var element = layui.element;
var page = function (opt) {
this.option = opt;
};
/**
* @since Pear Admin 4.0
*
* 创建 Page 页面
*/
page.prototype.render = function (opt) {
var option = {
elem: opt.elem,
url: opt.url,
width: opt.width || "100%",
height: opt.height || "100%",
title: opt.title
}
renderContent(option);
return new page(option);
}
/**
* @since Pear Admin 4.0
*
* 切换 Page 页面
*/
page.prototype.changePage = function (options) {
const $frame = $(`#${this.option.elem} .pear-page-content`);
if (options.type === "_iframe") {
$frame.html(`<iframe src='${options.href}' scrolling='auto' frameborder='0' allowfullscreen='true'></iframe>`);
} else {
$.ajax({
url: options.href,
type: 'get',
dataType: 'html',
success: function (data) {
$frame.html(data)
},
error: function (xhr) {
return layer.msg('Status:' + xhr.status + '' + xhr.statusText + ',请稍后再试!');
}
});
}
$frame.attr("type", options.type);
$frame.attr("href", options.href);
}
page.prototype.refresh = function (loading) {
var $frameLoad = $(`#${this.option.elem} .pear-page-loading`);
var $frame = $(`#${this.option.elem} .pear-page-content`);
if (loading) {
$frameLoad.css({
display: 'block'
});
}
if ($frame.attr("type") === "_iframe") {
$frame.html(`<iframe src='${$frame.attr("href")}' scrolling='auto' frameborder='0' allowfullscreen='true'></iframe>`);
const $contentFrame = $frame.find("iframe");
$contentFrame.on("load", () => {
$frameLoad.fadeOut(1000);
})
} else {
$.ajax({
type: 'get',
url: $frame.attr("href"),
dataType: 'html',
success: function (data) {
$frame.html(data)
$frameLoad.fadeOut(1000);
element.init();
},
error: function (xhr) {
return layer.msg('Status:' + xhr.status + '' + xhr.statusText + ',请稍后再试!');
}
});
}
}
function renderContent(option) {
$("#" + option.elem).html(`
<div class='pear-page'>
<div class='pear-page-content' type='${option.type}' href='${option.url}'></div>
<div class="pear-page-loading">
<div class="ball-loader">
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
</div>`);
var $frame = $("#" + option.elem).find(".pear-page-content");
if (option.type === "_iframe") {
$frame.html(`<iframe src='${option.url}' scrolling='auto' frameborder='0' allowfullscreen='true'></iframe>`);
} else {
$.ajax({
url: option.url,
type: 'get',
dataType: 'html',
success: function (data) {
$frame.html(data);
},
error: function (xhr) {
return layer.msg('Status:' + xhr.status + '' + xhr.statusText + ',请稍后再试!');
}
});
}
}
exports('page', new page());
});
@@ -0,0 +1,656 @@
layui.define(['jquery', 'element', 'dropdown'], function (exports) {
"use strict";
var MOD_NAME = 'tabPage',
$ = layui.jquery,
dropdown = layui.dropdown,
element = layui.element;
var tabPage = function (opt) {
this.option = opt;
};
var tabData = new Array();
var tabDataCurrent = 0;
var contextTabDOM;
tabPage.prototype.render = function (opt) {
var option = {
elem: opt.elem,
data: opt.data,
index: opt.index,
tool: opt.tool || true,
roll: opt.roll || true,
success: opt.success ? opt.success : function (id) { },
session: opt.session ? opt.session : false,
preload: opt.preload ? opt.preload : false,
height: opt.height || "100%",
width: opt.width || "100%",
closeEvent: opt.closeEvent,
tabMax: opt.tabMax,
}
if (option.session) {
if (sessionStorage.getItem(option.elem + "-pear-tab-page-data") != null) {
tabData = JSON.parse(sessionStorage.getItem(option.elem + "-pear-tab-page-data"));
option.data = JSON.parse(sessionStorage.getItem(option.elem + "-pear-tab-page-data"));
tabDataCurrent = sessionStorage.getItem(option.elem + "-pear-tab-page-data-current");
tabData.forEach(function (item, index) {
if (item.id == tabDataCurrent) {
option.index = index;
}
})
} else {
tabData = opt.data;
}
}
var lastIndex;
var tab = createTab(option);
$("#" + option.elem).html(tab);
$(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-prev").click(function () {
rollPage("left", option);
})
$(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-next").click(function () {
rollPage("right", option);
})
element.init();
$("#" + option.elem).width(opt.width);
$("#" + option.elem).height(opt.height);
$("#" + option.elem).css({
position: "relative"
});
closeEvent(option);
option.success(sessionStorage.getItem(option.elem + "-pear-tab-page-data-current"));
dropdown.render({
elem: `#${option.elem} .layui-tab-control > .layui-icon-down`,
trigger: 'hover',
data: [{
title: '关 闭 当 前',
id: 1
}, {
title: '关 闭 其 他',
id: 2
}, {
title: '关 闭 全 部',
id: 3
}],
click: function (obj) {
const id = obj.id;
if (id === 1) {
var currentTab = $(".layui-tab[lay-filter='" + option.elem +
"'] .layui-tab-title .layui-this");
if (currentTab.find("span").is(".able-close")) {
var currentId = currentTab.attr("lay-id");
tabDelete(option.elem, currentId, option.closeEvent, option);
} else {
layer.msg("当前页面不允许关闭", {
icon: 3,
time: 1000
})
}
} else if (id === 2) {
var currentId = $(".layui-tab[lay-filter='" + option.elem +
"'] .layui-tab-title .layui-this").attr("lay-id");
var tabtitle = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title li");
$.each(tabtitle, function (i) {
if ($(this).attr("lay-id") != currentId) {
if ($(this).find("span").is(".able-close")) {
tabDelete(option.elem, $(this).attr("lay-id"), option.closeEvent,
option);
}
}
})
} else {
var currentId = $(".layui-tab[lay-filter='" + option.elem +
"'] .layui-tab-title .layui-this").attr("lay-id");
var tabtitle = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title li");
$.each(tabtitle, function (i) {
if ($(this).find("span").is(".able-close")) {
tabDelete(option.elem, $(this).attr("lay-id"), option.closeEvent, option);
}
})
}
}
})
$("body .layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title").on("contextmenu", "li",
function (e) {
var top = e.clientY;
var left = e.clientX;
var menuWidth = 100;
var menu = `<ul>
<li class='item' id='${option.elem}closeThis'>关闭当前</li>
<li class='item' id='${option.elem}closeOther'>关闭其他</li>
<li class='item' id='${option.elem}closeAll'>关闭所有</li>
</ul>`;
contextTabDOM = $(this);
var isOutsideBounds = (left + menuWidth) > $(window).width();
if (isOutsideBounds) {
left = $(window).width() - menuWidth;
}
layer.open({
type: 1,
title: false,
shade: false,
skin: 'pear-tab-page-menu',
closeBtn: false,
area: [menuWidth + 'px', '108px'],
fixed: true,
anim: false,
isOutAnim: false,
offset: [top, left],
content: menu,
success: function (layero, index) {
layer.close(lastIndex);
lastIndex = index;
menuEvent(option, index);
var timer;
$(layero).on('mouseout', function () {
timer = setTimeout(function () {
layer.close(index);
}, 30)
});
$(layero).on('mouseover', function () {
clearTimeout(timer);
});
$(layero).on('contextmenu', function () {
return false;
})
}
});
return false;
})
mousewheelAndTouchmoveHandler(option)
return new tabPage(option);
}
tabPage.prototype.click = function (callback) {
var option = this.option;
var elem = this.option.elem;
element.on('tab(' + this.option.elem + ')', function (data) {
var id = $("#" + elem + " .layui-tab-title .layui-this").attr("lay-id");
sessionStorage.setItem(option.elem + "-pear-tab-page-data-current", id);
callback(id);
});
}
tabPage.prototype.positionTab = function () {
var $tabTitle = $('.layui-tab[lay-filter=' + this.option.elem + '] .layui-tab-title');
var autoLeft = 0;
$tabTitle.children("li").each(function () {
if ($(this).hasClass('layui-this')) {
return false;
} else {
autoLeft += $(this).outerWidth();
}
});
$tabTitle.animate({
scrollLeft: autoLeft - $tabTitle.width() / 3
}, 200);
}
tabPage.prototype.clear = function () {
sessionStorage.removeItem(this.option.elem + "-pear-tab-page-data");
sessionStorage.removeItem(this.option.elem + "-pear-tab-page-data-current");
}
tabPage.prototype.changeTabTitleById = function (id, title) {
var currentTab = $(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-title [lay-id='" + id + "'] .title");
currentTab.html(title);
}
/**
* @since Pear Admin 4.0
*
* 删除指定选项卡
*
* @param id 编号
*/
tabPage.prototype.removeTab = function (id) {
var elem = this.option.elem;
if (id != undefined) {
var currentTab = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title [lay-id='" + id + "']");
if (currentTab.find("span").is(".able-close")) {
tabDelete(elem, id, () => { });
}
} else {
var tabtitle = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title li");
$.each(tabtitle, function () {
if ($(this).find("span").is(".able-close")) {
tabDelete(elem, $(this).attr("lay-id"), () => { });
}
})
}
}
/**
* @since Pear Admin 4.0
*
* 删除其他选项卡
*/
tabPage.prototype.removeOtherTab = function () {
var elem = this.option.elem;
var currentId = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title .layui-this").attr("lay-id");
var tabtitle = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title li");
$.each(tabtitle, function () {
if ($(this).attr("lay-id") != currentId) {
if ($(this).find("span").is(".able-close")) {
tabDelete(elem, $(this).attr("lay-id"), () => { });
}
}
})
}
/**
* @since Pear Admin 4.0
*
* 删除选中选项卡
*/
tabPage.prototype.removeCurrentTab = function () {
var currentTab = $(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-title .layui-this");
if (currentTab.find("span").is(".able-close")) {
var currentId = currentTab.attr("lay-id");
tabDelete(this.option.elem, currentId, () => { });
}
}
/**
* @since Pear Admin 4.0
*
* 切换选项卡
*
* @param opt 内容
*/
tabPage.prototype.changePage = function (opt) {
var title = `<span class="pear-tab-page-active"></span>
<span class="${opt.close ? 'able-close' : 'disable-close'} title">${opt.title}</span>
<i class="layui-icon layui-unselect layui-tab-close">ဆ</i>`;
if ($(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-title li[lay-id]").length <=
0) {
var that = this;
if (opt.type === "_iframe") {
element.tabAdd(this.option.elem, {
id: opt.id,
title: title,
content: `<iframe id="${opt.id}" type="${opt.type}" data-frameid="${opt.id}" scrolling="auto" frameborder="0" src="${opt.url}" style="width:100%;height:100%;" allowfullscreen="true"></iframe>`
});
} else {
$.ajax({
url: opt.url,
type: 'get',
dataType: 'html',
async: false,
success: function (data) {
element.tabAdd(that.option.elem, {
id: opt.id,
title: title,
content: `<div id="${opt.id}" type="${opt.type}" data-frameid="${opt.id}" src="${opt.url}">${data}</div>`,
});
},
error: function (xhr, textstatus, thrown) {
return layer.msg('Status:' + xhr.status + '' + xhr.statusText + ',请稍后再试!');
}
});
}
tabData.push(opt);
sessionStorage.setItem(that.option.elem + "-pear-tab-page-data", JSON.stringify(tabData));
sessionStorage.setItem(that.option.elem + "-pear-tab-page-data-current", opt.id);
} else {
var isData = false;
$.each($(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-title li[lay-id]"),
function () {
if ($(this).attr("lay-id") == opt.id) {
isData = true;
}
})
if (isData == false) {
if (this.option.tabMax != false) {
if ($(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-title li[lay-id]")
.length >= this.option.tabMax) {
layer.msg("最多打开" + this.option.tabMax + "个标签页", {
icon: 2,
time: 1000,
shift: 6
});
return false;
}
}
var that = this;
if (opt.type === "_iframe") {
element.tabAdd(this.option.elem, {
id: opt.id,
title: title,
content: `<iframe id="${opt.id}" type="${opt.type}" data-frameid="${opt.id}" scrolling="auto" frameborder="0" src="${opt.url}" style="width:100%;height:100%;" allowfullscreen="true"></iframe>`
});
} else {
$.ajax({
url: opt.url,
type: 'get',
dataType: 'html',
async: false,
success: function (data) {
element.tabAdd(that.option.elem, {
id: opt.id,
title: title,
content: `<div id="${opt.id}" type="${opt.type}" data-frameid="${opt.id}" src="${opt.url}">${data}</div>`,
});
},
error: function (xhr, textstatus, thrown) {
return layer.msg('Status:' + xhr.status + '' + xhr.statusText + ',请稍后再试!');
}
});
}
tabData.push(opt);
sessionStorage.setItem(that.option.elem + "-pear-tab-page-data", JSON.stringify(tabData));
sessionStorage.setItem(that.option.elem + "-pear-tab-page-data-current", opt.id);
}
}
element.tabChange(this.option.elem, opt.id);
sessionStorage.setItem(this.option.elem + "-pear-tab-page-data-current", opt.id);
}
/**
* 刷新当前选型卡
*
* @param time 动画时长
*/
tabPage.prototype.refresh = function (time) {
var $iframe = $(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-content .layui-show > div[data-frameid]");
var $iframeLoad;
if (time != false && time != 0) {
$iframeLoad = $("#" + this.option.elem).find(".pear-tab-page-loading");
$iframeLoad.css({
display: "block"
});
}
if ($iframe.attr("type") === "_iframe") {
$iframe.attr("src", $iframe.attr("src"));
$iframe.on("load", function () {
$iframeLoad.fadeOut(1000, function () {
$iframeLoad.css({
display: "none"
});
});
})
} else {
$.ajax({
url: $iframe.attr("src"),
type: 'get',
dataType: 'html',
success: function (data) {
$iframe.html(data);
if ($iframeLoad != undefined) {
$iframeLoad.fadeOut(1000, function () {
$iframeLoad.css({
display: "none"
});
});
}
},
error: function (xhr) {
return layer.msg('Status:' + xhr.status + '' + xhr.statusText + ',请稍后再试!');
}
});
}
}
function tabDelete(elem, id, callback) {
var tabTitle = $(".layui-tab[lay-filter='" + elem + "']").find(".layui-tab-title");
var removeTab = tabTitle.find("li[lay-id='" + id + "']");
var nextNode = removeTab.next("li");
if (!removeTab.hasClass("layui-this")) {
removeTab.remove();
var tabContent = $(".layui-tab[lay-filter='" + elem + "']").find("*[id='" + id + "']")
.parent();
tabContent.remove();
tabData = JSON.parse(sessionStorage.getItem(elem + "-pear-tab-page-data"));
tabDataCurrent = sessionStorage.getItem(elem + "-pear-tab-page-data-current");
tabData = tabData.filter(function (item) {
return item.id != id;
})
sessionStorage.setItem(elem + "-pear-tab-page-data", JSON.stringify(tabData));
return false;
}
var currId;
if (nextNode.length) {
nextNode.addClass("layui-this");
currId = nextNode.attr("lay-id");
$("#" + elem + " [id='" + currId + "']").parent().addClass("layui-show");
} else {
var prevNode = removeTab.prev("li");
prevNode.addClass("layui-this");
currId = prevNode.attr("lay-id");
$("#" + elem + " [id='" + currId + "']").parent().addClass("layui-show");
}
callback(currId);
tabData = JSON.parse(sessionStorage.getItem(elem + "-pear-tab-page-data"));
tabDataCurrent = sessionStorage.getItem(elem + "-pear-tab-page-data-current");
tabData = tabData.filter(function (item) {
return item.id != id;
})
sessionStorage.setItem(elem + "-pear-tab-page-data", JSON.stringify(tabData));
sessionStorage.setItem(elem + "-pear-tab-page-data-current", currId);
removeTab.remove();
var tabContent = $(".layui-tab[lay-filter='" + elem + "']").find("*[id='" + id + "']").parent();
tabContent.remove();
}
/**
* @since Pear Admin 4.0
*/
function createTab(option) {
var type = "";
if (option.roll == true) {
type = "layui-tab-roll";
}
if (option.tool != false) {
type = "layui-tab-tool";
}
if (option.roll == true && option.tool != false) {
type = "layui-tab-rollTool";
}
var tab = '<div class="pear-tab-page ' + type + ' layui-tab" lay-filter="' + option.elem +
'" lay-allowClose="true">';
var headers = '<ul class="layui-tab-title">';
var content = '<div class="layui-tab-content">';
var loading = '<div class="pear-tab-page-loading"><div class="ball-loader"><span></span><span></span><span></span><span></span></div></div>'
var control = `<div class="layui-tab-control">
<li class="layui-tab-prev layui-icon layui-icon-left"></li>
<li class="layui-tab-next layui-icon layui-icon-right"></li>
<li class="layui-tab-tool layui-icon layui-icon-down"></li>
</div>`;
// 处 理 选 项 卡 头 部
var index = 0;
$.each(option.data, function (i, item) {
var titleItem = `<li lay-id="${item.id}" class="${option.index == index ? 'layui-this' : ''}">
<span class="pear-tab-page-active"></span>
<span class="${item.close ? 'able-close' : 'disable-close'} title">
${item.title}
</span>
<i class="layui-icon layui-unselect layui-tab-close">ဆ</i></li>
</li>`;
headers += titleItem;
if (item.type === "_iframe") {
content += `<div class="${option.index == index ? 'layui-show' : ''} layui-tab-item"><iframe id="${item.id}" type="${item.type}" data-frameid="${item.id}" scrolling="auto" frameborder="0" src="${item.url}" style="width:100%;height:100%;" allowfullscreen="true"></iframe></div>`
} else {
$.ajax({
url: item.url,
type: 'get',
dataType: 'html',
async: false,
success: function (data) {
content += `<div class="${option.index == index ? 'layui-show' : ''} layui-tab-item"><div id="${item.id}" type="${item.type}" data-frameid="${item.id}" src="${item.url}">${data}</div></div>`;
},
error: function (xhr) {
return layer.msg('Status:' + xhr.status + '' + xhr.statusText + ',请稍后再试!');
}
});
}
index++;
});
headers += '</ul>';
content += '</div>';
tab += headers;
tab += control;
tab += content;
tab += loading;
tab += '</div>';
tab += ''
return tab;
}
function rollPage(d, option) {
var $tabTitle = $('#' + option.elem + ' .layui-tab-title');
var left = $tabTitle.scrollLeft();
if ('left' === d) {
$tabTitle.animate({
scrollLeft: left - 450
}, 200);
} else {
$tabTitle.animate({
scrollLeft: left + 450
}, 200);
}
}
function closeEvent(option) {
$(".layui-tab[lay-filter='" + option.elem + "']")
.on("click", ".layui-tab-close", function () {
var layid = $(this).parent().attr("lay-id");
tabDelete(option.elem, layid, option.closeEvent, option);
})
.on("mousedown", ".layui-tab-title li", function (e) {
if (e.buttons === 4 && $(this).find("span").is(".able-close")) {
tabDelete(option.elem, $(this).attr("lay-id"), option.closeEvent, option);
}
});
}
function menuEvent(option, index) {
$("#" + option.elem + "closeThis").click(function () {
var currentTab = contextTabDOM;
if (currentTab.find("span").is(".able-close")) {
var currentId = currentTab.attr("lay-id");
tabDelete(option.elem, currentId, option.closeEvent, option);
} else {
layer.msg("当前页面不允许关闭", {
icon: 3,
time: 800
})
}
layer.close(index);
})
$("#" + option.elem + "closeOther").click(function () {
var currentId = contextTabDOM.attr("lay-id");
var tabtitle = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title li");
$.each(tabtitle, function (i) {
if ($(this).attr("lay-id") != currentId) {
if ($(this).find("span").is(".able-close")) {
tabDelete(option.elem, $(this).attr("lay-id"), option.closeEvent,
option);
}
}
})
layer.close(index);
})
$("#" + option.elem + "closeAll").click(function () {
var tabtitle = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title li");
$.each(tabtitle, function (i) {
if ($(this).find("span").is(".able-close")) {
tabDelete(option.elem, $(this).attr("lay-id"), option.closeEvent, option);
}
})
layer.close(index);
})
}
function mousewheelAndTouchmoveHandler(option) {
var $bodyTab = $("body .layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title")
var $tabTitle = $('#' + option.elem + ' .layui-tab-title');
var mouseScrollStep = 100
// 鼠标滚轮
$bodyTab.on("mousewheel DOMMouseScroll", function (e) {
e.originalEvent.preventDefault()
var delta = (e.originalEvent.wheelDelta && (e.originalEvent.wheelDelta > 0 ? "top" :
"down")) || // chrome & ie
(e.originalEvent.detail && (e.originalEvent.detail > 0 ? "down" : "top")); // firefox
var scrollLeft = $tabTitle.scrollLeft();
if (delta === "top") {
scrollLeft -= mouseScrollStep
} else if (delta === "down") {
scrollLeft += mouseScrollStep
}
$tabTitle.scrollLeft(scrollLeft)
});
// 触摸移动
var touchX = 0;
$bodyTab.on("touchstart", function (e) {
var touch = e.originalEvent.targetTouches[0];
touchX = touch.pageX
})
$bodyTab.on("touchmove", function (e) {
var event = e.originalEvent;
if (event.targetTouches.length > 1) return;
event.preventDefault();
var touch = event.targetTouches[0];
var distanceX = touchX - touch.pageX
var scrollLeft = $tabTitle.scrollLeft();
touchX = touch.pageX
$tabTitle.scrollLeft(scrollLeft += distanceX)
});
}
exports(MOD_NAME, new tabPage());
})
@@ -0,0 +1,40 @@
layui.define(['jquery', 'element'],
function (exports) {
var $ = layui.jquery;
var tools = new function () {
/**
* @since 防抖算法
*
* @param fn 要执行的方法
* @param time 防抖时间参数
*/
this.debounce = function (fn, time) {
var timer = null
return function () {
var arguments = arguments[0]
if (timer) {
clearTimeout(timer)
}
timer = setTimeout(function () {
fn(arguments)
}, time)
}
}
// image 转 base64
this.imageToBase64 = function (img) {
var canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0, img.width, img.height);
var ext = img.src.substring(img.src.lastIndexOf(".") + 1).toLowerCase();
var dataURL = canvas.toDataURL("image/" + ext);
return dataURL;
}
};
exports('tools', tools);
})
+19 -41
View File
@@ -7,45 +7,23 @@ window.rootPath = (function (src) {
layui.config({
base: rootPath + "module/",
version: "3.40.0"
version: "4.0.3"
}).extend({
admin: "admin", // 框架布局组件
common: "common", // 公共方法封装
menu: "menu", // 数据菜单组件
frame: "frame", // 内容页面组件
tab: "tab", // 多选项卡组件
echarts: "echarts", // 数据图表组件
echartsTheme: "echartsTheme",// 数据图表主题
encrypt: "encrypt", // 数据加密组件
select: "select", // 下拉多选组件
drawer: "drawer", // 抽屉弹层组件
notice: "notice", // 消息提示组件
step:"step", // 分布表单组件
tag:"tag", // 多标签页组件
popup:"popup", // 弹层封装
treetable:"treetable", // 树状表格
dtree:"dtree", // 树结构
tinymce:"tinymce/tinymce", // 编辑器
area:"area", // 省市级联
count:"count", // 数字滚动
topBar: "topBar", // 置顶组件
button: "button", // 加载按钮
design: "design", // 表单设计
card: "card", // 数据卡片组件
loading: "loading", // 加载组件
cropper:"cropper", // 裁剪组件
convert:"convert", // 数据转换
yaml:"yaml", // yaml 解析组件
context: "context", // 上下文组件
http: "http", // 网络请求组件
theme: "theme", // 主题转换
message: "message", // 通知组件
toast: "toast", // 消息通知
iconPicker: "iconPicker", // 图标选择
nprogress: "nprogress", // 进度过渡
watermark:"watermark/watermark", //水印组件
fullscreen:"fullscreen", //全屏组件
popover:"popover/popover" //汽泡组件
}).use(['layer', 'theme'], function () {
layui.theme.changeTheme(window, false);
});
admin: "admin",
page: "page",
tabPage: "tabPage",
menu: "menu",
fullscreen: "fullscreen",
messageCenter: "messageCenter",
menuSearch: "menuSearch",
button: "button",
tools: "tools",
popup: "extends/popup",
count: "extends/count",
toast: "extends/toast",
nprogress: "extends/nprogress",
echarts: "extends/echarts",
echartsTheme: "extends/echartsTheme",
yaml: "extends/yaml",
dtree: "dtree"
}).use([], function () { });