Browse Source

20220601

pull/81/head
xiaoz 3 years ago
parent
commit
43a2991d1f
  1. 33
      templates/admin/add_category.php
  2. 56
      templates/admin/click.php
  3. 38
      templates/admin/edit_category.php
  4. 3
      templates/admin/header.php
  5. 2
      templates/admin/setting/site.php
  6. 11
      templates/admin/setting/subscribe.php
  7. 2
      templates/admin/setting/theme.php
  8. 30
      templates/admin/setting/transition_page.php
  9. 48
      templates/admin/static/embed.js

33
templates/admin/add_category.php

@ -21,9 +21,9 @@
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">字体图标</label> <label for="" class="layui-form-label">字体图标</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="font_icon" placeholder="请输入字体图标,如:fa fa-bookmark-o" autocomplete="off" class="layui-input"> <input name="font_icon" type="text" id="iconHhys2" value="" lay-filter="iconHhys2" class="layui-input">
</div> </div>
</div> </div>
@ -74,3 +74,32 @@
</div> </div>
<?php include_once('footer.php'); ?> <?php include_once('footer.php'); ?>
<script>
//参考:https://gitee.com/luckygyl/iconFonts
layui.use(['iconHhysFa'], function(){
var iconHhysFa = layui.iconHhysFa;
iconHhysFa.render({
// 选择器,推荐使用input
elem: '#iconHhys2',
// 数据类型:fontClass/awesome,推荐使用fontClass
type: 'awesome',
// 是否开启搜索:true/false
search: true,
// fa 图标接口
url: './static/font-awesome/4.7.0/less/variables.less',
// 是否开启分页
page: true,
// 每页显示数量,默认12
limit: 30,
// 点击回调
value:'fa-bookmark-o', //自定义默认图标
click: function(data) {
console.log(data);
},
// 渲染成功后的回调
success: function(d) {
console.log(d);
}
});
})
</script>

56
templates/admin/click.php

@ -2,11 +2,13 @@
<html lang="zh-cn" xmlns="http://www.w3.org/1999/xhtml"> <html lang="zh-cn" xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title><?php echo $link['title']; ?> - OneNav</title> <title><?php echo $link['title']; ?> - <?php echo $site['title']; ?></title>
<meta name="keywords" content="<?php echo $link['title']; ?>" /> <meta name="keywords" content="<?php echo $link['title']; ?>" />
<meta name="description" content="<?php echo $link['description']; ?>" /> <meta name="description" content="<?php echo $link['description']; ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://lib.sinaapp.com/js/bootstrap/4.3.1/css/bootstrap.min.css" type="" media=""/> <link rel="stylesheet" href="static/bootstrap4/css/bootstrap.min.css" type="" media=""/>
<script src = "static/js/jquery.min.js"></script>
<script src="static/bootstrap4/js/bootstrap.min.js"></script>
<style> <style>
.prevent-overflow{ .prevent-overflow{
width:260px; width:260px;
@ -14,6 +16,11 @@
white-space: nowrap;/*不换行*/ white-space: nowrap;/*不换行*/
text-overflow:ellipsis;/*超出部分文字以...显示dsds*/ text-overflow:ellipsis;/*超出部分文字以...显示dsds*/
} }
.a_d img{
max-width:100%;
padding-top:1em;
padding-bottom:1em;
}
</style> </style>
<?php echo $site['custom_header']; ?> <?php echo $site['custom_header']; ?>
<?php <?php
@ -35,7 +42,29 @@
?> ?>
</head> </head>
<body> <body>
<!-- 顶部导航菜单 -->
<nav class="navbar navbar-expand-md bg-dark navbar-dark">
<a class="navbar-brand" href="/"><?php echo $site['title']; ?></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<ul class="navbar-nav">
<!-- 输出自定义菜单 -->
<?php echo $transition_page['menu']; ?>
<!-- 输出自定义菜单END -->
</ul>
</div>
</nav>
<!-- 顶部导航菜单END -->
<div class="container" style = "margin-top:2em;"> <div class="container" style = "margin-top:2em;">
<!-- 广告1 -->
<div class= "row">
<div class="col-sm-8 offset-sm-2 a_d">
<?php echo $transition_page['a_d_1']; ?>
</div>
</div>
<!-- 广告1 END -->
<div class="row"> <div class="row">
<div class="col-sm-8 offset-sm-2"> <div class="col-sm-8 offset-sm-2">
<!-- 新建一个表格 --> <!-- 新建一个表格 -->
@ -44,7 +73,7 @@
<tbody> <tbody>
<tr class="table-info"> <tr class="table-info">
<td>标题</td> <td width="170">标题</td>
<td><?php echo $link['title']; ?></td> <td><?php echo $link['title']; ?></td>
</tr> </tr>
@ -96,10 +125,29 @@
<div class="xcdn-content"> <div class="xcdn-content">
<?php echo $msg; ?> <?php echo $msg; ?>
</div> </div>
</div>
</div>
<!-- 广告2 -->
<div class= "row">
<div class="col-sm-8 offset-sm-2 a_d">
<?php echo $transition_page['a_d_2']; ?>
</div>
</div>
<!-- 广告2 END -->
<!-- 底部footer -->
<div class = "row">
<div class="col-sm-8 offset-sm-2">
<hr> <hr>
<div class="xcdn-footer">&copy;2022 Powered by <a href="https://www.xiaoz.me/" title = "小z博客" rel = "nofollow" target = "_blank">xiaoz</a></div> <div class="xcdn-footer">
<?php if( empty($transition_page['footer']) ){ ?>
&copy;2022 Powered by <a href="https://www.xiaoz.me/" title = "小z博客" rel = "nofollow" target = "_blank">xiaoz</a>
<?php }else{
echo $transition_page['footer'];
} ?>
</div>
</div> </div>
</div> </div>
<!-- 底部footer end -->
</div> </div>
</body> </body>
</html> </html>

38
templates/admin/edit_category.php

@ -59,11 +59,18 @@
</div> </div>
</div> </div>
<div class="layui-form-item"> <!-- <div class="layui-form-item">
<label class="layui-form-label">字体图标</label> <label class="layui-form-label">字体图标</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="font_icon" value = '<?php echo $category_one['font_icon']; ?>' placeholder="请输入字体图标,如:fa fa-bookmark-o" autocomplete="off" class="layui-input"> <input type="text" name="font_icon" value = '<?php echo $category_one['font_icon']; ?>' placeholder="请输入字体图标,如:fa fa-bookmark-o" autocomplete="off" class="layui-input">
</div> </div>
</div> -->
<div class="layui-form-item">
<label for="" class="layui-form-label">字体图标:</label>
<div class="layui-input-block">
<input name="font_icon" type="text" id="iconHhys2" value="<?php echo $category_one['font_icon']; ?>" lay-filter="iconHhys2" class="layui-input">
</div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
@ -100,3 +107,32 @@
</div> </div>
<?php include_once('footer.php'); ?> <?php include_once('footer.php'); ?>
<script>
//参考:https://gitee.com/luckygyl/iconFonts
layui.use(['iconHhysFa'], function(){
var iconHhysFa = layui.iconHhysFa;
iconHhysFa.render({
// 选择器,推荐使用input
elem: '#iconHhys2',
// 数据类型:fontClass/awesome,推荐使用fontClass
type: 'awesome',
// 是否开启搜索:true/false
search: true,
// fa 图标接口
url: './static/font-awesome/4.7.0/less/variables.less',
// 是否开启分页
page: true,
// 每页显示数量,默认12
limit: 30,
// 点击回调
value:'<?php echo str_replace("fa ","",$category_one["font_icon"]); ?>', //自定义默认图标
click: function(data) {
console.log(data);
},
// 渲染成功后的回调
success: function(d) {
console.log(d);
}
});
})
</script>

3
templates/admin/header.php

@ -3,9 +3,12 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="renderer" content="webkit"/>
<meta name="force-rendering" content="webkit"/>
<title>OneNav后台管理</title> <title>OneNav后台管理</title>
<link rel='stylesheet' href='static/layui/css/layui.css'> <link rel='stylesheet' href='static/layui/css/layui.css'>
<link rel='stylesheet' href='templates/admin/static/style.css?v=<?php echo $version; ?>'> <link rel='stylesheet' href='templates/admin/static/style.css?v=<?php echo $version; ?>'>
<link rel="stylesheet" href="static/font-awesome/4.7.0/css/font-awesome.css">
</head> </head>
<body class="layui-layout-body"> <body class="layui-layout-body">
<div class="layui-layout layui-layout-admin"> <div class="layui-layout layui-layout-admin">

2
templates/admin/setting/site.php

@ -59,7 +59,7 @@
</div> </div>
<div class="layui-form-item layui-form-text"> <div class="layui-form-item layui-form-text">
<label class="layui-form-label">自定义footer</label> <label class="layui-form-label">自定义footer(支持HTML代码,订阅可用)</label>
<div class="layui-input-block"> <div class="layui-input-block">
<textarea name = "custom_footer" placeholder="自定义站点底部信息,请填写HTML代码" class="layui-textarea"><?php echo $site['custom_footer']; ?></textarea> <textarea name = "custom_footer" placeholder="自定义站点底部信息,请填写HTML代码" class="layui-textarea"><?php echo $site['custom_footer']; ?></textarea>
</div> </div>

11
templates/admin/setting/subscribe.php

@ -12,7 +12,7 @@
<li>您可以前往:<a href="https://dwz.ovh/69h9q" rel = "nofollow" target = "_blank" title = "购买订阅服务">https://dwz.ovh/69h9q</a> 购买订阅服务,订阅后可以:</li> <li>您可以前往:<a href="https://dwz.ovh/69h9q" rel = "nofollow" target = "_blank" title = "购买订阅服务">https://dwz.ovh/69h9q</a> 购买订阅服务,订阅后可以:</li>
<li>1. 享受一键更新OneNav</li> <li>1. 享受一键更新OneNav</li>
<li>2. 可在线更新和下载主题(实现中...)</li> <li>2. 可在线更新和下载主题(实现中...)</li>
<li>3. 可享受一对一售后服务</li> <li>3. 可享受一对一售后服务(仅限高级版和商业版)</li>
<li>4. 可帮助OneNav持续发展,让OneNav变得更加美好</li> <li>4. 可帮助OneNav持续发展,让OneNav变得更加美好</li>
<li>5. 更多高级功能(实现中...)</li> <li>5. 更多高级功能(实现中...)</li>
</ol> </ol>
@ -27,33 +27,34 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">订单号</label> <label class="layui-form-label">订单号</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="order_id" value = "<?php echo $subscribe['order_id']; ?>" required lay-verify="required" autocomplete="off" placeholder="请输入订单号" class="layui-input"> <input type="text" id = "order_id" name="order_id" value = "<?php echo $subscribe['order_id']; ?>" required lay-verify="required" autocomplete="off" placeholder="请输入订单号" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">订阅邮箱</label> <label class="layui-form-label">订阅邮箱</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="email" name="email" value = "<?php echo $subscribe['email']; ?>" required lay-verify="required|email" autocomplete="off" placeholder="订阅邮箱" class="layui-input"> <input type="email" name="email" id = "email" value = "<?php echo $subscribe['email']; ?>" required lay-verify="required|email" autocomplete="off" placeholder="订阅邮箱" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item" style = "display:none;"> <div class="layui-form-item" style = "display:none;">
<label class="layui-form-label">域名</label> <label class="layui-form-label">域名</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="domain" value = "<?php echo $_SERVER['HTTP_HOST']; ?>" autocomplete="off" placeholder="网站域名" class="layui-input"> <input type="text" name="domain" id = "domain" value = "<?php echo $_SERVER['HTTP_HOST']; ?>" autocomplete="off" placeholder="网站域名" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">到期时间</label> <label class="layui-form-label">到期时间</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="end_time" readonly="readonly" value = "<?php echo date("Y-m-d",$subscribe['end_time']); ?>" autocomplete="off" placeholder="订阅到期时间" class="layui-input"> <input type="text" name="end_time" id = "end_time" readonly="readonly" value = "<?php echo date("Y-m-d",$subscribe['end_time']); ?>" autocomplete="off" placeholder="订阅到期时间" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<button class="layui-btn" lay-submit="" lay-filter="set_subscribe">保存设置</button> <button class="layui-btn" lay-submit="" lay-filter="set_subscribe">保存设置</button>
<button class="layui-btn" lay-submit="" lay-filter="reset_subscribe">删除订阅</button>
</div> </div>
</form> </form>

2
templates/admin/setting/theme.php

@ -17,7 +17,7 @@
//var_dump($theme['info']->name); //var_dump($theme['info']->name);
?> ?>
<!-- 主题列表 --> <!-- 主题列表 -->
<div class="layui-col-lg3"> <div class="layui-col-lg3 layui-col-md6 layui-col-sm12">
<fieldset style = "padding:1em;border:0px;height:280px;border:1px dashed #1E9FFF;box-shadow: 2px 2px 3px #888888;color:#666666"> <fieldset style = "padding:1em;border:0px;height:280px;border:1px dashed #1E9FFF;box-shadow: 2px 2px 3px #888888;color:#666666">
<legend style = "font-size:24px;"><?php echo $key; ?> - <?php echo $theme['info']->version ?></legend> <legend style = "font-size:24px;"><?php echo $key; ?> - <?php echo $theme['info']->version ?></legend>

30
templates/admin/setting/transition_page.php

@ -8,7 +8,7 @@
<!-- 说明提示框 --> <!-- 说明提示框 -->
<div class="layui-col-lg12"> <div class="layui-col-lg12">
<div class="setting-msg"> <div class="setting-msg">
过渡页使用说明,请参考:<a href="https://dwz.ovh/yoyaf" target = "_blank" title = "过渡页使用说明">https://dwz.ovh/c7goi</a> 过渡页使用说明,请参考:<a href="https://dwz.ovh/mrkx1" target = "_blank" title = "过渡页使用说明">https://dwz.ovh/mrkx1</a>
</div> </div>
</div> </div>
<!-- 说明提示框END --> <!-- 说明提示框END -->
@ -39,6 +39,34 @@
<div class="layui-form-mid layui-word-aux">管理员停留时间,单位秒</div> <div class="layui-form-mid layui-word-aux">管理员停留时间,单位秒</div>
</div> </div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">过渡页菜单(订阅可用)</label>
<div class="layui-input-block">
<textarea name = "menu" placeholder="请参考帮助文档进行设置!" rows = "4" class="layui-textarea"><?php echo $transition_page['menu']; ?></textarea>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">自定义footer,支持HTML(订阅可用)</label>
<div class="layui-input-block">
<textarea name = "footer" placeholder="请参考帮助文档进行设置!" rows = "4" class="layui-textarea"><?php echo $transition_page['footer']; ?></textarea>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">广告1(订阅可用)</label>
<div class="layui-input-block">
<textarea name = "a_d_1" placeholder="请参考帮助文档进行设置!" rows = "2" class="layui-textarea"><?php echo $transition_page['a_d_1']; ?></textarea>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">广告2(订阅可用)</label>
<div class="layui-input-block">
<textarea name = "a_d_2" placeholder="请参考帮助文档进行设置!" rows = "2" class="layui-textarea"><?php echo $transition_page['a_d_2']; ?></textarea>
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<button class="layui-btn" lay-submit="" lay-filter="set_transition_page">保存设置</button> <button class="layui-btn" lay-submit="" lay-filter="set_transition_page">保存设置</button>
</div> </div>

48
templates/admin/static/embed.js

@ -1,5 +1,12 @@
layui.config({
base: './static/module/'
}).extend({
iconHhysFa: 'iconHhys/iconHhysFa'
});
// 2022014 // 2022014
layui.use(['element','table','layer','form','upload'], function(){ layui.use(['element','table','layer','form','upload','iconHhysFa'], function(){
var element = layui.element; var element = layui.element;
var table = layui.table; var table = layui.table;
var form = layui.form; var form = layui.form;
@ -377,15 +384,18 @@ layui.use(['element','table','layer','form','upload'], function(){
//保存站点设置 //保存站点设置
form.on('submit(set_site)', function(data){ form.on('submit(set_site)', function(data){
var index = layer.load(1);
$.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){
if(data.code == 0) { if(data.code == 0) {
layer.closeAll('loading');
layer.msg(data.data, {icon: 1}); layer.msg(data.data, {icon: 1});
} }
else{ else{
layer.closeAll('loading');
layer.msg(data.err_msg, {icon: 5}); layer.msg(data.err_msg, {icon: 5});
} }
}); });
console.log(data.field) //当前容器的全部表单字段,名值对形式:{name: value} //console.log(data.field) //当前容器的全部表单字段,名值对形式:{name: value}
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。 return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
}); });
@ -393,7 +403,7 @@ layui.use(['element','table','layer','form','upload'], function(){
form.on('submit(set_subscribe)', function(data){ form.on('submit(set_subscribe)', function(data){
var order_id = data.field.order_id; var order_id = data.field.order_id;
var index = layer.load(1); var index = layer.load(1);
$.get('http://down.onenav.top/v1/check_subscribe.php',data.field,function(data,status){ $.get('https://onenav.xiaoz.top/v1/check_subscribe.php',data.field,function(data,status){
if(data.code == 200) { if(data.code == 200) {
//order_id = data.data.order_id; //order_id = data.data.order_id;
@ -420,6 +430,25 @@ layui.use(['element','table','layer','form','upload'], function(){
console.log(data.field) //当前容器的全部表单字段,名值对形式:{name: value} console.log(data.field) //当前容器的全部表单字段,名值对形式:{name: value}
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。 return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
}); });
//清空订阅信息
form.on('submit(reset_subscribe)', function(data){
//存储到数据库中
$.post("index.php?c=api&method=set_subscribe",{order_id:'',email:'',end_time:null},function(data,status){
if(data.code == 0) {
//清空表单
$("#order_id").val('');
$("#email").val('');
//$("#domain").val('');
$("#end_time").val('');
layer.msg(data.data, {icon: 1});
}
else{
layer.closeAll('loading');
layer.msg(data.err_msg, {icon: 5});
}
});
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
});
//保存站点设置 //保存站点设置
form.on('submit(set_transition_page)', function(data){ form.on('submit(set_transition_page)', function(data){
@ -858,3 +887,16 @@ function delete_theme(name) {
}); });
}); });
} }
//验证是否订阅
function check_subscribe(msg) {
$.get("/index.php?c=api&method=check_subscribe",function(data,status){
if( data.code == 200 ) {
return true;
}
else{
layer.msg(msg, {icon: 5});
return false;
}
});
}
Loading…
Cancel
Save