MrDoc/template/app_api/manage_token.html

70 lines
2.8 KiB
HTML
Raw Normal View History

2020-03-29 20:48:02 +08:00
{% extends 'app_doc/manage_base.html' %}
2020-10-18 08:05:41 +08:00
{% load static %}
2020-03-29 20:48:02 +08:00
{% block title %}用户Token管理{% endblock %}
{% block content %}
<div class="layui-card-header" style="margin-bottom: 10px;">
<div class="layui-row">
<span style="font-size:18px;">用户Token管理
</span>
</div>
</div>
2020-08-30 13:51:26 +08:00
<blockquote class="layui-elem-quote layui-quote-nm" style="font-size: 12px;color: #999;">
借助Token你可以无需打开MrDoc网站直接通过更加自动化的方式进行文档编写配合MrDoc浏览器剪藏扩展还能将MrDoc化身为便捷的网页内容摘录工具
</blockquote>
2020-03-29 20:48:02 +08:00
<div class="layui-row">
<form>
<div class="layui-form-item">
<label class="layui-form-label">Token值</label>
<div class="layui-input-inline" style="width:450px;">
<input type="text" name="token" id="token" value="{{token}}" autocomplete="off" class="layui-input" readonly>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">操作</label>
<button class="layui-btn layui-btn-normal layui-btn-sm" type="button" id="copy-token" onclick="copyToken()">复制</button>
<button class="layui-btn layui-btn-normal layui-btn-sm" type="button" onclick="generaToken()">重新生成Token</button>
2020-03-29 20:48:02 +08:00
</div>
</form>
</div>
2020-08-30 13:51:26 +08:00
2020-03-29 20:48:02 +08:00
{% endblock %}
{% block custom_script %}
<script>
//复制Token
copyToken = function(){
var token_val = document.getElementById("token");
token_val.select();
document.execCommand("Copy");
layer.msg("已复制!")
};
//生成Token
generaToken = function(){
layer.open({
type:1,
title:'重置Token',
area:'300px;',
id:'delPro',//配置ID
content:'<div style="margin:10px;">警告此操作将重新为你的账户生成Token旧Token将失效</div>',
btn:['确定','取消'], //添加按钮
btnAlign:'c', //按钮居中
yes:function (index,layero) {
layer.load(1);
2020-03-29 20:48:02 +08:00
$.post("{% url 'manage_token' %}",function(r){
layer.closeAll('loading');
2020-03-29 20:48:02 +08:00
if(r.status){
//生成成功
//window.location.reload();
$('#token').val(r.data);
layer.close(index)
}else{
//生成失败,提示
//console.log(r)
layer.close(index)
layer.msg(r.data)
}
})
},
});
};
</script>
{% endblock %}