更新前端
@@ -102,4 +102,4 @@
|
|||||||
50% {
|
50% {
|
||||||
transform: scale(1.2, 1);
|
transform: scale(1.2, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,4 +118,4 @@
|
|||||||
margin-top: -30px;
|
margin-top: -30px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
@@ -90,6 +90,7 @@ body {
|
|||||||
float: right;
|
float: right;
|
||||||
height: 42px;
|
height: 42px;
|
||||||
border: #e6e6e6 1px solid;
|
border: #e6e6e6 1px solid;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width:768px){
|
@media (max-width:768px){
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #eee;border-left-width:6px;background-color:#FAFAFA;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:40px;line-height:40px;border-bottom:1px solid #eee}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 10px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view .layui-code-ol li:first-child{padding-top:10px}.layui-code-view .layui-code-ol li:last-child{padding-bottom:10px}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}.layui-code-demo .layui-code{visibility:visible!important;margin:-15px;border-top:none;border-right:none;border-bottom:none}.layui-code-demo .layui-tab-content{padding:15px;border-top:none}
|
|
||||||
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 701 B |
|
Before Width: | Height: | Size: 1.7 KiB |
@@ -28,8 +28,6 @@
|
|||||||
|
|
||||||
<glyph glyph-name="clear" unicode="" d="M508.412288-59.874413000000004c-246.585071 0-447.224718 200.684672-447.224718 447.441659 0 246.738567 200.639646 447.448822 447.224718 447.448822 246.622934 0 447.2503-200.710254 447.2503-447.448822C955.661565 140.81025899999997 755.035222-59.874413000000004 508.412288-59.874413000000004zM685.286672 527.07151l-45.177945 45.215808L504.588193 436.690036 369.06766 572.287317l-45.184085-45.215808 135.520533-135.591141L323.883575 255.88411099999996l45.184085-45.184085 135.520533 135.583978 135.520533-135.583978 45.177945 45.184085L549.766139 391.480368 685.286672 527.07151z" horiz-adv-x="1024" />
|
<glyph glyph-name="clear" unicode="" d="M508.412288-59.874413000000004c-246.585071 0-447.224718 200.684672-447.224718 447.441659 0 246.738567 200.639646 447.448822 447.224718 447.448822 246.622934 0 447.2503-200.710254 447.2503-447.448822C955.661565 140.81025899999997 755.035222-59.874413000000004 508.412288-59.874413000000004zM685.286672 527.07151l-45.177945 45.215808L504.588193 436.690036 369.06766 572.287317l-45.184085-45.215808 135.520533-135.591141L323.883575 255.88411099999996l45.184085-45.184085 135.520533 135.583978 135.520533-135.583978 45.177945 45.184085L549.766139 391.480368 685.286672 527.07151z" horiz-adv-x="1024" />
|
||||||
|
|
||||||
<glyph glyph-name="keyboard" unicode="" d="M928.67 689.56H95.33A83.42 83.42 0 0 1 12 606.22v-444.44a83.42 83.42 0 0 1 83.33-83.33h833.34a83.42 83.42 0 0 1 83.33 83.33V606.22a83.42 83.42 0 0 1-83.33 83.34z m27.78-527.78A27.8 27.8 0 0 0 928.67 134H95.33a27.8 27.8 0 0 0-27.78 27.78V606.22A27.8 27.8 0 0 0 95.33 634h833.34a27.8 27.8 0 0 0 27.78-27.78zM845.33 272.89H178.67a27.78 27.78 0 0 1 0-55.56h666.66a27.78 27.78 0 0 1 0 55.56zM178.67 356.22H262a27.78 27.78 0 1 1 0 55.56h-83.33a27.78 27.78 0 0 1 0-55.56zM373.11 356.22h83.33a27.78 27.78 0 0 1 0 55.56h-83.33a27.78 27.78 0 0 1 0-55.56zM567.56 356.22h83.33a27.78 27.78 0 0 1 0 55.56h-83.33a27.78 27.78 0 0 1 0-55.56zM845.33 411.78H762a27.78 27.78 0 1 1 0-55.56h83.33a27.78 27.78 0 0 1 0 55.56zM178.67 495.11H262a27.78 27.78 0 1 1 0 55.56h-83.33a27.78 27.78 0 0 1 0-55.56zM373.11 495.11h83.33a27.78 27.78 0 0 1 0 55.56h-83.33a27.78 27.78 0 0 1 0-55.56zM567.56 495.11h83.33a27.78 27.78 0 0 1 0 55.56h-83.33a27.78 27.78 0 0 1 0-55.56zM845.33 550.6700000000001H762a27.78 27.78 0 1 1 0-55.56h83.33a27.78 27.78 0 0 1 0 55.56z" horiz-adv-x="1024" />
|
|
||||||
|
|
||||||
<glyph glyph-name="heart-fill" unicode="" d="M729.068827 776.44202c-94.686523 0-176.905082-48.314379-217.069851-118.640074-40.163745 70.325695-122.382305 118.640074-217.044268 118.640074-143.767358 0-229.665727-123.660414-229.665727-243.219417 0-283.128359 415.870616-527.841803 433.576883-538.126031 4.062526-2.363837 8.584516-3.538593 13.132088-3.538593 4.547573 0 9.070586 1.174756 13.132088 3.538593 17.706267 10.283204 433.576883 254.997672 433.576883 538.126031C958.708971 652.781606 872.811626 776.44202 729.068827 776.44202z" horiz-adv-x="1024" />
|
<glyph glyph-name="heart-fill" unicode="" d="M729.068827 776.44202c-94.686523 0-176.905082-48.314379-217.069851-118.640074-40.163745 70.325695-122.382305 118.640074-217.044268 118.640074-143.767358 0-229.665727-123.660414-229.665727-243.219417 0-283.128359 415.870616-527.841803 433.576883-538.126031 4.062526-2.363837 8.584516-3.538593 13.132088-3.538593 4.547573 0 9.070586 1.174756 13.132088 3.538593 17.706267 10.283204 433.576883 254.997672 433.576883 538.126031C958.708971 652.781606 872.811626 776.44202 729.068827 776.44202z" horiz-adv-x="1024" />
|
||||||
|
|
||||||
<glyph glyph-name="light" unicode="" d="M512 72c-172.313 0-312 139.687-312 312s139.687 312 312 312 312-139.687 312-312-139.687-312-312-312z m0 64c136.967 0 248 111.033 248 248 0 136.967-111.033 248-248 248-136.967 0-248-111.033-248-248 0-136.967 111.033-248 248-248z m0 696c17.673 0 32-14.327 32-32v-51c0-17.673-14.327-32-32-32-17.673 0-32 14.327-32 32V800c0 17.673 14.327 32 32 32z m0-785c17.673 0 32-14.327 32-32v-51c0-17.673-14.327-32-32-32-17.673 0-32 14.327-32 32v51c0 17.673 14.327 32 32 32z m325.945 11.055c-12.497-12.496-32.758-12.496-45.255 0l-36.063 36.063c-12.496 12.497-12.496 32.758 0 45.255 12.497 12.496 32.758 12.496 45.255 0l36.063-36.063c12.496-12.497 12.496-32.758 0-45.255z m-568 565c-12.497-12.496-32.758-12.496-45.255 0l-36.063 36.063c-12.496 12.497-12.496 32.758 0 45.255 12.497 12.496 32.758 12.496 45.255 0l36.063-36.063c12.496-12.497 12.496-32.758 0-45.255z m561 81.318c12.496-12.497 12.496-32.758 0-45.255l-36.063-36.063c-12.497-12.496-32.758-12.496-45.255 0-12.496 12.497-12.496 32.758 0 45.255l36.063 36.063c12.497 12.496 32.758 12.496 45.255 0z m-563.572-565c12.496-12.497 12.496-32.758 0-45.255l-36.063-36.063c-12.497-12.496-32.758-12.496-45.255 0-12.496 12.497-12.496 32.758 0 45.255l36.063 36.063c12.497 12.496 32.758 12.496 45.255 0zM960 384c0-17.673-14.327-32-32-32h-51c-17.673 0-32 14.327-32 32 0 17.673 14.327 32 32 32h51c17.673 0 32-14.327 32-32z m-781 0c0-17.673-14.327-32-32-32H96c-17.673 0-32 14.327-32 32 0 17.673 14.327 32 32 32h51c17.673 0 32-14.327 32-32z" horiz-adv-x="1024" />
|
<glyph glyph-name="light" unicode="" d="M512 72c-172.313 0-312 139.687-312 312s139.687 312 312 312 312-139.687 312-312-139.687-312-312-312z m0 64c136.967 0 248 111.033 248 248 0 136.967-111.033 248-248 248-136.967 0-248-111.033-248-248 0-136.967 111.033-248 248-248z m0 696c17.673 0 32-14.327 32-32v-51c0-17.673-14.327-32-32-32-17.673 0-32 14.327-32 32V800c0 17.673 14.327 32 32 32z m0-785c17.673 0 32-14.327 32-32v-51c0-17.673-14.327-32-32-32-17.673 0-32 14.327-32 32v51c0 17.673 14.327 32 32 32z m325.945 11.055c-12.497-12.496-32.758-12.496-45.255 0l-36.063 36.063c-12.496 12.497-12.496 32.758 0 45.255 12.497 12.496 32.758 12.496 45.255 0l36.063-36.063c12.496-12.497 12.496-32.758 0-45.255z m-568 565c-12.497-12.496-32.758-12.496-45.255 0l-36.063 36.063c-12.496 12.497-12.496 32.758 0 45.255 12.497 12.496 32.758 12.496 45.255 0l36.063-36.063c12.496-12.497 12.496-32.758 0-45.255z m561 81.318c12.496-12.497 12.496-32.758 0-45.255l-36.063-36.063c-12.497-12.496-32.758-12.496-45.255 0-12.496 12.497-12.496 32.758 0 45.255l36.063 36.063c12.497 12.496 32.758 12.496 45.255 0z m-563.572-565c12.496-12.497 12.496-32.758 0-45.255l-36.063-36.063c-12.497-12.496-32.758-12.496-45.255 0-12.496 12.497-12.496 32.758 0 45.255l36.063 36.063c12.497 12.496 32.758 12.496 45.255 0zM960 384c0-17.673-14.327-32-32-32h-51c-17.673 0-32 14.327-32 32 0 17.673 14.327 32 32 32h51c17.673 0 32-14.327 32-32z m-781 0c0-17.673-14.327-32-32-32H96c-17.673 0-32 14.327-32 32 0 17.673 14.327 32 32 32h51c17.673 0 32-14.327 32-32z" horiz-adv-x="1024" />
|
||||||
@@ -270,7 +268,7 @@
|
|||||||
|
|
||||||
<glyph glyph-name="edit" unicode="" d="M769.089 516.251l-125.896 125.89 62.974 62.947c20.866 20.838 54.652 20.838 75.517 0l50.353-50.351c20.865-20.865 20.865-54.703 0-75.567L769.089 516.251zM403.349 150.52700000000004L277.453 276.418 619.706 615.982 745.601 490.09ZM176.314 47.283000000000015L252.912 251.87699999999995 377.753 127.01199999999994Z" horiz-adv-x="1024" />
|
<glyph glyph-name="edit" unicode="" d="M769.089 516.251l-125.896 125.89 62.974 62.947c20.866 20.838 54.652 20.838 75.517 0l50.353-50.351c20.865-20.865 20.865-54.703 0-75.567L769.089 516.251zM403.349 150.52700000000004L277.453 276.418 619.706 615.982 745.601 490.09ZM176.314 47.283000000000015L252.912 251.87699999999995 377.753 127.01199999999994Z" horiz-adv-x="1024" />
|
||||||
|
|
||||||
<glyph glyph-name="delete" unicode="" d="M738.923 24.288h-451.956c-27.2 0-49.327 21.603-49.327 48.157v418.017c0 26.548 22.129 48.147 49.327 48.147h451.956c27.2 0 49.327-21.598 49.327-48.147v-418.017c0-26.555-22.129-48.157-49.327-48.157zM286.966 494.547c-4.447 0-7.168-2.644-7.168-4.084v-418.017c0-1.443 2.722-4.093 7.168-4.093h451.956c4.448 0 7.168 2.651 7.168 4.093v418.017c0 1.44-2.722 4.084-7.168 4.084h-451.956zM832.199 496.302h-640.401c-27.201 0-49.327 20.131-49.327 44.876v61.045c0 24.74 22.128 44.867 49.327 44.867h640.401c27.2 0 49.327-20.127 49.327-44.867v-61.045c0-24.744-22.129-44.876-49.327-44.876zM184.631 541.327c0.387-0.733 2.722-2.866 7.168-2.866h640.401c4.445 0 6.782 2.132 7.168 2.867v60.741c-0.393 0.736-2.733 2.863-7.168 2.863h-640.401c-4.437 0-6.776-2.128-7.168-2.863v-60.742zM600.748 605.354h-174.546c-27.201 0-49.327 20.13-49.327 44.876v10.736c0 24.74 22.128 44.867 49.327 44.867h174.546c27.2 0 49.327-20.126 49.327-44.867v-10.736c0-24.745-22.128-44.876-49.327-44.876zM419.034 650.378c0.387-0.733 2.722-2.865 7.168-2.865h174.546c4.446 0 6.782 2.131 7.168 2.865v10.432c-0.393 0.736-2.734 2.862-7.168 2.862h-174.546c-4.437 0-6.776-2.126-7.168-2.862v-10.432zM404.099 430.833h-30.097c-7.297 0-13.213-5.916-13.213-13.213v-272.34c0-7.297 5.916-13.212 13.213-13.212h30.098c7.297 0 13.212 5.916 13.212 13.212v272.341c0 7.297-5.916 13.213-13.212 13.213zM659.583 430.833h-30.097c-7.298 0-13.213-5.916-13.213-13.213v-272.34c0-7.297 5.917-13.212 13.213-13.212h30.097c7.297 0 13.212 5.916 13.212 13.212v272.341c0 7.297-5.916 13.213-13.212 13.213zM531.841 430.833h-30.098c-7.297 0-13.213-5.916-13.213-13.213v-272.34c0-7.297 5.917-13.212 13.213-13.212h30.098c7.297 0 13.212 5.916 13.212 13.212v272.341c0 7.297-5.916 13.213-13.212 13.213z" horiz-adv-x="1024" />
|
<glyph glyph-name="delete" unicode="" d="M724.7403125 66.76999999999998h-423.70875c-25.5 0-46.2440625 20.2528125-46.2440625 45.1471875v391.8909375c0 24.88875 20.7459375 45.1378125 46.2440625 45.1378125h423.70875c25.5 0 46.2440625-20.248125 46.2440625-45.1378125v-391.8909375c0-24.8953125-20.7459375-45.1471875-46.2440625-45.1471875zM301.030625 507.6378125c-4.1690625 0-6.72-2.47875-6.72-3.82875v-391.8909375c0-1.3528125 2.551875-3.8371875 6.72-3.8371875h423.70875c4.17 0 6.72 2.4853125 6.72 3.8371875v391.8909375c0 1.35-2.551875 3.82875-6.72 3.82875h-423.70875zM812.1865625 509.283125h-600.3759375c-25.5009375 0-46.2440625 18.8728125-46.2440625 42.07125v57.2296875c0 23.19375 20.745 42.0628125 46.2440625 42.0628125h600.3759375c25.5 0 46.2440625-18.8690625 46.2440625-42.0628125v-57.2296875c0-23.1975-20.7459375-42.07125-46.2440625-42.07125zM205.0915625 551.4940624999999c0.3628125-0.6871875 2.551875-2.686875 6.72-2.686875h600.3759375c4.1671875 0 6.358125 1.99875 6.72 2.6878125v56.9446875c-0.3684375 0.69-2.5621875 2.6840625-6.72 2.6840625h-600.3759375c-4.1596875 0-6.3525-1.995-6.72-2.6840625v-56.945625zM595.20125 611.5193750000001h-163.636875c-25.5009375 0-46.2440625 18.871875-46.2440625 42.07125v10.065c0 23.19375 20.745 42.0628125 46.2440625 42.0628125h163.636875c25.5 0 46.2440625-18.868125 46.2440625-42.0628125v-10.065c0-23.1984375-20.745-42.07125-46.2440625-42.07125zM424.844375 653.729375c0.3628125-0.6871875 2.551875-2.6859375 6.72-2.6859375h163.636875c4.168125 0 6.358125 1.9978125 6.72 2.6859375v9.78c-0.3684375 0.69-2.563125 2.683125-6.72 2.683125h-163.636875c-4.1596875 0-6.3525-1.993125-6.72-2.683125v-9.78zM410.8428125 447.9059375h-28.2159375c-6.8409375 0-12.3871875-5.54625-12.3871875-12.3871875v-255.31875c0-6.8409375 5.54625-12.38625 12.3871875-12.38625h28.216875c6.8409375 0 12.38625 5.54625 12.38625 12.38625v255.3196875c0 6.8409375-5.54625 12.3871875-12.38625 12.3871875zM650.3590625 447.9059375h-28.2159375c-6.841875 0-12.3871875-5.54625-12.3871875-12.3871875v-255.31875c0-6.8409375 5.5471875-12.38625 12.3871875-12.38625h28.2159375c6.8409375 0 12.38625 5.54625 12.38625 12.38625v255.3196875c0 6.8409375-5.54625 12.3871875-12.38625 12.3871875zM530.6009375 447.9059375h-28.216875c-6.8409375 0-12.3871875-5.54625-12.3871875-12.3871875v-255.31875c0-6.8409375 5.5471875-12.38625 12.3871875-12.38625h28.216875c6.8409375 0 12.38625 5.54625 12.38625 12.38625v255.3196875c0 6.8409375-5.54625 12.3871875-12.38625 12.3871875z" horiz-adv-x="1024" />
|
||||||
|
|
||||||
<glyph glyph-name="engine" unicode="" d="M422.214332 360.70413299999996L186.183684 360.70413299999996l0 46.568461 236.030648 0c10.379577 40.075407 46.47537 69.794509 89.785668 69.794509 51.432433 0 93.067103-41.657943 93.067103-93.067103C605.067103 332.56756700000005 563.40916 290.909624 512 290.909624 468.689703 290.909624 432.593909 320.65199900000005 422.214332 360.70413299999996L422.214332 360.70413299999996zM512 779.634098c-218.529658 0-395.634098-177.10444-395.634098-395.634098 0-218.529658 177.10444-395.634098 395.634098-395.634098 154.76275 0 288.417257 89.064217 353.440885 218.55293l101.398692-59.112389-23.063141-39.959044-62.161099 35.909613c-33.745261-51.595341-77.42792-96.115813-129.093079-129.744711l35.653614-61.765464-40.308133-23.295867-35.653614 61.765464c-53.620057-27.345298-113.360805-44.404109-176.894987-47.73209L535.319139-127.99706800000001l-46.568461 0 0 70.981412c-63.534182 3.327981-123.27493 20.386792-176.894987 47.73209l-35.653614-61.765464-40.308133 23.295867 35.653614 61.765464c-51.665159 33.628898-95.347818 78.149371-129.093079 129.744711l-62.161099-35.909613-23.295867 40.308133 62.114553 35.863067c-27.415116 53.550239-44.799743 113.104807-48.127724 176.685534L0.002932 360.70413299999996l0 46.568461 70.958139 0c3.327981 63.580727 20.712609 123.135295 48.127724 176.685534l-62.114553 35.863067 23.295867 40.308133 62.161099-35.909613c33.745261 51.595341 77.42792 96.115813 129.093079 129.744711l-35.653614 61.765464 40.308133 23.295867 35.653614-61.765464c53.620057 27.345298 113.360805 44.404109 176.894987 47.73209L488.727406 895.997068l46.568461 0 0-70.981412c63.534182-3.327981 123.27493-20.386792 176.894987-47.73209l35.653614 61.765464 40.308133-23.295867-35.653614-61.765464c51.665159-33.628898 95.347818-78.149371 129.093079-129.744711l62.161099 35.909613 23.063141-39.959044-101.398692-59.112389C800.417257 690.569881 666.76275 779.634098 512 779.634098L512 779.634098z" horiz-adv-x="1024" />
|
<glyph glyph-name="engine" unicode="" d="M422.214332 360.70413299999996L186.183684 360.70413299999996l0 46.568461 236.030648 0c10.379577 40.075407 46.47537 69.794509 89.785668 69.794509 51.432433 0 93.067103-41.657943 93.067103-93.067103C605.067103 332.56756700000005 563.40916 290.909624 512 290.909624 468.689703 290.909624 432.593909 320.65199900000005 422.214332 360.70413299999996L422.214332 360.70413299999996zM512 779.634098c-218.529658 0-395.634098-177.10444-395.634098-395.634098 0-218.529658 177.10444-395.634098 395.634098-395.634098 154.76275 0 288.417257 89.064217 353.440885 218.55293l101.398692-59.112389-23.063141-39.959044-62.161099 35.909613c-33.745261-51.595341-77.42792-96.115813-129.093079-129.744711l35.653614-61.765464-40.308133-23.295867-35.653614 61.765464c-53.620057-27.345298-113.360805-44.404109-176.894987-47.73209L535.319139-127.99706800000001l-46.568461 0 0 70.981412c-63.534182 3.327981-123.27493 20.386792-176.894987 47.73209l-35.653614-61.765464-40.308133 23.295867 35.653614 61.765464c-51.665159 33.628898-95.347818 78.149371-129.093079 129.744711l-62.161099-35.909613-23.295867 40.308133 62.114553 35.863067c-27.415116 53.550239-44.799743 113.104807-48.127724 176.685534L0.002932 360.70413299999996l0 46.568461 70.958139 0c3.327981 63.580727 20.712609 123.135295 48.127724 176.685534l-62.114553 35.863067 23.295867 40.308133 62.161099-35.909613c33.745261 51.595341 77.42792 96.115813 129.093079 129.744711l-35.653614 61.765464 40.308133 23.295867 35.653614-61.765464c53.620057 27.345298 113.360805 44.404109 176.894987 47.73209L488.727406 895.997068l46.568461 0 0-70.981412c63.534182-3.327981 123.27493-20.386792 176.894987-47.73209l35.653614 61.765464 40.308133-23.295867-35.653614-61.765464c51.665159-33.628898 95.347818-78.149371 129.093079-129.744711l62.161099 35.909613 23.063141-39.959044-101.398692-59.112389C800.417257 690.569881 666.76275 779.634098 512 779.634098L512 779.634098z" horiz-adv-x="1024" />
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 309 KiB After Width: | Height: | Size: 309 KiB |
@@ -1,4 +1,3 @@
|
|||||||
/** Buttom 默认*/
|
|
||||||
.pear-btn {
|
.pear-btn {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
line-height: 38px;
|
line-height: 38px;
|
||||||
@@ -36,22 +35,23 @@
|
|||||||
line-height: 37px;
|
line-height: 37px;
|
||||||
color: #fff !important
|
color: #fff !important
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Button 主题 */
|
/** Button 主题 */
|
||||||
.pear-btn-primary {
|
.pear-btn-primary {
|
||||||
|
border: 1px solid #2D8CF0;
|
||||||
background-color: #2D8CF0 !important;
|
background-color: #2D8CF0 !important;
|
||||||
border: #2D8CF0;
|
|
||||||
}
|
}
|
||||||
.pear-btn-danger {
|
.pear-btn-danger {
|
||||||
|
border: 1px solid #f56c6c;
|
||||||
background-color: #f56c6c !important;
|
background-color: #f56c6c !important;
|
||||||
border: #f56c6c;
|
|
||||||
}
|
}
|
||||||
.pear-btn-warming {
|
.pear-btn-warming {
|
||||||
|
border: 1px solid #f6ad55;
|
||||||
background-color: #f6ad55 !important;
|
background-color: #f6ad55 !important;
|
||||||
border: #f6ad55;
|
|
||||||
}
|
}
|
||||||
.pear-btn-success {
|
.pear-btn-success {
|
||||||
|
border: 1px solid #36b368;
|
||||||
background-color: #36b368 !important;
|
background-color: #36b368 !important;
|
||||||
border: #36b368;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pear-btn[round] {
|
.pear-btn[round] {
|
||||||
|
|||||||
@@ -25,9 +25,10 @@ textarea::-webkit-input-placeholder {
|
|||||||
border: #5FB878 1px solid!important;
|
border: #5FB878 1px solid!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layui-input[failure] {
|
.layui-input[failure],
|
||||||
box-shadow: 0px 0px 0px 3px #fef0f0 !important;
|
.layui-form-item .layui-form-danger:focus {
|
||||||
border: #F56C6C 1px solid;
|
box-shadow: 0px 0px 0px 3px #fef0f0 !important;
|
||||||
|
border: #F56C6C 1px solid!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layui-input,
|
.layui-input,
|
||||||
@@ -64,4 +65,10 @@ textarea::-webkit-input-placeholder {
|
|||||||
|
|
||||||
.layui-form-select dl::-webkit-scrollbar-corner {
|
.layui-form-select dl::-webkit-scrollbar-corner {
|
||||||
background: #f6f6f6;
|
background: #f6f6f6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* layui 2.6.9 样式变化 */
|
||||||
|
.layui-form-select dl dd.layui-this{
|
||||||
|
background-color: #F6F6F6;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
html:-moz-full-screen {
|
||||||
|
background: grey;
|
||||||
|
}
|
||||||
|
html:-webkit-full-screen {
|
||||||
|
background: grey;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
html:fullscreen{
|
||||||
|
background: grey;
|
||||||
|
width: 100% !important;
|
||||||
|
height: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
:not(:root):fullscreen::backdrop{
|
||||||
|
background:whitesmoke;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pear-full-screen {
|
||||||
|
width: 100% !important;
|
||||||
|
height: 100% !important;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
.layui-iconpicker {
|
||||||
|
width: 295px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layui-iconpicker .layui-iconpicker-search .layui-input:focus{
|
||||||
|
box-shadow: none!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layui-iconpicker-search .layui-icon {
|
||||||
|
top: 8px;
|
||||||
|
}
|
||||||
@@ -1,4 +1,324 @@
|
|||||||
.layui-layer-msg{
|
.layui-layer-msg {
|
||||||
border-color: transparent!important;
|
border-color: transparent !important;
|
||||||
box-shadow: 2px 0 6px rgb(0 21 41 / 0.05)!important;
|
box-shadow: 2px 0 6px rgb(0 21 41 / 0.04) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 扩展动画开始 */
|
||||||
|
.pear-drawer.layui-layer {
|
||||||
|
border-radius: 0 !important;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pear-drawer.layui-layer.position-absolute {
|
||||||
|
position: absolute !important;
|
||||||
|
}
|
||||||
|
.pear-drawer-anim,
|
||||||
|
.pear-drawer-anim.layui-anim {
|
||||||
|
-webkit-animation-duration: .3s;
|
||||||
|
animation-duration: .3s;
|
||||||
|
-webkit-animation-timing-function: cubic-bezier(0.7, 0.3, 0.1, 1);
|
||||||
|
animation-timing-function: cubic-bezier(0.7, 0.3, 0.1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* right to left */
|
||||||
|
@keyframes layer-rl {
|
||||||
|
from {
|
||||||
|
-webkit-transform: translate3d(100%, 0, 0);
|
||||||
|
-ms-transform: translate3d(100%, 0, 0);
|
||||||
|
transform: translate3d(100%, 0, 0);
|
||||||
|
opacity: 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
|
-ms-transform: translate3d(0, 0, 0);
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes layer-rl {
|
||||||
|
from {
|
||||||
|
-webkit-transform: translate3d(100%, 0, 0);
|
||||||
|
-ms-transform: translate3d(100%, 0, 0);
|
||||||
|
transform: translate3d(100%, 0, 0);
|
||||||
|
opacity: 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
|
-ms-transform: translate3d(0, 0, 0);
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-anim-rl {
|
||||||
|
-webkit-animation-name: layer-rl;
|
||||||
|
animation-name: layer-rl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* right to left close */
|
||||||
|
@keyframes layer-rl-close {
|
||||||
|
from {
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
|
-ms-transform: translate3d(0, 0, 0);
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
-webkit-transform: translate3d(100%, 0, 0);
|
||||||
|
-ms-transform: translate3d(100%, 0, 0);
|
||||||
|
transform: translate3d(100%, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes layer-rl-close {
|
||||||
|
from {
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
|
-ms-transform: translate3d(0, 0, 0);
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
-webkit-transform: translate3d(100%, 0, 0);
|
||||||
|
-ms-transform: translate3d(100%, 0, 0);
|
||||||
|
transform: translate3d(100%, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-anim-rl-close,
|
||||||
|
.layer-anim-rl.layer-anim-close {
|
||||||
|
-webkit-animation-name: layer-rl-close;
|
||||||
|
animation-name: layer-rl-close;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* left to right */
|
||||||
|
@-webkit-keyframes layer-lr {
|
||||||
|
from {
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
|
-ms-transform: translate3d(0, 0, 0);
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
-webkit-transform: translate3d(-100%, 0, 0);
|
||||||
|
-ms-transform: translate3d(-100%, 0, 0);
|
||||||
|
transform: translate3d(-100%, 0, 0);
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes layer-lr {
|
||||||
|
from {
|
||||||
|
-webkit-transform: translate3d(-100%, 0, 0);
|
||||||
|
-ms-transform: translate3d(-100%, 0, 0);
|
||||||
|
transform: translate3d(-100%, 0, 0);
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
|
-ms-transform: translate3d(0, 0, 0);
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-anim-lr {
|
||||||
|
-webkit-animation-name: layer-lr;
|
||||||
|
animation-name: layer-lr
|
||||||
|
}
|
||||||
|
|
||||||
|
/* left to right close */
|
||||||
|
@-webkit-keyframes layer-lr-close {
|
||||||
|
from {
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
|
-ms-transform: translate3d(0, 0, 0);
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
-webkit-transform: translate3d(-100%, 0, 0);
|
||||||
|
-ms-transform: translate3d(-100%, 0, 0);
|
||||||
|
transform: translate3d(-100%, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes layer-lr-close {
|
||||||
|
from {
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
|
-ms-transform: translate3d(0, 0, 0);
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
-webkit-transform: translate3d(-100%, 0, 0);
|
||||||
|
-ms-transform: translate3d(-100%, 0, 0);
|
||||||
|
transform: translate3d(-100%, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-anim-lr-close,
|
||||||
|
.layer-anim-lr.layer-anim-close {
|
||||||
|
-webkit-animation-name: layer-lr-close;
|
||||||
|
animation-name: layer-lr-close
|
||||||
|
}
|
||||||
|
|
||||||
|
/* top to bottom */
|
||||||
|
@-webkit-keyframes layer-tb {
|
||||||
|
from {
|
||||||
|
-webkit-transform: translate3d(0, -100%, 0);
|
||||||
|
-ms-transform: translate3d(0, -100%, 0);
|
||||||
|
transform: translate3d(0, -100%, 0);
|
||||||
|
opacity: 1;
|
||||||
|
animation-timing-function: cubic-bezier(0.7, 0.3, 0.1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
|
-ms-transform: translate3d(0, 0, 0);
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
opacity: 1;
|
||||||
|
animation-timing-function: cubic-bezier(0.7, 0.3, 0.1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes layer-tb {
|
||||||
|
from {
|
||||||
|
-webkit-transform: translate3d(0, -100%, 0);
|
||||||
|
-ms-transform: translate3d(0, -100%, 0);
|
||||||
|
transform: translate3d(0, -100%, 0);
|
||||||
|
opacity: 1;
|
||||||
|
animation-timing-function: cubic-bezier(0.7, 0.3, 0.1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
|
-ms-transform: translate3d(0, 0, 0);
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
opacity: 1;
|
||||||
|
animation-timing-function: cubic-bezier(0.7, 0.3, 0.1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-anim-tb {
|
||||||
|
-webkit-animation-name: layer-tb;
|
||||||
|
animation-name: layer-tb
|
||||||
|
}
|
||||||
|
|
||||||
|
/* top to bottom close */
|
||||||
|
@-webkit-keyframes layer-tb-close {
|
||||||
|
from {
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
|
-ms-transform: translate3d(0, 0, 0);
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
-webkit-transform: translate3d(0, -100%, 0);
|
||||||
|
-ms-transform: translate3d(0, -100%, 0);
|
||||||
|
transform: translate3d(0, -100%, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes layer-tb-close {
|
||||||
|
from {
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
|
-ms-transform: translate3d(0, 0, 0);
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
-webkit-transform: translate3d(0, -100%, 0);
|
||||||
|
-ms-transform: translate3d(0, -100%, 0);
|
||||||
|
transform: translate3d(0, -100%, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-anim-tb-close,
|
||||||
|
.layer-anim-tb.layer-anim-close {
|
||||||
|
-webkit-animation-name: layer-tb-close;
|
||||||
|
animation-name: layer-tb-close
|
||||||
|
}
|
||||||
|
|
||||||
|
/* bottom to top */
|
||||||
|
@-webkit-keyframes layer-bt {
|
||||||
|
from {
|
||||||
|
-webkit-transform: translate3d(0, 100%, 0);
|
||||||
|
-ms-transform: translate3d(0, 100%, 0);
|
||||||
|
transform: translate3d(0, 100%, 0);
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
|
-ms-transform: translate3d(0, 0, 0);
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes layer-bt {
|
||||||
|
from {
|
||||||
|
-webkit-transform: translate3d(0, 100%, 0);
|
||||||
|
-ms-transform: translate3d(0, 100%, 0);
|
||||||
|
transform: translate3d(0, 100%, 0);
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
|
-ms-transform: translate3d(0, 0, 0);
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-anim-bt {
|
||||||
|
-webkit-animation-name: layer-bt;
|
||||||
|
animation-name: layer-bt
|
||||||
|
}
|
||||||
|
|
||||||
|
/* bottom to top close */
|
||||||
|
@-webkit-keyframes layer-bt-close {
|
||||||
|
from {
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
|
-ms-transform: translate3d(0, 0, 0);
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
-webkit-transform: translate3d(0, 100%, 0);
|
||||||
|
-ms-transform: translate3d(0, 100%, 0);
|
||||||
|
transform: translate3d(0, 100%, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes layer-bt-close {
|
||||||
|
from {
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
|
-ms-transform: translate3d(0, 0, 0);
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
-webkit-transform: translate3d(0, 100%, 0);
|
||||||
|
-ms-transform: translate3d(0, 100%, 0);
|
||||||
|
transform: translate3d(0, 100%, 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-anim-bt-close,
|
||||||
|
.layer-anim-bt.layer-anim-close {
|
||||||
|
-webkit-animation-name: layer-bt-close;
|
||||||
|
animation-name: layer-bt-close
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 扩展动画结束 */
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
.pear-container {
|
.pear-container {
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
background-color: whitesmoke;
|
background-color: whitesmoke;
|
||||||
|
width: calc(100vw - 20px);
|
||||||
}
|
}
|
||||||
|
|
||||||
body::-webkit-scrollbar {
|
body::-webkit-scrollbar {
|
||||||
|
|||||||
@@ -28,11 +28,6 @@
|
|||||||
width: 230px;
|
width: 230px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pear-nav-tree .layui-nav-child {
|
|
||||||
padding-top: 5px;
|
|
||||||
padding-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pear-nav-tree .layui-nav-child dd.layui-this,
|
.pear-nav-tree .layui-nav-child dd.layui-this,
|
||||||
.layui-nav-tree .layui-nav-child dd.layui-this a,
|
.layui-nav-tree .layui-nav-child dd.layui-this a,
|
||||||
.layui-nav-tree .layui-this,
|
.layui-nav-tree .layui-this,
|
||||||
@@ -133,15 +128,23 @@
|
|||||||
|
|
||||||
/** 隐 藏 后 子 级 悬 浮 菜 单 */
|
/** 隐 藏 后 子 级 悬 浮 菜 单 */
|
||||||
.pear-nav-tree .layui-nav-hover {
|
.pear-nav-tree .layui-nav-hover {
|
||||||
|
position: fixed;
|
||||||
|
min-width: 130px;
|
||||||
|
padding: 4px;
|
||||||
|
display: block !important;
|
||||||
|
background: transparent !important;
|
||||||
|
}
|
||||||
|
.pear-nav-tree .layui-nav-hover:before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
right: 4px;
|
||||||
|
left: 4px;
|
||||||
|
bottom: 0;
|
||||||
|
top: 0;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background-color: #28333E;
|
background-color: #28333E;
|
||||||
display: block;
|
display: block;
|
||||||
position: fixed;
|
|
||||||
min-width: 130px;
|
|
||||||
margin-left: 62px;
|
|
||||||
padding-top: 4px !important;
|
|
||||||
padding-bottom: 4px !important;
|
|
||||||
box-shadow: 0px 0px 3px lightgray;
|
box-shadow: 0px 0px 3px lightgray;
|
||||||
}
|
}
|
||||||
.pear-nav-tree .layui-nav-hover a span {
|
.pear-nav-tree .layui-nav-hover a span {
|
||||||
@@ -151,7 +154,7 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.pear-nav-tree .layui-nav-child dd a span {
|
.pear-nav-tree .layui-nav-child dd a span {
|
||||||
margin-left: 30px !important;
|
margin-left: 26px !important;
|
||||||
}
|
}
|
||||||
.pear-nav-tree .layui-nav-child dd a i {
|
.pear-nav-tree .layui-nav-child dd a i {
|
||||||
display: none;
|
display: none;
|
||||||
@@ -159,10 +162,11 @@
|
|||||||
.pear-nav-tree .layui-nav-hover dd a span {
|
.pear-nav-tree .layui-nav-hover dd a span {
|
||||||
margin-left: 0px !important;
|
margin-left: 0px !important;
|
||||||
}
|
}
|
||||||
|
.pear-nav-tree dl {
|
||||||
|
padding-top: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
/** 亮 样 式*/
|
/** 亮 样 式*/
|
||||||
|
|
||||||
/** 亮 样 式*/
|
|
||||||
|
|
||||||
.dark-theme .layui-nav-tree{
|
.dark-theme .layui-nav-tree{
|
||||||
background-color: #28333E!important;
|
background-color: #28333E!important;
|
||||||
}
|
}
|
||||||
@@ -172,6 +176,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.light-theme .pear-nav-tree,
|
.light-theme .pear-nav-tree,
|
||||||
|
.light-theme .pear-nav-tree .layui-nav-hover:before,
|
||||||
.light-theme .pear-nav-tree .layui-nav-child{
|
.light-theme .pear-nav-tree .layui-nav-child{
|
||||||
background-color: white!important;
|
background-color: white!important;
|
||||||
}
|
}
|
||||||
@@ -187,11 +192,6 @@
|
|||||||
border-bottom-color: dimgray!important;
|
border-bottom-color: dimgray!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.light-theme .pear-nav-tree .layui-nav-child{
|
|
||||||
padding-top: 0px;
|
|
||||||
padding-bottom: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.light-theme .pear-nav-tree .layui-this a,
|
.light-theme .pear-nav-tree .layui-this a,
|
||||||
.light-theme .pear-nav-tree .layui-this{
|
.light-theme .pear-nav-tree .layui-this{
|
||||||
color: white!important;
|
color: white!important;
|
||||||
@@ -247,10 +247,21 @@
|
|||||||
width: 12px;
|
width: 12px;
|
||||||
text-align: center;
|
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);
|
||||||
|
-ms-transform: rotate(270deg);
|
||||||
|
-moz-transform: rotate(270deg);
|
||||||
|
-webkit-transform: rotate(270deg);
|
||||||
|
-o-transform: rotate(270deg);
|
||||||
|
width: 12px;
|
||||||
|
text-align: center;
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pear-nav-tree.arrow .layui-nav-child.layui-nav-hover>a>.layui-nav-more:before,
|
||||||
.pear-nav-tree.arrow .layui-nav-itemed>a>.layui-nav-more:before {
|
.pear-nav-tree.arrow .layui-nav-itemed>a>.layui-nav-more:before {
|
||||||
content: '\e61a';
|
content: '\e61a';
|
||||||
background-color: transparent;
|
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.pear-notice .layui-tab-title {
|
.pear-notice .layui-tab-title {
|
||||||
|
display: flex;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border-right: 1px solid whitesmoke;
|
border-right: 1px solid whitesmoke;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pear-notice .layui-tab-title li {
|
||||||
|
flex: 1;
|
||||||
|
text-align: center;
|
||||||
|
border-right: 1px solid whitesmoke;
|
||||||
|
}
|
||||||
|
/*排除最后一个 li 右边框*/
|
||||||
|
.pear-notice .layui-tab-title li:last-child {
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
|
||||||
.pear-notice * {
|
.pear-notice * {
|
||||||
color: dimgray !important;
|
color: dimgray !important;
|
||||||
}
|
}
|
||||||
@@ -70,3 +81,53 @@
|
|||||||
.pear-notice *::-webkit-scrollbar-corner {
|
.pear-notice *::-webkit-scrollbar-corner {
|
||||||
background: #f6f6f6;
|
background: #f6f6f6;
|
||||||
}
|
}
|
||||||
|
/** 增加 empty 样式 */
|
||||||
|
.pear-empty {
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.5715;
|
||||||
|
min-height: 200px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.pear-empty-normal {
|
||||||
|
margin: 32px 0;
|
||||||
|
color: #00000040;
|
||||||
|
}
|
||||||
|
.pear-empty-normal .pear-empty-image {
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pear-empty-image {
|
||||||
|
height: 100px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
.pear-empty-image svg {
|
||||||
|
height: 100%;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pear-empty-img-simple-g {
|
||||||
|
stroke: #d9d9d9;
|
||||||
|
}
|
||||||
|
.pear-empty-img-default-g {
|
||||||
|
fill: #fff;
|
||||||
|
}
|
||||||
|
.pear-empty-img-simple-path {
|
||||||
|
fill: #fafafa;
|
||||||
|
}
|
||||||
|
.pear-empty-img-default-path-1 {
|
||||||
|
fill: #aeb8c2;
|
||||||
|
}
|
||||||
|
.pear-empty-img-default-path-2 {
|
||||||
|
fill: url(#linearGradient-1);
|
||||||
|
}
|
||||||
|
.pear-empty-img-default-path-3 {
|
||||||
|
fill: #f5f5f7;
|
||||||
|
}
|
||||||
|
.pear-empty-img-default-path-4, .pear-empty-img-default-path-5 {
|
||||||
|
fill: #dce0e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
/* Make clicks pass-through */
|
||||||
|
#nprogress {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nprogress .bar {
|
||||||
|
background: #29d;
|
||||||
|
|
||||||
|
position: fixed;
|
||||||
|
z-index: 999999;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
height: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fancy blur effect */
|
||||||
|
#nprogress .peg {
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
right: 0px;
|
||||||
|
width: 100px;
|
||||||
|
height: 100%;
|
||||||
|
box-shadow: 0 0 10px #29d, 0 0 5px #29d;
|
||||||
|
opacity: 1.0;
|
||||||
|
|
||||||
|
-webkit-transform: rotate(3deg) translate(0px, -4px);
|
||||||
|
-ms-transform: rotate(3deg) translate(0px, -4px);
|
||||||
|
transform: rotate(3deg) translate(0px, -4px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remove these to get rid of the spinner */
|
||||||
|
#nprogress .spinner {
|
||||||
|
display: block;
|
||||||
|
position: fixed;
|
||||||
|
z-index: 1031;
|
||||||
|
top: 15px;
|
||||||
|
right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nprogress .spinner-icon {
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
border: solid 2px transparent;
|
||||||
|
border-top-color: #29d;
|
||||||
|
border-left-color: #29d;
|
||||||
|
border-radius: 50%;
|
||||||
|
|
||||||
|
-webkit-animation: nprogress-spinner 400ms linear infinite;
|
||||||
|
animation: nprogress-spinner 400ms linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nprogress-custom-parent {
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nprogress-custom-parent #nprogress .spinner,
|
||||||
|
.nprogress-custom-parent #nprogress .bar {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes nprogress-spinner {
|
||||||
|
0% { -webkit-transform: rotate(0deg); }
|
||||||
|
100% { -webkit-transform: rotate(360deg); }
|
||||||
|
}
|
||||||
|
@keyframes nprogress-spinner {
|
||||||
|
0% { transform: rotate(0deg); }
|
||||||
|
100% { transform: rotate(360deg); }
|
||||||
|
}
|
||||||
@@ -439,13 +439,13 @@ div[xm-select-skin=default].xm-form-selected .xm-select:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
div[xm-select-skin=primary] .xm-select-title div.xm-select-label>span {
|
div[xm-select-skin=primary] .xm-select-title div.xm-select-label>span {
|
||||||
background-color: #5FB878!important
|
background-color: #5FB878!important;
|
||||||
color: #FFF;
|
color: #FFF;
|
||||||
border: 1px solid #5FB878!important
|
border: 1px solid #5FB878!important
|
||||||
}
|
}
|
||||||
|
|
||||||
div[xm-select-skin=primary] .xm-select-title div.xm-select-label>span i {
|
div[xm-select-skin=primary] .xm-select-title div.xm-select-label>span i {
|
||||||
background-color: #5FB878!important
|
background-color: #5FB878!important;
|
||||||
color: #FFF
|
color: #FFF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,7 +517,7 @@ div[xm-select-skin=danger] .xm-select-title div.xm-select-label>span {
|
|||||||
}
|
}
|
||||||
|
|
||||||
div[xm-select-skin=danger] .xm-select-title div.xm-select-label>span i {
|
div[xm-select-skin=danger] .xm-select-title div.xm-select-label>span i {
|
||||||
background-color:#f56c6c!important
|
background-color:#f56c6c!important;
|
||||||
color: #FFF
|
color: #FFF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -820,8 +820,3 @@ div[xm-select-search-type="1"] .xm-select .xm-select-input {
|
|||||||
.icon-expand:before {
|
.icon-expand:before {
|
||||||
content: "\e641";
|
content: "\e641";
|
||||||
}
|
}
|
||||||
|
|
||||||
.xm-select-parent .xm-form-select dl{
|
|
||||||
position: relative;
|
|
||||||
top: 5px!important;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -47,7 +47,6 @@
|
|||||||
border-right: 1px solid whitesmoke;
|
border-right: 1px solid whitesmoke;
|
||||||
color: dimgray;
|
color: dimgray;
|
||||||
font-size: 13.5px;
|
font-size: 13.5px;
|
||||||
line-height: 43px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pear-tab .layui-tab-title .layui-tab-bar {
|
.pear-tab .layui-tab-title .layui-tab-bar {
|
||||||
|
|||||||
@@ -17,6 +17,11 @@
|
|||||||
border: none !important;
|
border: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 兼容 layui 2.7.0 升级 table cell 单元格边距的调整 */
|
||||||
|
.layui-table-view .layui-table td, .layui-table-view .layui-table th {
|
||||||
|
padding: 5px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
.layui-table-cell {
|
.layui-table-cell {
|
||||||
height: 34px;
|
height: 34px;
|
||||||
line-height: 34px;
|
line-height: 34px;
|
||||||
@@ -24,13 +29,10 @@
|
|||||||
|
|
||||||
.layui-table .layui-laypage .layui-laypage-curr .layui-laypage-em {
|
.layui-table .layui-laypage .layui-laypage-curr .layui-laypage-em {
|
||||||
border-radius: 50px !important;
|
border-radius: 50px !important;
|
||||||
|
border-radius: 4px!important;
|
||||||
background-color: #5FB878 !important;
|
background-color: #5FB878 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layui-table-view .layui-table{
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layui-table tr {
|
.layui-table tr {
|
||||||
height: 34px;
|
height: 34px;
|
||||||
line-height: 34px;
|
line-height: 34px;
|
||||||
@@ -53,6 +55,14 @@
|
|||||||
font-size: 15px !important;
|
font-size: 15px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.layui-table-cell .pear-btn {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layui-table-cell .pear-btn:last-child {
|
||||||
|
margin-right: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
.layui-table-page {
|
.layui-table-page {
|
||||||
height: 45px !important;
|
height: 45px !important;
|
||||||
padding-top: 10px !important;
|
padding-top: 10px !important;
|
||||||
@@ -68,6 +78,12 @@
|
|||||||
.layui-table-view .layui-table[lay-skin=line] {
|
.layui-table-view .layui-table[lay-skin=line] {
|
||||||
border: none !important;
|
border: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.layui-table-init .layui-icon{
|
||||||
|
font-size: 40px !important;
|
||||||
|
margin: -15px 0 0 -15px;
|
||||||
|
}
|
||||||
|
|
||||||
.layui-table-body::-webkit-scrollbar {
|
.layui-table-body::-webkit-scrollbar {
|
||||||
width: 0px;
|
width: 0px;
|
||||||
height: 0px;
|
height: 0px;
|
||||||
|
|||||||
@@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
@import url("module/dtree/font/dtreefont.css");
|
@import url("module/dtree/font/dtreefont.css");
|
||||||
@import url("module/dtree/dtree.css");
|
@import url("module/dtree/dtree.css");
|
||||||
|
@import url("module/iconPicker.css");
|
||||||
@import url("module/treetable.css");
|
@import url("module/treetable.css");
|
||||||
|
@import url("module/nprogress.css");
|
||||||
@import url("module/message.css");
|
@import url("module/message.css");
|
||||||
@import url("module/cropper.css");
|
@import url("module/cropper.css");
|
||||||
@import url("module/loading.css");
|
@import url("module/loading.css");
|
||||||
@@ -23,4 +25,6 @@
|
|||||||
@import url("module/step.css");
|
@import url("module/step.css");
|
||||||
@import url("module/card.css");
|
@import url("module/card.css");
|
||||||
@import url("module/tab.css");
|
@import url("module/tab.css");
|
||||||
@import url("module/tag.css");
|
@import url("module/tag.css");
|
||||||
|
@import url("module/fullscreen.css");
|
||||||
|
@import url("module/popover.min.css");
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'menu', 'frame', 'theme', 'convert'],
|
layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'menu', 'frame', 'theme', 'convert','fullscreen'],
|
||||||
function(exports) {
|
function(exports) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@@ -11,7 +11,8 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
pearMenu = layui.menu,
|
pearMenu = layui.menu,
|
||||||
pearFrame = layui.frame,
|
pearFrame = layui.frame,
|
||||||
pearTheme = layui.theme,
|
pearTheme = layui.theme,
|
||||||
message = layui.message;
|
message = layui.message,
|
||||||
|
fullscreen=layui.fullscreen;
|
||||||
|
|
||||||
var bodyFrame;
|
var bodyFrame;
|
||||||
var sideMenu;
|
var sideMenu;
|
||||||
@@ -19,7 +20,6 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
var config;
|
var config;
|
||||||
var logout = function() {};
|
var logout = function() {};
|
||||||
var msgInstance;
|
var msgInstance;
|
||||||
|
|
||||||
var body = $('body');
|
var body = $('body');
|
||||||
|
|
||||||
var pearAdmin = new function() {
|
var pearAdmin = new function() {
|
||||||
@@ -93,8 +93,9 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
compatible();
|
compatible();
|
||||||
},
|
},
|
||||||
done: function() {
|
done: function() {
|
||||||
|
sideMenu.isCollapse = param.menu.collapse;
|
||||||
sideMenu.selectItem(param.menu.select);
|
sideMenu.selectItem(param.menu.select);
|
||||||
pearAdmin.collaspe(param);
|
pearAdmin.collapse(param);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -115,6 +116,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
session: param.tab.session,
|
session: param.tab.session,
|
||||||
index: 0,
|
index: 0,
|
||||||
tabMax: param.tab.max,
|
tabMax: param.tab.max,
|
||||||
|
preload: param.tab.preload,
|
||||||
closeEvent: function(id) {
|
closeEvent: function(id) {
|
||||||
sideMenu.selectItem(id);
|
sideMenu.selectItem(id);
|
||||||
},
|
},
|
||||||
@@ -150,9 +152,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
icon: data.menuIcon,
|
icon: data.menuIcon,
|
||||||
close: true
|
close: true
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|
||||||
compatible();
|
compatible();
|
||||||
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
bodyFrame = pearFrame.render({
|
bodyFrame = pearFrame.render({
|
||||||
@@ -187,7 +187,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
localStorage.setItem("theme-color-color", currentColor.color);
|
localStorage.setItem("theme-color-color", currentColor.color);
|
||||||
localStorage.setItem("theme-color-second", currentColor.second);
|
localStorage.setItem("theme-color-second", currentColor.second);
|
||||||
pearTheme.changeTheme(window, isAutoHead(config));
|
pearTheme.changeTheme(window, isAutoHead(config));
|
||||||
|
|
||||||
var menu = localStorage.getItem("theme-menu");
|
var menu = localStorage.getItem("theme-menu");
|
||||||
if (menu === null) {
|
if (menu === null) {
|
||||||
menu = option.theme.defaultMenu;
|
menu = option.theme.defaultMenu;
|
||||||
@@ -196,7 +196,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
menu = option.theme.defaultMenu;
|
menu = option.theme.defaultMenu;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var header = localStorage.getItem("theme-header");
|
var header = localStorage.getItem("theme-header");
|
||||||
if (header === null) {
|
if (header === null) {
|
||||||
header = option.theme.defaultHeader;
|
header = option.theme.defaultHeader;
|
||||||
@@ -205,7 +205,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
header = option.theme.defaultHeader;
|
header = option.theme.defaultHeader;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var banner = localStorage.getItem("theme-banner");
|
var banner = localStorage.getItem("theme-banner");
|
||||||
if (banner === null) {
|
if (banner === null) {
|
||||||
banner = option.theme.banner;
|
banner = option.theme.banner;
|
||||||
@@ -214,7 +214,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
banner = option.theme.banner;
|
banner = option.theme.banner;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var autoHead = localStorage.getItem("auto-head");
|
var autoHead = localStorage.getItem("auto-head");
|
||||||
if (autoHead === null) {
|
if (autoHead === null) {
|
||||||
autoHead = option.other.autoHead;
|
autoHead = option.other.autoHead;
|
||||||
@@ -223,7 +223,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
autoHead = option.other.autoHead;
|
autoHead = option.other.autoHead;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var muiltTab = localStorage.getItem("muilt-tab");
|
var muiltTab = localStorage.getItem("muilt-tab");
|
||||||
if (muiltTab === null) {
|
if (muiltTab === null) {
|
||||||
muiltTab = option.tab.enable;
|
muiltTab = option.tab.enable;
|
||||||
@@ -232,7 +232,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
muiltTab = option.tab.enable;
|
muiltTab = option.tab.enable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var control = localStorage.getItem("control");
|
var control = localStorage.getItem("control");
|
||||||
if (control === null) {
|
if (control === null) {
|
||||||
control = option.menu.control;
|
control = option.menu.control;
|
||||||
@@ -241,30 +241,53 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
control = option.menu.control;
|
control = option.menu.control;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
localStorage.setItem("muilt-tab",muiltTab);
|
var footer = localStorage.getItem("footer");
|
||||||
|
if( footer === null) {
|
||||||
|
footer = option.other.footer;
|
||||||
|
}else{
|
||||||
|
if (option.theme.allowCustom === false) {
|
||||||
|
footer = option.other.footer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
localStorage.setItem("muilt-tab", muiltTab);
|
||||||
localStorage.setItem("theme-banner", banner);
|
localStorage.setItem("theme-banner", banner);
|
||||||
localStorage.setItem("theme-menu", menu);
|
localStorage.setItem("theme-menu", menu);
|
||||||
localStorage.setItem("theme-header", header);
|
localStorage.setItem("theme-header", header);
|
||||||
localStorage.setItem("auto-head", autoHead);
|
localStorage.setItem("auto-head", autoHead);
|
||||||
localStorage.setItem("control",control);
|
localStorage.setItem("control", control);
|
||||||
|
localStorage.setItem("footer", footer);
|
||||||
this.menuSkin(menu);
|
this.menuSkin(menu);
|
||||||
this.headerSkin(header);
|
this.headerSkin(header);
|
||||||
this.bannerSkin(banner);
|
this.bannerSkin(banner);
|
||||||
|
this.footer(footer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.footer = function(footer){
|
||||||
|
var bodyDOM = $(".pear-admin .layui-body");
|
||||||
|
var footerDOM = $(".pear-admin .layui-footer");
|
||||||
|
if (footer === true || footer === "true") {
|
||||||
|
footerDOM.removeClass("close");
|
||||||
|
bodyDOM.css("bottom", footerDOM.outerHeight());
|
||||||
|
} else {
|
||||||
|
footerDOM.addClass("close");
|
||||||
|
bodyDOM.css("bottom", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.bannerSkin = function(theme) {
|
this.bannerSkin = function(theme) {
|
||||||
var pearAdmin = $(".pear-admin");
|
var pearAdmin = $(".pear-admin");
|
||||||
pearAdmin.removeClass("banner-layout");
|
pearAdmin.removeClass("banner-layout");
|
||||||
if(theme === true || theme === "true") {
|
if (theme === true || theme === "true") {
|
||||||
pearAdmin.addClass("banner-layout");
|
pearAdmin.addClass("banner-layout");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.collaspe = function(param) {
|
this.collapse = function(param) {
|
||||||
if (param.menu.collaspe) {
|
if (param.menu.collapse) {
|
||||||
if ($(window).width() >= 768) {
|
if ($(window).width() >= 768) {
|
||||||
collaspe()
|
collapse()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -275,7 +298,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
pearAdmin.removeClass("dark-theme");
|
pearAdmin.removeClass("dark-theme");
|
||||||
pearAdmin.addClass(theme);
|
pearAdmin.addClass(theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.headerSkin = function(theme) {
|
this.headerSkin = function(theme) {
|
||||||
var pearAdmin = $(".pear-admin .layui-header");
|
var pearAdmin = $(".pear-admin .layui-header");
|
||||||
pearAdmin.removeClass("light-theme");
|
pearAdmin.removeClass("light-theme");
|
||||||
@@ -293,8 +316,20 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.jump = function(id, title, url) {
|
this.collapseSide = function() {
|
||||||
if (isMuiltTab(config)==="true" || isMuiltTab(param) === true) {
|
collapse()
|
||||||
|
}
|
||||||
|
|
||||||
|
this.refreshThis = function() {
|
||||||
|
refresh()
|
||||||
|
}
|
||||||
|
|
||||||
|
this.refresh = function(id) {
|
||||||
|
$("iframe[id='"+ id +"']").attr('src', $("iframe[id='"+ id +"']").attr('src'));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.addTab = function(id, title, url) {
|
||||||
|
if (isMuiltTab(config) === "true" || isMuiltTab(config) === true) {
|
||||||
bodyTab.addTabOnly({
|
bodyTab.addTabOnly({
|
||||||
id: id,
|
id: id,
|
||||||
title: title,
|
title: title,
|
||||||
@@ -302,14 +337,82 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
icon: null,
|
icon: null,
|
||||||
close: true
|
close: true
|
||||||
}, 400);
|
}, 400);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.closeTab = function(id) {
|
||||||
|
if (isMuiltTab(config) === "true" || isMuiltTab(config) === true) {
|
||||||
|
pearTab.delTabByElem('content', id, function(currentId){
|
||||||
|
sideMenu.selectItem(currentId);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.closeCurrentTab = function() {
|
||||||
|
if (isMuiltTab(config) === "true" || isMuiltTab(config) === true) {
|
||||||
|
pearTab.delCurrentTabByElem('content', function(id){
|
||||||
|
sideMenu.selectItem(id);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.closeOtherTab = function() {
|
||||||
|
if (isMuiltTab(config) === "true" || isMuiltTab(config) === true) {
|
||||||
|
pearTab.delOtherTabByElem('content', function(id){
|
||||||
|
sideMenu.selectItem(id);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.closeAllTab = function() {
|
||||||
|
if (isMuiltTab(config) === "true" || isMuiltTab(config) === true) {
|
||||||
|
pearTab.delAllTabByElem('content', function(id){
|
||||||
|
sideMenu.selectItem(id);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.changeTabTitle = function(id, title) {
|
||||||
|
pearTab.changeTabTitleById('content', id ,title);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.changeIframe = function(id, title, url) {
|
||||||
|
if (isMuiltTab(config) === "true" || isMuiltTab(config) === true) {
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
sideMenu.selectItem(id);
|
sideMenu.selectItem(id);
|
||||||
bodyFrame.changePage(url, true);
|
bodyFrame.changePage(url, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.refresh = function() {
|
this.jump = function(id, title, url) {
|
||||||
refresh();
|
if (isMuiltTab(config) === "true" || isMuiltTab(config) === true) {
|
||||||
|
pearAdmin.addTab(id, title, url)
|
||||||
|
} else {
|
||||||
|
pearAdmin.changeIframe(id, title, url)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.fullScreen = function() {
|
||||||
|
if ($(".fullScreen").hasClass("layui-icon-screen-restore")) {
|
||||||
|
screenFun(2).then(function() {
|
||||||
|
$(".fullScreen").eq(0).removeClass("layui-icon-screen-restore");
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
screenFun(1).then(function() {
|
||||||
|
$(".fullScreen").eq(0).addClass("layui-icon-screen-restore");
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -320,8 +423,8 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
refreshA.addClass("layui-anim-rotate");
|
refreshA.addClass("layui-anim-rotate");
|
||||||
refreshA.addClass("layui-anim-loop");
|
refreshA.addClass("layui-anim-loop");
|
||||||
refreshA.addClass("layui-icon-loading");
|
refreshA.addClass("layui-icon-loading");
|
||||||
if (isMuiltTab(config) === "true" || isMuiltTab(config) === true) bodyTab.refresh(400);
|
if (isMuiltTab(config) === "true" || isMuiltTab(config) === true) bodyTab.refresh(true);
|
||||||
else bodyFrame.refresh(400);
|
else bodyFrame.refresh(true);
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
refreshA.addClass("layui-icon-refresh-1");
|
refreshA.addClass("layui-icon-refresh-1");
|
||||||
refreshA.removeClass("layui-anim");
|
refreshA.removeClass("layui-anim");
|
||||||
@@ -331,8 +434,8 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
}, 600)
|
}, 600)
|
||||||
}
|
}
|
||||||
|
|
||||||
function collaspe() {
|
function collapse() {
|
||||||
sideMenu.collaspe();
|
sideMenu.collapse();
|
||||||
var admin = $(".pear-admin");
|
var admin = $(".pear-admin");
|
||||||
var left = $(".layui-icon-spread-left")
|
var left = $(".layui-icon-spread-left")
|
||||||
var right = $(".layui-icon-shrink-right")
|
var right = $(".layui-icon-shrink-right")
|
||||||
@@ -340,37 +443,233 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
left.addClass("layui-icon-shrink-right")
|
left.addClass("layui-icon-shrink-right")
|
||||||
left.removeClass("layui-icon-spread-left")
|
left.removeClass("layui-icon-spread-left")
|
||||||
admin.removeClass("pear-mini");
|
admin.removeClass("pear-mini");
|
||||||
|
sideMenu.isCollapse = false;
|
||||||
} else {
|
} else {
|
||||||
right.addClass("layui-icon-spread-left")
|
right.addClass("layui-icon-spread-left")
|
||||||
right.removeClass("layui-icon-shrink-right")
|
right.removeClass("layui-icon-shrink-right")
|
||||||
admin.addClass("pear-mini");
|
admin.addClass("pear-mini");
|
||||||
|
sideMenu.isCollapse = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
body.on("click", ".logout", function() {
|
body.on("click", ".logout", function() {
|
||||||
if (logout()) {
|
if (logout() && bodyTab) {
|
||||||
bodyTab.clear();
|
bodyTab.clear();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
body.on("click", ".collaspe,.pear-cover", function() {
|
body.on("click", ".collapse,.pear-cover", function() {
|
||||||
collaspe();
|
collapse();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
body.on("click", ".menuSearch", function () {
|
||||||
|
// 过滤菜单
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 树转路径
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建搜索列表
|
||||||
|
var createList = function (data) {
|
||||||
|
var _listHtml = '';
|
||||||
|
$.each(data, function (index, item) {
|
||||||
|
_listHtml += '<li 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 + '">';
|
||||||
|
_listHtml += ' <span><i style="margin-right:10px" class=" ' + item.info.icon + '"></i>' + item.path + '</span>';
|
||||||
|
_listHtml += ' <i class="layui-icon layui-icon-right"></i>';
|
||||||
|
_listHtml += '</li>'
|
||||||
|
})
|
||||||
|
return _listHtml;
|
||||||
|
}
|
||||||
|
|
||||||
|
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>'
|
||||||
|
].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 = sideMenu.option.data;
|
||||||
|
|
||||||
|
|
||||||
|
$layer.css("border-radius", "6px");
|
||||||
|
$input.off("focus").focus();
|
||||||
|
// 搜索菜单
|
||||||
|
$input.off("input").on("input", 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 menuId = $(this).attr("smenu-id");
|
||||||
|
var menuUrl = $(this).attr("smenu-url");
|
||||||
|
var menuIcon = $(this).attr("smenu-icon");
|
||||||
|
var menuTitle = $(this).attr("smenu-title");
|
||||||
|
var menuType = $(this).attr("smenu-type");
|
||||||
|
var openableWindow = menuType === "1" || menuType === 1;
|
||||||
|
|
||||||
|
if(sideMenu.isCollapse){
|
||||||
|
collapse();
|
||||||
|
}
|
||||||
|
if (openableWindow) {
|
||||||
|
pearAdmin.jump(menuId, menuTitle, menuUrl)
|
||||||
|
} else {
|
||||||
|
sideMenu.selectItem(menuId);
|
||||||
|
}
|
||||||
|
compatible();
|
||||||
|
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");
|
||||||
|
})
|
||||||
|
|
||||||
|
// 监听键盘事件
|
||||||
|
// Enter:13 Spacebar:32 UpArrow:38 DownArrow:40 Esc:27
|
||||||
|
$(document).off("keydown").keydown(function (e) {
|
||||||
|
if (e.keyCode === 13 || e.keyCode === 32) {
|
||||||
|
e.preventDefault();
|
||||||
|
var menuId = $(".menu-search-list li.this").attr("smenu-id");
|
||||||
|
var menuUrl = $(".menu-search-list li.this").attr("smenu-url");
|
||||||
|
var menuTitle = $(".menu-search-list li.this").attr("smenu-title");
|
||||||
|
var menuType = $(".menu-search-list li.this").attr("smenu-type");
|
||||||
|
var openableWindow = menuType === "1" || menuType === 1;
|
||||||
|
if (sideMenu.isCollapse) {
|
||||||
|
collapse();
|
||||||
|
}
|
||||||
|
if (openableWindow) {
|
||||||
|
pearAdmin.jump(menuId, menuTitle, menuUrl)
|
||||||
|
} else {
|
||||||
|
sideMenu.selectItem(menuId);
|
||||||
|
}
|
||||||
|
compatible();
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
body.on("click", ".fullScreen", function() {
|
body.on("click", ".fullScreen", function() {
|
||||||
if ($(this).hasClass("layui-icon-screen-restore")) {
|
if ($(this).hasClass("layui-icon-screen-restore")) {
|
||||||
screenFun(2).then(function() {
|
fullscreen.fullClose().then(function() {
|
||||||
$(".fullScreen").eq(0).removeClass("layui-icon-screen-restore");
|
$(".fullScreen").eq(0).removeClass("layui-icon-screen-restore");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
screenFun(1).then(function() {
|
fullscreen.fullScreen().then(function() {
|
||||||
$(".fullScreen").eq(0).addClass("layui-icon-screen-restore");
|
$(".fullScreen").eq(0).addClass("layui-icon-screen-restore");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
body.on("click", '[user-menu-id]', function() {
|
body.on("click", '[user-menu-id]', function() {
|
||||||
if (isMuiltTab(config) === "true" || isMuiltTab(param) === true) {
|
if (isMuiltTab(config) === "true" || isMuiltTab(config) === true) {
|
||||||
bodyTab.addTabOnly({
|
bodyTab.addTabOnly({
|
||||||
id: $(this).attr("user-menu-id"),
|
id: $(this).attr("user-menu-id"),
|
||||||
title: $(this).attr("user-menu-title"),
|
title: $(this).attr("user-menu-title"),
|
||||||
@@ -408,7 +707,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
'<ul>\n' + menuItem + '</ul>\n' +
|
'<ul>\n' + menuItem + '</ul>\n' +
|
||||||
'</div>\n' +
|
'</div>\n' +
|
||||||
'</div>';
|
'</div>';
|
||||||
|
|
||||||
var headItem =
|
var headItem =
|
||||||
'<li class="layui-this" data-select-header="light-theme" >' +
|
'<li class="layui-this" data-select-header="light-theme" >' +
|
||||||
'<a href="javascript:;" data-skin="skin-blue" style="" class="clearfix full-opacity-hover">' +
|
'<a href="javascript:;" data-skin="skin-blue" style="" class="clearfix full-opacity-hover">' +
|
||||||
@@ -416,7 +715,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
'<div><span style="display:block; width: 20%; float: left; height: 40px; background: #28333E;"></span><span style="display:block; width: 80%; float: left; height: 40px; background: #f4f5f7;"></span></div>' +
|
'<div><span style="display:block; width: 20%; float: left; height: 40px; background: #28333E;"></span><span style="display:block; width: 80%; float: left; height: 40px; background: #f4f5f7;"></span></div>' +
|
||||||
'</a>' +
|
'</a>' +
|
||||||
'</li>';
|
'</li>';
|
||||||
|
|
||||||
headItem +=
|
headItem +=
|
||||||
'<li data-select-header="dark-theme" >' +
|
'<li data-select-header="dark-theme" >' +
|
||||||
'<a href="javascript:;" data-skin="skin-blue" style="" class="clearfix full-opacity-hover">' +
|
'<a href="javascript:;" data-skin="skin-blue" style="" class="clearfix full-opacity-hover">' +
|
||||||
@@ -424,7 +723,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
'<div><span style="display:block; width: 20%; float: left; height: 40px; background: #28333E;"></span><span style="display:block; width: 80%; float: left; height: 40px; background: #f4f5f7;"></span></div>' +
|
'<div><span style="display:block; width: 20%; float: left; height: 40px; background: #28333E;"></span><span style="display:block; width: 80%; float: left; height: 40px; background: #f4f5f7;"></span></div>' +
|
||||||
'</a>' +
|
'</a>' +
|
||||||
'</li>';
|
'</li>';
|
||||||
|
|
||||||
var headHtml =
|
var headHtml =
|
||||||
'<div class="pearone-color">\n' +
|
'<div class="pearone-color">\n' +
|
||||||
'<div class="color-title">顶部风格</div>\n' +
|
'<div class="color-title">顶部风格</div>\n' +
|
||||||
@@ -436,15 +735,18 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
var moreItem =
|
var moreItem =
|
||||||
'<div class="layui-form-item"><div class="layui-input-inline"><input type="checkbox" name="control" lay-filter="control" lay-skin="switch" lay-text="开|关"></div><span class="set-text">菜单</span></div>';
|
'<div class="layui-form-item"><div class="layui-input-inline"><input type="checkbox" name="control" lay-filter="control" lay-skin="switch" lay-text="开|关"></div><span class="set-text">菜单</span></div>';
|
||||||
|
|
||||||
moreItem +=
|
moreItem +=
|
||||||
'<div class="layui-form-item"><div class="layui-input-inline"><input type="checkbox" name="muilt-tab" lay-filter="muilt-tab" lay-skin="switch" lay-text="开|关"></div><span class="set-text">视图</span></div>';
|
'<div class="layui-form-item"><div class="layui-input-inline"><input type="checkbox" name="muilt-tab" lay-filter="muilt-tab" lay-skin="switch" lay-text="开|关"></div><span class="set-text">视图</span></div>';
|
||||||
|
|
||||||
moreItem +=
|
moreItem +=
|
||||||
'<div class="layui-form-item"><div class="layui-input-inline"><input type="checkbox" name="banner" lay-filter="banner" lay-skin="switch" lay-text="开|关"></div><span class="set-text">通栏</span></div>';
|
'<div class="layui-form-item"><div class="layui-input-inline"><input type="checkbox" name="banner" lay-filter="banner" lay-skin="switch" lay-text="开|关"></div><span class="set-text">通栏</span></div>';
|
||||||
|
|
||||||
moreItem +=
|
moreItem +=
|
||||||
'<div class="layui-form-item"><div class="layui-input-inline"><input type="checkbox" name="auto-head" lay-filter="auto-head" lay-skin="switch" lay-text="开|关"></div><span class="set-text">通色</span></div>';
|
'<div class="layui-form-item"><div class="layui-input-inline"><input type="checkbox" name="auto-head" lay-filter="auto-head" lay-skin="switch" lay-text="开|关"></div><span class="set-text">通色</span></div>';
|
||||||
|
|
||||||
|
moreItem +=
|
||||||
|
'<div class="layui-form-item"><div class="layui-input-inline"><input type="checkbox" name="footer" lay-filter="footer" lay-skin="switch" lay-text="开|关"></div><span class="set-text">页脚</span></div>';
|
||||||
|
|
||||||
var moreHtml = '<br><div class="pearone-color">\n' +
|
var moreHtml = '<br><div class="pearone-color">\n' +
|
||||||
'<div class="color-title">更多设置</div>\n' +
|
'<div class="color-title">更多设置</div>\n' +
|
||||||
'<div class="color-content">\n' +
|
'<div class="color-content">\n' +
|
||||||
@@ -463,7 +765,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
anim: -1,
|
anim: -1,
|
||||||
skin: 'layer-anim-right',
|
skin: 'layer-anim-right',
|
||||||
move: false,
|
move: false,
|
||||||
content: menuHtml + headHtml + buildColorHtml() + moreHtml + bottomTool(),
|
content: menuHtml + headHtml + buildColorHtml() + moreHtml,
|
||||||
success: function(layero, index) {
|
success: function(layero, index) {
|
||||||
|
|
||||||
form.render();
|
form.render();
|
||||||
@@ -496,15 +798,6 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#closeTheme').click(function() {
|
|
||||||
var $layero = $('#layui-layer' + index);
|
|
||||||
$layero.animate({
|
|
||||||
left: $layero.offset().left + $layero.width()
|
|
||||||
}, 200, function() {
|
|
||||||
layer.close(index);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
|
|
||||||
form.on('switch(control)', function(data) {
|
form.on('switch(control)', function(data) {
|
||||||
localStorage.setItem("control", this.checked);
|
localStorage.setItem("control", this.checked);
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
@@ -514,17 +807,22 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
localStorage.setItem("muilt-tab", this.checked);
|
localStorage.setItem("muilt-tab", this.checked);
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
})
|
})
|
||||||
|
|
||||||
form.on('switch(auto-head)', function(data) {
|
form.on('switch(auto-head)', function(data) {
|
||||||
localStorage.setItem("auto-head", this.checked);
|
localStorage.setItem("auto-head", this.checked);
|
||||||
pearTheme.changeTheme(window, this.checked);
|
pearTheme.changeTheme(window, this.checked);
|
||||||
})
|
})
|
||||||
|
|
||||||
form.on('switch(banner)', function(data) {
|
form.on('switch(banner)', function(data) {
|
||||||
localStorage.setItem("theme-banner", this.checked);
|
localStorage.setItem("theme-banner", this.checked);
|
||||||
pearAdmin.bannerSkin(this.checked);
|
pearAdmin.bannerSkin(this.checked);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
form.on('switch(footer)', function (data) {
|
||||||
|
localStorage.setItem("footer", this.checked);
|
||||||
|
pearAdmin.footer(this.checked);
|
||||||
|
})
|
||||||
|
|
||||||
if (localStorage.getItem('theme-banner') === 'true') {
|
if (localStorage.getItem('theme-banner') === 'true') {
|
||||||
$('input[name="banner"]').attr('checked', 'checked')
|
$('input[name="banner"]').attr('checked', 'checked')
|
||||||
} else {
|
} else {
|
||||||
@@ -536,29 +834,30 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
} else {
|
} else {
|
||||||
$('input[name="control"]').removeAttr('checked')
|
$('input[name="control"]').removeAttr('checked')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localStorage.getItem('muilt-tab') === 'true') {
|
if (localStorage.getItem('muilt-tab') === 'true') {
|
||||||
$('input[name="muilt-tab"]').attr('checked', 'checked')
|
$('input[name="muilt-tab"]').attr('checked', 'checked')
|
||||||
} else {
|
} else {
|
||||||
$('input[name="muilt-tab"]').removeAttr('checked')
|
$('input[name="muilt-tab"]').removeAttr('checked')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localStorage.getItem('auto-head') === 'true') {
|
if (localStorage.getItem('auto-head') === 'true') {
|
||||||
$('input[name="auto-head"]').attr('checked', 'checked')
|
$('input[name="auto-head"]').attr('checked', 'checked')
|
||||||
} else {
|
} else {
|
||||||
$('input[name="auto-head"]').removeAttr('checked')
|
$('input[name="auto-head"]').removeAttr('checked')
|
||||||
}
|
}
|
||||||
|
|
||||||
form.render('checkbox');
|
|
||||||
|
|
||||||
|
if (localStorage.getItem('footer') === 'true') {
|
||||||
|
$('input[name="footer"]').attr('checked', 'checked')
|
||||||
|
} else {
|
||||||
|
$('input[name="footer"]').removeAttr('checked')
|
||||||
|
}
|
||||||
|
|
||||||
|
form.render('checkbox');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function bottomTool() {
|
|
||||||
return "<button id='closeTheme' style='position: absolute;bottom: 20px;left: 20px;' class='pear-btn'>关闭</button>"
|
|
||||||
}
|
|
||||||
|
|
||||||
body.on('click', '[data-select-bgcolor]', function() {
|
body.on('click', '[data-select-bgcolor]', function() {
|
||||||
var theme = $(this).attr('data-select-bgcolor');
|
var theme = $(this).attr('data-select-bgcolor');
|
||||||
$('[data-select-bgcolor]').removeClass("layui-this");
|
$('[data-select-bgcolor]').removeClass("layui-this");
|
||||||
@@ -566,7 +865,7 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
localStorage.setItem("theme-menu", theme);
|
localStorage.setItem("theme-menu", theme);
|
||||||
pearAdmin.menuSkin(theme);
|
pearAdmin.menuSkin(theme);
|
||||||
});
|
});
|
||||||
|
|
||||||
body.on('click', '[data-select-header]', function() {
|
body.on('click', '[data-select-header]', function() {
|
||||||
var theme = $(this).attr('data-select-header');
|
var theme = $(this).attr('data-select-header');
|
||||||
$('[data-select-header]').removeClass("layui-this");
|
$('[data-select-header]').removeClass("layui-this");
|
||||||
@@ -629,50 +928,10 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
|
|
||||||
function compatible() {
|
function compatible() {
|
||||||
if ($(window).width() <= 768) {
|
if ($(window).width() <= 768) {
|
||||||
collaspe()
|
collapse()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function screenFun(num) {
|
|
||||||
num = num || 1;
|
|
||||||
num = num * 1;
|
|
||||||
var docElm = document.documentElement;
|
|
||||||
switch (num) {
|
|
||||||
case 1:
|
|
||||||
if (docElm.requestFullscreen) {
|
|
||||||
docElm.requestFullscreen();
|
|
||||||
} else if (docElm.mozRequestFullScreen) {
|
|
||||||
docElm.mozRequestFullScreen();
|
|
||||||
} else if (docElm.webkitRequestFullScreen) {
|
|
||||||
docElm.webkitRequestFullScreen();
|
|
||||||
} else if (docElm.msRequestFullscreen) {
|
|
||||||
docElm.msRequestFullscreen();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
if (document.exitFullscreen) {
|
|
||||||
document.exitFullscreen();
|
|
||||||
} else if (document.mozCancelFullScreen) {
|
|
||||||
document.mozCancelFullScreen();
|
|
||||||
} else if (document.webkitCancelFullScreen) {
|
|
||||||
document.webkitCancelFullScreen();
|
|
||||||
} else if (document.msExitFullscreen) {
|
|
||||||
document.msExitFullscreen();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return new Promise(function(res, rej) {
|
|
||||||
res("返回值");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function isFullscreen() {
|
|
||||||
return document.fullscreenElement ||
|
|
||||||
document.msFullscreenElement ||
|
|
||||||
document.mozFullScreenElement ||
|
|
||||||
document.webkitFullscreenElement || false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isControl(option) {
|
function isControl(option) {
|
||||||
if (option.theme.allowCustom) {
|
if (option.theme.allowCustom) {
|
||||||
if (localStorage.getItem("control") != null) {
|
if (localStorage.getItem("control") != null) {
|
||||||
@@ -684,19 +943,19 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
return option.menu.control
|
return option.menu.control
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isAutoHead(option) {
|
function isAutoHead(option) {
|
||||||
if(option.theme.allowCustom) {
|
if (option.theme.allowCustom) {
|
||||||
if(localStorage.getItem("auto-head") != null) {
|
if (localStorage.getItem("auto-head") != null) {
|
||||||
return localStorage.getItem("auto-head");
|
return localStorage.getItem("auto-head");
|
||||||
} else {
|
} else {
|
||||||
return option.other.autoHead;
|
return option.other.autoHead;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return option.other.autoHead;
|
return option.other.autoHead;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isMuiltTab(option) {
|
function isMuiltTab(option) {
|
||||||
if (option.theme.allowCustom) {
|
if (option.theme.allowCustom) {
|
||||||
if (localStorage.getItem("muilt-tab") != null) {
|
if (localStorage.getItem("muilt-tab") != null) {
|
||||||
@@ -710,10 +969,28 @@ layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'm
|
|||||||
}
|
}
|
||||||
|
|
||||||
window.onresize = function() {
|
window.onresize = function() {
|
||||||
if (!isFullscreen()) {
|
if (!fullscreen.isFullscreen()) {
|
||||||
$(".fullScreen").eq(0).removeClass("layui-icon-screen-restore");
|
$(".fullScreen").eq(0).removeClass("layui-icon-screen-restore");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(window).on('resize', debounce(function () {
|
||||||
|
if (sideMenu && !sideMenu.isCollapse && $(window).width() <= 768) {
|
||||||
|
collapse();
|
||||||
|
}
|
||||||
|
},50));
|
||||||
|
|
||||||
|
function debounce(fn, awaitTime) {
|
||||||
|
var timerID = null
|
||||||
|
return function () {
|
||||||
|
var arg = arguments[0]
|
||||||
|
if (timerID) {
|
||||||
|
clearTimeout(timerID)
|
||||||
|
}
|
||||||
|
timerID = setTimeout(function () {
|
||||||
|
fn(arg)
|
||||||
|
}, awaitTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
exports('admin', pearAdmin);
|
exports('admin', pearAdmin);
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ layui.define(['table', 'laypage','jquery', 'element'], function(exports) {
|
|||||||
option.count = 0;
|
option.count = 0;
|
||||||
} else {
|
} else {
|
||||||
option.data = data.data;
|
option.data = data.data;
|
||||||
option.count = option.data.length;
|
option.count = data.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!!option.data && option.data.length > 0) {
|
if (!!option.data && option.data.length > 0) {
|
||||||
@@ -177,7 +177,7 @@ layui.define(['table', 'laypage','jquery', 'element'], function(exports) {
|
|||||||
function createCard(elem, linenum, item, no) {
|
function createCard(elem, linenum, item, no) {
|
||||||
var line = 12 / linenum;
|
var line = 12 / linenum;
|
||||||
var card =
|
var card =
|
||||||
'<div id=' + item.id + ' onclick="cardTableCheckedCard(' + elem + ',this)" class="layui-col-md' + line + ' ew-datagrid-item" data-index="' + no+'" data-number="1"> <div class="project-list-item"> <img class="project-list-item-cover" src="' +item.image + '"> <div class="project-list-item-body"> <h2>' + item.title + '</h2> <div class="project-list-item-text layui-text">' + item.remark + '</div> <div class="project-list-item-desc"> <span class="time">' +item.time + '</span> <div class="ew-head-list"></div> </div> </div > </div > </div > '
|
'<div id=' + item.id + ' onclick="cardTableCheckedCard(' + elem + ',this)" class="layui-col-md' + line + ' ew-datagrid-item" data-index="' + no+'" data-number="1"> <div class="project-list-item"> <img class="project-list-item-cover" src="' + item.image + '"> <div class="project-list-item-body"> <h2 class="layui-elip">' + item.title + '</h2> <div class="project-list-item-text layui-text">' + item.remark + '</div> <div class="project-list-item-desc"> <span class="time">' +item.time + '</span> <div class="ew-head-list"></div> </div> </div > </div > </div > '
|
||||||
return card;
|
return card;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ layui.define(['table', 'laypage','jquery', 'element'], function(exports) {
|
|||||||
var dataList = tempData[option.response.dataName];
|
var dataList = tempData[option.response.dataName];
|
||||||
data.data = [];
|
data.data = [];
|
||||||
for (var i = 0; i < dataList.length; i++) {
|
for (var i = 0; i < dataList.length; i++) {
|
||||||
var item = {};
|
var item = dataList[i];
|
||||||
item.id = dataList[i][option.request.idName];
|
item.id = dataList[i][option.request.idName];
|
||||||
item.image = dataList[i][option.request.imageName];
|
item.image = dataList[i][option.request.imageName];
|
||||||
item.title = dataList[i][option.request.titleName];
|
item.title = dataList[i][option.request.titleName];
|
||||||
@@ -202,7 +202,7 @@ layui.define(['table', 'laypage','jquery', 'element'], function(exports) {
|
|||||||
|
|
||||||
function getData(url) {
|
function getData(url) {
|
||||||
var defer = $.Deferred();
|
var defer = $.Deferred();
|
||||||
$.get(url + "?fresh=" + Math.random(), function(result) {
|
$.get(url + (url.indexOf("?") ? "&" : "?") + "fresh=" + Math.random(), function(result) {
|
||||||
defer.resolve(result)
|
defer.resolve(result)
|
||||||
});
|
});
|
||||||
return defer.promise();
|
return defer.promise();
|
||||||
@@ -212,6 +212,7 @@ layui.define(['table', 'laypage','jquery', 'element'], function(exports) {
|
|||||||
$(obj).addClass('layui-table-click').siblings().removeClass('layui-table-click');
|
$(obj).addClass('layui-table-click').siblings().removeClass('layui-table-click');
|
||||||
var item = {};
|
var item = {};
|
||||||
item.id = obj.id;
|
item.id = obj.id;
|
||||||
|
item.index = $(obj).attr('data-index');
|
||||||
item.image = $(obj).find('.project-list-item-cover')[0].src;
|
item.image = $(obj).find('.project-list-item-cover')[0].src;
|
||||||
item.title = $(obj).find('h2')[0].innerHTML;
|
item.title = $(obj).find('h2')[0].innerHTML;
|
||||||
item.remark = $(obj).find('.project-list-item-text')[0].innerHTML;
|
item.remark = $(obj).find('.project-list-item-text')[0].innerHTML;
|
||||||
|
|||||||
@@ -1,71 +1,114 @@
|
|||||||
layui.define(['jquery', 'element','table'], function(exports) {
|
layui.define(['jquery', 'element', 'table'], function (exports) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 常用封装类
|
* 常用封装类
|
||||||
* */
|
* */
|
||||||
var MOD_NAME = 'common',
|
var MOD_NAME = 'common',
|
||||||
$ = layui.jquery,
|
$ = layui.jquery,
|
||||||
table = layui.table,
|
table = layui.table,
|
||||||
element = layui.element;
|
element = layui.element;
|
||||||
|
|
||||||
var common = new function() {
|
var common = new function () {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前表格选中字段
|
* 获取当前表格选中字段
|
||||||
* @param obj 表格回调参数
|
* @param obj 表格回调参数
|
||||||
* @param field 要获取的字段
|
* @param field 要获取的字段
|
||||||
* */
|
* */
|
||||||
this.checkField = function(obj, field) {
|
this.checkField = function (obj, field) {
|
||||||
let data = table.checkStatus(obj.config.id).data;
|
let data = table.checkStatus(obj.config.id).data;
|
||||||
if (data.length === 0) {
|
if (data.length === 0) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
let ids = "";
|
let ids = "";
|
||||||
for (let i = 0; i < data.length; i++) {
|
for (let i = 0; i < data.length; i++) {
|
||||||
ids += data[i][field] + ",";
|
ids += data[i][field] + ",";
|
||||||
}
|
}
|
||||||
ids = ids.substr(0, ids.length - 1);
|
ids = ids.substring(0, ids.length - 1);
|
||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前是否为与移动端
|
* 当前是否为与移动端
|
||||||
* */
|
* */
|
||||||
this.isModile = function(){
|
this.isModile = function () {
|
||||||
if ($(window).width() <= 768) {
|
return $(window).width() <= 768;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
/**
|
||||||
|
* 提交 json 数据
|
||||||
|
* @param href 必选 提交接口
|
||||||
/**
|
* @param data 可选 提交数据
|
||||||
* 提交 json 数据
|
* @param ajaxtype 可选 提交方式(默认为get)
|
||||||
* @param data 提交数据
|
* @param table 可选 刷新父级表
|
||||||
* @param href 提交接口
|
* @param callback 可选 自定义回调函数
|
||||||
* @param table 刷新父级表
|
* @param dataType 可选 返回数据类型 智能猜测(可以是xml, json, script, 或 html)
|
||||||
*
|
* @param is_async 可选 请求是否异步处理。默认是 true
|
||||||
* */
|
* @param is_cache 可选 浏览器是否缓存被请求页面。默认是 true
|
||||||
this.submit = function(data,href,table,callback){
|
* */
|
||||||
$.ajax({
|
this.submit = function (href, data, ajaxtype, table, callback, dataType, is_async, is_cache) {
|
||||||
url:href,
|
if (data !== undefined) {
|
||||||
data:JSON.stringify(data),
|
$.ajaxSetup({data: JSON.stringify(data)});
|
||||||
dataType:'json',
|
} else {
|
||||||
contentType:'application/json',
|
$.ajaxSetup({data: ''});
|
||||||
type:'post',
|
}
|
||||||
success:callback !=null?callback(result):function(result){
|
if (dataType !== undefined) {
|
||||||
if(result.success){
|
$.ajaxSetup({dataType: dataType});
|
||||||
layer.msg(result.msg,{icon:1,time:1000},function(){
|
}
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
|
if (is_async !== undefined) {
|
||||||
parent.layui.table.reload(table);
|
$.ajaxSetup({async: is_async});
|
||||||
});
|
}
|
||||||
}else{
|
if (is_cache !== undefined) {
|
||||||
layer.msg(result.msg,{icon:2,time:1000});
|
$.ajaxSetup({cache: is_cache});
|
||||||
}
|
}
|
||||||
}
|
$.ajax({
|
||||||
})
|
url: href,
|
||||||
}
|
contentType: 'application/json',
|
||||||
}
|
type: ajaxtype || 'get',
|
||||||
exports(MOD_NAME, common);
|
success: callback != null ? callback : function (result) {
|
||||||
|
if (result.code === 1) {
|
||||||
|
layer.msg(result.msg, {icon: 1, time: 1000}, function () {
|
||||||
|
let frameIndex = parent.layer.getFrameIndex(window.name);
|
||||||
|
if (frameIndex) {
|
||||||
|
parent.layer.close(frameIndex);//关闭当前页
|
||||||
|
}
|
||||||
|
table && parent.layui.table.reload(table);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
layer.msg(result.msg, {icon: 2, time: 1000});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (xhr) {
|
||||||
|
if (xhr.status === 401) {
|
||||||
|
layer.msg('权限不足,您无法访问受限资源或数据', {icon: 5});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (xhr.status === 404) {
|
||||||
|
layer.msg('请求url地址错误,请确认后刷新重试', {icon: 5});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (xhr.status === 419) {
|
||||||
|
layer.msg('长时间未操作,自动刷新后重试!', {icon: 5});
|
||||||
|
setTimeout(function () {
|
||||||
|
window.location.reload();
|
||||||
|
}, 2000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (xhr.status === 429) {
|
||||||
|
layer.msg('尝试次数太多,请一分钟后再试', {icon: 5});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (xhr.status === 500) {
|
||||||
|
layer.msg(xhr.responseJSON.message, {icon: 5});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
, complete: function (xhr, status) {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports(MOD_NAME, common);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
layui.define(['jquery', 'element'], function(exports) {
|
layui.define(['jquery', 'element', 'layer', 'loading'], function (exports) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6,36 +6,270 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
* */
|
* */
|
||||||
var MOD_NAME = 'drawer',
|
var MOD_NAME = 'drawer',
|
||||||
$ = layui.jquery,
|
$ = layui.jquery,
|
||||||
element = layui.element;
|
element = layui.element,
|
||||||
|
layer = layui.layer,
|
||||||
|
loading = layui.loading;
|
||||||
|
|
||||||
var drawer = new function() {
|
|
||||||
|
var drawer = new function () {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* open drawer
|
* open drawer
|
||||||
* */
|
* */
|
||||||
this.open = function(option) {
|
this.open = function (option) {
|
||||||
var obj = new mSlider({
|
// 默认使用 legacy 模式
|
||||||
dom: option.dom,
|
if (option.legacy === undefined) {
|
||||||
direction: option.direction,
|
option.legacy = true;
|
||||||
distance: option.distance,
|
};
|
||||||
time: option.time ? option.time : 0,
|
if (option.legacy) {
|
||||||
maskClose: option.maskClose,
|
var obj = new mSlider({
|
||||||
callback: option.success
|
target: option.target,
|
||||||
|
dom: option.dom,
|
||||||
|
direction: option.direction,
|
||||||
|
distance: option.distance,
|
||||||
|
time: option.time ? option.time : 0,
|
||||||
|
maskClose: option.maskClose,
|
||||||
|
callback: option.success
|
||||||
|
});
|
||||||
|
obj.open();
|
||||||
|
return obj;
|
||||||
|
} else {
|
||||||
|
return layerDrawer(option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.title = layer.title;
|
||||||
|
this.style = layer.style;
|
||||||
|
this.close = layer.close;
|
||||||
|
this.closeAll = layer.closeAll;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 封装 layer.open
|
||||||
|
* type,anim,move,fixed不可用,其它参数和 layer.open 一致
|
||||||
|
* @param {LayerOption} option
|
||||||
|
* @returns 原生 layer 的 index
|
||||||
|
*/
|
||||||
|
function layerDrawer(option) {
|
||||||
|
var opt = normalizeOption(option)
|
||||||
|
if (opt.target) appendToTarget(opt);
|
||||||
|
if (opt.url) loadFragment(opt);
|
||||||
|
var layerIndex = layer.open(opt);
|
||||||
|
|
||||||
|
return layerIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载 HTML 片段到 layer content
|
||||||
|
* @param {*} option
|
||||||
|
*/
|
||||||
|
function loadFragment(option) {
|
||||||
|
option.success = Aspect(option.success, function (layero, index) {
|
||||||
|
var layerID = "#" + layero.attr("id");
|
||||||
|
loading.block({
|
||||||
|
type: 1,
|
||||||
|
elem: layerID,
|
||||||
|
msg: ''
|
||||||
});
|
});
|
||||||
obj.open();
|
$.ajax({
|
||||||
return obj;
|
url: option.url,
|
||||||
|
dataType: "html",
|
||||||
|
success: function (result) {
|
||||||
|
layero.children('.layui-layer-content').html(result);
|
||||||
|
loading.blockRemove(layerID);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*将 layer 挂载到指定节点
|
||||||
|
* @param {object} opt
|
||||||
|
*/
|
||||||
|
function appendToTarget(opt) {
|
||||||
|
var targetDOM = $(opt.target);
|
||||||
|
var contentDOM = $(opt.content);
|
||||||
|
contentDOM.appendTo(targetDOM);
|
||||||
|
opt.skin = getDrawerAnimationClass(opt.offset, true);
|
||||||
|
opt.offset = calcOffset(opt.offset, opt.area, targetDOM);
|
||||||
|
// 处理关闭后偶现 DOM 仍显示的问题,layer 的 BUG
|
||||||
|
opt.end = Aspect(opt.end, function () {
|
||||||
|
contentDOM.css("display", "none");
|
||||||
|
})
|
||||||
|
if (opt.shade) {
|
||||||
|
opt.success = Aspect(opt.success, function (layero, index) {
|
||||||
|
var shadeDOM = $("#layui-layer-shade" + index);
|
||||||
|
shadeDOM.css("position", "absolute");
|
||||||
|
shadeDOM.appendTo(layero.parent());
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规格化 layer.open 选项,兼容原版 Drawer 所有选项
|
||||||
|
* @param {LayerOption} option layer.open 的选项
|
||||||
|
* @returns 规格化后的 layer.open 选项
|
||||||
|
*/
|
||||||
|
function normalizeOption(option) {
|
||||||
|
if (option.direction && !option.offset) {
|
||||||
|
if (option.direction === "right") {
|
||||||
|
option.offset = "r";
|
||||||
|
} else if (option.direction === "left") {
|
||||||
|
option.offset = "l";
|
||||||
|
} else if (option.direction === "top") {
|
||||||
|
option.offset = "t";
|
||||||
|
} else if (option.direction === "bottom") {
|
||||||
|
option.offset = "b";
|
||||||
|
} else {
|
||||||
|
option.offset = "r";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (option.distance && !option.area) {
|
||||||
|
option.area = option.distance;
|
||||||
|
}
|
||||||
|
if (option.dom && !option.content) {
|
||||||
|
option.content = $(option.dom);
|
||||||
|
}
|
||||||
|
if (option.maskClose && option.shadeClose === undefined) {
|
||||||
|
option.shadeClose = (option.maskClose + "").toString() !== "false" ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
option.type = 1
|
||||||
|
option.anim = -1;
|
||||||
|
option.move = false;
|
||||||
|
option.fixed = true;
|
||||||
|
if (option.iframe) {
|
||||||
|
option.type = 2;
|
||||||
|
option.content = option.iframe;
|
||||||
|
}
|
||||||
|
if (option.offset === undefined) option.offset = "r";
|
||||||
|
option.area = calcDrawerArea(option.offset, option.area);
|
||||||
|
if (option.title === undefined) option.title = false;
|
||||||
|
if (option.closeBtn === undefined) option.closeBtn = false;
|
||||||
|
if (option.shade === undefined) option.shade = 0.3;
|
||||||
|
if (option.shadeClose === undefined) option.shadeClose = true;
|
||||||
|
if (option.skin === undefined) option.skin = getDrawerAnimationClass(option.offset);
|
||||||
|
if (option.resize === undefined) option.resize = false;
|
||||||
|
if (option.success === undefined) option.success = function () { }; // 处理遮罩需要
|
||||||
|
if (option.end === undefined) option.end = function () { };
|
||||||
|
|
||||||
|
return option;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算抽屉宽高
|
||||||
|
* @param {string} offset 抽屉方向 l = 左, r = 右, t = 上, b = 下
|
||||||
|
* @param {string[] | string} drawerArea 抽屉大小,字符串数组格式:[width, height],字符串格式:百分比或单位 px。
|
||||||
|
* @returns 抽屉宽高数组
|
||||||
|
*/
|
||||||
|
function calcDrawerArea(offset, drawerArea) {
|
||||||
|
if (drawerArea instanceof Array) {
|
||||||
|
return drawerArea;
|
||||||
|
}
|
||||||
|
if (drawerArea === undefined || drawerArea === "auto") {
|
||||||
|
drawerArea = "30%";
|
||||||
|
}
|
||||||
|
if (offset === "l" || offset === "r") {
|
||||||
|
return [drawerArea, "100%"];
|
||||||
|
} else if (offset === "t" || offset === "b") {
|
||||||
|
return ["100%", drawerArea];
|
||||||
|
}
|
||||||
|
return [drawerArea, "100%"];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取抽屉动画类
|
||||||
|
* @param {string} offset 抽屉方向
|
||||||
|
* @param {boolean} 是否 absolute 布局
|
||||||
|
* @returns 抽屉入场动画类
|
||||||
|
*/
|
||||||
|
function getDrawerAnimationClass(offset, isAbsolute) {
|
||||||
|
var positionAbsoluteClass = "position-absolute ";
|
||||||
|
var prefixClass = "pear-drawer pear-drawer-anim layui-anim layer-anim-";
|
||||||
|
var suffix = "rl";
|
||||||
|
|
||||||
|
if (isAbsolute) {
|
||||||
|
prefixClass = positionAbsoluteClass + prefixClass;
|
||||||
|
}
|
||||||
|
if (offset === "l") {
|
||||||
|
suffix = "lr";
|
||||||
|
} else if (offset === "r") {
|
||||||
|
suffix = "rl";
|
||||||
|
} else if (offset === "t") {
|
||||||
|
suffix = "tb";
|
||||||
|
} else if (offset === "b") {
|
||||||
|
suffix = "bt";
|
||||||
|
}
|
||||||
|
return prefixClass + suffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定挂载容器重新计算 offset
|
||||||
|
* @param {*} offset 位置
|
||||||
|
* @param {*} area 范围大小
|
||||||
|
* @param {*} targetEl 挂载节点
|
||||||
|
* @returns 包含抽屉位置信息的数组,[top,left]
|
||||||
|
*/
|
||||||
|
function calcOffset(offset, area, targetEl) {
|
||||||
|
if (offset === undefined || offset === "l" || offset === "t") {
|
||||||
|
offset = "lt";
|
||||||
|
} else if (offset === "r") {
|
||||||
|
var left;
|
||||||
|
if (area instanceof Array) {
|
||||||
|
area = area[0];
|
||||||
|
}
|
||||||
|
if (area.indexOf("%") != -1) {
|
||||||
|
left = targetEl.innerWidth() * (1 - area.replace("%", "") / 100);
|
||||||
|
} else {
|
||||||
|
left = targetEl.innerWidth() - area;
|
||||||
|
}
|
||||||
|
offset = [0, left];
|
||||||
|
} else if (offset === "b") {
|
||||||
|
var top;
|
||||||
|
if (area instanceof Array) {
|
||||||
|
area = area[1];
|
||||||
|
}
|
||||||
|
if (area.indexOf("%") != -1) {
|
||||||
|
top = targetEl.innerHeight() * (1 - area.replace("%", "") / 100);
|
||||||
|
} else {
|
||||||
|
top = targetEl.innerHeight() - area;
|
||||||
|
}
|
||||||
|
offset = [top, 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 简易的切面
|
||||||
|
* @param {Function} func 被通知的对象,原函数
|
||||||
|
* @param {Function | undefined} before 前置通知
|
||||||
|
* @param {Function | undefined} after 后置通知
|
||||||
|
* @returns 代理函数
|
||||||
|
*/
|
||||||
|
function Aspect(target, before, after) {
|
||||||
|
function proxyFunc() {
|
||||||
|
if (before && typeof before === "function") {
|
||||||
|
before.apply(this, arguments)
|
||||||
|
}
|
||||||
|
target.apply(this, arguments);
|
||||||
|
if (after && typeof after === "function") {
|
||||||
|
after.apply(this, arguments)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return proxyFunc;
|
||||||
|
}
|
||||||
|
|
||||||
exports(MOD_NAME, drawer);
|
exports(MOD_NAME, drawer);
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 源码
|
* 源码
|
||||||
* */
|
* */
|
||||||
(function(b, c) {
|
(function (b, c) {
|
||||||
function a(d) {
|
function a(d) {
|
||||||
this.opts = {
|
this.opts = {
|
||||||
|
"target": d.target || "body",
|
||||||
"direction": d.direction || "left",
|
"direction": d.direction || "left",
|
||||||
"distance": d.distance || "60%",
|
"distance": d.distance || "60%",
|
||||||
"dom": this.Q(d.dom),
|
"dom": this.Q(d.dom),
|
||||||
@@ -44,6 +278,7 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
"callback": d.callback || ""
|
"callback": d.callback || ""
|
||||||
};
|
};
|
||||||
this.rnd = this.rnd();
|
this.rnd = this.rnd();
|
||||||
|
this.target = this.opts.target;
|
||||||
this.dom = this.opts.dom[0];
|
this.dom = this.opts.dom[0];
|
||||||
this.wrap = "";
|
this.wrap = "";
|
||||||
this.inner = "";
|
this.inner = "";
|
||||||
@@ -51,35 +286,36 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
this.init()
|
this.init()
|
||||||
}
|
}
|
||||||
a.prototype = {
|
a.prototype = {
|
||||||
Q: function(d) {
|
Q: function (d) {
|
||||||
return document.querySelectorAll(d)
|
return document.querySelectorAll(d)
|
||||||
},
|
},
|
||||||
isMobile: function() {
|
isMobile: function () {
|
||||||
return navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i) ? true : false
|
return navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i) ? true : false
|
||||||
},
|
},
|
||||||
addEvent: function(f, e, d) {
|
addEvent: function (f, e, d) {
|
||||||
if (f.attachEvent) {
|
if (f.attachEvent) {
|
||||||
f.attachEvent("on" + e, d)
|
f.attachEvent("on" + e, d)
|
||||||
} else {
|
} else {
|
||||||
f.addEventListener(e, d, false)
|
f.addEventListener(e, d, false)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
rnd: function() {
|
rnd: function () {
|
||||||
return Math.random().toString(36).substr(2, 6)
|
return Math.random().toString(36).substr(2, 6)
|
||||||
},
|
},
|
||||||
init: function() {
|
init: function () {
|
||||||
var g = this;
|
var g = this;
|
||||||
if (!g.dom) {
|
if (!g.dom) {
|
||||||
console.log("未正确绑定弹窗容器");
|
console.log("未正确绑定弹窗容器");
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
g.dom.style.display = "block"; // 兼容 layer 捕获层
|
||||||
var d = document.createElement("div");
|
var d = document.createElement("div");
|
||||||
var e = document.createElement("div");
|
var e = document.createElement("div");
|
||||||
var f = document.createElement("div");
|
var f = document.createElement("div");
|
||||||
d.setAttribute("class", "mSlider-main ms-" + g.rnd);
|
d.setAttribute("class", "mSlider-main ms-" + g.rnd);
|
||||||
e.setAttribute("class", "mSlider-inner");
|
e.setAttribute("class", "mSlider-inner");
|
||||||
f.setAttribute("class", "mSlider-mask");
|
f.setAttribute("class", "mSlider-mask");
|
||||||
g.Q("body")[0].appendChild(d);
|
g.Q(g.target)[0].appendChild(d);
|
||||||
g.Q(".ms-" + g.rnd)[0].appendChild(e);
|
g.Q(".ms-" + g.rnd)[0].appendChild(e);
|
||||||
g.Q(".ms-" + g.rnd)[0].appendChild(f);
|
g.Q(".ms-" + g.rnd)[0].appendChild(f);
|
||||||
g.wrap = g.Q(".ms-" + g.rnd)[0];
|
g.wrap = g.Q(".ms-" + g.rnd)[0];
|
||||||
@@ -116,7 +352,7 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
g.translate = "-100%,0,0"
|
g.translate = "-100%,0,0"
|
||||||
}
|
}
|
||||||
g.wrap.style.display = "none";
|
g.wrap.style.display = "none";
|
||||||
g.wrap.style.position = "fixed";
|
g.wrap.style.position = (g.target === "body" ? "fixed" : "absolute");
|
||||||
g.wrap.style.top = "0";
|
g.wrap.style.top = "0";
|
||||||
g.wrap.style.left = "0";
|
g.wrap.style.left = "0";
|
||||||
g.wrap.style.width = "100%";
|
g.wrap.style.width = "100%";
|
||||||
@@ -128,7 +364,7 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
g.inner.style.left = g.left;
|
g.inner.style.left = g.left;
|
||||||
g.inner.style.right = g.right;
|
g.inner.style.right = g.right;
|
||||||
g.inner.style.width = g.width;
|
g.inner.style.width = g.width;
|
||||||
g.inner.style.height = g.height;
|
g.inner.style.height = (g.target === "body" ? g.height : "100%");
|
||||||
g.inner.style.backgroundColor = "#fff";
|
g.inner.style.backgroundColor = "#fff";
|
||||||
g.inner.style.transform = "translate3d(" + g.translate + ")";
|
g.inner.style.transform = "translate3d(" + g.translate + ")";
|
||||||
g.inner.style.webkitTransition = "all .2s ease-out";
|
g.inner.style.webkitTransition = "all .2s ease-out";
|
||||||
@@ -142,39 +378,38 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
g.mask.style.webkitBackfaceVisibility = "hidden";
|
g.mask.style.webkitBackfaceVisibility = "hidden";
|
||||||
g.events()
|
g.events()
|
||||||
},
|
},
|
||||||
open: function() {
|
open: function () {
|
||||||
var d = this;
|
var d = this;
|
||||||
d.wrap.style.display = "block";
|
d.wrap.style.display = "block";
|
||||||
|
setTimeout(function () {
|
||||||
setTimeout(function() {
|
|
||||||
d.inner.style.transform = "translate3d(0,0,0)";
|
d.inner.style.transform = "translate3d(0,0,0)";
|
||||||
d.inner.style.webkitTransform = "translate3d(0,0,0)";
|
d.inner.style.webkitTransform = "translate3d(0,0,0)";
|
||||||
d.mask.style.opacity = 0.1
|
d.mask.style.opacity = 0.1
|
||||||
}, 30);
|
}, 30);
|
||||||
if (d.opts.time) {
|
if (d.opts.time) {
|
||||||
d.timer = setTimeout(function() {
|
d.timer = setTimeout(function () {
|
||||||
d.close()
|
d.close()
|
||||||
}, d.opts.time)
|
}, d.opts.time)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
close: function() {
|
close: function () {
|
||||||
var d = this;
|
var d = this;
|
||||||
d.timer && clearTimeout(d.timer);
|
d.timer && clearTimeout(d.timer);
|
||||||
d.inner.style.webkitTransform = "translate3d(" + d.translate + ")";
|
d.inner.style.webkitTransform = "translate3d(" + d.translate + ")";
|
||||||
d.inner.style.transform = "translate3d(" + d.translate + ")";
|
d.inner.style.transform = "translate3d(" + d.translate + ")";
|
||||||
d.mask.style.opacity = 0;
|
d.mask.style.opacity = 0;
|
||||||
setTimeout(function() {
|
setTimeout(function () {
|
||||||
d.wrap.style.display = "none";
|
d.wrap.style.display = "none";
|
||||||
d.timer = null;
|
d.timer = null;
|
||||||
d.opts.callback && d.opts.callback()
|
d.opts.callback && d.opts.callback()
|
||||||
}, 300)
|
}, 300)
|
||||||
},
|
},
|
||||||
events: function() {
|
events: function () {
|
||||||
var d = this;
|
var d = this;
|
||||||
d.addEvent(d.mask, "touchmove", function(f) {
|
d.addEvent(d.mask, "touchmove", function (f) {
|
||||||
f.preventDefault()
|
f.preventDefault()
|
||||||
});
|
});
|
||||||
d.addEvent(d.mask, (d.isMobile() ? "touchend" : "click"), function(f) {
|
d.addEvent(d.mask, (d.isMobile() ? "touchend" : "click"), function (f) {
|
||||||
if (d.opts.maskClose) {
|
if (d.opts.maskClose) {
|
||||||
d.close()
|
d.close()
|
||||||
}
|
}
|
||||||
@@ -182,4 +417,4 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
b.mSlider = a
|
b.mSlider = a
|
||||||
})(window);
|
})(window);
|
||||||
|
|||||||
@@ -21,14 +21,10 @@ layui.define(function(exports) {
|
|||||||
},
|
},
|
||||||
"line": {
|
"line": {
|
||||||
"itemStyle": {
|
"itemStyle": {
|
||||||
"normal": {
|
|
||||||
"borderWidth": "3"
|
"borderWidth": "3"
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"lineStyle": {
|
"lineStyle": {
|
||||||
"normal": {
|
|
||||||
"width": "4"
|
"width": "4"
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"symbolSize": "10",
|
"symbolSize": "10",
|
||||||
"symbol": "emptyCircle",
|
"symbol": "emptyCircle",
|
||||||
@@ -36,14 +32,10 @@ layui.define(function(exports) {
|
|||||||
},
|
},
|
||||||
"radar": {
|
"radar": {
|
||||||
"itemStyle": {
|
"itemStyle": {
|
||||||
"normal": {
|
|
||||||
"borderWidth": "3"
|
"borderWidth": "3"
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"lineStyle": {
|
"lineStyle": {
|
||||||
"normal": {
|
|
||||||
"width": "4"
|
"width": "4"
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"symbolSize": "10",
|
"symbolSize": "10",
|
||||||
"symbol": "emptyCircle",
|
"symbol": "emptyCircle",
|
||||||
@@ -51,11 +43,11 @@ layui.define(function(exports) {
|
|||||||
},
|
},
|
||||||
"bar": {
|
"bar": {
|
||||||
"itemStyle": {
|
"itemStyle": {
|
||||||
"normal": {
|
|
||||||
"barBorderWidth": 0,
|
"barBorderWidth": 0,
|
||||||
"barBorderColor": "#ccc"
|
"barBorderColor": "#ccc"
|
||||||
},
|
},
|
||||||
"emphasis": {
|
"emphasis": {
|
||||||
|
"itemStyle": {
|
||||||
"barBorderWidth": 0,
|
"barBorderWidth": 0,
|
||||||
"barBorderColor": "#ccc"
|
"barBorderColor": "#ccc"
|
||||||
}
|
}
|
||||||
@@ -63,11 +55,11 @@ layui.define(function(exports) {
|
|||||||
},
|
},
|
||||||
"pie": {
|
"pie": {
|
||||||
"itemStyle": {
|
"itemStyle": {
|
||||||
"normal": {
|
|
||||||
"borderWidth": 0,
|
"borderWidth": 0,
|
||||||
"borderColor": "#ccc"
|
"borderColor": "#ccc"
|
||||||
},
|
},
|
||||||
"emphasis": {
|
"emphasis": {
|
||||||
|
"itemStyle": {
|
||||||
"borderWidth": 0,
|
"borderWidth": 0,
|
||||||
"borderColor": "#ccc"
|
"borderColor": "#ccc"
|
||||||
}
|
}
|
||||||
@@ -75,11 +67,11 @@ layui.define(function(exports) {
|
|||||||
},
|
},
|
||||||
"scatter": {
|
"scatter": {
|
||||||
"itemStyle": {
|
"itemStyle": {
|
||||||
"normal": {
|
|
||||||
"borderWidth": 0,
|
"borderWidth": 0,
|
||||||
"borderColor": "#ccc"
|
"borderColor": "#ccc"
|
||||||
},
|
},
|
||||||
"emphasis": {
|
"emphasis": {
|
||||||
|
"itemStyle": {
|
||||||
"borderWidth": 0,
|
"borderWidth": 0,
|
||||||
"borderColor": "#ccc"
|
"borderColor": "#ccc"
|
||||||
}
|
}
|
||||||
@@ -87,11 +79,12 @@ layui.define(function(exports) {
|
|||||||
},
|
},
|
||||||
"boxplot": {
|
"boxplot": {
|
||||||
"itemStyle": {
|
"itemStyle": {
|
||||||
"normal": {
|
"borderWidth": 0,
|
||||||
"borderWidth": 0,
|
"borderColor": "#ccc"
|
||||||
"borderColor": "#ccc"
|
|
||||||
},
|
},
|
||||||
"emphasis": {
|
"emphasis": {
|
||||||
|
"itemStyle": {
|
||||||
"borderWidth": 0,
|
"borderWidth": 0,
|
||||||
"borderColor": "#ccc"
|
"borderColor": "#ccc"
|
||||||
}
|
}
|
||||||
@@ -99,11 +92,11 @@ layui.define(function(exports) {
|
|||||||
},
|
},
|
||||||
"parallel": {
|
"parallel": {
|
||||||
"itemStyle": {
|
"itemStyle": {
|
||||||
"normal": {
|
|
||||||
"borderWidth": 0,
|
"borderWidth": 0,
|
||||||
"borderColor": "#ccc"
|
"borderColor": "#ccc"
|
||||||
},
|
},
|
||||||
"emphasis": {
|
"emphasis": {
|
||||||
|
"itemStyle": {
|
||||||
"borderWidth": 0,
|
"borderWidth": 0,
|
||||||
"borderColor": "#ccc"
|
"borderColor": "#ccc"
|
||||||
}
|
}
|
||||||
@@ -111,11 +104,11 @@ layui.define(function(exports) {
|
|||||||
},
|
},
|
||||||
"sankey": {
|
"sankey": {
|
||||||
"itemStyle": {
|
"itemStyle": {
|
||||||
"normal": {
|
"borderWidth": 0,
|
||||||
"borderWidth": 0,
|
"borderColor": "#ccc"
|
||||||
"borderColor": "#ccc"
|
},
|
||||||
},
|
"emphasis": {
|
||||||
"emphasis": {
|
"itemStyle": {
|
||||||
"borderWidth": 0,
|
"borderWidth": 0,
|
||||||
"borderColor": "#ccc"
|
"borderColor": "#ccc"
|
||||||
}
|
}
|
||||||
@@ -123,11 +116,11 @@ layui.define(function(exports) {
|
|||||||
},
|
},
|
||||||
"funnel": {
|
"funnel": {
|
||||||
"itemStyle": {
|
"itemStyle": {
|
||||||
"normal": {
|
"borderWidth": 0,
|
||||||
"borderWidth": 0,
|
"borderColor": "#ccc"
|
||||||
"borderColor": "#ccc"
|
},
|
||||||
},
|
"emphasis": {
|
||||||
"emphasis": {
|
"itemStyle": {
|
||||||
"borderWidth": 0,
|
"borderWidth": 0,
|
||||||
"borderColor": "#ccc"
|
"borderColor": "#ccc"
|
||||||
}
|
}
|
||||||
@@ -135,11 +128,11 @@ layui.define(function(exports) {
|
|||||||
},
|
},
|
||||||
"gauge": {
|
"gauge": {
|
||||||
"itemStyle": {
|
"itemStyle": {
|
||||||
"normal": {
|
"borderWidth": 0,
|
||||||
"borderWidth": 0,
|
"borderColor": "#ccc"
|
||||||
"borderColor": "#ccc"
|
},
|
||||||
},
|
"emphasis": {
|
||||||
"emphasis": {
|
"itemStyle": {
|
||||||
"borderWidth": 0,
|
"borderWidth": 0,
|
||||||
"borderColor": "#ccc"
|
"borderColor": "#ccc"
|
||||||
}
|
}
|
||||||
@@ -147,27 +140,21 @@ layui.define(function(exports) {
|
|||||||
},
|
},
|
||||||
"candlestick": {
|
"candlestick": {
|
||||||
"itemStyle": {
|
"itemStyle": {
|
||||||
"normal": {
|
"color": "#e6a0d2",
|
||||||
"color": "#e6a0d2",
|
"color0": "transparent",
|
||||||
"color0": "transparent",
|
"borderColor": "#e6a0d2",
|
||||||
"borderColor": "#e6a0d2",
|
"borderColor0": "#3fb1e3",
|
||||||
"borderColor0": "#3fb1e3",
|
"borderWidth": "2"
|
||||||
"borderWidth": "2"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"graph": {
|
"graph": {
|
||||||
"itemStyle": {
|
"itemStyle": {
|
||||||
"normal": {
|
"borderWidth": 0,
|
||||||
"borderWidth": 0,
|
"borderColor": "#ccc"
|
||||||
"borderColor": "#ccc"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"lineStyle": {
|
"lineStyle": {
|
||||||
"normal": {
|
|
||||||
"width": "1",
|
"width": "1",
|
||||||
"color": "#cccccc"
|
"color": "#cccccc"
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"symbolSize": "10",
|
"symbolSize": "10",
|
||||||
"symbol": "emptyCircle",
|
"symbol": "emptyCircle",
|
||||||
@@ -180,63 +167,47 @@ layui.define(function(exports) {
|
|||||||
"#c4ebad",
|
"#c4ebad",
|
||||||
"#96dee8"
|
"#96dee8"
|
||||||
],
|
],
|
||||||
"label": {
|
"label": {
|
||||||
"normal": {
|
"color": "#ffffff"
|
||||||
"textStyle": {
|
|
||||||
"color": "#ffffff"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"map": {
|
"map": {
|
||||||
"itemStyle": {
|
"itemStyle": {
|
||||||
"normal": {
|
"areaColor": "#eeeeee",
|
||||||
"areaColor": "#eeeeee",
|
"borderColor": "#aaaaaa",
|
||||||
"borderColor": "#aaaaaa",
|
"borderWidth": 0.5
|
||||||
"borderWidth": 0.5
|
},
|
||||||
},
|
"label": {
|
||||||
"emphasis": {
|
"color": "#ffffff"
|
||||||
|
},
|
||||||
|
"emphasis": {
|
||||||
|
"itemStyle": {
|
||||||
"areaColor": "rgba(63,177,227,0.25)",
|
"areaColor": "rgba(63,177,227,0.25)",
|
||||||
"borderColor": "#3fb1e3",
|
"borderColor": "#3fb1e3",
|
||||||
"borderWidth": 1
|
"borderWidth": 1
|
||||||
}
|
|
||||||
},
|
|
||||||
"label": {
|
|
||||||
"normal": {
|
|
||||||
"textStyle": {
|
|
||||||
"color": "#ffffff"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"emphasis": {
|
"label":{
|
||||||
"textStyle": {
|
"color": "rgb(63,177,227)"
|
||||||
"color": "rgb(63,177,227)"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"geo": {
|
"geo": {
|
||||||
"itemStyle": {
|
"itemStyle": {
|
||||||
"normal": {
|
"areaColor": "#eeeeee",
|
||||||
"areaColor": "#eeeeee",
|
"borderColor": "#aaaaaa",
|
||||||
"borderColor": "#aaaaaa",
|
"borderWidth": 0.5
|
||||||
"borderWidth": 0.5
|
},
|
||||||
},
|
"label": {
|
||||||
"emphasis": {
|
"color": "#ffffff"
|
||||||
|
},
|
||||||
|
"emphasis": {
|
||||||
|
"itemStyle": {
|
||||||
"areaColor": "rgba(63,177,227,0.25)",
|
"areaColor": "rgba(63,177,227,0.25)",
|
||||||
"borderColor": "#3fb1e3",
|
"borderColor": "#3fb1e3",
|
||||||
"borderWidth": 1
|
"borderWidth": 1
|
||||||
}
|
|
||||||
},
|
|
||||||
"label": {
|
|
||||||
"normal": {
|
|
||||||
"textStyle": {
|
|
||||||
"color": "#ffffff"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"emphasis": {
|
"label":{
|
||||||
"textStyle": {
|
"color": "rgb(63,177,227)"
|
||||||
"color": "rgb(63,177,227)"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -255,9 +226,9 @@ layui.define(function(exports) {
|
|||||||
},
|
},
|
||||||
"axisLabel": {
|
"axisLabel": {
|
||||||
"show": true,
|
"show": true,
|
||||||
"textStyle": {
|
|
||||||
"color": "#999999"
|
"color": "#999999"
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"splitLine": {
|
"splitLine": {
|
||||||
"show": true,
|
"show": true,
|
||||||
@@ -291,10 +262,9 @@ layui.define(function(exports) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"axisLabel": {
|
"axisLabel": {
|
||||||
"show": true,
|
"show": true,
|
||||||
"textStyle": {
|
"color": "#999999"
|
||||||
"color": "#999999"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"splitLine": {
|
"splitLine": {
|
||||||
"show": true,
|
"show": true,
|
||||||
@@ -328,10 +298,9 @@ layui.define(function(exports) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"axisLabel": {
|
"axisLabel": {
|
||||||
"show": true,
|
"show": true,
|
||||||
"textStyle": {
|
"color": "#999999"
|
||||||
"color": "#999999"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"splitLine": {
|
"splitLine": {
|
||||||
"show": true,
|
"show": true,
|
||||||
@@ -366,9 +335,9 @@ layui.define(function(exports) {
|
|||||||
},
|
},
|
||||||
"axisLabel": {
|
"axisLabel": {
|
||||||
"show": true,
|
"show": true,
|
||||||
"textStyle": {
|
|
||||||
"color": "#999999"
|
"color": "#999999"
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"splitLine": {
|
"splitLine": {
|
||||||
"show": true,
|
"show": true,
|
||||||
@@ -390,10 +359,10 @@ layui.define(function(exports) {
|
|||||||
},
|
},
|
||||||
"toolbox": {
|
"toolbox": {
|
||||||
"iconStyle": {
|
"iconStyle": {
|
||||||
"normal": {
|
"borderColor": "#999999"
|
||||||
"borderColor": "#999999"
|
},
|
||||||
},
|
"emphasis": {
|
||||||
"emphasis": {
|
"iconStyle": {
|
||||||
"borderColor": "#666666"
|
"borderColor": "#666666"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -420,41 +389,34 @@ layui.define(function(exports) {
|
|||||||
"color": "#626c91",
|
"color": "#626c91",
|
||||||
"width": 1
|
"width": 1
|
||||||
},
|
},
|
||||||
"itemStyle": {
|
"itemStyle": {
|
||||||
"normal": {
|
"color": "#626c91",
|
||||||
"color": "#626c91",
|
"borderWidth": 1
|
||||||
"borderWidth": 1
|
|
||||||
},
|
},
|
||||||
"emphasis": {
|
"controlStyle": {
|
||||||
"color": "#626c91"
|
"color": "#626c91",
|
||||||
}
|
"borderColor": "#626c91",
|
||||||
},
|
"borderWidth": 0.5
|
||||||
"controlStyle": {
|
|
||||||
"normal": {
|
|
||||||
"color": "#626c91",
|
|
||||||
"borderColor": "#626c91",
|
|
||||||
"borderWidth": 0.5
|
|
||||||
},
|
|
||||||
"emphasis": {
|
|
||||||
"color": "#626c91",
|
|
||||||
"borderColor": "#626c91",
|
|
||||||
"borderWidth": 0.5
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"checkpointStyle": {
|
"checkpointStyle": {
|
||||||
"color": "#3fb1e3",
|
"color": "#3fb1e3",
|
||||||
"borderColor": "rgba(63,177,227,0.15)"
|
"borderColor": "rgba(63,177,227,0.15)"
|
||||||
},
|
},
|
||||||
"label": {
|
"label": {
|
||||||
"normal": {
|
"color": "#626c91"
|
||||||
"textStyle": {
|
},
|
||||||
"color": "#626c91"
|
"emphasis": {
|
||||||
}
|
"itemStyle": {
|
||||||
|
"color": "#626c91"
|
||||||
},
|
},
|
||||||
"emphasis": {
|
"controlStyle":{
|
||||||
"textStyle": {
|
"color": "#626c91",
|
||||||
"color": "#626c91"
|
"borderColor": "#626c91",
|
||||||
}
|
"borderWidth": 0.5
|
||||||
|
},
|
||||||
|
"label":{
|
||||||
|
"color": "#626c91"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -475,16 +437,12 @@ layui.define(function(exports) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"markPoint": {
|
"markPoint": {
|
||||||
"label": {
|
"label": {
|
||||||
"normal": {
|
"color": "#ffffff"
|
||||||
"textStyle": {
|
},
|
||||||
"color": "#ffffff"
|
"emphasis": {
|
||||||
}
|
"label": {
|
||||||
},
|
"color": "#ffffff"
|
||||||
"emphasis": {
|
|
||||||
"textStyle": {
|
|
||||||
"color": "#ffffff"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1771,5 +1771,5 @@ layui.define(function (exports) {
|
|||||||
pearHash.Base64Decode = function (str) {
|
pearHash.Base64Decode = function (str) {
|
||||||
return Base64.decode(str);
|
return Base64.decode(str);
|
||||||
}
|
}
|
||||||
exports('hash', pearHash);
|
exports('encrypt', pearHash);
|
||||||
});
|
});
|
||||||
@@ -1,80 +1,71 @@
|
|||||||
layui.define(['table', 'jquery', 'element'], function (exports) {
|
layui.define(['jquery', 'element'], function(exports) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var MOD_NAME = 'frame',
|
var $ = layui.jquery;
|
||||||
$ = layui.jquery,
|
|
||||||
element = layui.element;
|
|
||||||
|
|
||||||
var pearFrame = function (opt) {
|
|
||||||
this.option = opt;
|
|
||||||
};
|
|
||||||
|
|
||||||
pearFrame.prototype.render = function (opt) {
|
var frame = function(opt) {
|
||||||
|
this.option = opt;
|
||||||
|
};
|
||||||
|
|
||||||
|
frame.prototype.render = function(opt) {
|
||||||
var option = {
|
var option = {
|
||||||
elem:opt.elem,
|
elem: opt.elem,
|
||||||
url:opt.url,
|
url: opt.url,
|
||||||
title:opt.title,
|
title: opt.title,
|
||||||
width:opt.width,
|
width: opt.width,
|
||||||
height:opt.height,
|
height: opt.height,
|
||||||
done:opt.done ? opt.done: function(){ console.log("菜单渲染成功");}
|
done: opt.done ? opt.done : function() {
|
||||||
}
|
console.log("菜单渲染成功");
|
||||||
createFrameHTML(option);
|
|
||||||
$("#"+option.elem).width(option.width);
|
|
||||||
$("#"+option.elem).height(option.height);
|
|
||||||
return new pearFrame(option);
|
|
||||||
}
|
|
||||||
|
|
||||||
pearFrame.prototype.changePage = function(url,loading){
|
|
||||||
if(loading){
|
|
||||||
var loading = $("#"+this.option.elem).find(".pear-frame-loading");
|
|
||||||
loading.css({display:'block'});
|
|
||||||
}
|
|
||||||
$("#"+this.option.elem+" iframe").attr("src",url);
|
|
||||||
if(loading){
|
|
||||||
var loading = $("#"+this.option.elem).find(".pear-frame-loading");
|
|
||||||
setTimeout(function(){
|
|
||||||
loading.fadeOut(500);
|
|
||||||
},800)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pearFrame.prototype.changePageByElement = function(elem,url,title,loading){
|
|
||||||
if(loading){
|
|
||||||
var loading = $("#"+elem).find(".pear-frame-loading");
|
|
||||||
loading.css({display:'block'});
|
|
||||||
}
|
|
||||||
$("#"+elem+" iframe").attr("src",url);
|
|
||||||
$("#"+elem+" .title").html(title);
|
|
||||||
if(loading){
|
|
||||||
var loading = $("#"+elem).find(".pear-frame-loading");
|
|
||||||
setTimeout(function(){
|
|
||||||
loading.css({display:'none'});
|
|
||||||
},400)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pearFrame.prototype.refresh = function (time) {
|
|
||||||
if(time!=false){
|
|
||||||
var loading = $("#"+this.option.elem).find(".pear-frame-loading");
|
|
||||||
loading.css({display:'block'});
|
|
||||||
if(time!=0){
|
|
||||||
setTimeout(function(){
|
|
||||||
loading.fadeOut(500);
|
|
||||||
},time)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$("#"+this.option.elem).find("iframe")[0].contentWindow.location.reload(true);
|
renderContent(option);
|
||||||
|
$("#" + option.elem).width(option.width);
|
||||||
|
$("#" + option.elem).height(option.height);
|
||||||
|
return new frame(option);
|
||||||
|
}
|
||||||
|
|
||||||
|
frame.prototype.changePage = function(url, loading) {
|
||||||
|
var $frameLoad = $("#" + this.option.elem).find(".pear-frame-loading");
|
||||||
|
var $frame = $("#" + this.option.elem + " iframe");
|
||||||
|
$frame.attr("src", url);
|
||||||
|
renderContentLoading($frame, $frameLoad, loading);
|
||||||
|
}
|
||||||
|
|
||||||
|
frame.prototype.changePageByElement = function(elem, url, title, loading) {
|
||||||
|
var $frameLoad = $("#" + elem).find(".pear-frame-loading");
|
||||||
|
var $frame = $("#" + elem + " iframe");
|
||||||
|
$frame.attr("src", url);
|
||||||
|
$("#" + elem + " .title").html(title);
|
||||||
|
renderContentLoading($frame, $frameLoad, loading);
|
||||||
|
}
|
||||||
|
|
||||||
|
frame.prototype.refresh = function(loading) {
|
||||||
|
var $frameLoad = $("#" + this.option.elem).find(".pear-frame-loading");
|
||||||
|
var $frame = $("#" + this.option.elem).find("iframe");
|
||||||
|
$frame.attr("src", $frame.attr("src"));
|
||||||
|
renderContentLoading($frame, $frameLoad, loading);
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderContent(option) {
|
||||||
|
var iframe = `<iframe class='pear-frame-content' style='width:100%;height:100%;' scrolling='auto' frameborder='0' src='${option.url}' allowfullscreen='true' ></iframe>`;
|
||||||
|
var loading = `<div class="pear-frame-loading">
|
||||||
|
<div class="ball-loader">
|
||||||
|
<span></span><span></span><span></span><span></span>
|
||||||
|
</div>
|
||||||
|
</div></div>`;
|
||||||
|
$("#" + option.elem).html("<div class='pear-frame'>" + iframe + loading + "</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
function createFrameHTML(option){
|
function renderContentLoading (iframeEl, loadingEl, isLoading) {
|
||||||
var iframe = "<iframe class='pear-frame-content' style='width:100%;height:100%;' scrolling='auto' frameborder='0' src='"+option.url+"' ></iframe>";
|
if (isLoading) {
|
||||||
var loading = '<div class="pear-frame-loading">'+
|
loadingEl.css({
|
||||||
'<div class="ball-loader">'+
|
display: 'block'
|
||||||
'<span></span><span></span><span></span><span></span>'+
|
});
|
||||||
'</div>'+
|
$(iframeEl).on('load', function() {
|
||||||
'</div></div>';
|
loadingEl.fadeOut(1000);
|
||||||
$("#"+option.elem).html("<div class='pear-frame'>"+ iframe + loading +"</div>");
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exports(MOD_NAME,new pearFrame());
|
exports('frame', new frame());
|
||||||
})
|
});
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
layui.define(['message', 'table', 'jquery', 'element', 'yaml', 'form', 'tab', 'menu', 'frame', 'theme', 'convert'],
|
||||||
|
function(exports) {
|
||||||
|
"use strict";
|
||||||
|
var $ = layui.jquery;
|
||||||
|
var defer = $.Deferred();
|
||||||
|
var fullScreen = new function() {
|
||||||
|
this.func = null;
|
||||||
|
this.onFullchange = function(func){
|
||||||
|
this.func = func;
|
||||||
|
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("返回值");
|
||||||
|
return defer.promise();
|
||||||
|
}
|
||||||
|
this.fullClose = function(){
|
||||||
|
if(this.isFullscreen()) {
|
||||||
|
if (document.exitFullscreen) {
|
||||||
|
document.exitFullscreen();
|
||||||
|
} else if (document.mozCancelFullScreen) {
|
||||||
|
document.mozCancelFullScreen();
|
||||||
|
} else if (document.webkitCancelFullScreen) {
|
||||||
|
document.webkitCancelFullScreen();
|
||||||
|
} else if (document.msExitFullscreen) {
|
||||||
|
document.msExitFullscreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defer.resolve("返回值");
|
||||||
|
return defer.promise();
|
||||||
|
}
|
||||||
|
this.isFullscreen = function(){
|
||||||
|
return document.fullscreenElement ||
|
||||||
|
document.msFullscreenElement ||
|
||||||
|
document.mozFullScreenElement ||
|
||||||
|
document.webkitFullscreenElement || false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
exports('fullscreen', fullScreen);
|
||||||
|
})
|
||||||
@@ -42,7 +42,8 @@ layui.define(['jquery', 'layer'], function (exports) {
|
|||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
headers: {
|
headers: {
|
||||||
'X-Requested-With': 'XMLHttpRequest'
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
}
|
},
|
||||||
|
customHandleError: true
|
||||||
},
|
},
|
||||||
|
|
||||||
defaultError: {
|
defaultError: {
|
||||||
@@ -112,7 +113,7 @@ layui.define(['jquery', 'layer'], function (exports) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
handleErrorResponse: function (jqXHR, userOptions, $dfd) {
|
handleErrorResponse: function (jqXHR, userOptions, $dfd) {
|
||||||
if (userOptions.customHandleError !== false) {
|
if (!userOptions.customHandleError) {
|
||||||
switch (jqXHR.status) {
|
switch (jqXHR.status) {
|
||||||
case 401:
|
case 401:
|
||||||
http.ajax.showErrorAndRedirectUrl(http.ajax.defaultError401, http.appPath);
|
http.ajax.showErrorAndRedirectUrl(http.ajax.defaultError401, http.appPath);
|
||||||
|
|||||||
@@ -0,0 +1,525 @@
|
|||||||
|
layui.define(['laypage', 'form'], function(exports) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var IconPicker = function() {
|
||||||
|
this.v = '1.1';
|
||||||
|
},
|
||||||
|
_MOD = 'iconPicker',
|
||||||
|
_this = this,
|
||||||
|
$ = layui.jquery,
|
||||||
|
laypage = layui.laypage,
|
||||||
|
form = layui.form,
|
||||||
|
BODY = 'body',
|
||||||
|
TIPS = '请选择图标';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渲染组件
|
||||||
|
*/
|
||||||
|
IconPicker.prototype.render = function(options) {
|
||||||
|
var opts = options,
|
||||||
|
// DOM选择器
|
||||||
|
elem = opts.elem,
|
||||||
|
// 数据类型:fontClass/unicode
|
||||||
|
type = opts.type == null ? 'fontClass' : opts.type,
|
||||||
|
// 是否分页:true/false
|
||||||
|
page = opts.page == null ? true : opts.page,
|
||||||
|
// 每页显示数量
|
||||||
|
limit = opts.limit == null ? 12 : opts.limit,
|
||||||
|
// 是否开启搜索:true/false
|
||||||
|
search = opts.search == null ? true : opts.search,
|
||||||
|
// 每个图标格子的宽度:'43px'或'20%'
|
||||||
|
cellWidth = opts.cellWidth,
|
||||||
|
// 点击回调
|
||||||
|
click = opts.click,
|
||||||
|
// 渲染成功后的回调
|
||||||
|
success = opts.success,
|
||||||
|
// 前缀 默认使用 layui-icon
|
||||||
|
ICON_prefix = opts.prefix == null ? "layui-icon" : opts.prefix,
|
||||||
|
// 异步获取外部字体图标数据
|
||||||
|
ICON_url = opts.url ,
|
||||||
|
// json数据
|
||||||
|
data = {},
|
||||||
|
// 唯一标识
|
||||||
|
tmp = new Date().getTime(),
|
||||||
|
// 是否使用的class数据
|
||||||
|
isFontClass = opts.type === 'fontClass',
|
||||||
|
// 是否使用自定义图标数据
|
||||||
|
isCustom = opts.url !=null && opts.prefix != null,
|
||||||
|
|
||||||
|
// 初始化时input的值
|
||||||
|
ORIGINAL_ELEM_VALUE = $(elem).val(),
|
||||||
|
TITLE = 'layui-select-title',
|
||||||
|
TITLE_ID = 'layui-select-title-' + tmp,
|
||||||
|
ICON_BODY = 'layui-iconpicker-' + tmp,
|
||||||
|
PICKER_BODY = 'layui-iconpicker-body-' + tmp,
|
||||||
|
PAGE_ID = 'layui-iconpicker-page-' + tmp,
|
||||||
|
LIST_BOX = 'layui-iconpicker-list-box',
|
||||||
|
selected = 'layui-form-selected',
|
||||||
|
unselect = 'layui-unselect';
|
||||||
|
|
||||||
|
var a = {
|
||||||
|
init: function() {
|
||||||
|
if(isCustom)
|
||||||
|
{
|
||||||
|
data = common.ajaxData(ICON_url,ICON_prefix);
|
||||||
|
}else{
|
||||||
|
data = common.getData[type]();
|
||||||
|
}
|
||||||
|
a.hideElem().createSelect().createBody().toggleSelect();
|
||||||
|
a.preventEvent().inputListen();
|
||||||
|
common.loadCss();
|
||||||
|
|
||||||
|
if (success) {
|
||||||
|
success(this.successHandle());
|
||||||
|
}
|
||||||
|
|
||||||
|
return a;
|
||||||
|
},
|
||||||
|
successHandle: function() {
|
||||||
|
var d = {
|
||||||
|
options: opts,
|
||||||
|
data: data,
|
||||||
|
id: tmp,
|
||||||
|
elem: $('#' + ICON_BODY)
|
||||||
|
};
|
||||||
|
return d;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 隐藏elem
|
||||||
|
*/
|
||||||
|
hideElem: function() {
|
||||||
|
$(elem).hide();
|
||||||
|
return a;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 绘制select下拉选择框
|
||||||
|
*/
|
||||||
|
createSelect: function() {
|
||||||
|
var oriIcon = '<i class="layui-icon">';
|
||||||
|
|
||||||
|
// 默认图标
|
||||||
|
if (ORIGINAL_ELEM_VALUE === '') {
|
||||||
|
if (isFontClass) {
|
||||||
|
ORIGINAL_ELEM_VALUE = 'layui-icon-circle-dot';
|
||||||
|
} else {
|
||||||
|
ORIGINAL_ELEM_VALUE = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isFontClass || isCustom) {
|
||||||
|
oriIcon = '<i class="'+ ICON_prefix + ' ' + ORIGINAL_ELEM_VALUE + '">';
|
||||||
|
} else {
|
||||||
|
oriIcon += ORIGINAL_ELEM_VALUE;
|
||||||
|
}
|
||||||
|
oriIcon += '</i>';
|
||||||
|
|
||||||
|
var selectHtml =
|
||||||
|
'<div class="layui-iconpicker layui-unselect layui-form-select" id="' +
|
||||||
|
ICON_BODY + '">' +
|
||||||
|
'<div class="' + TITLE + '" id="' + TITLE_ID + '">' +
|
||||||
|
'<div class="layui-iconpicker-item">' +
|
||||||
|
'<span class="layui-iconpicker-icon layui-unselect">' +
|
||||||
|
oriIcon +
|
||||||
|
'</span>' +
|
||||||
|
'<i class="layui-edge"></i>' +
|
||||||
|
'</div>' +
|
||||||
|
'</div>' +
|
||||||
|
'<div class="layui-anim layui-anim-upbit" style="">' +
|
||||||
|
'123' +
|
||||||
|
'</div>';
|
||||||
|
$(elem).after(selectHtml);
|
||||||
|
return a;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 展开/折叠下拉框
|
||||||
|
*/
|
||||||
|
toggleSelect: function() {
|
||||||
|
var item = '#' + TITLE_ID + ' .layui-iconpicker-item,#' + TITLE_ID +
|
||||||
|
' .layui-iconpicker-item .layui-edge';
|
||||||
|
a.event('click', item, function(e) {
|
||||||
|
var $icon = $('#' + ICON_BODY);
|
||||||
|
if ($icon.hasClass(selected)) {
|
||||||
|
$icon.removeClass(selected).addClass(unselect);
|
||||||
|
} else {
|
||||||
|
// 隐藏其他picker
|
||||||
|
$('.layui-form-select').removeClass(selected);
|
||||||
|
// 显示当前picker
|
||||||
|
$icon.addClass(selected).removeClass(unselect);
|
||||||
|
}
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
return a;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 绘制主体部分
|
||||||
|
*/
|
||||||
|
createBody: function() {
|
||||||
|
// 获取数据
|
||||||
|
var searchHtml = '';
|
||||||
|
|
||||||
|
if (search) {
|
||||||
|
searchHtml = '<div class="layui-iconpicker-search">' +
|
||||||
|
'<input class="layui-input">' +
|
||||||
|
'<i class="layui-icon"></i>' +
|
||||||
|
'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 组合dom
|
||||||
|
var bodyHtml = '<div class="layui-iconpicker-body" id="' + PICKER_BODY + '">' +
|
||||||
|
searchHtml +
|
||||||
|
'<div class="' + LIST_BOX + '"></div> ' +
|
||||||
|
'</div>';
|
||||||
|
$('#' + ICON_BODY).find('.layui-anim').eq(0).html(bodyHtml);
|
||||||
|
a.search().createList().check().page();
|
||||||
|
|
||||||
|
return a;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 绘制图标列表
|
||||||
|
* @param text 模糊查询关键字
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
createList: function(text) {
|
||||||
|
var d = data,
|
||||||
|
l = d.length,
|
||||||
|
pageHtml = '',
|
||||||
|
listHtml = $(
|
||||||
|
'<div class="layui-iconpicker-list">') //'<div class="layui-iconpicker-list">';
|
||||||
|
|
||||||
|
// 计算分页数据
|
||||||
|
var _limit = limit, // 每页显示数量
|
||||||
|
_pages = l % _limit === 0 ? l / _limit : parseInt(l / _limit + 1), // 总计多少页
|
||||||
|
_id = PAGE_ID;
|
||||||
|
|
||||||
|
// 图标列表
|
||||||
|
var icons = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < l; i++) {
|
||||||
|
var obj = d[i];
|
||||||
|
|
||||||
|
// 判断是否模糊查询
|
||||||
|
if (text && obj.indexOf(text) === -1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否自定义格子宽度
|
||||||
|
var style = '';
|
||||||
|
if (cellWidth !== null) {
|
||||||
|
style += ' style="width:' + cellWidth + '"';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 每个图标dom
|
||||||
|
var icon = '<div class="layui-iconpicker-icon-item" title="' + obj + '" ' +
|
||||||
|
style + '>';
|
||||||
|
if (isFontClass || isCustom)
|
||||||
|
{
|
||||||
|
icon += '<i class="'+ ICON_prefix + ' ' + obj + '"></i>';
|
||||||
|
}else{
|
||||||
|
icon += '<i class="layui-icon">' + obj.replace('amp;', '') + '</i>';
|
||||||
|
}
|
||||||
|
icon += '</div>';
|
||||||
|
|
||||||
|
icons.push(icon);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询出图标后再分页
|
||||||
|
l = icons.length;
|
||||||
|
_pages = l % _limit === 0 ? l / _limit : parseInt(l / _limit + 1);
|
||||||
|
for (var i = 0; i < _pages; i++) {
|
||||||
|
// 按limit分块
|
||||||
|
var lm = $(
|
||||||
|
'<div class="layui-iconpicker-icon-limit" id="layui-iconpicker-icon-limit-' +
|
||||||
|
tmp + (i + 1) + '">');
|
||||||
|
|
||||||
|
for (var j = i * _limit; j < (i + 1) * _limit && j < l; j++) {
|
||||||
|
lm.append(icons[j]);
|
||||||
|
}
|
||||||
|
|
||||||
|
listHtml.append(lm);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 无数据
|
||||||
|
if (l === 0) {
|
||||||
|
listHtml.append('<p class="layui-iconpicker-tips">无数据</p>');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断是否分页
|
||||||
|
if (page) {
|
||||||
|
$('#' + PICKER_BODY).addClass('layui-iconpicker-body-page');
|
||||||
|
pageHtml = '<div class="layui-iconpicker-page" id="' + PAGE_ID + '">' +
|
||||||
|
'<div class="layui-iconpicker-page-count">' +
|
||||||
|
'<span id="' + PAGE_ID + '-current">1</span>/' +
|
||||||
|
'<span id="' + PAGE_ID + '-pages">' + _pages + '</span>' +
|
||||||
|
' (<span id="' + PAGE_ID + '-length">' + l + '</span>)' +
|
||||||
|
'</div>' +
|
||||||
|
'<div class="layui-iconpicker-page-operate">' +
|
||||||
|
'<i class="layui-icon" id="' + PAGE_ID +
|
||||||
|
'-prev" data-index="0" prev></i> ' +
|
||||||
|
'<i class="layui-icon" id="' + PAGE_ID +
|
||||||
|
'-next" data-index="2" next></i> ' +
|
||||||
|
'</div>' +
|
||||||
|
'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$('#' + ICON_BODY).find('.layui-anim').find('.' + LIST_BOX).html('').append(
|
||||||
|
listHtml).append(pageHtml);
|
||||||
|
return a;
|
||||||
|
},
|
||||||
|
// 阻止Layui的一些默认事件
|
||||||
|
preventEvent: function() {
|
||||||
|
var item = '#' + ICON_BODY + ' .layui-anim';
|
||||||
|
a.event('click', item, function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
return a;
|
||||||
|
},
|
||||||
|
// 分页
|
||||||
|
page: function() {
|
||||||
|
var icon = '#' + PAGE_ID + ' .layui-iconpicker-page-operate .layui-icon';
|
||||||
|
|
||||||
|
$(icon).unbind('click');
|
||||||
|
a.event('click', icon, function(e) {
|
||||||
|
var elem = e.currentTarget,
|
||||||
|
total = parseInt($('#' + PAGE_ID + '-pages').html()),
|
||||||
|
isPrev = $(elem).attr('prev') !== undefined,
|
||||||
|
// 按钮上标的页码
|
||||||
|
index = parseInt($(elem).attr('data-index')),
|
||||||
|
$cur = $('#' + PAGE_ID + '-current'),
|
||||||
|
// 点击时正在显示的页码
|
||||||
|
current = parseInt($cur.html());
|
||||||
|
|
||||||
|
// 分页数据
|
||||||
|
if (isPrev && current > 1) {
|
||||||
|
current = current - 1;
|
||||||
|
$(icon + '[prev]').attr('data-index', current);
|
||||||
|
} else if (!isPrev && current < total) {
|
||||||
|
current = current + 1;
|
||||||
|
$(icon + '[next]').attr('data-index', current);
|
||||||
|
}
|
||||||
|
$cur.html(current);
|
||||||
|
|
||||||
|
// 图标数据
|
||||||
|
$('#' + ICON_BODY + ' .layui-iconpicker-icon-limit').hide();
|
||||||
|
$('#layui-iconpicker-icon-limit-' + tmp + current).show();
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
return a;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 搜索
|
||||||
|
*/
|
||||||
|
search: function() {
|
||||||
|
var item = '#' + PICKER_BODY + ' .layui-iconpicker-search .layui-input';
|
||||||
|
a.event('input propertychange', item, function(e) {
|
||||||
|
var elem = e.target,
|
||||||
|
t = $(elem).val();
|
||||||
|
a.createList(t);
|
||||||
|
});
|
||||||
|
return a;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 点击选中图标
|
||||||
|
*/
|
||||||
|
check: function() {
|
||||||
|
var item = '#' + PICKER_BODY + ' .layui-iconpicker-icon-item';
|
||||||
|
a.event('click', item, function(e) {
|
||||||
|
var el = $(e.currentTarget).find('.' + ICON_prefix),
|
||||||
|
icon = '';
|
||||||
|
console.log( el.attr('class'));
|
||||||
|
if (isFontClass || isCustom) {
|
||||||
|
var clsArr = el.attr('class').split(/[\s\n]/),
|
||||||
|
cls = clsArr[1],
|
||||||
|
icon = cls;
|
||||||
|
$('#' + TITLE_ID).find('.layui-iconpicker-item .' + ICON_prefix).html(
|
||||||
|
'').attr('class', clsArr.join(' '));
|
||||||
|
} else {
|
||||||
|
var cls = el.html(),
|
||||||
|
icon = cls;
|
||||||
|
$('#' + TITLE_ID).find('.layui-iconpicker-item .layui-icon').html(
|
||||||
|
icon);
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#' + ICON_BODY).removeClass(selected).addClass(unselect);
|
||||||
|
$(elem).val(icon).attr('value', icon);
|
||||||
|
// 回调
|
||||||
|
if (click) {
|
||||||
|
click({
|
||||||
|
icon: icon
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
return a;
|
||||||
|
},
|
||||||
|
// 监听原始input数值改变
|
||||||
|
inputListen: function() {
|
||||||
|
var el = $(elem);
|
||||||
|
a.event('change', elem, function() {
|
||||||
|
var value = el.val();
|
||||||
|
})
|
||||||
|
// el.change(function(){
|
||||||
|
|
||||||
|
// });
|
||||||
|
return a;
|
||||||
|
},
|
||||||
|
event: function(evt, el, fn) {
|
||||||
|
$(BODY).on(evt, el, fn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var common = {
|
||||||
|
/**
|
||||||
|
* 加载样式表
|
||||||
|
*/
|
||||||
|
loadCss: function() {
|
||||||
|
var css =
|
||||||
|
'.layui-iconpicker {max-width: 280px;}.layui-iconpicker .layui-anim{display:none;position:absolute;left:0;top:42px;padding:5px 0;z-index:899;min-width:100%;border:1px solid #d2d2d2;max-height:300px;overflow-y:auto;background-color:#fff;border-radius:2px;box-shadow:0 2px 4px rgba(0,0,0,.12);box-sizing:border-box;}.layui-iconpicker-item{border:1px solid #e6e6e6;width:90px;height:38px;border-radius:4px;cursor:pointer;position:relative;}.layui-iconpicker-icon{border-right:1px solid #e6e6e6;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;width:60px;height:100%;float:left;text-align:center;background:#fff;transition:all .3s;}.layui-iconpicker-icon i{line-height:38px;font-size:18px;}.layui-iconpicker-item > .layui-edge{left:70px;}.layui-iconpicker-item:hover{border-color:#D2D2D2!important;}.layui-iconpicker-item:hover .layui-iconpicker-icon{border-color:#D2D2D2!important;}.layui-iconpicker.layui-form-selected .layui-anim{display:block;}.layui-iconpicker-body{padding:6px;}.layui-iconpicker .layui-iconpicker-list{background-color:#fff;border:1px solid #ccc;border-radius:4px;}.layui-iconpicker .layui-iconpicker-icon-item{display:inline-block;width:21.1%;line-height:36px;text-align:center;cursor:pointer;vertical-align:top;height:36px;margin:4px;border:1px solid #ddd;border-radius:2px;transition:300ms;}.layui-iconpicker .layui-iconpicker-icon-item i.layui-icon{font-size:17px;}.layui-iconpicker .layui-iconpicker-icon-item:hover{background-color:#eee;border-color:#ccc;-webkit-box-shadow:0 0 2px #aaa,0 0 2px #fff inset;-moz-box-shadow:0 0 2px #aaa,0 0 2px #fff inset;box-shadow:0 0 2px #aaa,0 0 2px #fff inset;text-shadow:0 0 1px #fff;}.layui-iconpicker-search{position:relative;margin:0 0 6px 0;border:1px solid #e6e6e6;border-radius:2px;transition:300ms;}.layui-iconpicker-search:hover{border-color:#D2D2D2!important;}.layui-iconpicker-search .layui-input{cursor:text;display:inline-block;width:86%;border:none;padding-right:0;margin-top:1px;}.layui-iconpicker-search .layui-icon{position:absolute;top:11px;right:4%;}.layui-iconpicker-tips{text-align:center;padding:8px 0;cursor:not-allowed;}.layui-iconpicker-page{margin-top:6px;margin-bottom:-6px;font-size:12px;padding:0 2px;}.layui-iconpicker-page-count{display:inline-block;}.layui-iconpicker-page-operate{display:inline-block;float:right;cursor:default;}.layui-iconpicker-page-operate .layui-icon{font-size:12px;cursor:pointer;}.layui-iconpicker-body-page .layui-iconpicker-icon-limit{display:none;}.layui-iconpicker-body-page .layui-iconpicker-icon-limit:first-child{display:block;}';
|
||||||
|
var $style = $('head').find('style[iconpicker]');
|
||||||
|
if ($style.length === 0) {
|
||||||
|
$('head').append('<style rel="stylesheet" iconpicker>' + css + '</style>');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 获取数据
|
||||||
|
*/
|
||||||
|
getData: {
|
||||||
|
fontClass: function() {
|
||||||
|
var arr = ["layui-icon-rate-half", "layui-icon-rate", "layui-icon-rate-solid",
|
||||||
|
"layui-icon-cellphone", "layui-icon-vercode", "layui-icon-login-wechat",
|
||||||
|
"layui-icon-login-qq", "layui-icon-login-weibo", "layui-icon-password",
|
||||||
|
"layui-icon-username", "layui-icon-refresh-3", "layui-icon-auz",
|
||||||
|
"layui-icon-spread-left", "layui-icon-shrink-right",
|
||||||
|
"layui-icon-snowflake", "layui-icon-tips", "layui-icon-note",
|
||||||
|
"layui-icon-home", "layui-icon-senior", "layui-icon-refresh",
|
||||||
|
"layui-icon-refresh-1", "layui-icon-flag", "layui-icon-theme",
|
||||||
|
"layui-icon-notice", "layui-icon-website", "layui-icon-console",
|
||||||
|
"layui-icon-face-surprised", "layui-icon-set", "layui-icon-template-1",
|
||||||
|
"layui-icon-app", "layui-icon-template", "layui-icon-praise",
|
||||||
|
"layui-icon-tread", "layui-icon-male", "layui-icon-female",
|
||||||
|
"layui-icon-camera", "layui-icon-camera-fill", "layui-icon-more",
|
||||||
|
"layui-icon-more-vertical", "layui-icon-rmb", "layui-icon-dollar",
|
||||||
|
"layui-icon-diamond", "layui-icon-fire", "layui-icon-return",
|
||||||
|
"layui-icon-location", "layui-icon-read", "layui-icon-survey",
|
||||||
|
"layui-icon-face-smile", "layui-icon-face-cry",
|
||||||
|
"layui-icon-cart-simple", "layui-icon-cart", "layui-icon-next",
|
||||||
|
"layui-icon-prev", "layui-icon-upload-drag", "layui-icon-upload",
|
||||||
|
"layui-icon-download-circle", "layui-icon-component",
|
||||||
|
"layui-icon-file-b", "layui-icon-user", "layui-icon-find-fill",
|
||||||
|
"layui-icon-loading", "layui-icon-loading-1", "layui-icon-add-1",
|
||||||
|
"layui-icon-play", "layui-icon-pause", "layui-icon-headset",
|
||||||
|
"layui-icon-video", "layui-icon-voice", "layui-icon-speaker",
|
||||||
|
"layui-icon-fonts-del", "layui-icon-fonts-code",
|
||||||
|
"layui-icon-fonts-html", "layui-icon-fonts-strong", "layui-icon-unlink",
|
||||||
|
"layui-icon-picture", "layui-icon-link", "layui-icon-face-smile-b",
|
||||||
|
"layui-icon-align-left", "layui-icon-align-right",
|
||||||
|
"layui-icon-align-center", "layui-icon-fonts-u", "layui-icon-fonts-i",
|
||||||
|
"layui-icon-tabs", "layui-icon-radio", "layui-icon-circle",
|
||||||
|
"layui-icon-edit", "layui-icon-share", "layui-icon-delete",
|
||||||
|
"layui-icon-form", "layui-icon-cellphone-fine", "layui-icon-dialogue",
|
||||||
|
"layui-icon-fonts-clear", "layui-icon-layer", "layui-icon-date",
|
||||||
|
"layui-icon-water", "layui-icon-code-circle", "layui-icon-carousel",
|
||||||
|
"layui-icon-prev-circle", "layui-icon-layouts", "layui-icon-util",
|
||||||
|
"layui-icon-templeate-1", "layui-icon-upload-circle", "layui-icon-tree",
|
||||||
|
"layui-icon-table", "layui-icon-chart", "layui-icon-chart-screen",
|
||||||
|
"layui-icon-engine", "layui-icon-triangle-d", "layui-icon-triangle-r",
|
||||||
|
"layui-icon-file", "layui-icon-set-sm", "layui-icon-add-circle",
|
||||||
|
"layui-icon-404", "layui-icon-about", "layui-icon-up",
|
||||||
|
"layui-icon-down", "layui-icon-left", "layui-icon-right",
|
||||||
|
"layui-icon-circle-dot", "layui-icon-search", "layui-icon-set-fill",
|
||||||
|
"layui-icon-group", "layui-icon-friends", "layui-icon-reply-fill",
|
||||||
|
"layui-icon-menu-fill", "layui-icon-log", "layui-icon-picture-fine",
|
||||||
|
"layui-icon-face-smile-fine", "layui-icon-list", "layui-icon-release",
|
||||||
|
"layui-icon-ok", "layui-icon-help", "layui-icon-chat", "layui-icon-top",
|
||||||
|
"layui-icon-star", "layui-icon-star-fill", "layui-icon-close-fill",
|
||||||
|
"layui-icon-close", "layui-icon-ok-circle", "layui-icon-add-circle-fine"
|
||||||
|
];
|
||||||
|
return arr;
|
||||||
|
},
|
||||||
|
unicode: function() {
|
||||||
|
return ["&#xe6c9;", "&#xe67b;", "&#xe67a;", "&#xe678;",
|
||||||
|
"&#xe679;", "&#xe677;", "&#xe676;", "&#xe675;",
|
||||||
|
"&#xe673;", "&#xe66f;", "&#xe9aa;", "&#xe672;",
|
||||||
|
"&#xe66b;", "&#xe668;", "&#xe6b1;", "&#xe702;",
|
||||||
|
"&#xe66e;", "&#xe68e;", "&#xe674;", "&#xe669;",
|
||||||
|
"&#xe666;", "&#xe66c;", "&#xe66a;", "&#xe667;",
|
||||||
|
"&#xe7ae;", "&#xe665;", "&#xe664;", "&#xe716;",
|
||||||
|
"&#xe656;", "&#xe653;", "&#xe663;", "&#xe6c6;",
|
||||||
|
"&#xe6c5;", "&#xe662;", "&#xe661;", "&#xe660;",
|
||||||
|
"&#xe65d;", "&#xe65f;", "&#xe671;", "&#xe65e;",
|
||||||
|
"&#xe659;", "&#xe735;", "&#xe756;", "&#xe65c;",
|
||||||
|
"&#xe715;", "&#xe705;", "&#xe6b2;", "&#xe6af;",
|
||||||
|
"&#xe69c;", "&#xe698;", "&#xe657;", "&#xe65b;",
|
||||||
|
"&#xe65a;", "&#xe681;", "&#xe67c;", "&#xe601;",
|
||||||
|
"&#xe857;", "&#xe655;", "&#xe770;", "&#xe670;",
|
||||||
|
"&#xe63d;", "&#xe63e;", "&#xe654;", "&#xe652;",
|
||||||
|
"&#xe651;", "&#xe6fc;", "&#xe6ed;", "&#xe688;",
|
||||||
|
"&#xe645;", "&#xe64f;", "&#xe64e;", "&#xe64b;",
|
||||||
|
"&#xe62b;", "&#xe64d;", "&#xe64a;", "&#xe64c;",
|
||||||
|
"&#xe650;", "&#xe649;", "&#xe648;", "&#xe647;",
|
||||||
|
"&#xe646;", "&#xe644;", "&#xe62a;", "&#xe643;",
|
||||||
|
"&#xe63f;", "&#xe642;", "&#xe641;", "&#xe640;",
|
||||||
|
"&#xe63c;", "&#xe63b;", "&#xe63a;", "&#xe639;",
|
||||||
|
"&#xe638;", "&#xe637;", "&#xe636;", "&#xe635;",
|
||||||
|
"&#xe634;", "&#xe633;", "&#xe632;", "&#xe631;",
|
||||||
|
"&#xe630;", "&#xe62f;", "&#xe62e;", "&#xe62d;",
|
||||||
|
"&#xe62c;", "&#xe629;", "&#xe628;", "&#xe625;",
|
||||||
|
"&#xe623;", "&#xe621;", "&#xe620;", "&#xe61f;",
|
||||||
|
"&#xe61c;", "&#xe60b;", "&#xe619;", "&#xe61a;",
|
||||||
|
"&#xe603;", "&#xe602;", "&#xe617;", "&#xe615;",
|
||||||
|
"&#xe614;", "&#xe613;", "&#xe612;", "&#xe611;",
|
||||||
|
"&#xe60f;", "&#xe60e;", "&#xe60d;", "&#xe60c;",
|
||||||
|
"&#xe60a;", "&#xe609;", "&#xe605;", "&#xe607;",
|
||||||
|
"&#xe606;", "&#xe604;", "&#xe600;", "&#xe658;",
|
||||||
|
"&#x1007;", "&#x1006;", "&#x1005;", "&#xe608;"
|
||||||
|
];
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
//通过异步获取自定义图标数据源
|
||||||
|
ajaxData:function (url,prefix){
|
||||||
|
var iconlist = [];
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: 'get',
|
||||||
|
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
|
||||||
|
async: false,
|
||||||
|
success: function (ret) {
|
||||||
|
var exp = eval("/"+prefix+"-(.*):/ig");
|
||||||
|
var result;
|
||||||
|
while ((result = exp.exec(ret)) != null) {
|
||||||
|
iconlist.push(prefix + '-' + result[1]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (xhr, textstatus, thrown) {
|
||||||
|
layer.msg('自定义图标接口有误');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return iconlist;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
a.init();
|
||||||
|
return new IconPicker();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选中图标
|
||||||
|
* @param filter lay-filter
|
||||||
|
* @param iconName 图标名称,自动识别fontClass/unicode
|
||||||
|
*/
|
||||||
|
IconPicker.prototype.checkIcon = function(filter, iconName) {
|
||||||
|
var el = $('*[lay-filter=' + filter + ']'),
|
||||||
|
p = el.next().find('.layui-iconpicker-item .layui-icon'),
|
||||||
|
c = iconName;
|
||||||
|
|
||||||
|
if (c.indexOf('#xe') > 0) {
|
||||||
|
p.html(c);
|
||||||
|
} else {
|
||||||
|
p.html('').attr('class', 'layui-icon ' + c);
|
||||||
|
}
|
||||||
|
el.attr('value', c).val(c);
|
||||||
|
};
|
||||||
|
|
||||||
|
var iconPicker = new IconPicker();
|
||||||
|
exports(_MOD, iconPicker);
|
||||||
|
});
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
layui.define(['table', 'jquery', 'element'], function(exports) {
|
layui.define(['table', 'jquery', 'element'], function (exports) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var MOD_NAME = 'menu',
|
var MOD_NAME = 'menu',
|
||||||
$ = layui.jquery,
|
$ = layui.jquery,
|
||||||
element = layui.element;
|
element = layui.element;
|
||||||
|
|
||||||
var pearMenu = function(opt) {
|
var pearMenu = function (opt) {
|
||||||
this.option = opt;
|
this.option = opt;
|
||||||
};
|
};
|
||||||
|
|
||||||
pearMenu.prototype.render = function(opt) {
|
pearMenu.prototype.render = function (opt) {
|
||||||
|
|
||||||
var option = {
|
var option = {
|
||||||
elem: opt.elem,
|
elem: opt.elem,
|
||||||
@@ -20,67 +20,75 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
defaultOpen: opt.defaultOpen,
|
defaultOpen: opt.defaultOpen,
|
||||||
defaultSelect: opt.defaultSelect,
|
defaultSelect: opt.defaultSelect,
|
||||||
control: opt.control,
|
control: opt.control,
|
||||||
controlWidth: opt.controlWidth ? opt.controlWidth: 500,
|
controlWidth: opt.controlWidth ? opt.controlWidth : "auto",
|
||||||
defaultMenu: opt.defaultMenu,
|
defaultMenu: opt.defaultMenu,
|
||||||
accordion: opt.accordion,
|
accordion: opt.accordion,
|
||||||
height: opt.height,
|
height: opt.height,
|
||||||
theme: opt.theme,
|
theme: opt.theme,
|
||||||
data: opt.data ? opt.data : [],
|
data: opt.data ? opt.data : [],
|
||||||
change: opt.change ? opt.change : function() {},
|
change: opt.change ? opt.change : function () { },
|
||||||
done: opt.done ? opt.done : function() {}
|
done: opt.done ? opt.done : function () { }
|
||||||
}
|
}
|
||||||
|
var tempDone = option.done;
|
||||||
|
option.done = function(){
|
||||||
|
if (option.control) {
|
||||||
|
rationalizeHeaderControlWidthAuto(option);
|
||||||
|
}
|
||||||
|
tempDone();
|
||||||
|
}
|
||||||
|
|
||||||
if (option.async) {
|
if (option.async) {
|
||||||
if (option.method === "GET") {
|
if (option.method === "GET") {
|
||||||
getData(option.url).then(function(data) {
|
getData(option.url).then(function (data) {
|
||||||
option.data = data;
|
option.data = data;
|
||||||
renderMenu(option);
|
renderMenu(option);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
postData(option.url).then(function(data) {
|
postData(option.url).then(function (data) {
|
||||||
option.data = data;
|
option.data = data;
|
||||||
renderMenu(option);
|
renderMenu(option);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//renderMenu中需要调用done事件,done事件中需要menu对象,但是此时还未返回menu对象,做个延时提前返回对象
|
// 延时返回,和 javascript 执行时序关联
|
||||||
window.setTimeout(function() { renderMenu(option);}, 500);
|
window.setTimeout(function () { renderMenu(option); }, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理高度
|
// 处理高度
|
||||||
$("#"+opt.elem).height(option.height)
|
$("#" + opt.elem).height(option.height)
|
||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function () {
|
||||||
$("#"+opt.control+" .control").on("mousewheel DOMMouseScroll", function(event) {
|
$("#" + opt.control + " .control").on("mousewheel DOMMouseScroll", function (event) {
|
||||||
|
|
||||||
var delta = (event.originalEvent.wheelDelta && (event.originalEvent.wheelDelta > 0 ? 1 : -1)) || // chrome & ie
|
var delta = (event.originalEvent.wheelDelta && (event.originalEvent.wheelDelta > 0 ? 1 : -1)) || // chrome & ie
|
||||||
(event.originalEvent.detail && (event.originalEvent.detail > 0 ? -1 : 1)); // firefox
|
(event.originalEvent.detail && (event.originalEvent.detail > 0 ? -1 : 1)); // firefox
|
||||||
|
|
||||||
if (delta > 0) {
|
if (delta > 0) {
|
||||||
for (var num = 1; num < 20; num++) {
|
for (var num = 1; num < 20; num++) {
|
||||||
setTimeout(function() {
|
setTimeout(function () {
|
||||||
if ($("#"+opt.control+" .control ul").css('left').replace("px", "") < 0) {
|
if ($("#" + opt.control + " .control ul").css('left').replace("px", "") < 0) {
|
||||||
$("#"+opt.control+" .control ul").css("left", "+=2px");
|
$("#" + opt.control + " .control ul").css("left", "+=2px");
|
||||||
}
|
}
|
||||||
}, 10)
|
}, 10)
|
||||||
}
|
}
|
||||||
} else if (delta < 0) {
|
} else if (delta < 0) {
|
||||||
if(( (Number)($("#"+opt.control+" .control ul").css("left").replace("px","")) + ($("#"+opt.control+" .control ul").width() - $("#"+opt.control+" .control").width())) > 0){
|
if (((Number)($("#" + opt.control + " .control ul").css("left").replace("px", "")) + ($("#" + opt.control + " .control ul").width() - $("#" + opt.control + " .control").width())) > 0) {
|
||||||
for (var num = 1; num < 20; num++) {
|
for (var num = 1; num < 20; num++) {
|
||||||
setTimeout(function() {
|
setTimeout(function () {
|
||||||
$("#"+opt.control+" .control ul").css("left", "-=2px");
|
$("#" + opt.control + " .control ul").css("left", "-=2px");
|
||||||
}, 10)
|
}, 10)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},1000)
|
}, 1000)
|
||||||
|
|
||||||
return new pearMenu(opt);
|
return new pearMenu(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
pearMenu.prototype.click = function(clickEvent) {
|
pearMenu.prototype.click = function (clickEvent) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
$("body").on("click", "#" + _this.option.elem + " .site-demo-active", function() {
|
$("body").on("click", "#" + _this.option.elem + " .site-demo-active", function () {
|
||||||
var dom = $(this);
|
var dom = $(this);
|
||||||
var data = {
|
var data = {
|
||||||
menuId: dom.attr("menu-id"),
|
menuId: dom.attr("menu-id"),
|
||||||
@@ -98,18 +106,19 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
}
|
}
|
||||||
if (doms != null) {
|
if (doms != null) {
|
||||||
var domss = hash(doms);
|
var domss = hash(doms);
|
||||||
if(domss!=null){
|
if (domss != null) {
|
||||||
if (domss.text() != '') {
|
if (domss.text() != '') {
|
||||||
data['menuPath'] = domss.find("span").text() + " / " + data['menuPath'];
|
data['menuPath'] = domss.find("span").text() + " / " + data['menuPath'];
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (domss != null) {
|
if (domss != null) {
|
||||||
|
|
||||||
var domsss = hash(domss);
|
var domsss = hash(domss);
|
||||||
if(domsss!=null){
|
if (domsss != null) {
|
||||||
if (domsss.text() != '') {
|
if (domsss.text() != '') {
|
||||||
data['menuPath'] = domsss.find("span").text() + " / " + data['menuPath'];
|
data['menuPath'] = domsss.find("span").text() + " / " + data['menuPath'];
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($("#" + _this.option.elem).is(".pear-nav-mini")) {
|
if ($("#" + _this.option.elem).is(".pear-nav-mini")) {
|
||||||
if (_this.option.accordion) {
|
if (_this.option.accordion) {
|
||||||
@@ -130,14 +139,14 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
pearMenu.prototype.skin = function(skin) {
|
pearMenu.prototype.skin = function (skin) {
|
||||||
var menu = $(".pear-nav-tree[lay-filter='" + this.option.elem + "']").parent();
|
var menu = $(".pear-nav-tree[lay-filter='" + this.option.elem + "']").parent();
|
||||||
menu.removeClass("dark-theme");
|
menu.removeClass("dark-theme");
|
||||||
menu.removeClass("light-theme");
|
menu.removeClass("light-theme");
|
||||||
menu.addClass(skin);
|
menu.addClass(skin);
|
||||||
}
|
}
|
||||||
|
|
||||||
pearMenu.prototype.selectItem = function(pearId) {
|
pearMenu.prototype.selectItem = function (pearId) {
|
||||||
if (this.option.control != false) {
|
if (this.option.control != false) {
|
||||||
$("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents(".layui-side-scroll ").find("ul").css({
|
$("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents(".layui-side-scroll ").find("ul").css({
|
||||||
display: "none"
|
display: "none"
|
||||||
@@ -153,32 +162,73 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
$("#" + this.option.control).find("[pear-id='" + controlId + "']").addClass("layui-this");
|
$("#" + this.option.control).find("[pear-id='" + controlId + "']").addClass("layui-this");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.option.accordion == true) {
|
|
||||||
$("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents(".pear-nav-tree").find(".layui-nav-itemed").removeClass(
|
|
||||||
"layui-nav-itemed");
|
|
||||||
}
|
|
||||||
$("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents(".pear-nav-tree").find(".layui-this").removeClass(
|
$("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents(".pear-nav-tree").find(".layui-this").removeClass(
|
||||||
"layui-this");
|
"layui-this");
|
||||||
if (!$("#" + this.option.elem).is(".pear-nav-mini")) {
|
if (!$("#" + this.option.elem).is(".pear-nav-mini")) {
|
||||||
$("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents(".layui-nav-item").addClass("layui-nav-itemed");
|
var openEle = null;
|
||||||
$("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents("dd").addClass("layui-nav-itemed");
|
var openEleHeight = 0;
|
||||||
|
$($("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents('.layui-nav-child').get().reverse()).each(function () {
|
||||||
|
if (!$(this).parent().is('.layui-nav-itemed')) {
|
||||||
|
if (openEleHeight == 0) {
|
||||||
|
openEle = $(this);
|
||||||
|
} else {
|
||||||
|
$(this).parent().addClass('layui-nav-itemed');
|
||||||
|
$(this).css({
|
||||||
|
height: 'auto',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
openEleHeight += $(this).children("dd").length * 48;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (this.option.accordion) {
|
||||||
|
if (openEleHeight > 0) {
|
||||||
|
var currentDom = openEle.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");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (openEleHeight > 0) {
|
||||||
|
openEle.parent().addClass("layui-nav-itemed");
|
||||||
|
openEle.height(0);
|
||||||
|
openEle.animate({
|
||||||
|
height: openEleHeight + "px"
|
||||||
|
}, 240, function () {
|
||||||
|
$(this).css({ height: 'auto' });
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$("#" + this.option.elem + " a[menu-id='" + pearId + "']").parent().addClass("layui-this");
|
$("#" + this.option.elem + " a[menu-id='" + pearId + "']").parent().addClass("layui-this");
|
||||||
}
|
}
|
||||||
|
|
||||||
var activeMenus;
|
var activeMenus;
|
||||||
pearMenu.prototype.collaspe = function(time) {
|
pearMenu.prototype.collapse = function (time) {
|
||||||
var elem = this.option.elem;
|
var elem = this.option.elem;
|
||||||
var config = this.option;
|
var config = this.option;
|
||||||
if ($("#" + this.option.elem).is(".pear-nav-mini")) {
|
if ($("#" + this.option.elem).is(".pear-nav-mini")) {
|
||||||
$.each(activeMenus, function(i, item) {
|
$.each(activeMenus, function (i, item) {
|
||||||
$("#" + elem + " a[menu-id='" + $(this).attr("menu-id") + "']").parent().addClass("layui-nav-itemed");
|
$("#" + elem + " a[menu-id='" + $(this).attr("menu-id") + "']").parent().addClass("layui-nav-itemed");
|
||||||
})
|
})
|
||||||
$("#" + this.option.elem).removeClass("pear-nav-mini");
|
$("#" + this.option.elem).removeClass("pear-nav-mini");
|
||||||
$("#" + this.option.elem).animate({
|
$("#" + this.option.elem).animate({
|
||||||
width: "220px"
|
width: "220px"
|
||||||
}, 150);
|
}, 180);
|
||||||
isHoverMenu(false, config);
|
isHoverMenu(false, config);
|
||||||
|
var that = this;
|
||||||
|
$("#" + this.option.elem)
|
||||||
|
.promise()
|
||||||
|
.done(function () {
|
||||||
|
if (that.option.control) {
|
||||||
|
rationalizeHeaderControlWidth(that.option);
|
||||||
|
}
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
activeMenus = $("#" + this.option.elem).find(".layui-nav-itemed>a");
|
activeMenus = $("#" + this.option.elem).find(".layui-nav-itemed>a");
|
||||||
$("#" + this.option.elem).find(".layui-nav-itemed").removeClass("layui-nav-itemed");
|
$("#" + this.option.elem).find(".layui-nav-itemed").removeClass("layui-nav-itemed");
|
||||||
@@ -186,13 +236,22 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
$("#" + this.option.elem).animate({
|
$("#" + this.option.elem).animate({
|
||||||
width: "60px"
|
width: "60px"
|
||||||
}, 400);
|
}, 400);
|
||||||
isHoverMenu(true, config);
|
var that = this;
|
||||||
|
$("#" + this.option.elem)
|
||||||
|
.promise()
|
||||||
|
.done(function () {
|
||||||
|
isHoverMenu(true, config);
|
||||||
|
if (that.option.control) {
|
||||||
|
rationalizeHeaderControlWidth(that.option);
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getData(url) {
|
function getData(url) {
|
||||||
var defer = $.Deferred();
|
var defer = $.Deferred();
|
||||||
$.get(url + "?fresh=" + Math.random(), function(result) {
|
var symbol = url.indexOf('?') !== -1 ? '&' : '?';
|
||||||
|
$.get(url + symbol + "fresh=" + Math.random(), function (result) {
|
||||||
defer.resolve(result)
|
defer.resolve(result)
|
||||||
});
|
});
|
||||||
return defer.promise();
|
return defer.promise();
|
||||||
@@ -200,9 +259,10 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
|
|
||||||
function postData(url) {
|
function postData(url) {
|
||||||
var defer = $.Deferred();
|
var defer = $.Deferred();
|
||||||
$.post(url + "?fresh=" + Math.random(), function(result) {
|
var symbol = url.indexOf('?') !== -1 ? '&' : '?';
|
||||||
|
$.post(url + symbol + "fresh=" + Math.random(), function (result) {
|
||||||
defer.resolve(result)
|
defer.resolve(result)
|
||||||
});
|
}, "json");
|
||||||
return defer.promise();
|
return defer.promise();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +285,7 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
function createMenu(option) {
|
function createMenu(option) {
|
||||||
var menuHtml = '<div style="height:100%!important;" class="pear-side-scroll layui-side-scroll ' + option.theme + '"><ul lay-filter="' + option.elem +
|
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">'
|
||||||
$.each(option.data, function(i, item) {
|
$.each(option.data, function (i, item) {
|
||||||
var content = '<li class="layui-nav-item" >';
|
var content = '<li class="layui-nav-item" >';
|
||||||
if (i == option.defaultOpen) {
|
if (i == option.defaultOpen) {
|
||||||
content = '<li class="layui-nav-item layui-nav-itemed" >';
|
content = '<li class="layui-nav-item layui-nav-itemed" >';
|
||||||
@@ -262,14 +322,14 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createMenuAndControl(option) {
|
function createMenuAndControl(option) {
|
||||||
var control = '<div style="width: '+ option.controlWidth +'px;white-space: nowrap;overflow-x: scroll;overflow: hidden;" class="control"><ul class="layui-nav pear-nav-control pc layui-hide-xs" style="width: fit-content;">';
|
var control = '<div style="width: ' + option.controlWidth + 'px;white-space: nowrap;overflow-x: scroll;overflow: hidden;" class="control"><ul class="layui-nav pear-nav-control pc layui-hide-xs" style="width: fit-content;">';
|
||||||
var controlPe = '<ul class="layui-nav pear-nav-control layui-hide-sm">';
|
var controlPe = '<ul class="layui-nav pear-nav-control layui-hide-sm">';
|
||||||
// 声 明 头 部
|
// 声 明 头 部
|
||||||
var menu = '<div class="layui-side-scroll ' + option.theme + '">'
|
var menu = '<div class="layui-side-scroll ' + option.theme + '">'
|
||||||
// 开 启 同 步 操 作
|
// 开 启 同 步 操 作
|
||||||
var index = 0;
|
var index = 0;
|
||||||
var controlItemPe = '<dl class="layui-nav-child">';
|
var controlItemPe = '<dl class="layui-nav-child">';
|
||||||
$.each(option.data, function(i, item) {
|
$.each(option.data, function (i, item) {
|
||||||
var menuItem = '';
|
var menuItem = '';
|
||||||
var controlItem = '';
|
var controlItem = '';
|
||||||
if (i === option.defaultMenu) {
|
if (i === option.defaultMenu) {
|
||||||
@@ -279,14 +339,14 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
'" class="layui-nav arrow layui-nav-tree pear-nav-tree">';
|
'" class="layui-nav arrow layui-nav-tree pear-nav-tree">';
|
||||||
|
|
||||||
controlPe += '<li class="layui-nav-item"><a class="pe-title" href="javascript:;" >' + item.title + '</a>';
|
controlPe += '<li class="layui-nav-item"><a class="pe-title" href="javascript:;" >' + item.title + '</a>';
|
||||||
|
|
||||||
controlItemPe += '<dd pear-href="' + item.href + '" pear-title="' + item.title + '" pear-id="' + item.id +
|
controlItemPe += '<dd pear-href="' + item.href + '" pear-title="' + item.title + '" pear-id="' + item.id +
|
||||||
'"><a href="javascript:void(0);">' + item.title + '</a></dd>';
|
'"><a href="javascript:void(0);">' + item.title + '</a></dd>';
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
controlItem = '<li pear-href="' + item.href + '" pear-title="' + item.title + '" pear-id="' + item.id +
|
controlItem = '<li pear-href="' + item.href + '" pear-title="' + item.title + '" pear-id="' + item.id +
|
||||||
'" class="layui-nav-item"><a href="#">' + item.title + '</a></li>';
|
'" class="layui-nav-item"><a href="#">' + item.title + '</a></li>';
|
||||||
|
|
||||||
menuItem = '<ul style="display:none" pear-id="' + item.id + '" lay-filter="' + option.elem +
|
menuItem = '<ul style="display:none" pear-id="' + item.id + '" lay-filter="' + option.elem +
|
||||||
'" class="layui-nav arrow layui-nav-tree pear-nav-tree">';
|
'" class="layui-nav arrow layui-nav-tree pear-nav-tree">';
|
||||||
|
|
||||||
@@ -295,7 +355,7 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
$.each(item.children, function(i, note) {
|
$.each(item.children, function (i, note) {
|
||||||
// 创 建 每 一 个 菜 单 项
|
// 创 建 每 一 个 菜 单 项
|
||||||
var content = '<li class="layui-nav-item" >';
|
var content = '<li class="layui-nav-item" >';
|
||||||
var href = "javascript:;";
|
var href = "javascript:;";
|
||||||
@@ -328,10 +388,10 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
})
|
})
|
||||||
controlItemPe += "</li></dl></ul>"
|
controlItemPe += "</li></dl></ul>"
|
||||||
controlPe += controlItemPe;
|
controlPe += controlItemPe;
|
||||||
$("#" + option.control).html(control+"</div>");
|
$("#" + option.control).html(control + "</div>");
|
||||||
$("#" + option.control).append(controlPe);
|
$("#" + option.control).append(controlPe);
|
||||||
$("#" + option.elem).html(menu);
|
$("#" + option.elem).html(menu);
|
||||||
$("#" + option.control + " .pear-nav-control").on("click", "[pear-id]", function() {
|
$("#" + option.control + " .pear-nav-control").on("click", "[pear-id]", function () {
|
||||||
$("#" + option.elem).find(".pear-nav-tree").css({
|
$("#" + option.elem).find(".pear-nav-tree").css({
|
||||||
display: 'none'
|
display: 'none'
|
||||||
});
|
});
|
||||||
@@ -355,7 +415,7 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
// 如 果 嵌 套 不 等 于 空
|
// 如 果 嵌 套 不 等 于 空
|
||||||
if (obj.children != null && obj.children.length > 0) {
|
if (obj.children != null && obj.children.length > 0) {
|
||||||
// 遍 历 子 项 目
|
// 遍 历 子 项 目
|
||||||
$.each(obj.children, function(i, note) {
|
$.each(obj.children, function (i, note) {
|
||||||
// 创 建 子 项 结 构
|
// 创 建 子 项 结 构
|
||||||
content += '<dd>';
|
content += '<dd>';
|
||||||
var href = "javascript:;";
|
var href = "javascript:;";
|
||||||
@@ -391,7 +451,7 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function downShow(option) {
|
function downShow(option) {
|
||||||
$("body #" + option.elem).on("click", "a[menu-type='0']", function() {
|
$("body #" + option.elem).on("click", "a[menu-type='0']", function () {
|
||||||
if (!$("#" + option.elem).is(".pear-nav-mini")) {
|
if (!$("#" + option.elem).is(".pear-nav-mini")) {
|
||||||
var superEle = $(this).parent();
|
var superEle = $(this).parent();
|
||||||
var ele = $(this).next('.layui-nav-child');
|
var ele = $(this).next('.layui-nav-child');
|
||||||
@@ -399,13 +459,21 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
|
|
||||||
if ($(this).parent().is(".layui-nav-itemed")) {
|
if ($(this).parent().is(".layui-nav-itemed")) {
|
||||||
if (option.accordion) {
|
if (option.accordion) {
|
||||||
$(this).parent().parent().find(".layui-nav-itemed").removeClass("layui-nav-itemed");
|
var currentDom = $(this).parent().siblings('.layui-nav-itemed').children('.layui-nav-child');
|
||||||
$(this).parent().addClass("layui-nav-itemed");
|
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.height(0);
|
||||||
ele.animate({
|
ele.animate({
|
||||||
height: heights + "px"
|
height: heights + "px"
|
||||||
}, 200, function() {
|
}, 240, function () {
|
||||||
ele.css({
|
ele.css({
|
||||||
height: "auto"
|
height: "auto"
|
||||||
});
|
});
|
||||||
@@ -414,7 +482,7 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
$(this).parent().addClass("layui-nav-itemed");
|
$(this).parent().addClass("layui-nav-itemed");
|
||||||
ele.animate({
|
ele.animate({
|
||||||
height: "0px"
|
height: "0px"
|
||||||
}, 200, function() {
|
}, 240, function () {
|
||||||
ele.css({
|
ele.css({
|
||||||
height: "auto"
|
height: "auto"
|
||||||
});
|
});
|
||||||
@@ -428,8 +496,11 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
/** 二 级 悬 浮 菜 单*/
|
/** 二 级 悬 浮 菜 单*/
|
||||||
function isHoverMenu(b, option) {
|
function isHoverMenu(b, option) {
|
||||||
if (b) {
|
if (b) {
|
||||||
$("#" + option.elem + ".pear-nav-mini .layui-nav-item,#" + option.elem + ".pear-nav-mini dd").hover(function(e) {
|
var navItem = "#" + option.elem + ".pear-nav-mini .layui-nav-item";
|
||||||
e.stopPropagation();
|
var navChildDl = navItem + " .layui-nav-child>dl";
|
||||||
|
var navChildDd = navItem + " .layui-nav-child>dd";
|
||||||
|
|
||||||
|
$(navItem + "," + navChildDd).mouseenter(function () {
|
||||||
var _this = $(this);
|
var _this = $(this);
|
||||||
_this.siblings().find(".layui-nav-child")
|
_this.siblings().find(".layui-nav-child")
|
||||||
.removeClass("layui-nav-hover").css({
|
.removeClass("layui-nav-hover").css({
|
||||||
@@ -437,7 +508,6 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
top: 0
|
top: 0
|
||||||
});
|
});
|
||||||
_this.children(".layui-nav-child").addClass("layui-nav-hover");
|
_this.children(".layui-nav-child").addClass("layui-nav-hover");
|
||||||
_this.closest('.layui-nav-item').data('time') && clearTimeout(_this.closest('.layui-nav-item').data('time'));
|
|
||||||
var height = $(window).height();
|
var height = $(window).height();
|
||||||
var topLength = _this.offset().top;
|
var topLength = _this.offset().top;
|
||||||
var thisHeight = _this.children(".layui-nav-child").height();
|
var thisHeight = _this.children(".layui-nav-child").height();
|
||||||
@@ -450,25 +520,52 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
}
|
}
|
||||||
_this.children(".layui-nav-child").offset({
|
_this.children(".layui-nav-child").offset({
|
||||||
top: topLength,
|
top: topLength,
|
||||||
left: left + 3
|
left: left
|
||||||
});
|
});
|
||||||
}, function(e) {
|
});
|
||||||
e.stopPropagation();
|
|
||||||
|
$(navItem + "," + navChildDl).mouseleave(function () {
|
||||||
var _this = $(this);
|
var _this = $(this);
|
||||||
_this.closest('.layui-nav-item').data('time', setTimeout(function() {
|
_this.closest('.layui-nav-item')
|
||||||
_this.closest('.layui-nav-item')
|
.find(".layui-nav-child")
|
||||||
.find(".layui-nav-child")
|
.removeClass("layui-nav-hover")
|
||||||
.removeClass("layui-nav-hover")
|
.css({
|
||||||
.css({
|
left: 0,
|
||||||
left: 0,
|
top: 0
|
||||||
top: 0
|
});
|
||||||
});
|
});
|
||||||
}, 50));
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
$("#" + option.elem + " .layui-nav-item").off('mouseenter').unbind('mouseleave');
|
$("#" + option.elem + " .layui-nav-item").off('mouseenter').unbind('mouseleave');
|
||||||
$("#" + option.elem + " dd").off('mouseenter').unbind('mouseleave');
|
$("#" + option.elem + " dd").off('mouseenter').unbind('mouseleave');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function rationalizeHeaderControlWidth(option) {
|
||||||
|
var $headerControl = $("#" + option.control);
|
||||||
|
var $nextEl = $headerControl.next();
|
||||||
|
var rationalizeWidth;
|
||||||
|
if ($nextEl.length) {
|
||||||
|
rationalizeWidth = $nextEl.position().left - $headerControl.position().left;
|
||||||
|
} else {
|
||||||
|
rationalizeWidth = $headerControl.parent().innerWidth() - $headerControl.position().left;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (option.controlWidth && rationalizeWidth >= option.controlWidth) {
|
||||||
|
rationalizeWidth = option.controlWidth;
|
||||||
|
}
|
||||||
|
$("#" + option.control + " .control").css({ "width": rationalizeWidth, "transition": "width .15s" });
|
||||||
|
}
|
||||||
|
|
||||||
|
function rationalizeHeaderControlWidthAuto(option){
|
||||||
|
$(window).on('resize', function () {
|
||||||
|
rationalizeHeaderControlWidth(option);
|
||||||
|
})
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
rationalizeHeaderControlWidth(option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
exports(MOD_NAME, new pearMenu());
|
exports(MOD_NAME, new pearMenu());
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
layui.define(['table', 'jquery', 'element'], function(exports) {
|
layui.define(['table', 'jquery', 'element'], function (exports) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var MOD_NAME = 'message',
|
var MOD_NAME = 'message',
|
||||||
$ = layui.jquery,
|
$ = layui.jquery,
|
||||||
element = layui.element;
|
element = layui.element;
|
||||||
|
|
||||||
var message = function(opt) {
|
var message = function (opt) {
|
||||||
this.option = opt;
|
this.option = opt;
|
||||||
};
|
};
|
||||||
|
|
||||||
message.prototype.render = function(opt) {
|
message.prototype.render = function (opt) {
|
||||||
//默认配置值
|
//默认配置值
|
||||||
var option = {
|
var option = {
|
||||||
elem: opt.elem,
|
elem: opt.elem,
|
||||||
@@ -21,10 +21,30 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
option.data = getData(option.url);
|
option.data = getData(option.url);
|
||||||
var notice = createHtml(option);
|
var notice = createHtml(option);
|
||||||
$(option.elem).html(notice);
|
$(option.elem).html(notice);
|
||||||
|
var targetNode = document.querySelector(option.elem + ' .pear-notice')
|
||||||
|
var mutationObserver = new MutationObserver(function (mutationsList, observer) {
|
||||||
|
if (getComputedStyle(targetNode).display !== 'none') {
|
||||||
|
var rect = targetNode.getBoundingClientRect();
|
||||||
|
//是否超出右侧屏幕
|
||||||
|
if (rect.right > $(window).width()) {
|
||||||
|
var elemRight = document.querySelector(option.elem).getBoundingClientRect().right;
|
||||||
|
var offsetRight = 20;
|
||||||
|
targetNode.style.right = elemRight - $(window).width() + offsetRight + 'px';
|
||||||
|
targetNode.style.left = 'unset';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mutationObserver.observe(targetNode, {
|
||||||
|
attributes: true,
|
||||||
|
childList: false,
|
||||||
|
subtree: false,
|
||||||
|
attributeOldValue: false,
|
||||||
|
attributeFilter: ['class']
|
||||||
|
});
|
||||||
}
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function () {
|
||||||
element.init();
|
element.init();
|
||||||
$(opt.elem + " li").click(function(e) {
|
$(opt.elem + " li").click(function (e) {
|
||||||
$(this).siblings().removeClass('pear-this');
|
$(this).siblings().removeClass('pear-this');
|
||||||
$(this).addClass('pear-this');
|
$(this).addClass('pear-this');
|
||||||
})
|
})
|
||||||
@@ -32,8 +52,8 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
return new message(option);
|
return new message(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
message.prototype.click = function(callback) {
|
message.prototype.click = function (callback) {
|
||||||
$("*[notice-id]").click(function(event) {
|
$("*[notice-id]").click(function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var id = $(this).attr("notice-id");
|
var id = $(this).attr("notice-id");
|
||||||
var title = $(this).attr("notice-title");
|
var title = $(this).attr("notice-title");
|
||||||
@@ -43,11 +63,16 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 刷 新 消 息 */
|
||||||
|
message.prototype.reload = function () {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/** 同 步 请 求 获 取 数 据 */
|
/** 同 步 请 求 获 取 数 据 */
|
||||||
function getData(url) {
|
function getData(url) {
|
||||||
$.ajaxSettings.async = false;
|
$.ajaxSettings.async = false;
|
||||||
var data = null;
|
var data = null;
|
||||||
$.get(url, function(result) {
|
$.get(url, function (result) {
|
||||||
data = result;
|
data = result;
|
||||||
});
|
});
|
||||||
$.ajaxSettings.async = true;
|
$.ajaxSettings.async = true;
|
||||||
@@ -58,12 +83,12 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
|
|
||||||
var count = 0;
|
var count = 0;
|
||||||
var noticeTitle = '<ul class="layui-tab-title">';
|
var noticeTitle = '<ul class="layui-tab-title">';
|
||||||
var noticeContent = '<div class="layui-tab-content" style="height:' + option.height + ';overflow-x: hidden;">';
|
var noticeContent = '<div class="layui-tab-content" style="height:' + option.height + ';overflow-x: hidden;padding:0px;">';
|
||||||
|
|
||||||
|
|
||||||
// 根据 data 便利数据
|
// 根据 data 便利数据
|
||||||
$.each(option.data, function(i, item) {
|
$.each(option.data, function (i, item) {
|
||||||
|
|
||||||
if (i === 0) {
|
if (i === 0) {
|
||||||
noticeTitle += '<li class="pear-this">' + item.title + '</li>';
|
noticeTitle += '<li class="pear-this">' + item.title + '</li>';
|
||||||
noticeContent += '<div class="layui-tab-item layui-show">';
|
noticeContent += '<div class="layui-tab-item layui-show">';
|
||||||
@@ -72,20 +97,36 @@ layui.define(['table', 'jquery', 'element'], function(exports) {
|
|||||||
noticeContent += '<div class="layui-tab-item">';
|
noticeContent += '<div class="layui-tab-item">';
|
||||||
}
|
}
|
||||||
|
|
||||||
$.each(item.children, function(i, note) {
|
$.each(item.children, function (i, note) {
|
||||||
|
count++;
|
||||||
noticeContent += '<div class="pear-notice-item" notice-form="' + note.form + '" notice-context="' + note.context +
|
noticeContent += '<div class="pear-notice-item" notice-form="' + note.form + '" notice-context="' + note.context +
|
||||||
'" notice-title="' + note.title + '" notice-id="' + note.id + '">' +
|
'" notice-title="' + note.title + '" notice-id="' + note.id + '">' ;
|
||||||
'<img src="' + note.avatar + '"/>' +
|
|
||||||
'<div style="display:inline-block;">' + note.title + '</div>'+
|
if (note.avatar)
|
||||||
|
noticeContent +='<img src="' + note.avatar + '"/>';
|
||||||
|
|
||||||
|
noticeContent +='<div style="display:inline-block;">' + note.title + '</div>' +
|
||||||
'<div class="pear-notice-end">' + note.time + '</div>' +
|
'<div class="pear-notice-end">' + note.time + '</div>' +
|
||||||
'</div>';
|
'</div>';
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 空内容
|
||||||
|
if(item.children.length==0){
|
||||||
|
noticeContent +='<div class="pear-empty"><div class="pear-empty-image"><svg class="pear-empty-img-default" width="184" height="152" viewBox="0 0 184 152"><g fill="none" fill-rule="evenodd"><g transform="translate(24 31.67)"><ellipse class="pear-empty-img-default-ellipse" cx="67.797" cy="106.89" rx="67.797" ry="12.668"></ellipse><path class="pear-empty-img-default-path-1" d="M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z"></path><path class="pear-empty-img-default-path-2" d="M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z" transform="translate(13.56)"></path><path class="pear-empty-img-default-path-3" d="M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z"></path><path class="pear-empty-img-default-path-4" d="M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z"></path></g><path class="pear-empty-img-default-path-5" d="M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z"></path><g class="pear-empty-img-default-g" transform="translate(149.65 15.383)"><ellipse cx="20.654" cy="3.167" rx="2.849" ry="2.815"></ellipse><path d="M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"></path></g></g></svg></div><p class="pear-empty-description">暂无数据</p></div>';
|
||||||
|
}
|
||||||
noticeContent += '</div>';
|
noticeContent += '</div>';
|
||||||
})
|
})
|
||||||
|
|
||||||
var notice = '<li class="layui-nav-item" lay-unselect="">' +
|
var notice;
|
||||||
'<a href="#" class="notice layui-icon layui-icon-notice"><span class="layui-badge-dot"></div></a>' +
|
if (count > 0){
|
||||||
'<div class="layui-nav-child layui-tab pear-notice" style="margin-top: 0px;;left: -200px;">';
|
notice = '<li class="layui-nav-item" lay-unselect="">' +
|
||||||
|
'<a href="#" class="notice layui-icon layui-icon-notice"><span class="layui-badge-dot"></span></a>' +
|
||||||
|
'<div class="layui-nav-child layui-tab pear-notice" style="margin-top: 0px;left: -200px;padding:0px;">';
|
||||||
|
}else {
|
||||||
|
notice = '<li class="layui-nav-item" lay-unselect="">' +
|
||||||
|
'<a href="#" class="notice layui-icon layui-icon-notice"></a>' +
|
||||||
|
'<div class="layui-nav-child layui-tab pear-notice" style="margin-top: 0px;left: -200px;padding:0px;">';
|
||||||
|
}
|
||||||
|
|
||||||
noticeTitle += '</ul>';
|
noticeTitle += '</ul>';
|
||||||
noticeContent += '</div>';
|
noticeContent += '</div>';
|
||||||
|
|||||||
@@ -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);
|
||||||
|
});
|
||||||
@@ -20,7 +20,7 @@ layui.define(['layer', 'jquery', 'element'], function(exports) {
|
|||||||
time: 1000
|
time: 1000
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
this.warming = function(msg) {
|
this.warning = function(msg) {
|
||||||
layer.msg(msg, {
|
layer.msg(msg, {
|
||||||
icon: 3,
|
icon: 3,
|
||||||
time: 1000
|
time: 1000
|
||||||
@@ -38,7 +38,7 @@ layui.define(['layer', 'jquery', 'element'], function(exports) {
|
|||||||
time: 1000
|
time: 1000
|
||||||
}, callback);
|
}, callback);
|
||||||
},
|
},
|
||||||
this.warning = function(msg, callback) {
|
this.warming = function(msg, callback) {
|
||||||
layer.msg(msg, {
|
layer.msg(msg, {
|
||||||
icon: 3,
|
icon: 3,
|
||||||
time: 1000
|
time: 1000
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
|
|
||||||
var tabData = new Array();
|
var tabData = new Array();
|
||||||
var tabDataCurrent = 0;
|
var tabDataCurrent = 0;
|
||||||
|
var contextTabDOM;
|
||||||
|
|
||||||
pearTab.prototype.render = function(opt) {
|
pearTab.prototype.render = function(opt) {
|
||||||
|
|
||||||
@@ -24,6 +25,7 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
height: opt.height,
|
height: opt.height,
|
||||||
tabMax: opt.tabMax,
|
tabMax: opt.tabMax,
|
||||||
session: opt.session ? opt.session : false,
|
session: opt.session ? opt.session : false,
|
||||||
|
preload: opt.preload ? opt.preload : false,
|
||||||
closeEvent: opt.closeEvent,
|
closeEvent: opt.closeEvent,
|
||||||
success: opt.success ? opt.success : function(id) {}
|
success: opt.success ? opt.success : function(id) {}
|
||||||
}
|
}
|
||||||
@@ -63,53 +65,62 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
|
|
||||||
option.success(sessionStorage.getItem(option.elem + "-pear-tab-data-current"));
|
option.success(sessionStorage.getItem(option.elem + "-pear-tab-data-current"));
|
||||||
|
|
||||||
$("body .layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title").on("contextmenu", "li", function(e) {
|
$("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 currentId = $(this).attr("lay-id");
|
||||||
|
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 top = e.clientY;
|
var isOutsideBounds = (left + menuWidth) > $(window).width();
|
||||||
var left = e.clientX;
|
if (isOutsideBounds) {
|
||||||
|
left = $(window).width() - menuWidth;
|
||||||
var currentId = $(this).attr("lay-id");
|
|
||||||
|
|
||||||
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>";
|
|
||||||
|
|
||||||
// 初始化
|
|
||||||
layer.open({
|
|
||||||
type: 1,
|
|
||||||
title: false,
|
|
||||||
shade: false,
|
|
||||||
skin: 'pear-tab-menu',
|
|
||||||
closeBtn: false,
|
|
||||||
area: ['100px', '108px'],
|
|
||||||
fixed: true,
|
|
||||||
offset: [top, left],
|
|
||||||
content: menu, //iframe的url,
|
|
||||||
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);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 清除 item 右击
|
|
||||||
$(layero).on('contextmenu',function(){
|
|
||||||
return false;
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
// 初始化
|
||||||
return false;
|
layer.open({
|
||||||
})
|
type: 1,
|
||||||
|
title: false,
|
||||||
|
shade: false,
|
||||||
|
skin: 'pear-tab-menu',
|
||||||
|
closeBtn: false,
|
||||||
|
area: [menuWidth + 'px', '108px'],
|
||||||
|
fixed: true,
|
||||||
|
anim: false,
|
||||||
|
isOutAnim: false,
|
||||||
|
offset: [top, left],
|
||||||
|
content: menu, //iframe的url,
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 清除 item 右击
|
||||||
|
$(layero).on('contextmenu', function() {
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
|
||||||
|
mousewheelAndTouchmoveHandler(option)
|
||||||
return new pearTab(option);
|
return new pearTab(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,6 +130,21 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
element.on('tab(' + this.option.elem + ')', function(data) {
|
element.on('tab(' + this.option.elem + ')', function(data) {
|
||||||
var id = $("#" + elem + " .layui-tab-title .layui-this").attr("lay-id");
|
var id = $("#" + elem + " .layui-tab-title .layui-this").attr("lay-id");
|
||||||
sessionStorage.setItem(option.elem + "-pear-tab-data-current", id);
|
sessionStorage.setItem(option.elem + "-pear-tab-data-current", id);
|
||||||
|
if (!option.preload) {
|
||||||
|
var $iframe = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-content").find(
|
||||||
|
"iframe[id='" + id + "']");
|
||||||
|
var iframeUrl = $iframe.attr("src");
|
||||||
|
if (!iframeUrl || iframeUrl === "about:blank") {
|
||||||
|
// 获取 url 并重载
|
||||||
|
tabData.forEach(function(item, index) {
|
||||||
|
if (item.id === id) {
|
||||||
|
iframeUrl = item.url;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
tabIframeLoading(elem);
|
||||||
|
$iframe.attr("src", iframeUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
callback(id);
|
callback(id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -146,16 +172,17 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
pearTab.prototype.addTab = function(opt) {
|
pearTab.prototype.addTab = function(opt) {
|
||||||
var title = '';
|
var title = '';
|
||||||
if (opt.close) {
|
if (opt.close) {
|
||||||
title += '<span class="pear-tab-active"></span><span class="able-close">' + opt.title +
|
title += '<span class="pear-tab-active"></span><span class="able-close title">' + opt.title +
|
||||||
'</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>';
|
'</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>';
|
||||||
} else {
|
} else {
|
||||||
title += '<span class="pear-tab-active"></span><span class="disable-close">' + opt.title +
|
title += '<span class="pear-tab-active"></span><span class="disable-close title">' + opt.title +
|
||||||
'</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>';
|
'</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>';
|
||||||
}
|
}
|
||||||
element.tabAdd(this.option.elem, {
|
element.tabAdd(this.option.elem, {
|
||||||
title: title,
|
title: title,
|
||||||
content: '<iframe id="' + opt.id + '" data-frameid="' + opt.id + '" scrolling="auto" frameborder="0" src="' +
|
content: '<iframe id="' + opt.id + '" data-frameid="' + opt.id +
|
||||||
opt.url + '" style="width:100%;height:100%;"></iframe>',
|
'" scrolling="auto" frameborder="0" src="' +
|
||||||
|
opt.url + '" style="width:100%;height:100%;" allowfullscreen="true"></>',
|
||||||
id: opt.id
|
id: opt.id
|
||||||
});
|
});
|
||||||
tabData.push(opt);
|
tabData.push(opt);
|
||||||
@@ -165,15 +192,45 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var index = 0;
|
var index = 0;
|
||||||
|
// 根据过滤 fliter 标识, 重置选项卡标题
|
||||||
|
pearTab.prototype.changeTabTitleById = function(elem, id, title) {
|
||||||
|
var currentTab = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title [lay-id='" + id +
|
||||||
|
"'] .title");
|
||||||
|
currentTab.html(title);
|
||||||
|
}
|
||||||
|
|
||||||
// 根据过滤 filter 标识, 删除执行选项卡
|
// 根据过滤 filter 标识, 删除指定选项卡
|
||||||
pearTab.prototype.delTabByElem = function(elem, id, callback) {
|
pearTab.prototype.delTabByElem = function(elem, id, callback) {
|
||||||
var currentTab = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title [lay-id='" + id + "']");
|
var currentTab = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title [lay-id='" + id + "']");
|
||||||
if (currentTab.find("span").is(".able-close")) {
|
if (currentTab.find("span").is(".able-close")) {
|
||||||
tabDelete(elem, id, callback);
|
tabDelete(elem, id, callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 根据过滤 filter 标识, 删除其他选项卡
|
||||||
|
pearTab.prototype.delOtherTabByElem = function(elem, callback) {
|
||||||
|
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(i) {
|
||||||
|
if ($(this).attr("lay-id") != currentId) {
|
||||||
|
if ($(this).find("span").is(".able-close")) {
|
||||||
|
tabDelete(elem, $(this).attr("lay-id"), callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据过滤 filter 标识, 删除全部选项卡
|
||||||
|
pearTab.prototype.delAllTabByElem = function(elem, callback) {
|
||||||
|
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(i) {
|
||||||
|
if ($(this).find("span").is(".able-close")) {
|
||||||
|
tabDelete(elem, $(this).attr("lay-id"), callback);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
// 根据过滤 filter 标识, 删除当前选项卡
|
// 根据过滤 filter 标识, 删除当前选项卡
|
||||||
pearTab.prototype.delCurrentTabByElem = function(elem, callback) {
|
pearTab.prototype.delCurrentTabByElem = function(elem, callback) {
|
||||||
var currentTab = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title .layui-this");
|
var currentTab = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title .layui-this");
|
||||||
@@ -187,37 +244,23 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
pearTab.prototype.addTabOnlyByElem = function(elem, opt, time) {
|
pearTab.prototype.addTabOnlyByElem = function(elem, opt, time) {
|
||||||
var title = '';
|
var title = '';
|
||||||
if (opt.close) {
|
if (opt.close) {
|
||||||
title += '<span class="pear-tab-active"></span><span class="able-close">' + opt.title +
|
title += '<span class="pear-tab-active"></span><span class="able-close title">' + opt.title +
|
||||||
'</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>'
|
'</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>'
|
||||||
} else {
|
} else {
|
||||||
title += '<span class="pear-tab-active"></span><span class="disable-close">' + opt.title +
|
title += '<span class="pear-tab-active"></span><span class="disable-close title">' + opt.title +
|
||||||
'</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>'
|
'</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>'
|
||||||
}
|
}
|
||||||
if ($(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title li[lay-id]").length <= 0) {
|
if ($(".layui-tab[lay-filter='" + elem + "'] .layui-tab-title li[lay-id]").length <= 0) {
|
||||||
|
|
||||||
if (time != false && time != 0) {
|
|
||||||
|
|
||||||
var load = '<div id="pear-tab-loading' + index + '" class="pear-tab-loading">' +
|
|
||||||
'<div class="ball-loader">' +
|
|
||||||
'<span></span><span></span><span></span><span></span>' +
|
|
||||||
'</div>' +
|
|
||||||
'</div>'
|
|
||||||
$("#" + elem).find(".pear-tab").append(load);
|
|
||||||
var pearLoad = $("#" + elem).find("#pear-tab-loading" + index);
|
|
||||||
pearLoad.css({
|
|
||||||
display: "block"
|
|
||||||
});
|
|
||||||
setTimeout(function() {
|
|
||||||
pearLoad.fadeOut(500);
|
|
||||||
}, time);
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
element.tabAdd(elem, {
|
element.tabAdd(elem, {
|
||||||
title: title,
|
title: title,
|
||||||
content: '<iframe id="' + opt.id + '" data-frameid="' + opt.id + '" scrolling="auto" frameborder="0" src="' +
|
content: '<iframe id="' + opt.id + '" data-frameid="' + opt.id +
|
||||||
opt.url + '" style="width:100%;height:100%;"></iframe>',
|
'" scrolling="auto" frameborder="0" src="' +
|
||||||
|
opt.url + '" style="width:100%;height:100%;" allowfullscreen="true"></iframe>',
|
||||||
id: opt.id
|
id: opt.id
|
||||||
});
|
});
|
||||||
|
if (time != false && time != 0) {
|
||||||
|
tabIframeLoading(elem, opt.id);
|
||||||
|
}
|
||||||
tabData.push(opt);
|
tabData.push(opt);
|
||||||
sessionStorage.setItem(elem + "-pear-tab-data", JSON.stringify(tabData));
|
sessionStorage.setItem(elem + "-pear-tab-data", JSON.stringify(tabData));
|
||||||
} else {
|
} else {
|
||||||
@@ -229,29 +272,16 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (isData == false) {
|
if (isData == false) {
|
||||||
if (time != false && time != 0) {
|
|
||||||
var load = '<div id="pear-tab-loading' + index + '" class="pear-tab-loading">' +
|
|
||||||
'<div class="ball-loader">' +
|
|
||||||
'<span></span><span></span><span></span><span></span>' +
|
|
||||||
'</div>' +
|
|
||||||
'</div>'
|
|
||||||
|
|
||||||
$("#" + elem).find(".pear-tab").append(load);
|
|
||||||
var pearLoad = $("#" + elem).find("#pear-tab-loading" + index);
|
|
||||||
pearLoad.css({
|
|
||||||
display: "block"
|
|
||||||
});
|
|
||||||
setTimeout(function() {
|
|
||||||
pearLoad.fadeOut(500);
|
|
||||||
}, time);
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
element.tabAdd(elem, {
|
element.tabAdd(elem, {
|
||||||
title: title,
|
title: title,
|
||||||
content: '<iframe id="' + opt.id + '" data-frameid="' + opt.id + '" scrolling="auto" frameborder="0" src="' +
|
content: '<iframe id="' + opt.id + '" data-frameid="' + opt.id +
|
||||||
opt.url + '" style="width:100%;height:100%;"></iframe>',
|
'" scrolling="auto" frameborder="0" src="' +
|
||||||
|
opt.url + '" style="width:100%;height:100%;" allowfullscreen="true"></iframe>',
|
||||||
id: opt.id
|
id: opt.id
|
||||||
});
|
});
|
||||||
|
if (time != false && time != 0) {
|
||||||
|
tabIframeLoading(elem, opt.id);
|
||||||
|
}
|
||||||
tabData.push(opt);
|
tabData.push(opt);
|
||||||
sessionStorage.setItem(elem + "-pear-tab-data", JSON.stringify(tabData));
|
sessionStorage.setItem(elem + "-pear-tab-data", JSON.stringify(tabData));
|
||||||
|
|
||||||
@@ -265,79 +295,59 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
pearTab.prototype.addTabOnly = function(opt, time) {
|
pearTab.prototype.addTabOnly = function(opt, time) {
|
||||||
var title = '';
|
var title = '';
|
||||||
if (opt.close) {
|
if (opt.close) {
|
||||||
title += '<span class="pear-tab-active"></span><span class="able-close">' + opt.title +
|
title += '<span class="pear-tab-active"></span><span class="able-close title">' + opt.title +
|
||||||
'</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>';
|
'</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>';
|
||||||
} else {
|
} else {
|
||||||
title += '<span class="pear-tab-active"></span><span class="disable-close">' + opt.title +
|
title += '<span class="pear-tab-active"></span><span class="disable-close title">' + opt.title +
|
||||||
'</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>';
|
'</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) {
|
if ($(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-title li[lay-id]").length <=
|
||||||
if (time != false && time != 0) {
|
0) {
|
||||||
var load = '<div id="pear-tab-loading' + index + '" class="pear-tab-loading">' +
|
|
||||||
'<div class="ball-loader">' +
|
|
||||||
'<span></span><span></span><span></span><span></span>' +
|
|
||||||
'</div>' +
|
|
||||||
'</div>';
|
|
||||||
$("#" + this.option.elem).find(".pear-tab").append(load);
|
|
||||||
var pearLoad = $("#" + this.option.elem).find("#pear-tab-loading" + index);
|
|
||||||
pearLoad.css({
|
|
||||||
display: "block"
|
|
||||||
});
|
|
||||||
setTimeout(function() {
|
|
||||||
pearLoad.fadeOut(500);
|
|
||||||
}, time);
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
element.tabAdd(this.option.elem, {
|
element.tabAdd(this.option.elem, {
|
||||||
title: title,
|
title: title,
|
||||||
content: '<iframe id="' + opt.id + '" data-frameid="' + opt.id + '" scrolling="auto" frameborder="0" src="' +
|
content: '<iframe id="' + opt.id + '" data-frameid="' + opt.id +
|
||||||
opt.url + '" style="width:100%;height:100%;"></iframe>',
|
'" scrolling="auto" frameborder="0" src="' +
|
||||||
|
opt.url + '" style="width:100%;height:100%;" allowfullscreen="true"></iframe>',
|
||||||
id: opt.id
|
id: opt.id
|
||||||
});
|
});
|
||||||
|
if (time != false && time != 0) {
|
||||||
|
tabIframeLoading(this.option.elem, opt.id);
|
||||||
|
}
|
||||||
tabData.push(opt);
|
tabData.push(opt);
|
||||||
sessionStorage.setItem(this.option.elem + "-pear-tab-data", JSON.stringify(tabData));
|
sessionStorage.setItem(this.option.elem + "-pear-tab-data", JSON.stringify(tabData));
|
||||||
sessionStorage.setItem(this.option.elem + "-pear-tab-data-current", opt.id);
|
sessionStorage.setItem(this.option.elem + "-pear-tab-data-current", opt.id);
|
||||||
} else {
|
} else {
|
||||||
var isData = false;
|
var isData = false;
|
||||||
$.each($(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-title li[lay-id]"), function() {
|
$.each($(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-title li[lay-id]"),
|
||||||
if ($(this).attr("lay-id") == opt.id) {
|
function() {
|
||||||
isData = true;
|
if ($(this).attr("lay-id") == opt.id) {
|
||||||
}
|
isData = true;
|
||||||
})
|
}
|
||||||
|
})
|
||||||
if (isData == false) {
|
if (isData == 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time != false && time != 0) {
|
|
||||||
var load = '<div id="pear-tab-loading' + index + '" class="pear-tab-loading">' +
|
|
||||||
'<div class="ball-loader">' +
|
|
||||||
'<span></span><span></span><span></span><span></span>' +
|
|
||||||
'</div>' +
|
|
||||||
'</div>'
|
|
||||||
|
|
||||||
$("#" + this.option.elem).find(".pear-tab").append(load);
|
if (this.option.tabMax != false) {
|
||||||
var pearLoad = $("#" + this.option.elem).find("#pear-tab-loading" + index);
|
if ($(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-title li[lay-id]")
|
||||||
pearLoad.css({
|
.length >= this.option.tabMax) {
|
||||||
display: "block"
|
layer.msg("最多打开" + this.option.tabMax + "个标签页", {
|
||||||
});
|
icon: 2,
|
||||||
setTimeout(function() {
|
time: 1000,
|
||||||
pearLoad.fadeOut(500);
|
shift: 6
|
||||||
}, time);
|
});
|
||||||
index++;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
element.tabAdd(this.option.elem, {
|
element.tabAdd(this.option.elem, {
|
||||||
title: title,
|
title: title,
|
||||||
content: '<iframe id="' + opt.id + '" data-frameid="' + opt.id + '" scrolling="auto" frameborder="0" src="' +
|
content: '<iframe id="' + opt.id + '" data-frameid="' + opt.id +
|
||||||
opt.url + '" style="width:100%;height:100%;"></iframe>',
|
'" scrolling="auto" frameborder="0" src="' +
|
||||||
|
opt.url + '" style="width:100%;height:100%;" allowfullscreen="true"></iframe>',
|
||||||
id: opt.id
|
id: opt.id
|
||||||
});
|
});
|
||||||
|
if (time != false && time != 0) {
|
||||||
|
tabIframeLoading(this.option.elem, opt.id);
|
||||||
|
}
|
||||||
tabData.push(opt);
|
tabData.push(opt);
|
||||||
sessionStorage.setItem(this.option.elem + "-pear-tab-data", JSON.stringify(tabData));
|
sessionStorage.setItem(this.option.elem + "-pear-tab-data", JSON.stringify(tabData));
|
||||||
sessionStorage.setItem(this.option.elem + "-pear-tab-data-current", opt.id);
|
sessionStorage.setItem(this.option.elem + "-pear-tab-data-current", opt.id);
|
||||||
@@ -350,36 +360,39 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
// 刷 新 指 定 的 选 项 卡
|
// 刷 新 指 定 的 选 项 卡
|
||||||
pearTab.prototype.refresh = function(time) {
|
pearTab.prototype.refresh = function(time) {
|
||||||
// 刷 新 指 定 的 选 项 卡
|
// 刷 新 指 定 的 选 项 卡
|
||||||
|
var $iframe = $(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-content .layui-show")
|
||||||
|
.find("iframe");
|
||||||
if (time != false && time != 0) {
|
if (time != false && time != 0) {
|
||||||
var load = '<div id="pear-tab-loading' + index + '" class="pear-tab-loading">' +
|
tabIframeLoading(this.option.elem);
|
||||||
'<div class="ball-loader">' +
|
|
||||||
'<span></span><span></span><span></span><span></span>' +
|
|
||||||
'</div>' +
|
|
||||||
'</div>'
|
|
||||||
|
|
||||||
var elem = this.option.elem;
|
|
||||||
$("#" + this.option.elem).find(".pear-tab").append(load);
|
|
||||||
var pearLoad = $("#" + this.option.elem).find("#pear-tab-loading" + index);
|
|
||||||
pearLoad.css({
|
|
||||||
display: "block"
|
|
||||||
});
|
|
||||||
index++;
|
|
||||||
setTimeout(function() {
|
|
||||||
pearLoad.fadeOut(500, function() {
|
|
||||||
pearLoad.remove();
|
|
||||||
});
|
|
||||||
}, time);
|
|
||||||
$(".layui-tab[lay-filter='" + elem + "'] .layui-tab-content .layui-show").find("iframe")[0].contentWindow
|
|
||||||
.location.reload(true);
|
|
||||||
} else {
|
|
||||||
$(".layui-tab[lay-filter='" + this.option.elem + "'] .layui-tab-content .layui-show").find("iframe")[0].contentWindow
|
|
||||||
.location.reload(true);
|
|
||||||
}
|
}
|
||||||
|
$iframe.attr("src", $iframe.attr("src"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function tabIframeLoading(elem, id) {
|
||||||
|
var load = '<div id="pear-tab-loading' + index + '" class="pear-tab-loading">' +
|
||||||
|
'<div class="ball-loader">' +
|
||||||
|
'<span></span><span></span><span></span><span></span>' +
|
||||||
|
'</div>' +
|
||||||
|
'</div>'
|
||||||
|
var $iframe = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-content .layui-show").find("iframe");
|
||||||
|
if (id) {
|
||||||
|
$iframe = $(".layui-tab[lay-filter='" + elem + "'] .layui-tab-content").find("iframe[id='" + id +
|
||||||
|
"']");
|
||||||
|
}
|
||||||
|
$iframe.parent().append(load);
|
||||||
|
var pearLoad = $("#" + elem).find("#pear-tab-loading" + index);
|
||||||
|
pearLoad.css({
|
||||||
|
display: "block"
|
||||||
|
});
|
||||||
|
index++;
|
||||||
|
$iframe.on("load", function() {
|
||||||
|
pearLoad.fadeOut(1000, function() {
|
||||||
|
pearLoad.remove();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function tabDelete(elem, id, callback, option) {
|
function tabDelete(elem, id, callback, option) {
|
||||||
|
|
||||||
//根据 elem id 来删除指定的 layui title li
|
//根据 elem id 来删除指定的 layui title li
|
||||||
var tabTitle = $(".layui-tab[lay-filter='" + elem + "']").find(".layui-tab-title");
|
var tabTitle = $(".layui-tab[lay-filter='" + elem + "']").find(".layui-tab-title");
|
||||||
|
|
||||||
@@ -388,7 +401,8 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
var nextNode = removeTab.next("li");
|
var nextNode = removeTab.next("li");
|
||||||
if (!removeTab.hasClass("layui-this")) {
|
if (!removeTab.hasClass("layui-this")) {
|
||||||
removeTab.remove();
|
removeTab.remove();
|
||||||
var tabContent = $(".layui-tab[lay-filter='" + elem + "']").find("iframe[id='" + id + "']").parent();
|
var tabContent = $(".layui-tab[lay-filter='" + elem + "']").find("iframe[id='" + id + "']")
|
||||||
|
.parent();
|
||||||
tabContent.remove();
|
tabContent.remove();
|
||||||
|
|
||||||
tabData = JSON.parse(sessionStorage.getItem(elem + "-pear-tab-data"));
|
tabData = JSON.parse(sessionStorage.getItem(elem + "-pear-tab-data"));
|
||||||
@@ -452,31 +466,37 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
$.each(option.data, function(i, item) {
|
$.each(option.data, function(i, item) {
|
||||||
var TitleItem = '';
|
var TitleItem = '';
|
||||||
if (option.index == index) {
|
if (option.index == index) {
|
||||||
TitleItem += '<li lay-id="' + item.id + '" class="layui-this"><span class="pear-tab-active"></span>';
|
TitleItem += '<li lay-id="' + item.id +
|
||||||
|
'" class="layui-this"><span class="pear-tab-active"></span>';
|
||||||
} else {
|
} else {
|
||||||
TitleItem += '<li lay-id="' + item.id + '" ><span class="pear-tab-active"></span>';
|
TitleItem += '<li lay-id="' + item.id + '" ><span class="pear-tab-active"></span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.close) {
|
if (item.close) {
|
||||||
// 当 前 选 项 卡 可 以 关 闭
|
// 当 前 选 项 卡 可 以 关 闭
|
||||||
TitleItem += '<span class="able-close">' + item.title + '</span>';
|
TitleItem += '<span class="able-close title">' + item.title + '</span>';
|
||||||
} else {
|
} else {
|
||||||
// 当 前 选 项 卡 不 允 许 关 闭
|
// 当 前 选 项 卡 不 允 许 关 闭
|
||||||
TitleItem += '<span class="disable-close">' + item.title + '</span>';
|
TitleItem += '<span class="disable-close title">' + item.title + '</span>';
|
||||||
}
|
}
|
||||||
TitleItem += '<i class="layui-icon layui-unselect layui-tab-close">ဆ</i></li>';
|
TitleItem += '<i class="layui-icon layui-unselect layui-tab-close">ဆ</i></li>';
|
||||||
title += TitleItem;
|
title += TitleItem;
|
||||||
if (option.index == index) {
|
if (option.index == index) {
|
||||||
|
|
||||||
// 处 理 显 示 内 容
|
// 处 理 显 示 内 容
|
||||||
content += '<div class="layui-show layui-tab-item"><iframe id="' + item.id + '" data-frameid="' + item.id +
|
content += '<div class="layui-show layui-tab-item"><iframe id="' + item.id +
|
||||||
|
'" data-frameid="' + item.id +
|
||||||
'" src="' + item.url +
|
'" src="' + item.url +
|
||||||
'" frameborder="no" border="0" marginwidth="0" marginheight="0" style="width: 100%;height: 100%;"></iframe></div>'
|
'" frameborder="no" border="0" marginwidth="0" marginheight="0" style="width: 100%;height: 100%;" allowfullscreen="true"></iframe></div>'
|
||||||
} else {
|
} else {
|
||||||
|
if (!option.preload) {
|
||||||
|
item.url = "about:blank";
|
||||||
|
}
|
||||||
// 处 理 显 示 内 容
|
// 处 理 显 示 内 容
|
||||||
content += '<div class="layui-tab-item"><iframe id="' + item.id + '" data-frameid="' + item.id + '" src="' +
|
content += '<div class="layui-tab-item"><iframe id="' + item.id + '" data-frameid="' +
|
||||||
|
item.id + '" src="' +
|
||||||
item.url +
|
item.url +
|
||||||
'" frameborder="no" border="0" marginwidth="0" marginheight="0" style="width: 100%;height: 100%;"></iframe></div>'
|
'" frameborder="no" border="0" marginwidth="0" marginheight="0" style="width: 100%;height: 100%;" allowfullscreen="true"></iframe></div>'
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
});
|
});
|
||||||
@@ -517,11 +537,11 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function menuEvent(option,index) {
|
function menuEvent(option, index) {
|
||||||
|
|
||||||
$("#" + option.elem + "closeThis").click(function() {
|
$("#" + option.elem + "closeThis").click(function() {
|
||||||
var currentTab = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title .layui-this");
|
var currentTab = contextTabDOM;
|
||||||
|
|
||||||
if (currentTab.find("span").is(".able-close")) {
|
if (currentTab.find("span").is(".able-close")) {
|
||||||
var currentId = currentTab.attr("lay-id");
|
var currentId = currentTab.attr("lay-id");
|
||||||
tabDelete(option.elem, currentId, option.closeEvent, option);
|
tabDelete(option.elem, currentId, option.closeEvent, option);
|
||||||
@@ -535,12 +555,13 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
$("#" + option.elem + "closeOther").click(function() {
|
$("#" + option.elem + "closeOther").click(function() {
|
||||||
var currentId = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title .layui-this").attr("lay-id");
|
var currentId = contextTabDOM.attr("lay-id");
|
||||||
var tabtitle = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title li");
|
var tabtitle = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title li");
|
||||||
$.each(tabtitle, function(i) {
|
$.each(tabtitle, function(i) {
|
||||||
if ($(this).attr("lay-id") != currentId) {
|
if ($(this).attr("lay-id") != currentId) {
|
||||||
if ($(this).find("span").is(".able-close")) {
|
if ($(this).find("span").is(".able-close")) {
|
||||||
tabDelete(option.elem, $(this).attr("lay-id"), option.closeEvent, option);
|
tabDelete(option.elem, $(this).attr("lay-id"), option.closeEvent,
|
||||||
|
option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -548,7 +569,7 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
$("#" + option.elem + "closeAll").click(function() {
|
$("#" + option.elem + "closeAll").click(function() {
|
||||||
var currentId = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title .layui-this").attr("lay-id");
|
var currentId = contextTabDOM.attr("lay-id");
|
||||||
var tabtitle = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title li");
|
var tabtitle = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title li");
|
||||||
$.each(tabtitle, function(i) {
|
$.each(tabtitle, function(i) {
|
||||||
if ($(this).find("span").is(".able-close")) {
|
if ($(this).find("span").is(".able-close")) {
|
||||||
@@ -559,11 +580,10 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function toolEvent(option) {
|
function toolEvent(option) {
|
||||||
|
|
||||||
$("body .layui-tab[lay-filter='" + option.elem + "']").on("click", "#closeThis", function() {
|
$("body .layui-tab[lay-filter='" + option.elem + "']").on("click", "#closeThis", function() {
|
||||||
var currentTab = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title .layui-this");
|
var currentTab = $(".layui-tab[lay-filter='" + option.elem +
|
||||||
|
"'] .layui-tab-title .layui-this");
|
||||||
if (currentTab.find("span").is(".able-close")) {
|
if (currentTab.find("span").is(".able-close")) {
|
||||||
var currentId = currentTab.attr("lay-id");
|
var currentId = currentTab.attr("lay-id");
|
||||||
tabDelete(option.elem, currentId, option.closeEvent, option);
|
tabDelete(option.elem, currentId, option.closeEvent, option);
|
||||||
@@ -576,19 +596,22 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
$("body .layui-tab[lay-filter='" + option.elem + "']").on("click", "#closeOther", function() {
|
$("body .layui-tab[lay-filter='" + option.elem + "']").on("click", "#closeOther", function() {
|
||||||
var currentId = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title .layui-this").attr("lay-id");
|
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");
|
var tabtitle = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title li");
|
||||||
$.each(tabtitle, function(i) {
|
$.each(tabtitle, function(i) {
|
||||||
if ($(this).attr("lay-id") != currentId) {
|
if ($(this).attr("lay-id") != currentId) {
|
||||||
if ($(this).find("span").is(".able-close")) {
|
if ($(this).find("span").is(".able-close")) {
|
||||||
tabDelete(option.elem, $(this).attr("lay-id"), option.closeEvent, option);
|
tabDelete(option.elem, $(this).attr("lay-id"), option.closeEvent,
|
||||||
|
option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
$("body .layui-tab[lay-filter='" + option.elem + "']").on("click", "#closeAll", function() {
|
$("body .layui-tab[lay-filter='" + option.elem + "']").on("click", "#closeAll", function() {
|
||||||
var currentId = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title .layui-this").attr("lay-id");
|
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");
|
var tabtitle = $(".layui-tab[lay-filter='" + option.elem + "'] .layui-tab-title li");
|
||||||
$.each(tabtitle, function(i) {
|
$.each(tabtitle, function(i) {
|
||||||
if ($(this).find("span").is(".able-close")) {
|
if ($(this).find("span").is(".able-close")) {
|
||||||
@@ -598,5 +621,43 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 pearTab());
|
exports(MOD_NAME, new pearTab());
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ layui.define('jquery', function(exports){
|
|||||||
DEFAULT_SKIN ='layui-btn layui-btn-primary layui-btn-sm'
|
DEFAULT_SKIN ='layui-btn layui-btn-primary layui-btn-sm'
|
||||||
,tag = function(){
|
,tag = function(){
|
||||||
this.config = {
|
this.config = {
|
||||||
likeHref:'../css/module/tag.css',
|
|
||||||
skin: DEFAULT_SKIN,
|
skin: DEFAULT_SKIN,
|
||||||
tagText:'+ New Tag'
|
tagText:'+ New Tag'
|
||||||
};
|
};
|
||||||
@@ -142,9 +141,7 @@ layui.define('jquery', function(exports){
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//初始化元素操作
|
|
||||||
tag.prototype.init = function(filter, options){
|
tag.prototype.init = function(filter, options){
|
||||||
layui.addcss(tag.config.likeHref);
|
|
||||||
if(filter){
|
if(filter){
|
||||||
tag.configs[filter] = $.extend({}, tag.config, tag.configs[filter] || {}, options);
|
tag.configs[filter] = $.extend({}, tag.config, tag.configs[filter] || {}, options);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ layui.define(["jquery","layer"], function (exports) {
|
|||||||
|
|
||||||
theme.changeTheme = function (target, autoHead) {
|
theme.changeTheme = function (target, autoHead) {
|
||||||
this.autoHead = autoHead;
|
this.autoHead = autoHead;
|
||||||
const color = localStorage.getItem("theme-color-color");
|
var color = localStorage.getItem("theme-color-color");
|
||||||
const second = localStorage.getItem("theme-color-second");
|
var second = localStorage.getItem("theme-color-second");
|
||||||
this.colorSet(color, second);
|
this.colorSet(color, second);
|
||||||
if (target.frames.length == 0) return;
|
if (target.frames.length == 0) return;
|
||||||
for (var i = 0; i < target.frames.length; i++) {
|
for (var i = 0; i < target.frames.length; i++) {
|
||||||
@@ -24,11 +24,12 @@ layui.define(["jquery","layer"], function (exports) {
|
|||||||
|
|
||||||
theme.colorSet = function(color, second) {
|
theme.colorSet = function(color, second) {
|
||||||
|
|
||||||
let style = '';
|
var style = '';
|
||||||
style += '.light-theme .pear-nav-tree .layui-this a:hover,.light-theme .pear-nav-tree .layui-this,.light-theme .pear-nav-tree .layui-this a,.pear-nav-tree .layui-this a,.pear-nav-tree .layui-this{background-color: ' +color + '!important;}';
|
style += '.light-theme .pear-nav-tree .layui-this a:hover,.light-theme .pear-nav-tree .layui-this,.light-theme .pear-nav-tree .layui-this a,.pear-nav-tree .layui-this a,.pear-nav-tree .layui-this{background-color: ' +color + '!important;}';
|
||||||
style += '.pear-admin .layui-logo .title{color:' + color + '!important;}';
|
style += '.pear-admin .layui-logo .title{color:' + color + '!important;}';
|
||||||
style += '.pear-frame-title .dot,.pear-tab .layui-this .pear-tab-active{background-color: ' + color +'!important;}';
|
style += '.pear-frame-title .dot,.pear-tab .layui-this .pear-tab-active{background-color: ' + color +'!important;}';
|
||||||
style += '.bottom-nav li a:hover{background-color:' + color + '!important;}';
|
style += '.bottom-nav li a:hover{background-color:' + color + '!important;}';
|
||||||
|
style += '.pear-btn-primary {border: 1px solid ' + color + '!important;}';
|
||||||
style += '.pear-admin .layui-header .layui-nav .layui-nav-bar{background-color: ' + color + '!important;}'
|
style += '.pear-admin .layui-header .layui-nav .layui-nav-bar{background-color: ' + color + '!important;}'
|
||||||
style += '.ball-loader>span,.signal-loader>span {background-color: ' + color + '!important;}';
|
style += '.ball-loader>span,.signal-loader>span {background-color: ' + color + '!important;}';
|
||||||
style += '.layui-header .layui-nav-child .layui-this a{background-color:' + color +'!important;color:white!important;}';
|
style += '.layui-header .layui-nav-child .layui-this a{background-color:' + color +'!important;color:white!important;}';
|
||||||
@@ -36,12 +37,16 @@ layui.define(["jquery","layer"], function (exports) {
|
|||||||
style += '.pearone-color .color-content li.layui-this:after, .pearone-color .color-content li:hover:after {border: ' +color + ' 3px solid!important;}';
|
style += '.pearone-color .color-content li.layui-this:after, .pearone-color .color-content li:hover:after {border: ' +color + ' 3px solid!important;}';
|
||||||
style += '.layui-nav .layui-nav-child dd.layui-this a, .layui-nav-child dd.layui-this{background-color:' + color + ';color:white;}';
|
style += '.layui-nav .layui-nav-child dd.layui-this a, .layui-nav-child dd.layui-this{background-color:' + color + ';color:white;}';
|
||||||
style += '.pear-social-entrance {background-color:' + color + '!important}';
|
style += '.pear-social-entrance {background-color:' + color + '!important}';
|
||||||
style += '.pear-admin .pe-collaspe {background-color:' + color + '!important}';
|
style += '.pear-admin .pe-collapse {background-color:' + color + '!important}';
|
||||||
style += '.layui-fixbar li {background-color:' + color + '!important}';
|
style += '.layui-fixbar li {background-color:' + color + '!important}';
|
||||||
style += '.pear-btn-primary {background-color:' + color + '!important}';
|
style += '.pear-btn-primary {background-color:' + color + '!important}';
|
||||||
style += '.layui-input:focus,.layui-textarea:focus {border-color: '+ color +'!important;box-shadow: 0 0 0 3px '+ second +' !important;}'
|
style += '.layui-input:focus,.layui-textarea:focus {border-color: ' + color + '!important;box-shadow: 0 0 0 3px ' + second + ' !important;}'
|
||||||
style += '.layui-form-checked[lay-skin=primary] i {border-color: '+ color +'!important;background-color: ' + color + ';}'
|
style += '.layui-form-checkbox[lay-skin=primary]:hover span {background-color: initial;}'
|
||||||
style += '.layui-form-onswitch { border-color: ' + color + '; background-color: '+color+';}'
|
style += '.layui-form-checked[lay-skin=primary] i {border-color: ' + color + '!important;background-color: ' + color + ';}'
|
||||||
|
style += '.layui-form-checked,.layui-form-checked:hover {border-color: ' + color + '!important;}'
|
||||||
|
style += '.layui-form-checked span,.layui-form-checked:hover span {background-color: ' + color + ';}'
|
||||||
|
style += '.layui-form-checked i,.layui-form-checked:hover i {color: ' + color + ';}'
|
||||||
|
style += '.layui-form-onswitch { border-color: ' + color + '; background-color: ' + color + ';}'
|
||||||
style += '.layui-form-radio>i:hover, .layui-form-radioed>i {color: ' + color + ';}'
|
style += '.layui-form-radio>i:hover, .layui-form-radioed>i {color: ' + color + ';}'
|
||||||
style += '.layui-laypage .layui-laypage-curr .layui-laypage-em{background-color:'+ color +'!important}'
|
style += '.layui-laypage .layui-laypage-curr .layui-laypage-em{background-color:'+ color +'!important}'
|
||||||
style += '.layui-tab-brief>.layui-tab-more li.layui-this:after, .layui-tab-brief>.layui-tab-title .layui-this:after{border-bottom: 3px solid '+color+'!important}'
|
style += '.layui-tab-brief>.layui-tab-more li.layui-this:after, .layui-tab-brief>.layui-tab-title .layui-this:after{border-bottom: 3px solid '+color+'!important}'
|
||||||
@@ -52,8 +57,8 @@ layui.define(["jquery","layer"], function (exports) {
|
|||||||
style += '.layui-laydate .layui-this{background-color:'+color+'!important}';
|
style += '.layui-laydate .layui-this{background-color:'+color+'!important}';
|
||||||
style += '.pear-this,.pear-text{color:' + color + '!important}';
|
style += '.pear-this,.pear-text{color:' + color + '!important}';
|
||||||
style += '.pear-back{background-color:'+ color +'!important}';
|
style += '.pear-back{background-color:'+ color +'!important}';
|
||||||
style += '.pear-collasped-pe{background-color:'+color+'!important}'
|
style += '.pear-collapsed-pe{background-color:'+color+'!important}'
|
||||||
style += '.layui-form-select dl dd.layui-this{background-color:'+color+'}'
|
style += '.layui-form-select dl dd.layui-this{color:'+color+'!important;}'
|
||||||
style += '.tag-item-normal{background:'+color+'!important}';
|
style += '.tag-item-normal{background:'+color+'!important}';
|
||||||
style += '.step-item-head.step-item-head-active{background-color:'+color+'}'
|
style += '.step-item-head.step-item-head-active{background-color:'+color+'}'
|
||||||
style += '.step-item-head{border: 3px solid '+color+';}'
|
style += '.step-item-head{border: 3px solid '+color+';}'
|
||||||
@@ -69,6 +74,7 @@ layui.define(["jquery","layer"], function (exports) {
|
|||||||
style += '.pear-tab-menu .item:hover{background-color:'+color+'!important}'
|
style += '.pear-tab-menu .item:hover{background-color:'+color+'!important}'
|
||||||
style += '.layui-form-danger:focus {border-color:#FF5722 !important}'
|
style += '.layui-form-danger:focus {border-color:#FF5722 !important}'
|
||||||
style += '.pear-admin .user .layui-this a:hover{color:white!important}'
|
style += '.pear-admin .user .layui-this a:hover{color:white!important}'
|
||||||
|
style += '.pear-admin .user a:hover{color:'+color+'!important}'
|
||||||
style += '.pear-notice .layui-this{color:'+color+'!important}'
|
style += '.pear-notice .layui-this{color:'+color+'!important}'
|
||||||
style += '.layui-form-radio:hover *, .layui-form-radioed, .layui-form-radioed>i{color:' + color + ' !important}';
|
style += '.layui-form-radio:hover *, .layui-form-radioed, .layui-form-radioed>i{color:' + color + ' !important}';
|
||||||
style += '.pear-btn:hover {color: '+color+';background-color: ' + second + ';}'
|
style += '.pear-btn:hover {color: '+color+';background-color: ' + second + ';}'
|
||||||
@@ -77,11 +83,13 @@ layui.define(["jquery","layer"], function (exports) {
|
|||||||
style += '.light-theme .pear-nav-tree .layui-this a:hover,.light-theme .pear-nav-tree .layui-this,.light-theme .pear-nav-tree .layui-this a {background-color:'+second+'!important;color:'+color+'!important;}'
|
style += '.light-theme .pear-nav-tree .layui-this a:hover,.light-theme .pear-nav-tree .layui-this,.light-theme .pear-nav-tree .layui-this a {background-color:'+second+'!important;color:'+color+'!important;}'
|
||||||
style += '.light-theme .pear-nav-tree .layui-this{ border-right: 3px solid '+color+'!important}'
|
style += '.light-theme .pear-nav-tree .layui-this{ border-right: 3px solid '+color+'!important}'
|
||||||
style += '.loader:after {background:'+color+'}'
|
style += '.loader:after {background:'+color+'}'
|
||||||
|
style += '.layui-laydate .layui-this, .layui-laydate .layui-this>div{background:'+color+'!important}'
|
||||||
if(this.autoHead === true || this.autoHead === "true"){
|
if(this.autoHead === true || this.autoHead === "true"){
|
||||||
style += '.pear-admin.banner-layout .layui-header .layui-logo,.pear-admin .layui-header{border:none;background-color:' + color + '!important;}.pear-admin.banner-layout .layui-header .layui-logo .title,.pear-admin .layui-header .layui-nav .layui-nav-item>a{color:whitesmoke!important;}';
|
style += '.pear-admin.banner-layout .layui-header .layui-logo,.pear-admin .layui-header{border:none;background-color:' + color + '!important;}.pear-admin.banner-layout .layui-header .layui-logo .title,.pear-admin .layui-header .layui-nav .layui-nav-item>a{color:whitesmoke!important;}';
|
||||||
style += '.pear-admin.banner-layout .layui-header{ box-shadow: 2px 0 6px rgb(0 21 41 / 35%) }'
|
style += '.pear-admin.banner-layout .layui-header{ box-shadow: 2px 0 6px rgb(0 21 41 / 35%) }'
|
||||||
style += '.pear-admin .layui-header .layui-layout-control .layui-this *,.pear-admin.banner-layout .layui-header .layui-layout-control .layui-this *{ background-color: rgba(0,0,0,.1)!important;}'
|
style += '.pear-admin .layui-header .layui-layout-control .layui-this *,.pear-admin.banner-layout .layui-header .layui-layout-control .layui-this *{ background-color: rgba(0,0,0,.1)!important;}'
|
||||||
}
|
}
|
||||||
|
style += '.menu-search-list li:hover,.menu-search-list li.this{background-color:'+ color +'}'
|
||||||
var colorPane = $("#pear-admin-color");
|
var colorPane = $("#pear-admin-color");
|
||||||
if(colorPane.length>0){
|
if(colorPane.length>0){
|
||||||
colorPane.html(style);
|
colorPane.html(style);
|
||||||
|
|||||||
@@ -14,9 +14,6 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
//
|
|
||||||
// Variables
|
|
||||||
//
|
|
||||||
var $iziToast = {},
|
var $iziToast = {},
|
||||||
PLUGIN_NAME = 'iziToast',
|
PLUGIN_NAME = 'iziToast',
|
||||||
BODY = document.querySelector('body'),
|
BODY = document.querySelector('body'),
|
||||||
@@ -1224,7 +1221,5 @@
|
|||||||
|
|
||||||
that.toast = $DOM.toast;
|
that.toast = $DOM.toast;
|
||||||
};
|
};
|
||||||
// 加载css
|
|
||||||
layui.link(layui.cache.base + 'iziToast/iziToast.css');
|
|
||||||
return $iziToast;
|
return $iziToast;
|
||||||
});
|
});
|
||||||
@@ -42,17 +42,9 @@ layui.define(['layer', 'table'], function (exports) {
|
|||||||
for (var i = 0; i < tNodes.length; i++) {
|
for (var i = 0; i < tNodes.length; i++) {
|
||||||
var tt = tNodes[i];
|
var tt = tNodes[i];
|
||||||
if (!tt.id) {
|
if (!tt.id) {
|
||||||
if (!param.treeIdName) {
|
|
||||||
layer.msg('参数treeIdName不能为空', {icon: 5});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
tt.id = tt[param.treeIdName];
|
tt.id = tt[param.treeIdName];
|
||||||
}
|
}
|
||||||
if (!tt.pid) {
|
if (!tt.pid) {
|
||||||
if (!param.treePidName) {
|
|
||||||
layer.msg('参数treePidName不能为空', {icon: 5});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
tt.pid = tt[param.treePidName];
|
tt.pid = tt[param.treePidName];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,6 +199,16 @@ layui.define(['layer', 'table'], function (exports) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!param.treeIdName) {
|
||||||
|
layer.msg('参数treeIdName不能为空', {icon: 5});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!param.treePidName) {
|
||||||
|
layer.msg('参数treePidName不能为空', {icon: 5});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!param.treeColIndex && param.treeColIndex != 0) {
|
if (!param.treeColIndex && param.treeColIndex != 0) {
|
||||||
layer.msg('参数treeColIndex不能为空', {icon: 5});
|
layer.msg('参数treeColIndex不能为空', {icon: 5});
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -0,0 +1,224 @@
|
|||||||
|
/* global Watermark */
|
||||||
|
layui.define(['jquery', 'element'], function(exports) {
|
||||||
|
var $=layui.$;
|
||||||
|
var _parentEle;
|
||||||
|
var _wmContainer;
|
||||||
|
var _wmObserver;
|
||||||
|
var _wmParentObserver;
|
||||||
|
var _resizeHandler;
|
||||||
|
var _windowsWidth = window.outerWidth;
|
||||||
|
var _windowsHeight = window.outerHeight;
|
||||||
|
|
||||||
|
var _left = 0;
|
||||||
|
var _top = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create DOM of watermark's container
|
||||||
|
* @param {Watermark} watermark
|
||||||
|
*/
|
||||||
|
var _createContainer = function (watermark) {
|
||||||
|
watermark._container = document.createElement('div');
|
||||||
|
watermark._container.classList.add('cell-watermark-container');
|
||||||
|
watermark._container.style.cssText = 'display: block; pointer-events: none;';
|
||||||
|
watermark._container.setAttribute('aria-hidden', true);
|
||||||
|
_parentEle = document.querySelector(watermark.options.appendTo) || document.body;
|
||||||
|
//获取页面最大宽度
|
||||||
|
_windowsWidth = Math.min(_parentEle.scrollWidth, _parentEle.clientWidth);
|
||||||
|
//获取页面最大高度
|
||||||
|
_windowsHeight = Math.min(_parentEle.scrollHeight, _parentEle.clientHeight);
|
||||||
|
_parentEle.appendChild(watermark._container);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create watermark's DOM
|
||||||
|
* @param {Watermark} watermark
|
||||||
|
* @param {Object} options
|
||||||
|
*/
|
||||||
|
var _createWatermark = function (watermark, options) {
|
||||||
|
options.rowSpacing = options.rowSpacing || 60;
|
||||||
|
options.colSpacing = options.colSpacing || 30;
|
||||||
|
options.width = options.width || 150;
|
||||||
|
options.height = options.height || 20;
|
||||||
|
|
||||||
|
let rows = parseInt(_windowsHeight / (options.height + options.rowSpacing));
|
||||||
|
let cols = parseInt(_windowsWidth / (options.width + options.colSpacing));
|
||||||
|
let offsetLeft =_left+ (_windowsWidth - options.width * cols - options.colSpacing * (cols - 1)) / 2;
|
||||||
|
let offsetTop = _top+(_windowsHeight - options.height * rows - options.rowSpacing * (rows - 1)) / 2;
|
||||||
|
let watermarkBase = document.createElement('div');
|
||||||
|
watermarkBase.classList.add('cell-watermark');
|
||||||
|
watermarkBase.style.cssText =
|
||||||
|
'transform: rotate(15deg); opacity: 0.1; font-size: 0.85rem; text-align: center;' +
|
||||||
|
'position: absolute; user-select: none; word-break: break-all; overflow: hidden; z-index: 999999;';
|
||||||
|
for (let row = 0; row < rows; row++) {
|
||||||
|
let top = offsetTop + (options.rowSpacing + options.height) * row;
|
||||||
|
let tempCols = cols;
|
||||||
|
row % 2 !== 0 && tempCols++;
|
||||||
|
for (let col = 0; col < tempCols; col++) {
|
||||||
|
let left = offsetLeft + (options.colSpacing + options.width) * col;
|
||||||
|
tempCols !== cols && (left -= (options.colSpacing + options.width) / 2);
|
||||||
|
let watermarkEle = watermarkBase.cloneNode();
|
||||||
|
watermarkEle.style.cssText += `left: ${left}px; top: ${top}px; width: ${options.width}px; height: ${options.height}px`;
|
||||||
|
watermarkEle.style.transform = `rotate(${options.rotate}deg)`;
|
||||||
|
watermarkEle.style.opacity = options.opacity;
|
||||||
|
watermarkEle.style.fontSize = `${options.fontSize}rem`;
|
||||||
|
watermarkEle.style.fontFamily = options.fontFamily;
|
||||||
|
watermarkEle.innerHTML = options.content;
|
||||||
|
watermark._container.appendChild(watermarkEle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Backup for recover the watermark's container when the its DOM is removed
|
||||||
|
_wmContainer = watermark._container;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rerender watermark
|
||||||
|
* @param {Watermark} watermark
|
||||||
|
* @param {Object} options
|
||||||
|
*/
|
||||||
|
var _render = function (watermark, options) {
|
||||||
|
_wmObserver.disconnect();
|
||||||
|
watermark._container.innerHTML = '';
|
||||||
|
_createWatermark(watermark, options);
|
||||||
|
_wmObserver.observe(watermark._container, {
|
||||||
|
attributes: true,
|
||||||
|
childList: true,
|
||||||
|
characterData: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Observe watermark and watermark's parentNode mutations
|
||||||
|
* @param {Watermark} watermark
|
||||||
|
*/
|
||||||
|
var _addObserve = function (watermark) {
|
||||||
|
//Observe watermark element and its child element
|
||||||
|
_wmObserver = new MutationObserver(function (mutations, observer) {
|
||||||
|
_render(watermark, watermark.options);
|
||||||
|
});
|
||||||
|
_wmObserver.observe(watermark._container, {
|
||||||
|
attributes: true,
|
||||||
|
childList: true,
|
||||||
|
characterData: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
//Observe parent element, recreate if the element is deleted
|
||||||
|
_wmParentObserver = new MutationObserver(function (mutations) {
|
||||||
|
for (let m of mutations) {
|
||||||
|
if (
|
||||||
|
m.type === 'childList' &&
|
||||||
|
m.removedNodes.length > 0 &&
|
||||||
|
document.querySelectorAll('.cell-watermark-container').length === 0
|
||||||
|
) {
|
||||||
|
_parentEle.appendChild(_wmContainer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
_wmParentObserver.observe(watermark._container.parentNode, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Window's resize listener
|
||||||
|
* @param {Watermark} watermark
|
||||||
|
*/
|
||||||
|
var _addResizeListener = function (watermark) {
|
||||||
|
_resizeHandler = function () {
|
||||||
|
|
||||||
|
//获取页面最大宽度
|
||||||
|
var _windowsWidth_n = Math.max(_parentEle.scrollWidth, _parentEle.clientWidth);
|
||||||
|
//获取页面最大高度
|
||||||
|
var _windowsHeight_n = Math.max(_parentEle.scrollHeight, _parentEle.clientHeight);
|
||||||
|
|
||||||
|
|
||||||
|
/*if (window.outerHeight !== _windowsHeight || window.outerWidth !== _windowsWidth) {
|
||||||
|
_windowsHeight = window.outerHeight;
|
||||||
|
_windowsWidth = window.outerWidth;
|
||||||
|
_render(watermark, watermark.options);
|
||||||
|
}*/
|
||||||
|
if (_windowsHeight_n !== _windowsHeight || _windowsWidth_n !== _windowsWidth) {
|
||||||
|
_windowsHeight = _windowsHeight_n;
|
||||||
|
_windowsWidth = _windowsWidth_n;
|
||||||
|
_render(watermark, watermark.options);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
window.addEventListener('resize', _resizeHandler);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Watermark.
|
||||||
|
* Create watermark for webpage and automatic adjust when windows resize.
|
||||||
|
* @param {Object} options
|
||||||
|
* @param {String} [options.content] watermark's text
|
||||||
|
* @param {String} [options.appendTo='body'] parent of watermark's container
|
||||||
|
* @param {Number} [options.width=150] watermark's width. unit: px
|
||||||
|
* @param {Number} [options.height=20] watermark's height. unit: px
|
||||||
|
* @param {Number} [options.rowSpacing=60] row spacing of watermarks. unit: px
|
||||||
|
* @param {Number} [options.colSpacing=30] col spacing of watermarks. unit: px
|
||||||
|
* @param {Number} [options.rotate=15] watermark's tangent angle. unit: deg
|
||||||
|
* @param {Number} [options.opacity=0.1] watermark's transparency
|
||||||
|
* @param {Number} [options.fontSize=0.85] watermark's fontSize. unit: rem
|
||||||
|
* @param {Number} [options.fontFamily='inherit'] watermark's fontFamily.
|
||||||
|
* @namespace Watermark
|
||||||
|
* @class Watermark
|
||||||
|
* @version 1.0.3
|
||||||
|
* @author @Lruihao https://lruihao.cn
|
||||||
|
*/
|
||||||
|
function Watermark(options = {}) {
|
||||||
|
var _proto = Watermark.prototype;
|
||||||
|
this.options = options;
|
||||||
|
_createContainer(this);
|
||||||
|
_createWatermark(this, this.options);
|
||||||
|
_addObserve(this);
|
||||||
|
_addResizeListener(this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upload watermark's text content
|
||||||
|
* @param {String} content watermark's text
|
||||||
|
*/
|
||||||
|
_proto.upload = function (content) {
|
||||||
|
if (!content) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_wmParentObserver.disconnect();
|
||||||
|
_wmObserver.disconnect();
|
||||||
|
this.options.content = content;
|
||||||
|
for (const watermark of this._container.querySelectorAll('.cell-watermark')) {
|
||||||
|
watermark.innerHTML = content;
|
||||||
|
}
|
||||||
|
_wmParentObserver.observe(this._container.parentNode, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
_wmObserver.observe(this._container, {
|
||||||
|
attributes: true,
|
||||||
|
childList: true,
|
||||||
|
characterData: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rerender watermark
|
||||||
|
* @param {Object} options
|
||||||
|
*/
|
||||||
|
_proto.render = function (options = {}) {
|
||||||
|
_render(this, Object.assign(this.options, options));
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Force destroy watermark
|
||||||
|
*/
|
||||||
|
_proto.destroy = function () {
|
||||||
|
_wmObserver.disconnect();
|
||||||
|
_wmParentObserver.disconnect();
|
||||||
|
window.removeEventListener('resize', _resizeHandler);
|
||||||
|
this._container.parentNode.removeChild(this._container);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
exports("watermark",Watermark);
|
||||||
|
})
|
||||||
@@ -1,43 +1,51 @@
|
|||||||
window.rootPath = (function(src) {
|
window.rootPath = (function (src) {
|
||||||
src = document.scripts[document.scripts.length - 1].src;
|
src = document.currentScript
|
||||||
|
? document.currentScript.src
|
||||||
|
: document.scripts[document.scripts.length - 1].src;
|
||||||
return src.substring(0, src.lastIndexOf("/") + 1);
|
return src.substring(0, src.lastIndexOf("/") + 1);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
layui.config({
|
layui.config({
|
||||||
base: rootPath + "module/",
|
base: rootPath + "module/",
|
||||||
version: "3.9.0"
|
version: "3.30.0"
|
||||||
}).extend({
|
}).extend({
|
||||||
admin: "admin", // 框架布局组件
|
admin: "admin", // 框架布局组件
|
||||||
menu: "menu", // 数据菜单组件
|
common: "common", // 公共方法封装
|
||||||
frame: "frame", // 内容页面组件
|
menu: "menu", // 数据菜单组件
|
||||||
tab: "tab", // 多选项卡组件
|
frame: "frame", // 内容页面组件
|
||||||
echarts: "echarts", // 数据图表组件
|
tab: "tab", // 多选项卡组件
|
||||||
echartsTheme: "echartsTheme", // 数据图表主题
|
echarts: "echarts", // 数据图表组件
|
||||||
hash: "hash", // 数据加密组件
|
echartsTheme: "echartsTheme",// 数据图表主题
|
||||||
select: "select", // 下拉多选组件
|
encrypt: "encrypt", // 数据加密组件
|
||||||
drawer: "drawer", // 抽屉弹层组件
|
select: "select", // 下拉多选组件
|
||||||
notice: "notice", // 消息提示组件
|
drawer: "drawer", // 抽屉弹层组件
|
||||||
step:"step", // 分布表单组件
|
notice: "notice", // 消息提示组件
|
||||||
tag:"tag", // 多标签页组件
|
step:"step", // 分布表单组件
|
||||||
popup:"popup", // 弹层封装
|
tag:"tag", // 多标签页组件
|
||||||
treetable:"treetable", // 树状表格
|
popup:"popup", // 弹层封装
|
||||||
dtree:"dtree", // 树结构
|
treetable:"treetable", // 树状表格
|
||||||
tinymce:"tinymce/tinymce", // 编辑器
|
dtree:"dtree", // 树结构
|
||||||
area:"area", // 省市级联
|
tinymce:"tinymce/tinymce", // 编辑器
|
||||||
count:"count", // 数字滚动组件
|
area:"area", // 省市级联
|
||||||
topBar: "topBar", // 置顶组件
|
count:"count", // 数字滚动
|
||||||
button: "button", // 加载按钮
|
topBar: "topBar", // 置顶组件
|
||||||
design: "design", // 表单设计
|
button: "button", // 加载按钮
|
||||||
card: "card", // 数据卡片组件
|
design: "design", // 表单设计
|
||||||
loading: "loading", // 加载组件
|
card: "card", // 数据卡片组件
|
||||||
cropper:"cropper", // 裁剪组件
|
loading: "loading", // 加载组件
|
||||||
convert:"convert", // 数据转换
|
cropper:"cropper", // 裁剪组件
|
||||||
yaml:"yaml", // yaml 解析组件
|
convert:"convert", // 数据转换
|
||||||
context: "context", // 上下文组件
|
yaml:"yaml", // yaml 解析组件
|
||||||
http: "http", // ajax请求组件
|
context: "context", // 上下文组件
|
||||||
theme: "theme", // 主题转换
|
http: "http", // 网络请求组件
|
||||||
message: "message", // 通知组件
|
theme: "theme", // 主题转换
|
||||||
toast: "toast" // 消息通知
|
message: "message", // 通知组件
|
||||||
|
toast: "toast", // 消息通知
|
||||||
|
iconPicker: "iconPicker", // 图标选择
|
||||||
|
nprogress: "nprogress", // 进度过渡
|
||||||
|
watermark:"watermark/watermark", //水印组件
|
||||||
|
fullscreen:"fullscreen", //全屏组件
|
||||||
|
popover:"popover/popover" //汽泡组件
|
||||||
}).use(['layer', 'theme'], function () {
|
}).use(['layer', 'theme'], function () {
|
||||||
layui.theme.changeTheme(window, false);
|
layui.theme.changeTheme(window, false);
|
||||||
});
|
});
|
||||||