优化样式部署

This commit is contained in:
augushong
2021-03-23 19:47:49 +08:00
parent bb714a5333
commit 384aa7f908
7 changed files with 213 additions and 232 deletions

View File

@@ -1,7 +1,7 @@
<link rel="stylesheet" href="/static/css/reset.css">
<link rel="stylesheet" href="/static/css/pagination.css">
<link rel="stylesheet" href="/static/lib/layui/css/layui.css">
<link rel="stylesheet" href="/static/css/{$Request.cookie.skin_name|default='skin-1'}.css">
<link rel="stylesheet" href="/cdn/layui-ul-change.css">
<link rel="stylesheet" href="/static/css/common.css">
<script src="/static/lib/jquery/jquery-3.4.1.min.js"></script>
<script src="/static/lib/jquery/jquery.cookie.js"></script>
@@ -10,110 +10,85 @@
<script>
//JavaScript代码区域
layui.use(['element', 'layer', 'util'], function () {
var element = layui.element;
var util = layui.util;
var defaultCookieSetting = {
path: '/',
expires: 7,
}
//执行
util.fixbar({
bar1: '&#xe656;'
, click: function (type) {
console.log(type);
if (type === 'bar1') {
var skinName = $.cookie('skin_name')
$('body').removeClass()
if (skinName == 'skin-1') {
$.cookie('skin_name', 'skin-0', defaultCookieSetting)
$('body').addClass('skin-0')
} else {
$.cookie('skin_name', 'skin-1', defaultCookieSetting)
$('body').addClass('skin-1')
//JavaScript代码区域
layui.use(['element', 'layer', 'util'], function () {
var element = layui.element;
}
$('.layui-side').addClass('layui-hide-xs')
location.reload()
}
}
});
$('.layui-side').addClass('layui-hide-xs')
});
});
$(function () {
var skinName = $.cookie('skin-name')
$(function () {
var skinName = $.cookie('skin-name')
$('body').addClass(skinName)
setTimeout(() => {
if (typeof currentHeaderNavItem != "undefined") {
$('.header-nav-item').each(function (i, e) {
if ($(e).data('name') == currentHeaderNavItem) {
$(e).addClass('layui-this')
}
})
}
if (typeof currentLeftNavItem != "undefined") {
$('.left-nav-item').each(function (i, e) {
if ($(e).data('name') == currentLeftNavItem) {
$(e).addClass('layui-this')
}
})
}
$('body').addClass(skinName)
setTimeout(() => {
if (typeof currentHeaderNavItem != "undefined") {
$('.header-nav-item').each(function (i, e) {
if ($(e).data('name') == currentHeaderNavItem) {
$(e).addClass('layui-this')
}
})
}
if (typeof currentLeftNavItem != "undefined") {
$('.left-nav-item').each(function (i, e) {
if ($(e).data('name') == currentLeftNavItem) {
$(e).addClass('layui-this')
}
})
}
// 表格转卡片
// 表格转卡片
var tableContainer = $('.layui-table').parent()
var tableContainer = $('.layui-table').parent()
$('.layui-table').addClass('layui-hide-xs')
$('.layui-table').addClass('layui-hide-xs')
var cardList = $('<div class="table-card layui-show-xs-block layui-hide-md"></div>').prependTo(tableContainer)
var cardList = $('<div class="table-card layui-show-xs-block layui-hide-md"></div>').prependTo(tableContainer)
$('.layui-table tbody tr').each(function () {
var trItem = this;
$('.layui-table tbody tr').each(function () {
var trItem = this;
var boxItem = $('.tpl .table-card-box').clone()
var boxItem = $('.tpl .table-card-box').clone()
$.each($(trItem).data(),function(index,value){
$(boxItem).data(index,value)
})
$.each($(trItem).data(), function (index, value) {
$(trItem).find('td').each(function (index, ele) {
var itemItem = $('.tpl .table-card-item').clone()
$(itemItem).find('.item-title').text($('.layui-table thead th').eq(index).text())
$(boxItem).data(index, value)
})
if($(ele).children().length == 0){
$(itemItem).find('.item-value').html($(ele).html())
}else{
$(trItem).find('td').each(function (index, ele) {
var itemItem = $('.tpl .table-card-item').clone()
$(itemItem).find('.item-title').text($('.layui-table thead th').eq(index).text())
$(ele).children().clone().appendTo($(itemItem).find('.item-value'))
}
if ($(ele).children().length == 0) {
$(itemItem).find('.item-value').html($(ele).html())
} else {
$(itemItem).appendTo(boxItem)
})
$(ele).children().clone().appendTo($(itemItem).find('.item-value'))
}
$(boxItem).appendTo(cardList)
})
$(itemItem).appendTo(boxItem)
})
}, 1);
$(boxItem).appendTo(cardList)
})
}, 1);
})
})
</script>
{:get_system_config('site_tongji')}
<div class="tpl" style="display: none;">
<div class="table-card-box item">
<div class="table-card-box item">
</div>
<div class="table-card-item">
<div class="item-title"></div>
<div class="item-value"></div>
</div>
</div>
<div class="table-card-item">
<div class="item-title"></div>
<div class="item-value"></div>
</div>
</div>