2020-11-16 21:32:08 +08:00
|
|
|
|
{% extends 'app_doc/user/user_base.html' %}
|
2020-10-18 08:05:41 +08:00
|
|
|
|
{% load static %}
|
2020-12-02 21:25:59 +08:00
|
|
|
|
{% load i18n %}
|
2020-03-29 20:48:02 +08:00
|
|
|
|
{% block title %}用户Token管理{% endblock %}
|
|
|
|
|
{% block content %}
|
2020-11-16 21:32:08 +08:00
|
|
|
|
<div class="layui-card">
|
|
|
|
|
<div class="layui-card-body">
|
|
|
|
|
<blockquote class="layui-elem-quote layui-quote-nm" style="font-size: 12px;color: #999;">
|
2021-03-21 17:36:20 +08:00
|
|
|
|
借助Token,你可以无需打开觅道文档网站,直接通过更加自动化的方式进行文档编写;配合觅道文档浏览器剪藏扩展,还能将觅道文档化身为便捷的网页内容摘录工具;
|
2020-11-16 21:32:08 +08:00
|
|
|
|
</blockquote>
|
|
|
|
|
<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>
|
2021-02-15 17:22:14 +08:00
|
|
|
|
<button class="pear-btn pear-btn-primary pear-btn-sm" type="button" id="copy-token" onclick="copyToken()">复制</button>
|
|
|
|
|
<button class="pear-btn pear-btn-primary pear-btn-sm" type="button" onclick="generaToken()">重新生成Token</button>
|
2020-11-16 21:32:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
</form>
|
2020-03-29 20:48:02 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2020-11-16 21:32:08 +08:00
|
|
|
|
</div>
|
2020-03-29 20:48:02 +08:00
|
|
|
|
{% endblock %}
|
|
|
|
|
{% block custom_script %}
|
|
|
|
|
<script>
|
2020-11-16 21:32:08 +08:00
|
|
|
|
layui.use(['table', 'form', 'jquery', 'dtree'], function() {
|
|
|
|
|
let table = layui.table;
|
|
|
|
|
let form = layui.form;
|
|
|
|
|
let $ = layui.jquery;
|
|
|
|
|
let dtree = layui.dtree;
|
|
|
|
|
$.ajaxSetup({
|
|
|
|
|
data: {csrfmiddlewaretoken: '{{ csrf_token }}' },
|
2020-03-29 20:48:02 +08:00
|
|
|
|
});
|
2020-11-16 21:32:08 +08:00
|
|
|
|
//复制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);
|
|
|
|
|
$.post("{% url 'manage_token' %}",function(r){
|
|
|
|
|
layer.closeAll('loading');
|
|
|
|
|
if(r.status){
|
|
|
|
|
//生成成功
|
|
|
|
|
//window.location.reload();
|
|
|
|
|
$('#token').val(r.data);
|
|
|
|
|
layer.close(index)
|
|
|
|
|
layer.msg("生成成功!",{offset: 't'})
|
|
|
|
|
}else{
|
|
|
|
|
//生成失败,提示
|
|
|
|
|
//console.log(r)
|
|
|
|
|
layer.close(index)
|
|
|
|
|
layer.msg(r.data)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
})
|
2020-03-29 20:48:02 +08:00
|
|
|
|
</script>
|
|
|
|
|
{% endblock %}
|