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. 6
      data/update.log
  3. 7
      index.php
  4. 203
      templates/baisuTwo/css/style.css
  5. 172
      templates/baisuTwo/index.php
  6. 239
      templates/baisuTwo/js/admin.js
  7. 12
      templates/baisuTwo/js/common.js

4
README.md

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

6
data/update.log

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

7
index.php

@ -43,8 +43,11 @@ if((!isset($c)) || ($c == '')){ @@ -43,8 +43,11 @@ if((!isset($c)) || ($c == '')){
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';
if( file_exists($controller_file) ) {

203
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{
.search-main .search-btnlist {
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.search-main button.search-btn {
width: 140px;
height: 50px;
@ -334,25 +394,28 @@ a { @@ -334,25 +394,28 @@ a {
cursor: pointer;
border-right: 1px solid #64a15e;
}
.search-main button.search-btn img{
.search-main button.search-btn img {
display: block;
width: 25px;
height: 25px;
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;
text-align: center;
border: none;
border-radius: 0px 10px 10px 0px;
border-radius: 0px 10px 10px 0px;
background-color: #64a15e;
color: #ffffff;
font-size: 16px;
@ -367,7 +430,8 @@ a { @@ -367,7 +430,8 @@ a {
font-size: 16px;
line-height: 50px;
}
.search-main .search-btnlist .search-lists{
.search-main .search-btnlist .search-lists {
width: 390px;
display: flex;
justify-content: space-between;
@ -382,10 +446,12 @@ a { @@ -382,10 +446,12 @@ a {
z-index: 100;
box-shadow: 0px 0px 6px #000000;
}
.search-main .search-btnlist .search-lists.hide{
.search-main .search-btnlist .search-lists.hide {
display: none;
}
.search-main .search-btnlist .search-lists .list{
.search-main .search-btnlist .search-lists .list {
width: 33%;
line-height: 40px;
padding: 0 10px;
@ -397,7 +463,8 @@ a { @@ -397,7 +463,8 @@ a {
cursor: pointer;
transition: 0.3s all;
}
.search-main .search-btnlist .search-lists .list img{
.search-main .search-btnlist .search-lists .list img {
display: block;
width: 20px;
height: 20px;
@ -405,7 +472,7 @@ a { @@ -405,7 +472,7 @@ a {
border-radius: 6px;
}
.search-main .search-btnlist .search-lists .list:hover{
.search-main .search-btnlist .search-lists .list:hover {
background-color: #64a15e;
color: #FFFFFF;
transition: 0.3s all;
@ -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,14 +711,16 @@ footer.show { @@ -636,14 +711,16 @@ footer.show {
footer a:hover {
color: #64a15e !important;
}
.tool-list{
.tool-list {
position: fixed;
bottom: 30px;
right: 15px;
z-index: 99;
width: 45px;
}
.tool-list .list{
.tool-list .list {
width: 45px;
height: 45px;
display: block;
@ -655,13 +732,16 @@ footer a:hover { @@ -655,13 +732,16 @@ footer a:hover {
cursor: pointer;
margin-top: 12px;
}
.tool-list .list i{
.tool-list .list i {
font-size: 20px;
}
.tool-list .addsite i{
.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;
}
/*
@ -848,74 +930,72 @@ footer a:hover { @@ -848,74 +930,72 @@ footer a:hover {
*/
@media only screen and (max-width: 1200px) {
.index-nav{
.index-nav {
left: -100%;
transition: 0.3s all;
}
.index-nav.show{
.index-nav.show {
left: 0;
transition: 0.3s all;
}
.index-main{
.index-main {
padding: 15px !important;
}
.search-main-w{
.search-main-w {
width: 100%;
height: 120px;
margin-top: 60px;
}
.search-main-w .date-main{
.search-main-w .date-main {
display: none;
}
#he-plugin-standard{
#he-plugin-standard {
display: none;
}
.search-main{
.search-main {
width: 100%;
padding: 25px 0;
flex-wrap: wrap;
background-position: center;
}
.search-main .search-input{
.search-main .search-input {
width: 80%;
}
.search-main .search-btnlist{
.search-main .search-btnlist {
width: 100%;
display: none;
}
.search-main .search-btnlist .search-lists{
.search-main .search-btnlist .search-lists {
width: 100%;
left: 0;
right: 0;
margin: auto;
font-size: 13px;
}
.site-main .site-name{
.site-main .site-name {
margin-bottom: 10px;
}
.site-main .site-list .list{
.site-main .site-list .list {
width: 48%;
margin-bottom: 10px;
}
.site-main .site-list{
.site-main .site-list {
margin-bottom: 25px;
}
.site-main .site-list .list span{
.site-main .site-list .list span {
position: absolute;
right: 0px;
top: 0;
bottom: 0;
margin: auto;
}
.site-main .site-list .list a{
.site-main .site-list .list a {
padding: 0 10% 0 5%;
}
footer{
footer {
padding-left: 0;
}
.m-header{
.m-header {
width: 100%;
padding: 10px 15px;
display: flex;
@ -927,14 +1007,14 @@ footer a:hover { @@ -927,14 +1007,14 @@ footer a:hover {
z-index: 9999;
box-shadow: 0px 0px 1px #C0C4CC;
}
.m-header .logo{
.m-header .logo {
height: 30px;
}
.m-header .logo img{
.m-header .logo img {
display: block;
height: 100%;
}
.m-header .navbar{
.m-header .navbar {
display: flex;
justify-content: center;
flex-direction: column;
@ -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%;
}
}

172
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']); ?>
</a>
<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">
@ -137,7 +168,7 @@ @@ -137,7 +168,7 @@
<button><i class="iconfont icon-sousuo"></i></button>
</div>
</div>
<!--搜索 E-->
<!--搜索 E-->
<div class="site-main">
<!-- 遍历分类目录 -->
<?php foreach ( $categorys as $category ) {
@ -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>
@ -298,5 +453,4 @@ @@ -298,5 +453,4 @@
</body>
</html>
</html>

239
templates/baisuTwo/js/admin.js

@ -28,7 +28,7 @@ layui.use(['dropdown', 'layer', 'form'], function() { @@ -28,7 +28,7 @@ layui.use(['dropdown', 'layer', 'form'], function() {
click: function(data, othis) {
var elem = $(this.elem),
listId = elem.data('id');
listUrl = elem.data('url');
listUrl = elem.data('url');
switch(data.id) {
case 1:
window.open('index.php?c=click&id=' + listId, '_blank');
@ -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('一定要删除吗?', {
@ -53,11 +61,11 @@ layui.use(['dropdown', 'layer', 'form'], function() { @@ -53,11 +61,11 @@ layui.use(['dropdown', 'layer', 'form'], function() {
});
console.log('删除' + listId);
break;
}
}
});
//添加弹窗
//添加链接弹窗
$('#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() {
@ -92,5 +119,201 @@ layui.use(['dropdown', 'layer', 'form'], function() { @@ -92,5 +119,201 @@ layui.use(['dropdown', 'layer', 'form'], function() {
getUrlinfo(urlval)
}
});
//添加分类弹窗
$('#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,

12
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