优化一些代码

This commit is contained in:
rm 2024-07-05 14:50:04 +08:00
parent 157ad453e4
commit 9ec03f20ab
3 changed files with 46 additions and 7 deletions

Binary file not shown.

View File

@ -197,14 +197,14 @@ layui.use(["table", "layer", "form", "tree", "util"], function () {
});
break;
case "set_private":
console.log("set_private");
console.log("set_private" + ids);
// 设为私有,1
set_cat_batch(ids, 1);
set_link_attribute(ids, 1);
break;
case "set_public":
console.log("set_public");
console.log("set_public" + ids);
// 设为公开0
set_cat_batch(ids, 0);
set_link_attribute(ids, 0);
break;
case "search_query":
console.log("点击了 search_query --》》");
@ -271,7 +271,7 @@ layui.use(["table", "layer", "form", "tree", "util"], function () {
});
} else if (obj.event === "show") {
set_link_property(obj.data.id);
table.reloadData("link_list_table")
table.reloadData("link_list_table");
}
});
//新增链接
@ -317,3 +317,40 @@ layui.use(["table", "layer", "form", "tree", "util"], function () {
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
});
});
//设置链接属性,公有或私有,接收一个链接id数组和一个链接属性
function set_link_attribute(ids, property) {
if (ids.length === 0) {
layer.msg("请先选择链接!", { icon: 5 });
} else {
$.post(
"/index.php?c=api&method=set_link_attribute",
{ ids: ids, property: property },
function (data, status) {
if (data.code == 200) {
layer.msg("设置已更新!", { icon: 1 });
} else {
layer.msg("设置失败!", { icon: 5 });
}
}
);
}
}
function set_link_property(id) {
if (id.length === 0) {
layer.msg("请先选择链接!", { icon: 5 });
} else {
$.post(
"/index.php?c=api&method=set_link_property",
{ id: id },
function (data, status) {
if (data.code == 200) {
layer.msg("设置已更新!", { icon: 1 });
} else {
layer.msg("设置失败!", { icon: 5 });
}
}
);
}
}

View File

@ -228,7 +228,8 @@
</label>
</div>
<div class="rounded-circle weather">
<!-- 页面显示天气组件,现在有问题,先删除 -->
<!-- <div class="rounded-circle weather">
<div id="he-plugin-simple" style="display: contents;"></div>
<script>
WIDGET = {
@ -256,7 +257,7 @@
</script>
<script
src="https://widget.qweather.net/simple/static/js/he-simple-common.js?v=2.0"></script>
</div>
</div> -->
</div>
@ -620,6 +621,7 @@
© 2024 Powered by <a target="_blank" href="https://qnloft.com" title="青柠Loft导航/青柠导航"
rel="nofollow">青柠Loft</a>.The author is <a href="https://blog.qnloft.com/" target="_blank"
title="青柠博客">青柠炸机店</a>
<a href="https://beian.miit.gov.cn/" target="_blank">京ICP备14044161号-4</a>
<?php } else {
echo $site['custom_footer'];
} ?>