Compare commits

..

2 Commits

Author SHA1 Message Date
xiaoz 6c997be524
Merge pull request #185 from helloxz/dev 8 months ago
xiaoz 3f3890274b 20240318 8 months ago
  1. 5
      class/Api.php
  2. 5
      data/update.log
  3. 2
      templates/admin/footer.php
  4. 3
      templates/admin/setting/api.php
  5. 10
      templates/admin/setting/theme.php
  6. 26
      templates/admin/static/embed.js
  7. 18
      templates/admin/static/style.css
  8. 2
      version.txt

5
class/Api.php

@ -1690,6 +1690,11 @@ class Api { @@ -1690,6 +1690,11 @@ class Api {
//api请求地址
$api_url = API_URL."/v1/check_subscribe.php?order_id=".$subscribe['order_id']."&email=".$subscribe['email']."&domain=".$domain;
// 如果邮箱或者订单号为空,则返回提示
if( empty($subscribe['order_id']) || empty($subscribe['email']) ) {
$this->return_json(-2000,'','此功能需要订阅!');
}
try {
#GET HTTPS
$curl = curl_init($api_url);

5
data/update.log

@ -273,3 +273,8 @@ CREATE INDEX on_options_key_IDX ON on_options ("key"); @@ -273,3 +273,8 @@ CREATE INDEX on_options_key_IDX ON on_options ("key");
20240115
1. PC后台新增:分类数量/链接数量/PHP版本显示
20240318
1. 获取API页面新增一键复制按钮
2. 优化主题“使用中”的显示状态
3. 修改后台底部年份展示

2
templates/admin/footer.php

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
<div class="layui-footer">
<!-- 底部固定区域 -->
© Copyright 2023.Powered by <a href="https://www.onenav.top/" rel = "nofollow" target="_blank">OneNav</a>.
© Copyright 2024.Powered by <a href="https://www.onenav.top/" rel = "nofollow" target="_blank">OneNav</a>.
</div>
</div>
</body>

3
templates/admin/setting/api.php

@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
<div class="layui-form-item">
<label class="layui-form-label" style = "width:130px;">API域名</label>
<div class="layui-input-inline">
<input style = "width:400px;" type="text" readonly="readonly" name="api_domain" value = "<?php echo getCurrentUrlDomain(); ?>" autocomplete="off" placeholder="OneNav API域名" class="layui-input">
<input style = "width:400px;" type="text" readonly="readonly" id="api_domain" name="api_domain" value = "<?php echo getCurrentUrlDomain(); ?>" autocomplete="off" placeholder="OneNav API域名" class="layui-input">
</div>
</div>
@ -49,6 +49,7 @@ @@ -49,6 +49,7 @@
<button class="layui-btn" lay-submit="" lay-filter="create_sk">生成SecretKey</button>
<button class="layui-btn" lay-submit="" lay-filter="change_sk">更换SecretKey</button>
<button class="layui-btn" lay-submit="" lay-filter="cal_token">计算Token</button>
<button class="layui-btn" lay-submit="" lay-filter="one_copy" title="一键复制API域名和Token">一键复制</button>
</div>
</form>

10
templates/admin/setting/theme.php

@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
<div class="left">
<span class = "name"><?php echo $key; ?> - <?php echo $theme['info']->version ?></span>
<?php if( $current_them == $key ) { ?>
<span style = "color:#ff5722;">(使用中)</span>
<!-- <span style = "color:#ff5722;">(使用中)</span> -->
<?php } ?>
</div>
<div class="right">
@ -41,7 +41,13 @@ @@ -41,7 +41,13 @@
</div>
<div class="layui-card-body">
<!-- 主题图片 -->
<div class = "screenshot"><p><img layer-src="<?php echo $theme['info']->screenshot; ?>" src="<?php echo $theme['info']->screenshot; ?>" alt=""></p></div>
<div class = "screenshot">
<p><img layer-src="<?php echo $theme['info']->screenshot; ?>" src="<?php echo $theme['info']->screenshot; ?>" alt=""></p>
<?php if( $current_them == $key ) { ?>
<div class="in-use">使用中</div>
<?php } ?>
</div>
<!-- 主题图片END -->
<hr>
<div class = "thme-btns">

26
templates/admin/static/embed.js

@ -757,6 +757,32 @@ layui.use(['element','table','layer','form','upload','iconHhysFa'], function(){ @@ -757,6 +757,32 @@ layui.use(['element','table','layer','form','upload','iconHhysFa'], function(){
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
});
// 一键复制
form.on('submit(one_copy)', function(data){
if( (data.field.SecretKey != '') && (data.field.username != '' ) ) {
let username = data.field.username;
let sk = data.field.SecretKey;
let token = md5(username + sk);
let api_domain = $("#api_domain").val();
let result = `${api_domain}|${token}`;
lay.clipboard.writeText({
text: result,
done: function() {
layer.msg("已复制!",{icon:1});
},
error: function() {
layer.msg("复制失败!",{icon:5});
}
});
}
else{
layer.msg('SecretKey为空,请先生成!', {icon: 5});
}
//console.log(data.field) //当前容器的全部表单字段,名值对形式:{name: value}
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
});
//添加链接
form.on('submit(add_link)', function(data){
$.post('/index.php?c=api&method=add_link',data.field,function(data,status){

18
templates/admin/static/style.css

@ -151,6 +151,24 @@ @@ -151,6 +151,24 @@
/* .screenshot {
height:220px;
} */
.screenshot {
position: relative; /* 确保父容器是相对定位 */
/* 其他样式 */
}
.in-use {
position: absolute; /* 绝对定位“使用中”标签 */
top: 0; /* 距离顶部的距离 */
left: 0px; /* 距离右侧的距离 */
background-color: #ff5722; /* 背景颜色 */
color: white; /* 文字颜色 */
padding: 5px 10px; /* 内边距 */
box-shadow: 0px 0px 3px #888; /* 可选:添加一些阴影效果 */
}
.screenshot img{
width: 100%;
height:240px;

2
version.txt

@ -1 +1 @@ @@ -1 +1 @@
v0.9.34-20240115
v0.9.35-20240318
Loading…
Cancel
Save