Browse Source

update baisuTwo

pull/55/head
xiaoz 3 years ago
parent
commit
0408f668be
  1. 139
      templates/baisuTwo/css/style.css
  2. 166
      templates/baisuTwo/index.php
  3. 233
      templates/baisuTwo/js/admin.js
  4. 10
      templates/baisuTwo/js/common.js

139
templates/baisuTwo/css/style.css

@ -98,56 +98,114 @@ a { @@ -98,56 +98,114 @@ a {
padding: 0 25px 100px;
overflow: auto;
}
/* 整个滚动条 */
.index-nav .type-list::-webkit-scrollbar {
width: 6px;
background-color: transparent;
}
/* 滚动条上的按钮 (上下箭头). */
.index-nav .type-list::-webkit-scrollbar-button {
height: 0px;
width: 0px;
}
/* 滚动条上的滚动滑块. */
.index-nav .type-list::-webkit-scrollbar-thumb {
background-color: #64a15e;
border-radius: 50px;
}
/* 滚动条轨道. */
.index-nav .type-list::-webkit-scrollbar-track {
background-color: transparent;
}
/* 滚动条没有滑块的轨道部分 */
.index-nav .type-list::-webkit-scrollbar-track-piece {
background-color: transparent;
}
.index-nav .type-list .list {
display: flex;
justify-content: flex-start;
align-items: center;
margin-bottom: 10px;
line-height: 42px;
transition: 0.3s all;
overflow: hidden;
}
.index-nav .type-list .list a {
width: 80%;
display: flex;
justify-content: flex-start;
align-items: center;
font-size: 16px;
font-weight: bold;
padding: 10px;
border-radius: 5px;
margin-bottom: 10px;
padding: 0 10px;
border-radius: 5px 0px 0px 5px;
color: #555555;
transition: 0.3s all;
}
.index-nav .type-list .list i {
.index-nav .type-list .list a i {
display: block;
margin-right: 6px;
font-size: 22px;
}
.index-nav .type-list .list:hover {
.index-nav .type-list .list span {
display: block;
width: 0;
overflow: hidden;
text-align: center;
background-color: #477975;
cursor: pointer;
border-radius: 0px 5px 5px 0px;
color: #FFFFFF;
transition: 0.3s all;
}
.index-nav .type-list .list span i {
display: block;
font-size: 18px;
transition: 0.3s all;
}
.index-nav .type-list .list.add{
margin-top: 12px;
}
.index-nav .type-list .list.add a{
width: 100%;
border: 1px solid #64a15e;
border-radius: 5px;
cursor: pointer;
}
.index-nav .type-list .list:hover a {
background-color: #64a15e;
color: #FFFFFF;
transition: 0.3s all;
}
.index-nav .type-list .list:hover span {
width: 20%;
transition: 0.3s all;
}
.index-nav .user-info {
width: 100%;
background-color: #ffffff;
@ -313,12 +371,14 @@ a { @@ -313,12 +371,14 @@ a {
font-size: 20px;
color: #64a15e;
}
.search-main .search-btnlist {
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.search-main button.search-btn {
width: 140px;
height: 50px;
@ -334,6 +394,7 @@ a { @@ -334,6 +394,7 @@ a {
cursor: pointer;
border-right: 1px solid #64a15e;
}
.search-main button.search-btn img {
display: block;
width: 25px;
@ -341,12 +402,14 @@ a { @@ -341,12 +402,14 @@ a {
border-radius: 6px;
margin-right: 6px;
}
.search-main button.search-btn i {
display: block;
margin-right: 4px;
font-size: 20px;
line-height: 50px;
}
.search-main button.search-change {
width: 30px;
height: 50px;
@ -367,6 +430,7 @@ a { @@ -367,6 +430,7 @@ a {
font-size: 16px;
line-height: 50px;
}
.search-main .search-btnlist .search-lists {
width: 390px;
display: flex;
@ -382,9 +446,11 @@ a { @@ -382,9 +446,11 @@ a {
z-index: 100;
box-shadow: 0px 0px 6px #000000;
}
.search-main .search-btnlist .search-lists.hide {
display: none;
}
.search-main .search-btnlist .search-lists .list {
width: 33%;
line-height: 40px;
@ -397,6 +463,7 @@ a { @@ -397,6 +463,7 @@ a {
cursor: pointer;
transition: 0.3s all;
}
.search-main .search-btnlist .search-lists .list img {
display: block;
width: 20px;
@ -459,8 +526,6 @@ a { @@ -459,8 +526,6 @@ a {
margin-left: 15px;
}
.search-main-w .weather-main {
width: 240px;
height: 100%;
@ -528,7 +593,7 @@ a { @@ -528,7 +593,7 @@ a {
position: relative;
display: flex;
justify-content: flex-start;
align-items: center;
align-items: flex-start;
}
.site-main .site-list .list span {
@ -589,13 +654,23 @@ a { @@ -589,13 +654,23 @@ a {
bottom: 0;
}
.site-main .site-list .list .desc {
display: block;
width: 100%;
font-size: 13px;
padding-bottom: 10px;
color: #666;
line-height: 1.5;
}
.site-main .site-list .list:hover {
box-shadow: 0px 0px 6px #333;
background-color: #64a15e;
transition: 0.3s all;
}
.site-main .site-list .list:hover p.name {
.site-main .site-list .list:hover p.name,
.site-main .site-list .list:hover p.desc {
color: #ffffff;
}
@ -636,6 +711,7 @@ footer.show { @@ -636,6 +711,7 @@ footer.show {
footer a:hover {
color: #64a15e !important;
}
.tool-list {
position: fixed;
bottom: 30px;
@ -643,6 +719,7 @@ footer a:hover { @@ -643,6 +719,7 @@ footer a:hover {
z-index: 99;
width: 45px;
}
.tool-list .list {
width: 45px;
height: 45px;
@ -655,13 +732,16 @@ footer a:hover { @@ -655,13 +732,16 @@ footer a:hover {
cursor: pointer;
margin-top: 12px;
}
.tool-list .list i {
font-size: 20px;
}
.tool-list .addsite i {
font-size: 24px;
}
/**/
.addsiteBox {
@ -840,7 +920,9 @@ footer a:hover { @@ -840,7 +920,9 @@ footer a:hover {
margin-top: 0;
}
.m-header{display: none;}
.m-header {
display: none;
}
/*
@ -890,8 +972,6 @@ footer a:hover { @@ -890,8 +972,6 @@ footer a:hover {
margin: auto;
font-size: 13px;
}
.site-main .site-name {
margin-bottom: 10px;
}
@ -946,4 +1026,39 @@ footer a:hover { @@ -946,4 +1026,39 @@ footer a:hover {
color: #64a15e;
border-radius: 6px;
}
.m-navlist-w {
width: 100%;
position: absolute;
top: 100%;
left: 0;
right: 0;
background-color: #FFFFFF;
padding: 15px;
display: none;
border-top: 1px solid #C0C4CC;
}
.m-navlist {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
align-items: center;
}
.m-navlist a.list {
width: 33%;
padding: 0 10px;
line-height: 40px;
display: flex;
justify-content: flex-start;
align-items: center;
}
.m-navlist a.list i {
display: block;
margin-right: 4px;
}
.addsite-main {
width: 100%;
}
.addsite-main .list.type span {
width: 32%;
}
}

166
templates/baisuTwo/index.php

@ -19,9 +19,18 @@ @@ -19,9 +19,18 @@
<link rel="stylesheet" type="text/css" href="templates/<?php echo TEMPLATE; ?>/css/style.css" />
<link rel="stylesheet" href="https://libs.xiaoz.top/font-awesome/4.7.0/css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="templates/<?php echo TEMPLATE; ?>/layui/css/layui.css" />
<style type="text/css">
/*链接描述是否显示*/
.site-main .site-list .list .desc {
/*none:不显示,block:显示*/
display: none;
}
</style>
</head>
<body>
<!--手机顶部 S-->
<!--手机顶部 S-->
<div class="m-header">
<div class="logo">
@ -30,8 +39,22 @@ @@ -30,8 +39,22 @@
<div class="navbar">
<i class="iconfont icon-caidan"></i>
</div>
<div class="m-navlist-w">
<div class="m-navlist">
<?php
foreach ($categorys as $category) {
$font_icon = empty($category['font_icon']) ? '' : "<i class='{$category['font_icon']}'></i> ";
?>
<a href="#category-<?php echo $category['id']; ?>" class="list catlist">
<?php echo $font_icon; ?>
<?php echo htmlspecialchars_decode($category['name']); ?>
</a>
<?php } ?>
</div>
</div>
</div>
<!--手机顶部 E-->
<!--手机顶部 E-->
<!--左侧分类栏 S-->
<div class="index-nav">
<div class="logo">
@ -43,11 +66,19 @@ @@ -43,11 +66,19 @@
foreach ($categorys as $category) {
$font_icon = empty($category['font_icon']) ? '' : "<i class='{$category['font_icon']}'></i> ";
?>
<a href="#category-<?php echo $category['id']; ?>" class="list">
<?php echo $font_icon; ?><?php echo htmlspecialchars_decode($category['name']); ?>
<div class="list">
<a class="catlist" href="#category-<?php echo $category['id']; ?>">
<?php echo $font_icon; ?>
<?php echo htmlspecialchars_decode($category['name']); ?>
</a>
<span class="editFid" data-fid = "<?php echo $category['id']; ?>"><i class="iconfont icon-bianji"></i></span>
</div>
<?php } ?>
<div class="list add" id="addCat">
<a>
<i class="iconfont icon-tianjia"></i>添加分类</a>
</div>
</div>
<div class="user-info">
<div class="pic">
@ -154,7 +185,8 @@ @@ -154,7 +185,8 @@
?>
<div class="site-name" id="category-<?php echo $category['id']; ?>">
<?php echo $font_icon; ?><?php echo htmlspecialchars_decode($category['name']); ?>
<?php echo $font_icon; ?>
<?php echo htmlspecialchars_decode($category['name']); ?>
<?php echo $property; ?>
</div>
<div class="site-list">
@ -170,6 +202,9 @@ @@ -170,6 +202,9 @@
<img src="https://favicon.rss.ink/v1/<?php echo base64($link['url']); ?>">
<?php echo $link['title']; ?>
</p>
<p class="desc">
<?php echo $link['description']; ?>
</p>
</a>
<?php if($link['property'] == 1 ) { ?>
<span><i class="one iconfont icon-suo"></i></span>
@ -190,7 +225,7 @@ @@ -190,7 +225,7 @@
<!--底部版权 S-->
<footer>
© 2022 BaiSu,Powered by
© 2022 BaiSuPowered by
<a target="_blank" href="https://github.com/helloxz/onenav" title="简约导航/书签管理器" rel="nofollow">OneNav</a>
<br> The theme author is
<a href="https://gitee.com/baisucode/onenav" target="_blank">BaiSu</a>
@ -218,7 +253,7 @@ @@ -218,7 +253,7 @@
<!--添加链接 S-->
<div class="addsite-main" id="addsiteBox">
<div class="title">
添加
添加
</div>
<form class="layui-form list-w">
<div class="list">
@ -261,6 +296,126 @@ @@ -261,6 +296,126 @@
</div>
<!--添加链接 E-->
<!--修改链接 S-->
<div class="addsite-main" id="editsiteBox">
<div class="title">
修改链接
</div>
<form class="layui-form list-w" lay-filter="editsite">
<input type="hidden" name="id" id="id" value="" required lay-verify="required" />
<div class="list">
<span class="icon"><i class="iconfont icon-charulianjie"></i></span>
<input type="text" class="text" name="url" id="url" required lay-verify="required|url" placeholder="请输入完整的网址链接" autocomplete="off">
</div>
<div class="list">
<span class="icon"><i class="iconfont icon-bianji"></i></span>
<input type="text" class="text" name="title" id="title" required lay-verify="required" placeholder="请输入标题" autocomplete="off">
</div>
<div class="list type">
<input type="hidden" name="fid" id="fid" value="" required lay-verify="required" />
<?php foreach ($categorys as $category) {
?>
<span class="fid editfid-<?php echo $category['id'] ?>" data-fid="<?php echo $category['id'] ?>"><?php echo htmlspecialchars_decode($category['name']); ?></span>
<?php } ?>
<span class="kongs"></span>
<span class="kongs"></span>
<span class="kongs"></span>
</div>
<div class="list list-2">
<div class="li">
<span>权重:</span>
<input type="text" class="num" name="weight" min="0" max="999" value="0" required lay-verify="required|number" autocomplete="off">
</div>
<div class="li">
私有:
<input type="checkbox" lay-skin="switch" lay-text="是|否" name="property" value="1">
</div>
</div>
<div class="list">
<textarea name="description" id="description" placeholder="请输入站点描述(选填)"></textarea>
</div>
<div class="list">
<button lay-submit lay-filter="edit_link">修改</button>
</div>
</form>
</div>
<!--修改链接 E-->
<!--添加分类 S-->
<div class="addsite-main" id="addFidBox">
<div class="title">
添加分类
</div>
<form class="layui-form list-w" lay-filter="editsite">
<div class="list">
<span class="icon"><i class="iconfont icon-bianji"></i></span>
<input type="text" class="text" name="name" id="name" required lay-verify="required" placeholder="请输入分类名称" autocomplete="off">
</div>
<div class="list">
<span class="icon"><i class="iconfont icon-shezhi1"></i></span>
<input type="text" class="text" name="font_icon" id="font_icon" required lay-verify="required" placeholder="请输入或选择分类图标" autocomplete="off">
</div>
<div class="list list-2">
<div class="li">
<span>权重:</span>
<input type="text" class="num" name="weight" min="0" max="999" value="0" required lay-verify="required|number" autocomplete="off">
</div>
<div class="li">
私有:
<input type="checkbox" lay-skin="switch" lay-text="是|否" name="property" value="1">
</div>
</div>
<div class="list">
<textarea name="description" id="description" placeholder="请输入分类描述(选填)"></textarea>
</div>
<div class="list">
<button lay-submit lay-filter="add_fid">添加</button>
</div>
</form>
</div>
<!--添加分类 E-->
<!--修改分类 S-->
<div class="addsite-main" id="editFidBox">
<div class="title">
修改分类
</div>
<form class="layui-form list-w" lay-filter="editfid">
<input type="hidden" name="id" id="id" value="" required lay-verify="required" />
<div class="list">
<span class="icon"><i class="iconfont icon-bianji"></i></span>
<input type="text" class="text" name="name" id="name" required lay-verify="required" placeholder="请输入分类名称" autocomplete="off">
</div>
<div class="list">
<span class="icon"><i class="iconfont icon-shezhi1"></i></span>
<input type="text" class="text" name="font_icon" id="font_icon" required lay-verify="required" placeholder="请输入或选择分类图标" autocomplete="off">
</div>
<div class="list list-2">
<div class="li">
<span>权重:</span>
<input type="text" class="num" name="weight" min="0" max="999" value="0" required lay-verify="required|number" autocomplete="off">
</div>
<div class="li">
私有:
<input type="checkbox" lay-skin="switch" lay-text="是|否" name="property" value="1">
</div>
</div>
<div class="list">
<textarea name="description" id="description" placeholder="请输入分类描述(选填)"></textarea>
</div>
<div class="list">
<button lay-submit lay-filter="edit_fid">修改</button>
</div>
</form>
</div>
<!--修改分类 E-->
<!--iconfont-->
<link rel="stylesheet" type="text/css" href="//at.alicdn.com/t/font_3000268_oov6h4vru0h.css" />
<script src="//at.alicdn.com/t/font_3000268_oov6h4vru0h.js" type="text/javascript" charset="utf-8"></script>
@ -299,4 +454,3 @@ @@ -299,4 +454,3 @@
</body>
</html>

233
templates/baisuTwo/js/admin.js

@ -38,8 +38,16 @@ layui.use(['dropdown', 'layer', 'form'], function() { @@ -38,8 +38,16 @@ layui.use(['dropdown', 'layer', 'form'], function() {
console.log('复制' + listId);
break;
case 3:
window.open('index.php?c=admin&page=edit_link&id=' + listId, '_blank');
layer.open({
type: 1,
title: false,
closeBtn: 0,
shadeClose: true,
skin: 'addsiteBox',
content: $('#editsiteBox')
});
console.log('编辑' + listId);
get_a_link(listId);
break;
case 4:
layer.confirm('一定要删除吗?', {
@ -57,7 +65,7 @@ layui.use(['dropdown', 'layer', 'form'], function() { @@ -57,7 +65,7 @@ layui.use(['dropdown', 'layer', 'form'], function() {
}
}
});
//添加弹窗
//添加链接弹窗
$('#addsite').click(function() {
layer.open({
type: 1,
@ -67,19 +75,38 @@ layui.use(['dropdown', 'layer', 'form'], function() { @@ -67,19 +75,38 @@ layui.use(['dropdown', 'layer', 'form'], function() {
skin: 'addsiteBox',
content: $('#addsiteBox')
});
})
});
$('.addsite-main .list.type span.fid').click(function() {
var fid = $(this).data('fid');
$('#fid').val(fid);
$('#addsiteBox input#fid').val(fid);
$('#editsiteBox input#fid').val(fid);
$(this).addClass("hover").siblings().removeClass('hover');
});
//监听提交
//监听提交-添加链接
form.on('submit(add_link)', function(data) {
// layer.msg(JSON.stringify(data.field));
var datas = JSON.stringify(data.field);
addUrl(data.field);
return false;
});
//监听提交-修改链接
form.on('submit(edit_link)', function(data) {
console.log(data.field)
editUrl(data.field)
return false;
});
//监听提交-添加分类
form.on('submit(add_fid)', function(data) {
console.log(data.field);
addFID(data.field)
return false;
});
//监听提交-修改分类
form.on('submit(edit_fid)', function(data) {
console.log(data.field);
editFID(data.field)
return false;
});
//识别链接信息
$("input#title").focus(function() {
@ -93,4 +120,200 @@ layui.use(['dropdown', 'layer', 'form'], function() { @@ -93,4 +120,200 @@ layui.use(['dropdown', 'layer', 'form'], function() {
}
});
//添加分类弹窗
$('#addCat').click(function() {
layer.open({
type: 1,
title: false,
closeBtn: 0,
shadeClose: true,
skin: 'addsiteBox',
content: $('#addFidBox')
});
});
// 修改分类弹窗
$('span.editFid').click(function() {
layer.open({
type: 1,
title: false,
closeBtn: 0,
shadeClose: true,
skin: 'addsiteBox',
content: $('#editFidBox')
});
var fid = $(this).data('fid');
get_a_category(fid)
console.log('编辑' + fid);
});
//查询单个链接信息
function get_a_link(id) {
$.get("index.php?c=api&method=get_a_link", {
id: id
}, function(data, status) {
// console.log(data);
if(data.code == 0) {
console.log(data);
if(data.data.property == 0) {
var property = false
} else {
var property = true
};
$('.addsite-main .list.type span.editfid-' + data.data.fid).addClass("hover").siblings().removeClass('hover');
form.val('editsite', {
"id": data.data.id,
"url": data.data.url,
"title": data.data.title,
"description": data.data.description,
"fid": data.data.fid,
"weight": data.data.weight,
"property": property,
});
} else {
//获取信息失败
layer.msg('获取信息失败,请重试!', {
icon: 5,
});
}
});
};
//查询单个分类信息
function get_a_category(id) {
$.post("/index.php?c=api&method=get_a_category", {
id: id
}, function(data, status) {
console.log(data);
if(data.code == 0) {
console.log(data);
if(data.data.property == 0) {
var property = false
} else {
var property = true
};
form.val('editfid', {
"id": data.data.id,
"name": data.data.name,
"font_icon": data.data.font_icon,
"description": data.data.description,
"weight": data.data.weight,
"property": property,
});
} else {
//获取信息失败
layer.msg('获取信息失败,请重试!', {
icon: 5,
});
}
});
};
});
//修改链接
function editUrl(data) {
$.post("/index.php?c=api&method=edit_link", {
fid: data.fid,
id: data.id,
url: data.url,
title: data.title,
weight: data.weight,
property: data.property,
description: data.description,
}, function(data, status) {
console.log(data)
console.log(status)
if(data.code == 0) {
layer.msg('修改成功!', {
icon: 6,
time: 600,
end: function() {
window.location.reload();
return false;
}
});
} else {
//修改失败
layer.msg('修改失败,请重试!', {
icon: 5,
});
}
});
};
//添加分类
function addFID(data) {
$.post("/index.php?c=api&method=add_category", {
name: data.name,
font_icon: data.font_icon,
weight: data.weight,
property: data.property,
description: data.description,
}, function(data, status) {
console.log(data)
console.log(status)
if(data.code == 0) {
layer.msg('添加成功!', {
icon: 6,
time: 600,
end: function() {
window.location.reload();
return false;
}
});
} else {
//修改失败
layer.msg('添加失败,请重试!', {
icon: 5,
});
}
});
}
//修改分类
function editFID(data) {
$.post("/index.php?c=api&method=edit_category", {
id: data.id,
name: data.name,
font_icon: data.font_icon,
weight: data.weight,
property: data.property,
description: data.description,
}, function(data, status) {
console.log(data)
console.log(status)
if(data.code == 0) {
layer.msg('添加成功!', {
icon: 6,
time: 600,
end: function() {
// window.location.reload();
return false;
}
});
} else {
//修改失败
layer.msg('添加失败,请重试!', {
icon: 5,
});
}
});
}
//
// fid: data.fid,
// id: data.id,
// url: data.url,
// title: data.title,
// weight: data.weight,
// property: data.property,
// description: data.description,

10
templates/baisuTwo/js/common.js

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
var bodyH = $('.index-main').height();
var winH = $(window).height();
var winH = $(window).height() - 100;
if(bodyH > winH) {
$('footer').addClass('show');
};
@ -192,7 +192,7 @@ function keyClick() { @@ -192,7 +192,7 @@ function keyClick() {
keyClick();
//锚点、返回顶部
$("a.list").click(function() {
$("a.catlist").click(function() {
$("html, body").animate({
scrollTop: $($(this).attr("href")).offset().top - 5 + "px"
}, 500);
@ -255,5 +255,9 @@ $('#nowWeek').text('星期' + nowWeek); @@ -255,5 +255,9 @@ $('#nowWeek').text('星期' + nowWeek);
//手机端
$(".navbar").click(function() {
$(".index-nav").toggleClass("show");
$(".m-navlist-w").slideToggle();
$(this).toggleClass("hover");
});
$(".m-navlist a.list").click(function() {
$(".m-navlist-w").slideUp();
});
Loading…
Cancel
Save