utools_password/index.html

103 lines
3.8 KiB
HTML
Raw Normal View History

2022-05-16 02:14:57 +08:00
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="layui/css/layui.css">
</head>
<body>
<form class="layui-form" action="">
<div class="layui-form-item">
<button id="clear" type="button" class="layui-btn layui-btn-normal layui-btn-sm"><i
class="layui-icon"></i></button>
<button id="reload" type="button" class="layui-btn layui-btn-normal layui-btn-sm"><i
class="layui-icon">&#xe669;</i></button>
</div>
<!-- <div class="layui-form-item">
<label class="layui-form-label">输入框</label>
<div class="layui-input-block">
<input type="text" name="title" required lay-verify="required" placeholder="请输入标题" autocomplete="off"
class="layui-input">
</div>
</div> -->
<div class="layui-form-item">
<table id="table" lay-filter="table"></table>
</div>
</form>
<script src="layui/layui.js"></script>
<script src="layui/jquery-3.2.1.js"></script>
<script>
layui.use(['layer', 'form', 'table'], function () {
let table = layui.table;
let form = layui.form;
$('#clear').click(function () {
utools.db.remove('token')
history.go(0);
})
$('#reload').click(function () {
history.go(0);
})
let token = utools.db.get("token");
if (token === null) {
console.log("数据库为空")
layer.prompt({
formType: 0,
value: '',
closeBtn: 0,
title: '请输入Key',
area: ['250px', '50px'], //自定义文本域宽高
}, function (value, index, elem) {
utools.db.put({
_id: "token",
data: value
})
layer.close(index);
init();
});
return;
} else {
init()
}
function init() {
let purl = 'http://tools.yutou233.cn/tools/password/get/all.do?token=' + utools.db.get('token').data
utools.onPluginOut(() => {
//utools.removeSubInput();
})
utools.onPluginEnter(({ code, type, payload }) => {
utools.setSubInput(({ text }) => {
purl = 'http://tools.yutou233.cn/tools/password/get/all.do?token=' + utools.db.get('token').data + '&search=' + text
table.reload('table', {
url: purl
});
}, '搜索', true)
utools.subInputSelect()
})
table.render({
elem: "#table"
, url: purl
, toolbar: '#topTools'
, page: true
, cols: [[
{ field: "id", title: "", width: 60, sort: true, fixed: 'left' }
, { field: 'title', title: '标题', width: 150 }
, { field: 'account', title: '账号', width: 200 }
, { field: 'password', title: '密码', width: 200 }
, { field: 'desc', title: '备注', width: 200 }
, { field: 'url', title: '网址', width: 400, templet: '<div><a href="{{d.url}}" target="_blank">{{d.url}}</a></div>' }
, { field: "right", width: 200, toolbar: '#listTools' }
]]
, done: function (data) {
}
});
}
})
</script>
</body>
</html>