From 33fdd8f3b5ebd645e173129d7cf9b23fe42ab883 Mon Sep 17 00:00:00 2001 From: xiaoz Date: Mon, 9 May 2022 12:51:55 +0800 Subject: [PATCH] 20220509 --- templates/admin/imp_link.php | 6 ++--- templates/admin/link_list.php | 2 ++ templates/admin/static/embed.js | 45 ++++++++++++++++++++++++++++++--- 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/templates/admin/imp_link.php b/templates/admin/imp_link.php index 8d4b32b..fa1265b 100755 --- a/templates/admin/imp_link.php +++ b/templates/admin/imp_link.php @@ -5,7 +5,7 @@
-
仅支持 .html 格式导入,使用前请参考帮助文档
+
仅支持 .html 格式导入,导入时会自动创建不存在的分类,使用前请参考帮助文档
@@ -23,7 +23,7 @@
-
+
diff --git a/templates/admin/link_list.php b/templates/admin/link_list.php index 4e4f4b4..9feb99e 100755 --- a/templates/admin/link_list.php +++ b/templates/admin/link_list.php @@ -34,6 +34,8 @@
+ +
diff --git a/templates/admin/static/embed.js b/templates/admin/static/embed.js index a7a1b92..c90440e 100755 --- a/templates/admin/static/embed.js +++ b/templates/admin/static/embed.js @@ -193,6 +193,28 @@ layui.use(['element','table','layer','form','upload'], function(){ } //console.log(data); break; + case "set_private": + //用户点击设为私有按钮 + var data = checkStatus.data; + ids = []; + //获取链接所有ID,并拼接为数组 + for(let i = 0;i < data.length;i++) { + ids.push(data[i].id); + } + //调用函数设为私有 + set_link_attribute(ids,1); + break; + case "set_public": + //用户点击设为私有按钮 + var data = checkStatus.data; + ids = []; + //获取链接所有ID,并拼接为数组 + for(let i = 0;i < data.length;i++) { + ids.push(data[i].id); + } + //调用函数设为公有 + set_link_attribute(ids,0); + break; case 'isAll': layer.msg(checkStatus.isAll ? '全选': '未全选'); break; @@ -546,12 +568,12 @@ layui.use(['element','table','layer','form','upload'], function(){ //识别链接信息 form.on('submit(imp_link)', function(data){ //用ajax异步加载 - $.post('/index.php?c=api&method=imp_link',data.field,function(data,status){ + $.post('/index.php?c=api&method=import_link',data.field,function(data,status){ //如果添加成功 - if(data.code == 0) { + if(data.code == 200) { layer.open({ title: '导入完成' - ,content: data.msg + ,content: "总数:" + data.msg.count + " 成功:" + data.msg.success + " 失败:" + data.msg.failed }); //layer.msg('已添加!', {icon: 1}); } @@ -745,3 +767,20 @@ function get_latest_version(){ }); } + +//设置链接属性,公有或私有,接收一个链接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}); + } + }); + } +} \ No newline at end of file