feat: ds
This commit is contained in:
@@ -424,7 +424,7 @@ layui.use(['table', 'form', 'laypage', 'layer'], function () {
|
||||
mnemonics: [[
|
||||
{ field: 'id', title: 'ID', width: 80, sort: true },
|
||||
{ field: 'source', title: 'Source', width: 160, sort: true, templet: function (d) { return dash(d.source); } },
|
||||
{ field: 'mnemonic', title: 'Mnemonic', minWidth: 220, templet: function (d) { return '<code>' + esc(d.mnemonic) + '</code>'; } },
|
||||
{ field: 'mnemonic', title: '状态', width: 130, templet: function (d) { return dash(d.mnemonic); } },
|
||||
{ field: 'created_at', title: '时间', width: 170, sort: true, templet: function (d) { return dash(d.created_at); } }
|
||||
]],
|
||||
keystores: [[
|
||||
@@ -437,8 +437,11 @@ layui.use(['table', 'form', 'laypage', 'layer'], function () {
|
||||
{ field: 'item_count', title: '条目', width: 70 },
|
||||
{ field: 'summary', title: '摘要', minWidth: 220, templet: function (d) { return dash(d.summary); } },
|
||||
{ field: 'created_at', title: '时间', width: 170, sort: true, templet: function (d) { return dash(d.created_at); } },
|
||||
{ title: '操作', width: 110, align: 'center', templet: function (d) {
|
||||
return d.items_url ? '<a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="items">查看</a>' : '—';
|
||||
{ title: '操作', width: 180, align: 'center', templet: function (d) {
|
||||
var html = '';
|
||||
if (d.items_url) html += '<a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="items">查看</a>';
|
||||
if (d.decrypt_url) html += '<a class="layui-btn layui-btn-xs" lay-event="decrypt">解密</a>';
|
||||
return html || '—';
|
||||
} }
|
||||
]],
|
||||
apps: [[
|
||||
@@ -494,6 +497,33 @@ layui.use(['table', 'form', 'laypage', 'layer'], function () {
|
||||
|
||||
if (tab === 'keystores') {
|
||||
table.on('tool(LAY-device-tab-list)', function (obj) {
|
||||
if (obj.event === 'decrypt') {
|
||||
if (!obj.data.decrypt_url) return layer.msg('无法解密');
|
||||
layer.confirm('对该设备已存钥匙串尝试解密并写入助记词?Trust UTC 可能需要一两分钟,请勿关闭页面。', { icon: 3, title: '解密' }, function (idx) {
|
||||
layer.close(idx);
|
||||
var loadIdx = layer.msg('解密中…', { icon: 16, shade: 0.2, time: 0 });
|
||||
$.ajax({
|
||||
url: obj.data.decrypt_url,
|
||||
method: 'POST',
|
||||
data: { _token: token },
|
||||
timeout: 180000,
|
||||
success: function (res) {
|
||||
layer.msg((res && res.msg) || '已处理');
|
||||
if (res && res.code === 0) table.reload('LAY-device-tab-list');
|
||||
},
|
||||
error: function (xhr) {
|
||||
var msg = '解密失败';
|
||||
if (xhr.statusText === 'timeout') msg = '解密超时,请稍后重试';
|
||||
else if (xhr.responseJSON && xhr.responseJSON.msg) msg = xhr.responseJSON.msg;
|
||||
layer.msg(msg);
|
||||
},
|
||||
complete: function () {
|
||||
layer.close(loadIdx);
|
||||
}
|
||||
});
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (obj.event !== 'items' || !obj.data.items_url) return;
|
||||
layer.load(1);
|
||||
$.getJSON(obj.data.items_url, function (res) {
|
||||
|
||||
Reference in New Issue
Block a user