Browse Source

20220429

pull/71/head
xiaoz 3 years ago
parent
commit
f98865ae37
  1. 3
      templates/admin/click.php
  2. 26
      templates/admin/link_list.php
  3. 10
      templates/admin/setting/theme.php
  4. 83
      templates/admin/setting/theme_config.php
  5. 1
      templates/admin/setting/theme_detail.php
  6. 97
      templates/admin/static/embed.js
  7. 3
      templates/baisuTwo/config.json
  8. 13
      templates/baisuTwo/index.php
  9. 10
      templates/baisuTwo/info.json
  10. 2
      templates/baisuTwo/js/admin.js
  11. 5
      templates/default/config.json
  12. 19
      templates/default/index.php
  13. 14
      templates/default/info.json
  14. 2
      version.txt

3
templates/admin/click.php

@ -25,8 +25,6 @@
$admin_stay_time = $transition_page['admin_stay_time']; $admin_stay_time = $transition_page['admin_stay_time'];
if ($is_login) { if ($is_login) {
//header("Refresh:1;url=".$link['url']);
header("Refresh:$admin_stay_time;url=".$link['url']); header("Refresh:$admin_stay_time;url=".$link['url']);
} }
else{ else{
@ -103,6 +101,5 @@
</div> </div>
</div> </div>
</div> </div>
<?php g_extend_js(); ?>
</body> </body>
</html> </html>

26
templates/admin/link_list.php

@ -4,12 +4,36 @@
<div class="layui-body"> <div class="layui-body">
<!-- 内容主体区域 --> <!-- 内容主体区域 -->
<div class="layui-row content-body place-holder"> <div class="layui-row content-body place-holder">
<!-- 表单上面的按钮 -->
<div class="lay-col-lg12">
<form class="layui-form layui-form-pane" action="">
<div class="layui-form-item">
<div class="layui-inline">
<div class="layui-input-inline">
<select name="fid" lay-verify="" lay-search id = "fid">
<option value="">请选择一个分类</option>
<?php foreach( $categorys AS $category ){ ?>
<option value="<?php echo $category['id'] ?>"><?php echo $category['name']; ?></option>
<?php } ?>
</select>
</div>
<div class="layui-input-inline" style="width: 100px;">
<button class="layui-btn" lay-submit lay-filter="screen_link">查询此分类下的链接</button>
</div>
</div>
</div>
</div>
</form>
<!-- 表单上面的按钮END -->
<div class="layui-col-lg12"> <div class="layui-col-lg12">
<table id="link_list" lay-filter="mylink"></table> <table id="link_list" lay-filter="mylink" lay-data="{id: 'mylink_reload'}"></table>
<!-- 开启表格头部工具栏 --> <!-- 开启表格头部工具栏 -->
<script type="text/html" id="linktool"> <script type="text/html" id="linktool">
<div class="layui-btn-container"> <div class="layui-btn-container">
<button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="getCheckData">删除选中</button> <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="getCheckData">删除选中</button>
<button class="layui-btn layui-btn-sm" lay-event="readmoredata">批量修改分类</button>
<!-- <button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button> <!-- <button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button>
<button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button> --> <button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button> -->
</div> </div>

10
templates/admin/setting/theme.php

@ -28,6 +28,7 @@
<div class="layui-btn-group"> <div class="layui-btn-group">
<button type="button" class="layui-btn layui-btn-sm" onclick = "set_theme('<?php echo $key; ?>')">使用</button> <button type="button" class="layui-btn layui-btn-sm" onclick = "set_theme('<?php echo $key; ?>')">使用</button>
<button type="button" class="layui-btn layui-btn-sm" onclick = "theme_detail('<?php echo $key; ?>')">详情</button> <button type="button" class="layui-btn layui-btn-sm" onclick = "theme_detail('<?php echo $key; ?>')">详情</button>
<button type="button" class="layui-btn layui-btn-sm" onclick = "theme_config('<?php echo $key; ?>')">参数设置</button>
<?php if( $current_them == $key ) { ?> <?php if( $current_them == $key ) { ?>
<button type="button" class="layui-btn layui-btn-sm layui-btn-danger">当前主题</button> <button type="button" class="layui-btn layui-btn-sm layui-btn-danger">当前主题</button>
<?php } ?> <?php } ?>
@ -54,6 +55,15 @@ function theme_detail(name){
content:'/index.php?c=admin&page=setting/theme_detail&name=' + name content:'/index.php?c=admin&page=setting/theme_detail&name=' + name
}); });
} }
//主题参数设置
function theme_config(name){
layer.open({
title: "设置主题【" + name + "】参数:",
type:2,
area: ['620px', '560px'],
content:'/index.php?c=admin&page=setting/theme_config&name=' + name
});
}
function set_theme(name) { function set_theme(name) {
$.post("/index.php?c=api&method=set_theme",{key:"theme",value:name},function(data,status){ $.post("/index.php?c=api&method=set_theme",{key:"theme",value:name},function(data,status){

83
templates/admin/setting/theme_config.php

@ -0,0 +1,83 @@
<!-- 主题详情页面 -->
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>OneNav后台管理</title>
<link rel='stylesheet' href='static/layui/css/layui.css'>
<link rel='stylesheet' href='templates/admin/static/style.css?v=v0.9.17-20220314'>
</head>
<body class="layui-fluid">
<div class="layui-row" style = "margin-top:1em;">
<!-- 说明提示框 -->
<div class="layui-col-lg12">
<div class="setting-msg">
主题自定义参数设置,请参考:<a href="https://dwz.ovh/gnae4" target = "_blank" title = "主题参数设置说明">https://dwz.ovh/gnae4</a>,如果您不清楚,请勿修改。
</div>
</div>
<!-- 说明提示框END -->
<div class="layui-col-sm10 layui-col-sm-offset1">
<form class="layui-form layui-form-pane">
<div class="layui-form-item">
<label class="layui-form-label" style = "width:35%;">主题名称</label>
<div class="layui-input-inline" style = "width:63%;">
<input type="text" name="name" required lay-verify="required" value = "<?php echo $name; ?>" readonly="readonly" class="layui-input">
</div>
</div>
<!-- 遍历配置选项 -->
<?php foreach ($configs as $key => $config) {
//如果config.json获取到的数据是空的,则读取info.json
$value = empty( $current_configs->$key ) ? $config : $current_configs->$key;
?>
<div class="layui-form-item">
<label class="layui-form-label" style = "width:35%;"><?php echo $key; ?></label>
<div class="layui-input-inline" style = "width:63%;">
<input type="text" name="<?php echo $key; ?>" value = "<?php echo $value; ?>" class="layui-input">
</div>
</div>
<?php } ?>
<!-- 遍历配置选项END -->
<div class="layui-form-item">
<button class="layui-btn" lay-submit lay-filter="save_theme_config">保存</button>
</div>
</form>
</div>
</div>
<script src="static/js/jquery.min.js"></script>
<script src="static/layui/layui.js"></script>
<script>
layui.use(['layer','form'], function(){
var layer = layui.layer;
var form = layui.form;
form.on('submit(save_theme_config)', function(data){
console.log(data.field);
$.post("/index.php?c=api&method=save_theme_config",data.field,function(data,status){
if( data.data == 'success') {
layer.msg("设置已更新!",{icon:1});
}
else{
layer.msg(data.err_msg,{icon:5});
}
});
return false;
});
});
function set_theme(name) {
$.post("/index.php?c=api&method=set_theme",{key:"theme",value:name},function(data,status){
if( data.code == 0 ) {
layer.msg(data.data, {icon: 1});
setTimeout(() => {
location.reload();
}, 2000);
}
else{
layer.msg(data.err_msg, {icon: 5});
}
});
}
</script>
</body>
</html>

1
templates/admin/setting/theme_detail.php

@ -21,6 +21,7 @@
<p>版本:<?php echo $theme->version; ?></p> <p>版本:<?php echo $theme->version; ?></p>
<p>更新时间:<?php echo $theme->update; ?></p> <p>更新时间:<?php echo $theme->update; ?></p>
<p>作者:<?php echo $theme->author; ?></p> <p>作者:<?php echo $theme->author; ?></p>
<p>使用说明:<a style = "color:#01AAED;" href="<?php echo $theme->help_url; ?>" target="_blank" rel = "nofollow"><?php echo $theme->help_url; ?></a></p>
<p>主页:<a style = "color:#01AAED;" href="<?php echo $theme->homepage; ?>" target="_blank" rel = "nofollow"><?php echo $theme->homepage; ?></a></p> <p>主页:<a style = "color:#01AAED;" href="<?php echo $theme->homepage; ?>" target="_blank" rel = "nofollow"><?php echo $theme->homepage; ?></a></p>
</div> </div>
</div> </div>

97
templates/admin/static/embed.js

@ -71,6 +71,7 @@ layui.use(['element','table','layer','form','upload'], function(){
elem: '#link_list' elem: '#link_list'
,height: 520 ,height: 520
,url: 'index.php?c=api&method=link_list' //数据接口 ,url: 'index.php?c=api&method=link_list' //数据接口
,method: 'post'
,page: true //开启分页 ,page: true //开启分页
,toolbar: '#linktool' ,toolbar: '#linktool'
,cols: [[ //表头 ,cols: [[ //表头
@ -156,9 +157,41 @@ layui.use(['element','table','layer','form','upload'], function(){
//刷新当前页面 //刷新当前页面
//window.location.reload(); //window.location.reload();
break; break;
case 'getCheckLength': case 'readmoredata':
var data = checkStatus.data; var data = checkStatus.data;
layer.msg('选中了:'+ data.length + ' 个'); fidtext = $("#fid option:selected").text();
fid = $("#fid").val();
fid = parseInt(fid);
if( data.length == 0 ) {
layer.msg('未选中任何数据!');
return false;
}
if ( isNaN(fid) === true ){
layer.msg('请先选择分类!',{icon:5});
}
else{
layer.confirm('确认将选中链接的分类修改为【' + fidtext + '】?',{icon: 3, title:'温馨提示!'}, function(index){
id = [];
for(let i = 0;i < data.length;i++) {
id.push(data[i].id);
}
$.post("/index.php?c=api&method=batch_modify_category",{id:id,fid:fid},function(data,status){
if (data.msg === "success") {
layer.msg("修改成功!",{icon:1});
setTimeout(() => {
window.location.reload();
}, 2000);
}
else{
layer.msg(data.err_msg,{icon:5});
}
});
});
}
//console.log(data);
break; break;
case 'isAll': case 'isAll':
layer.msg(checkStatus.isAll ? '全选': '未全选'); layer.msg(checkStatus.isAll ? '全选': '未全选');
@ -260,6 +293,66 @@ layui.use(['element','table','layer','form','upload'], function(){
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。 return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
}); });
//筛选链接
form.on('submit(screen_link)', function(data){
fid = data.field.fid;
if( fid == "" ) {
layer.msg("请先选择分类!",{icon:5});
return false;
}
//表格重载
var tableIns = table.render({
elem: '#link_list'
,height: 520
,url: 'index.php?c=api&method=link_list' //数据接口
,method: 'post'
,page: true //开启分页
,toolbar: '#linktool'
,where:{
category_id:fid
}
,cols: [[ //表头
{type:'checkbox'} //开启复选框
,{field: 'id', title: 'ID', width:80, sort: true}
// ,{field: 'fid', title: '分类ID',sort:true, width:90}
,{field: 'category_name', title: '所属分类',sort:true,width:120}
,{field: 'url', title: 'URL',width:140,templet:function(d){
var url = '<a target = "_blank" href = "' + d.url + '" title = "' + d.url + '">' + d.url + '</a>';
return url;
}}
,{field: 'title', title: '链接标题', width:140}
,{field: 'add_time', title: '添加时间', width:148, sort: true,templet:function(d){
var add_time = timestampToTime(d.add_time);
return add_time;
}}
,{field: 'up_time', title: '修改时间', width:148,sort:true,templet:function(d){
if(d.up_time == null){
return '';
}
else{
var up_time = timestampToTime(d.up_time);
return up_time;
}
}}
,{field: 'weight', title: '权重', width: 75,sort:true}
,{field: 'property', title: '私有', width: 80, sort: true,templet: function(d){
if(d.property == 1) {
return '<button type="button" class="layui-btn layui-btn-xs">是</button>';
}
else {
return '<button type="button" class="layui-btn layui-btn-xs layui-btn-danger">否</button>';
}
}}
,{field: 'click', title: '点击数',width:90,sort:true}
,{fixed: 'right', title:'操作', toolbar: '#link_operate'}
]]
});
//console.log(data.field) //当前容器的全部表单字段,名值对形式:{name: value}
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
});
//保存站点设置 //保存站点设置
form.on('submit(set_site)', function(data){ form.on('submit(set_site)', function(data){
$.post('/index.php?c=api&method=set_site',data.field,function(data,status){ $.post('/index.php?c=api&method=set_site',data.field,function(data,status){

3
templates/baisuTwo/config.json

@ -0,0 +1,3 @@
{
"link_description": "hide"
}

13
templates/baisuTwo/index.php

@ -18,6 +18,15 @@
<link rel="stylesheet" href="static/font-awesome/4.7.0/css/font-awesome.css"> <link rel="stylesheet" href="static/font-awesome/4.7.0/css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="static/layui/css/layui.css" /> <link rel="stylesheet" type="text/css" href="static/layui/css/layui.css" />
<?php echo $site['custom_header']; ?> <?php echo $site['custom_header']; ?>
<style>
<?php if( $theme_config->link_description == "hide" ) { ?>
/*链接描述是否显示*/
.site-main .site-list .list .desc {
/*none:不显示,block:显示*/
display: none;
}
<?php } ?>
</style>
</head> </head>
<body> <body>
@ -419,6 +428,10 @@
私有: 私有:
<input type="checkbox" lay-skin="switch" lay-text="是|否" name="property" value="1"> <input type="checkbox" lay-skin="switch" lay-text="是|否" name="property" value="1">
</div> </div>
<div class="li" style = "display:none;">
<span>fid:</span>
<input type="text" class="num" name="fid" min="0" max="999" required lay-verify="required|number" autocomplete="off">
</div>
</div> </div>
<div class="list"> <div class="list">
<textarea name="description" id="description" placeholder="请输入分类描述(选填)"></textarea> <textarea name="description" id="description" placeholder="请输入分类描述(选填)"></textarea>

10
templates/baisuTwo/info.json

@ -2,8 +2,12 @@
"name":"百素主题2", "name":"百素主题2",
"description":"适用于OneNav的百素主题2", "description":"适用于OneNav的百素主题2",
"homepage":"https://gitee.com/baisucode/baisu-two", "homepage":"https://gitee.com/baisucode/baisu-two",
"version":"1.0.1", "version":"1.0.2",
"update":"2022/04/22", "update":"2022/04/29",
"author":"baisu", "author":"baisu",
"screenshot":"https://img.rss.ink/imgs/2022/03/cba9f1946776a8f0.png" "help_url":"https://dwz.ovh/gnae4",
"screenshot":"https://img.rss.ink/imgs/2022/03/cba9f1946776a8f0.png",
"config": {
"link_description":"hide"
}
} }

2
templates/baisuTwo/js/admin.js

@ -203,6 +203,7 @@ layui.use(['dropdown', 'layer', 'form'], function() {
"description": data.data.description, "description": data.data.description,
"weight": data.data.weight, "weight": data.data.weight,
"property": property, "property": property,
"fid":parseInt(data.data.fid)
}); });
} else { } else {
//获取信息失败 //获取信息失败
@ -287,6 +288,7 @@ function editFID(data) {
name: data.name, name: data.name,
font_icon: data.font_icon, font_icon: data.font_icon,
weight: data.weight, weight: data.weight,
fid:data.fid,
property: data.property, property: data.property,
description: data.description, description: data.description,
}, function(data, status) { }, function(data, status) {

5
templates/default/config.json

@ -0,0 +1,5 @@
{
"full_width_mode": "on",
"link_description": "hide",
"favicon": "online"
}

19
templates/default/index.php

@ -14,6 +14,16 @@
<link rel="stylesheet" href="templates/<?php echo $template; ?>/static/style.css?v=<?php echo $version; ?>"> <link rel="stylesheet" href="templates/<?php echo $template; ?>/static/style.css?v=<?php echo $version; ?>">
<script src = 'static/mdui/js/mdui.min.js'></script> <script src = 'static/mdui/js/mdui.min.js'></script>
<?php echo $site['custom_header']; ?> <?php echo $site['custom_header']; ?>
<style>
<?php if( $theme_config->link_description == "hide" ) { ?>
.link-content{
display:none;
}
.link-line{
height:56px;
}
<?php } ?>
</style>
</head> </head>
<?php <?php
// 根据cookie来设置mdui主题 // 根据cookie来设置mdui主题
@ -168,7 +178,7 @@
<!--左侧抽屉导航END--> <!--左侧抽屉导航END-->
<!--正文内容部分--> <!--正文内容部分-->
<div class="mdui-container"> <div class="<?php echo ( $theme_config->full_width_mode == "off") ? "mdui-container" : "mdui-container-fluid"; ?>">
<!-- 搜索框 --> <!-- 搜索框 -->
<!-- <div class="mdui-row"> <!-- <div class="mdui-row">
<div class="mdui-col-xs-12"> <div class="mdui-col-xs-12">
@ -207,7 +217,7 @@
//var_dump($link); //var_dump($link);
?> ?>
<a href="/index.php?c=click&id=<?php echo $link['id']; ?>" target="_blank" title = "<?php echo $link['description']; ?>"> <a href="/index.php?c=click&id=<?php echo $link['id']; ?>" target="_blank" title = "<?php echo $link['description']; ?>">
<div class="mdui-col-lg-3 mdui-col-md-4 mdui-col-xs-12 link-space" id = "id_<?php echo $link['id']; ?>" link-title = "<?php echo $link['title']; ?>" link-url = "<?php echo $link['url']; ?>"> <div class="mdui-col-lg-2 mdui-col-md-3 mdui-col-sm-4 mdui-col-xs-6 link-space" id = "id_<?php echo $link['id']; ?>" link-title = "<?php echo $link['title']; ?>" link-url = "<?php echo $link['url']; ?>">
<!--定义一个卡片--> <!--定义一个卡片-->
<div class="mdui-card link-line mdui-hoverable"> <div class="mdui-card link-line mdui-hoverable">
<!-- 如果是私有链接,则显示角标 --> <!-- 如果是私有链接,则显示角标 -->
@ -219,7 +229,12 @@
<!-- 角标END --> <!-- 角标END -->
<div class="mdui-card-primary" style = "padding-top:16px;"> <div class="mdui-card-primary" style = "padding-top:16px;">
<div class="mdui-card-primary-title link-title"> <div class="mdui-card-primary-title link-title">
<!-- 网站图标显示方式 -->
<?php if( $theme_config->favicon == "online") { ?>
<img src="https://favicon.rss.ink/v1/<?php echo base64($link['url']); ?>" alt="HUAN" width="16" height="16"> <img src="https://favicon.rss.ink/v1/<?php echo base64($link['url']); ?>" alt="HUAN" width="16" height="16">
<?php }else{ ?>
<img src="/index.php?c=ico&text=<?php echo $link['title']; ?>" alt="" width="16" height="16" />
<?php } ?>
<span class="link_title"><?php echo $link['title']; ?></span> <span class="link_title"><?php echo $link['title']; ?></span>
</div> </div>
</div> </div>

14
templates/default/info.json

@ -1,9 +1,15 @@
{ {
"name": "OneNav默认主题", "name": "OneNav默认主题",
"description": "OneNav默认主题", "description": "OneNav默认主题",
"homepage":"https://www.xiaoz.me", "homepage": "https:\/\/www.xiaoz.me",
"version":"0.9.19", "help_url":"https://dwz.ovh/gnae4",
"update":"2022/04/22", "version": "0.9.20",
"update": "2022\/04\/29",
"author": "xiaoz<xiaoz93@outlook.com>", "author": "xiaoz<xiaoz93@outlook.com>",
"screenshot":"https://img.rss.ink/imgs/2022/03/42ed3ef2c4a50f6d.png" "screenshot": "https:\/\/img.rss.ink\/imgs\/2022\/03\/42ed3ef2c4a50f6d.png",
"config": {
"full_width_mode":"off",
"link_description":"show",
"favicon": "offline"
}
} }

2
version.txt

@ -1 +1 @@
v0.9.19-20220424 v0.9.20-20220429
Loading…
Cancel
Save