Browse Source

Merge pull request #55 from helloxz/dev

20230315
pull/90/head 0.9.17
xiaoz 3 years ago committed by GitHub
parent
commit
dce29be103
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      README.md
  2. 4
      data/update.log
  3. 7
      index.php
  4. 139
      templates/baisuTwo/css/style.css
  5. 166
      templates/baisuTwo/index.php
  6. 233
      templates/baisuTwo/js/admin.js
  7. 10
      templates/baisuTwo/js/common.js

4
README.md

@ -29,8 +29,8 @@
1. 需安装PHP环境,并确保支持SQLite3 1. 需安装PHP环境,并确保支持SQLite3
2. 下载源码解压到站点根目录 2. 下载源码解压到站点根目录
3. 将`config.simple.php`复制为`data/config.php`并填写自己的站点信息 3. 访问首页自动完成安装
5. 访问后台:`http://IP/index.php?c=login` 4. 访问后台:`http://IP/index.php?c=login`
**Docker部署:** **Docker部署:**

4
data/update.log

@ -63,3 +63,7 @@ CREATE INDEX on_options_key_IDX ON on_options ("key");
1. 新增API:根据ID查询单个分类信息 1. 新增API:根据ID查询单个分类信息
2. 修复后台编辑链接,分类信息显示不正确 2. 修复后台编辑链接,分类信息显示不正确
3. 书签导入时文件名过滤 3. 书签导入时文件名过滤
20220315
1. 修复一个任意文件漏洞
2. baisuTwo主题更新

7
index.php

@ -43,8 +43,11 @@ if((!isset($c)) || ($c == '')){
else{ else{
//对请求参数进行过滤,同时检查文件是否存在 //对请求参数进行过滤,同时检查文件是否存在
$c = str_replace('../','',$c); $c = str_replace('\\','/',$c);
$c = str_replace('./','',$c); $pattern = "%\./%";
if ( preg_match_all($pattern,$c) ) {
exit('非法请求!');
}
//控制器文件 //控制器文件
$controller_file = "./controller/".$c.'.php'; $controller_file = "./controller/".$c.'.php';
if( file_exists($controller_file) ) { if( file_exists($controller_file) ) {

139
templates/baisuTwo/css/style.css

@ -98,56 +98,114 @@ a {
padding: 0 25px 100px; padding: 0 25px 100px;
overflow: auto; overflow: auto;
} }
/* 整个滚动条 */ /* 整个滚动条 */
.index-nav .type-list::-webkit-scrollbar { .index-nav .type-list::-webkit-scrollbar {
width: 6px; width: 6px;
background-color: transparent; background-color: transparent;
} }
/* 滚动条上的按钮 (上下箭头). */ /* 滚动条上的按钮 (上下箭头). */
.index-nav .type-list::-webkit-scrollbar-button { .index-nav .type-list::-webkit-scrollbar-button {
height: 0px; height: 0px;
width: 0px; width: 0px;
} }
/* 滚动条上的滚动滑块. */ /* 滚动条上的滚动滑块. */
.index-nav .type-list::-webkit-scrollbar-thumb { .index-nav .type-list::-webkit-scrollbar-thumb {
background-color: #64a15e; background-color: #64a15e;
border-radius: 50px; border-radius: 50px;
} }
/* 滚动条轨道. */ /* 滚动条轨道. */
.index-nav .type-list::-webkit-scrollbar-track { .index-nav .type-list::-webkit-scrollbar-track {
background-color: transparent; background-color: transparent;
} }
/* 滚动条没有滑块的轨道部分 */ /* 滚动条没有滑块的轨道部分 */
.index-nav .type-list::-webkit-scrollbar-track-piece { .index-nav .type-list::-webkit-scrollbar-track-piece {
background-color: transparent; background-color: transparent;
} }
.index-nav .type-list .list { .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; display: flex;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
font-size: 16px; font-size: 16px;
font-weight: bold; font-weight: bold;
padding: 10px; padding: 0 10px;
border-radius: 5px; border-radius: 5px 0px 0px 5px;
margin-bottom: 10px;
color: #555555; color: #555555;
transition: 0.3s all; transition: 0.3s all;
} }
.index-nav .type-list .list i { .index-nav .type-list .list a i {
display: block; display: block;
margin-right: 6px; margin-right: 6px;
font-size: 22px; 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; background-color: #64a15e;
color: #FFFFFF; color: #FFFFFF;
transition: 0.3s all; transition: 0.3s all;
} }
.index-nav .type-list .list:hover span {
width: 20%;
transition: 0.3s all;
}
.index-nav .user-info { .index-nav .user-info {
width: 100%; width: 100%;
background-color: #ffffff; background-color: #ffffff;
@ -313,12 +371,14 @@ a {
font-size: 20px; font-size: 20px;
color: #64a15e; color: #64a15e;
} }
.search-main .search-btnlist { .search-main .search-btnlist {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
position: relative; position: relative;
} }
.search-main button.search-btn { .search-main button.search-btn {
width: 140px; width: 140px;
height: 50px; height: 50px;
@ -334,6 +394,7 @@ a {
cursor: pointer; cursor: pointer;
border-right: 1px solid #64a15e; border-right: 1px solid #64a15e;
} }
.search-main button.search-btn img { .search-main button.search-btn img {
display: block; display: block;
width: 25px; width: 25px;
@ -341,12 +402,14 @@ a {
border-radius: 6px; border-radius: 6px;
margin-right: 6px; margin-right: 6px;
} }
.search-main button.search-btn i { .search-main button.search-btn i {
display: block; display: block;
margin-right: 4px; margin-right: 4px;
font-size: 20px; font-size: 20px;
line-height: 50px; line-height: 50px;
} }
.search-main button.search-change { .search-main button.search-change {
width: 30px; width: 30px;
height: 50px; height: 50px;
@ -367,6 +430,7 @@ a {
font-size: 16px; font-size: 16px;
line-height: 50px; line-height: 50px;
} }
.search-main .search-btnlist .search-lists { .search-main .search-btnlist .search-lists {
width: 390px; width: 390px;
display: flex; display: flex;
@ -382,9 +446,11 @@ a {
z-index: 100; z-index: 100;
box-shadow: 0px 0px 6px #000000; box-shadow: 0px 0px 6px #000000;
} }
.search-main .search-btnlist .search-lists.hide { .search-main .search-btnlist .search-lists.hide {
display: none; display: none;
} }
.search-main .search-btnlist .search-lists .list { .search-main .search-btnlist .search-lists .list {
width: 33%; width: 33%;
line-height: 40px; line-height: 40px;
@ -397,6 +463,7 @@ a {
cursor: pointer; cursor: pointer;
transition: 0.3s all; transition: 0.3s all;
} }
.search-main .search-btnlist .search-lists .list img { .search-main .search-btnlist .search-lists .list img {
display: block; display: block;
width: 20px; width: 20px;
@ -459,8 +526,6 @@ a {
margin-left: 15px; margin-left: 15px;
} }
.search-main-w .weather-main { .search-main-w .weather-main {
width: 240px; width: 240px;
height: 100%; height: 100%;
@ -528,7 +593,7 @@ a {
position: relative; position: relative;
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: flex-start;
} }
.site-main .site-list .list span { .site-main .site-list .list span {
@ -589,13 +654,23 @@ a {
bottom: 0; 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 { .site-main .site-list .list:hover {
box-shadow: 0px 0px 6px #333; box-shadow: 0px 0px 6px #333;
background-color: #64a15e; background-color: #64a15e;
transition: 0.3s all; 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; color: #ffffff;
} }
@ -636,6 +711,7 @@ footer.show {
footer a:hover { footer a:hover {
color: #64a15e !important; color: #64a15e !important;
} }
.tool-list { .tool-list {
position: fixed; position: fixed;
bottom: 30px; bottom: 30px;
@ -643,6 +719,7 @@ footer a:hover {
z-index: 99; z-index: 99;
width: 45px; width: 45px;
} }
.tool-list .list { .tool-list .list {
width: 45px; width: 45px;
height: 45px; height: 45px;
@ -655,13 +732,16 @@ footer a:hover {
cursor: pointer; cursor: pointer;
margin-top: 12px; margin-top: 12px;
} }
.tool-list .list i { .tool-list .list i {
font-size: 20px; font-size: 20px;
} }
.tool-list .addsite i { .tool-list .addsite i {
font-size: 24px; font-size: 24px;
} }
/**/ /**/
.addsiteBox { .addsiteBox {
@ -840,7 +920,9 @@ footer a:hover {
margin-top: 0; margin-top: 0;
} }
.m-header{display: none;} .m-header {
display: none;
}
/* /*
@ -890,8 +972,6 @@ footer a:hover {
margin: auto; margin: auto;
font-size: 13px; font-size: 13px;
} }
.site-main .site-name { .site-main .site-name {
margin-bottom: 10px; margin-bottom: 10px;
} }
@ -946,4 +1026,39 @@ footer a:hover {
color: #64a15e; color: #64a15e;
border-radius: 6px; 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 @@
<link rel="stylesheet" type="text/css" href="templates/<?php echo TEMPLATE; ?>/css/style.css" /> <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" 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" /> <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> </head>
<body> <body>
<!--手机顶部 S-->
<!--手机顶部 S--> <!--手机顶部 S-->
<div class="m-header"> <div class="m-header">
<div class="logo"> <div class="logo">
@ -30,8 +39,22 @@
<div class="navbar"> <div class="navbar">
<i class="iconfont icon-caidan"></i> <i class="iconfont icon-caidan"></i>
</div> </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> </div>
<!--手机顶部 E--> <!--手机顶部 E-->
<!--手机顶部 E-->
<!--左侧分类栏 S--> <!--左侧分类栏 S-->
<div class="index-nav"> <div class="index-nav">
<div class="logo"> <div class="logo">
@ -43,11 +66,19 @@
foreach ($categorys as $category) { foreach ($categorys as $category) {
$font_icon = empty($category['font_icon']) ? '' : "<i class='{$category['font_icon']}'></i> "; $font_icon = empty($category['font_icon']) ? '' : "<i class='{$category['font_icon']}'></i> ";
?> ?>
<a href="#category-<?php echo $category['id']; ?>" class="list"> <div class="list">
<?php echo $font_icon; ?><?php echo htmlspecialchars_decode($category['name']); ?> <a class="catlist" href="#category-<?php echo $category['id']; ?>">
<?php echo $font_icon; ?>
<?php echo htmlspecialchars_decode($category['name']); ?>
</a> </a>
<span class="editFid" data-fid = "<?php echo $category['id']; ?>"><i class="iconfont icon-bianji"></i></span>
</div>
<?php } ?> <?php } ?>
<div class="list add" id="addCat">
<a>
<i class="iconfont icon-tianjia"></i>添加分类</a>
</div>
</div> </div>
<div class="user-info"> <div class="user-info">
<div class="pic"> <div class="pic">
@ -154,7 +185,8 @@
?> ?>
<div class="site-name" id="category-<?php echo $category['id']; ?>"> <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; ?> <?php echo $property; ?>
</div> </div>
<div class="site-list"> <div class="site-list">
@ -170,6 +202,9 @@
<img src="https://favicon.rss.ink/v1/<?php echo base64($link['url']); ?>"> <img src="https://favicon.rss.ink/v1/<?php echo base64($link['url']); ?>">
<?php echo $link['title']; ?> <?php echo $link['title']; ?>
</p> </p>
<p class="desc">
<?php echo $link['description']; ?>
</p>
</a> </a>
<?php if($link['property'] == 1 ) { ?> <?php if($link['property'] == 1 ) { ?>
<span><i class="one iconfont icon-suo"></i></span> <span><i class="one iconfont icon-suo"></i></span>
@ -190,7 +225,7 @@
<!--底部版权 S--> <!--底部版权 S-->
<footer> <footer>
© 2022 BaiSu,Powered by © 2022 BaiSuPowered by
<a target="_blank" href="https://github.com/helloxz/onenav" title="简约导航/书签管理器" rel="nofollow">OneNav</a> <a target="_blank" href="https://github.com/helloxz/onenav" title="简约导航/书签管理器" rel="nofollow">OneNav</a>
<br> The theme author is <br> The theme author is
<a href="https://gitee.com/baisucode/onenav" target="_blank">BaiSu</a> <a href="https://gitee.com/baisucode/onenav" target="_blank">BaiSu</a>
@ -218,7 +253,7 @@
<!--添加链接 S--> <!--添加链接 S-->
<div class="addsite-main" id="addsiteBox"> <div class="addsite-main" id="addsiteBox">
<div class="title"> <div class="title">
添加 添加
</div> </div>
<form class="layui-form list-w"> <form class="layui-form list-w">
<div class="list"> <div class="list">
@ -261,6 +296,126 @@
</div> </div>
<!--添加链接 E--> <!--添加链接 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--> <!--iconfont-->
<link rel="stylesheet" type="text/css" href="//at.alicdn.com/t/font_3000268_oov6h4vru0h.css" /> <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> <script src="//at.alicdn.com/t/font_3000268_oov6h4vru0h.js" type="text/javascript" charset="utf-8"></script>
@ -299,4 +454,3 @@
</body> </body>
</html> </html>

233
templates/baisuTwo/js/admin.js

@ -38,8 +38,16 @@ layui.use(['dropdown', 'layer', 'form'], function() {
console.log('复制' + listId); console.log('复制' + listId);
break; break;
case 3: 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); console.log('编辑' + listId);
get_a_link(listId);
break; break;
case 4: case 4:
layer.confirm('一定要删除吗?', { layer.confirm('一定要删除吗?', {
@ -57,7 +65,7 @@ layui.use(['dropdown', 'layer', 'form'], function() {
} }
} }
}); });
//添加弹窗 //添加链接弹窗
$('#addsite').click(function() { $('#addsite').click(function() {
layer.open({ layer.open({
type: 1, type: 1,
@ -67,19 +75,38 @@ layui.use(['dropdown', 'layer', 'form'], function() {
skin: 'addsiteBox', skin: 'addsiteBox',
content: $('#addsiteBox') content: $('#addsiteBox')
}); });
}) });
$('.addsite-main .list.type span.fid').click(function() { $('.addsite-main .list.type span.fid').click(function() {
var fid = $(this).data('fid'); var fid = $(this).data('fid');
$('#fid').val(fid); $('#addsiteBox input#fid').val(fid);
$('#editsiteBox input#fid').val(fid);
$(this).addClass("hover").siblings().removeClass('hover'); $(this).addClass("hover").siblings().removeClass('hover');
}); });
//监听提交 //监听提交-添加链接
form.on('submit(add_link)', function(data) { form.on('submit(add_link)', function(data) {
// layer.msg(JSON.stringify(data.field)); // layer.msg(JSON.stringify(data.field));
var datas = JSON.stringify(data.field); var datas = JSON.stringify(data.field);
addUrl(data.field); addUrl(data.field);
return false; 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() { $("input#title").focus(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 @@
var bodyH = $('.index-main').height(); var bodyH = $('.index-main').height();
var winH = $(window).height(); var winH = $(window).height() - 100;
if(bodyH > winH) { if(bodyH > winH) {
$('footer').addClass('show'); $('footer').addClass('show');
}; };
@ -192,7 +192,7 @@ function keyClick() {
keyClick(); keyClick();
//锚点、返回顶部 //锚点、返回顶部
$("a.list").click(function() { $("a.catlist").click(function() {
$("html, body").animate({ $("html, body").animate({
scrollTop: $($(this).attr("href")).offset().top - 5 + "px" scrollTop: $($(this).attr("href")).offset().top - 5 + "px"
}, 500); }, 500);
@ -255,5 +255,9 @@ $('#nowWeek').text('星期' + nowWeek);
//手机端 //手机端
$(".navbar").click(function() { $(".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