Browse Source

20220509

pull/75/head
xiaoz 3 years ago
parent
commit
33fdd8f3b5
  1. 6
      templates/admin/imp_link.php
  2. 2
      templates/admin/link_list.php
  3. 45
      templates/admin/static/embed.js

6
templates/admin/imp_link.php

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
<!-- 内容主体区域 -->
<div class="layui-row content-body place-holder">
<div class="layui-col-lg6 layui-col-md-offset3">
<div class="setting-msg">仅支持 <em>.html</em> 格式导入,使用前请参考<a href="https://dwz.ovh/ij3mq" target="_blank" rel = "nofollow">帮助文档</a></div>
<div class="setting-msg">仅支持 <em>.html</em> 格式导入,导入时会自动创建不存在的分类,使用前请参考<a href="https://dwz.ovh/ij3mq" target="_blank" rel = "nofollow">帮助文档</a></div>
<!-- 上传 -->
<div class="layui-upload-drag" id="up_html">
<i class="layui-icon layui-icon-upload"></i>
@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
<input type="text" id = "filename" name="filename" required lay-verify="required" placeholder="请输入书签路径" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<!-- <div class="layui-form-item">
<label class="layui-form-label">所属分类</label>
<div class="layui-input-block">
<select name="fid" lay-verify="required" lay-search>
@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
<?php } ?>
</select>
</div>
</div>
</div> -->
<div class="layui-form-item">
<label class="layui-form-label">是否私有</label>

2
templates/admin/link_list.php

@ -34,6 +34,8 @@ @@ -34,6 +34,8 @@
<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" lay-event="readmoredata">批量修改分类</button>
<button class="layui-btn layui-btn-sm" lay-event="set_private">设为私有</button>
<button class="layui-btn layui-btn-sm" lay-event="set_public">设为公有</button>
<!-- <button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button>
<button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button> -->
</div>

45
templates/admin/static/embed.js

@ -193,6 +193,28 @@ layui.use(['element','table','layer','form','upload'], function(){ @@ -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(){ @@ -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(){ @@ -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});
}
});
}
}
Loading…
Cancel
Save