变更
This commit is contained in:
@@ -97,7 +97,7 @@ DATABASES = {
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'NAME': 'test',
|
||||
'USER': 'root',
|
||||
'PASSWORD': 'root',
|
||||
'PASSWORD': 'guoan123',
|
||||
'HOST': '127.0.0.1',
|
||||
'PORT': '3306',
|
||||
}
|
||||
|
||||
+5
-1
@@ -1,5 +1,6 @@
|
||||
from django.urls import path
|
||||
|
||||
from . import view_test
|
||||
from server.views.mind_map import *
|
||||
from server.views.jump import *
|
||||
from server.views.user import *
|
||||
@@ -8,7 +9,7 @@ from server_auth.lib.auth import *
|
||||
|
||||
urlpatterns = [
|
||||
# ---------------------------------------------------
|
||||
path('test', test), #
|
||||
# path('test', test), #
|
||||
|
||||
# ---------------------------------------------------
|
||||
path('', to_dashboard), # 跳转列表界面
|
||||
@@ -35,4 +36,7 @@ urlpatterns = [
|
||||
path('logout', LogoutView.as_view()), # 用户登出
|
||||
|
||||
# ---------------------------------------------------
|
||||
path('xmind/list/', view_test.updatax),
|
||||
|
||||
|
||||
]
|
||||
|
||||
@@ -4,41 +4,40 @@ DUPLICATE = 1
|
||||
|
||||
SNAPSHOT_JSON_DATA = """{
|
||||
"id": "root",
|
||||
"topic": "MindMap",
|
||||
"topic": "工业防火墙",
|
||||
"children": [{"id": "easy",
|
||||
"topic": "Easy",
|
||||
"topic": "网络配置",
|
||||
"direction": "left",
|
||||
"expanded": false,
|
||||
"children": [
|
||||
{"id": "easy1", "topic": "Easy to show"},
|
||||
{"id": "easy2", "topic": "Easy to edit"},
|
||||
{"id": "easy3", "topic": "Easy to store"},
|
||||
{"id": "easy4", "topic": "Easy to embed"}
|
||||
{"id": "easy1", "topic": "接口"},
|
||||
{"id": "easy2", "topic": "交换"},
|
||||
{"id": "easy3", "topic": "路由"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "open",
|
||||
"topic": "Open Source",
|
||||
"topic": "安全防护",
|
||||
"direction": "left",
|
||||
"expanded": false,
|
||||
"children": [
|
||||
{"id": "open1", "topic": "on GitHub"},
|
||||
{"id": "open2", "topic": "BSD License"}
|
||||
{"id": "open1", "topic": "Dos防护"},
|
||||
{"id": "open2", "topic": "入侵防护"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "powerful",
|
||||
"topic": "Powerful",
|
||||
"topic": "对象配置",
|
||||
"direction": "right",
|
||||
"expanded": false,
|
||||
"children": [
|
||||
{"id": "powerful1", "topic": "Base on Javascript"},
|
||||
{"id": "powerful2", "topic": "Base on HTML5"},
|
||||
{"id": "powerful3", "topic": "Depends on you"}
|
||||
{"id": "powerful1", "topic": "网络"},
|
||||
{"id": "powerful2", "topic": "服务"},
|
||||
{"id": "powerful3", "topic": "应用"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "other",
|
||||
"topic": "多人协作",
|
||||
"topic": "日志审计",
|
||||
"direction": "right"
|
||||
}]}"""
|
||||
|
||||
+60
-8
@@ -2,11 +2,63 @@ from django.http import HttpResponse
|
||||
from server.lib.qr_context import get_context
|
||||
|
||||
|
||||
def test(request):
|
||||
uid = request.GET.get('uid')
|
||||
print(uid)
|
||||
qrContext = get_context()
|
||||
consumer = qrContext.get(uid)
|
||||
print(consumer)
|
||||
consumer.sed_text('ppp')
|
||||
return HttpResponse('success')
|
||||
# @csrf_exempt
|
||||
def updatax(request):
|
||||
print("ok")
|
||||
if request.method == "GET":
|
||||
print("ok")
|
||||
file = request.FILES.get('file')
|
||||
if file:
|
||||
filename = str(file)
|
||||
with open('./nsfocus/media/xmind/'+filename, 'wb+') as destination:
|
||||
for chunk in file.chunks():
|
||||
destination.write(chunk)
|
||||
with open('./nsfocus/media/xmind/'+filename, 'rb') as f:
|
||||
content = f.read()
|
||||
# content = BytesIO(content)
|
||||
# xmind_dict = xmind_to_dict(content)
|
||||
# sheet = xmind_dict[0]
|
||||
# # {'title': '防火墙',
|
||||
# # 'topics':
|
||||
# # [{'title': '首页(信息可视化)',
|
||||
# # 'topics': [{'title': 'CPU'}, {'title': '内存'}, {'title': '趋势图'}]},
|
||||
# # {'title': 'Dos防护', 'topics': [{'title': 'Flood防护:根据检测阈值,检测周期,复位时间,自动保护,保护时间,流量显示进行防护。'}, {'title': 'Port防护'}, {'title': 'PINGSweep防护'}, {'title': 'ARPpoof防护'}]}]}
|
||||
# print("ok")
|
||||
# root_topic = sheet['topic']
|
||||
# root_one = root_topic['title']
|
||||
# root_two = []
|
||||
# root_three = []
|
||||
# str1 = " "
|
||||
# str2 = " "
|
||||
# str3 = " "
|
||||
# str4 = " "
|
||||
# num = 1
|
||||
#
|
||||
# for data in root_topic['topics']:
|
||||
# root_two.append(data['title'])
|
||||
# str1 = str(num) + "." + data['title']
|
||||
# str2 = str2 + str1
|
||||
# num = num + 1
|
||||
# num2 = 1
|
||||
# for info in data['topics']:
|
||||
# root_three.append(info['title'])
|
||||
# str3 = str(num2) + "." + info['title']
|
||||
# str4 = str4 + str3
|
||||
# num2 = num2 + 1
|
||||
# xmind_title = str2
|
||||
# xmind_xmind_root = str4
|
||||
# prompt1 = "我是一个软件测试工程师,现在我要测试一个" + root_one + "产品,首先我有的模块是:" + str2 + "请针对这两个模块结合产品" + root_one + "给我提供一点测试思路,内容尽量详细。"
|
||||
# gpt_little = chatgpt(prompt1)
|
||||
# prompt2 = "我是一个软件测试工程师,产品" + root_one + "的模块:" + str2 + "的详细" + "细节信息为:" + str4 + "请提供我更详细的测试思路"
|
||||
# gpt_big = chatgpt(prompt2)
|
||||
# prompt3 = "我是一个软件测试工程师,产品是" + root_one + "模块为:" + str2 + "模块的详细内容为:" + str4 + "请给我更好的建议和一些发散性的测试想法。"
|
||||
# gpt_more = chatgpt(prompt3)
|
||||
# prompt4 = "我是一个软件测试工程师,产品是" + root_one + "结合刚才你对我的测试内容的意见和思路:" + gpt_little + gpt_big + gpt_more + "请精简总结和点评上述内容。"
|
||||
# gpt_all = chatgpt(prompt4)
|
||||
# # last = "我是一个软件测试工程师,产品是" + root_one + "结合刚才你对我的测试内容的意见和思路:" + gpt_little + gpt_big + gpt_more +
|
||||
# # "请利用等价类、边界值、场景法等方法设计用例,输出字段要求有前置条件、序号、测试标题、测试数据、测试步骤、预期结果等;请给出x条用例,测试步骤在y条以上。"
|
||||
# models.Xmind.objects.create(filename=filename,xmind_title=xmind_title,xmind_root=xmind_xmind_root,gpt_little=gpt_little
|
||||
# ,gpt_big=gpt_big,gpt_more=gpt_more,gpt_all=gpt_all)
|
||||
# return HttpResponse(xmind_dict)
|
||||
|
||||
return HttpResponse('Invalid request method')
|
||||
|
||||
+1
-505
@@ -8,511 +8,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/dashboard.css">
|
||||
<link rel="stylesheet" type="text/css" href="/static/bootstrap-4.6.1-dist/css/bootstrap.css">
|
||||
|
||||
<!--script start-->
|
||||
<script src="/static/js/jquery-1.11.3.min.js"></script>
|
||||
<script src="https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
|
||||
<script src="/static/bootstrap-4.6.1-dist/js/bootstrap.bundle.js"></script> <!-- bootstrap.bundle.min.js,还包含了 Popper,用于支持工具提示(tooltip)和弹出框(popover)功能,但是不包含 jQuery。-->
|
||||
<script src="https://cdn.jsdelivr.net/npm/feather-icons@4.28.0/dist/feather.min.js"></script> <!-- 图标相关-->
|
||||
<script src="/static/js/mind/c_m_m.js"></script>
|
||||
<script>
|
||||
const DefaultView = function () {
|
||||
this.websocket = null
|
||||
this.uuid = (new Date().getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16)
|
||||
this.current_page_num = 1
|
||||
this.default_page_size = 15
|
||||
this.title_map = new Map([["main", "我的文件"], ["share", "我的分享"], ["star", "我的收藏"], ["recycle", "回收站"]]);// k-v 的形式
|
||||
}
|
||||
|
||||
DefaultView.prototype = {
|
||||
/**界面初始化*/
|
||||
init_view: function () {
|
||||
const uid = $('#uid').html()
|
||||
// 未登录
|
||||
if (!uid || isNaN(uid)) {
|
||||
$('#login_register').show()
|
||||
setTimeout(function () {
|
||||
$('#login_register').click()
|
||||
}, 500)
|
||||
$('#logout_a').hide()
|
||||
$('#newMindModal_btn').hide()
|
||||
} else {
|
||||
$('#login_register').hide()
|
||||
$('#logout_a').show()
|
||||
}
|
||||
|
||||
// 判断页面
|
||||
const page_tag = this.get_page_tag()
|
||||
$('#main h5').html(this.title_map.get(page_tag))
|
||||
},
|
||||
get_uu_id: function () {
|
||||
return (new Date().getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16)
|
||||
},
|
||||
/**注销登录*/
|
||||
logout_: function () {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "logout",
|
||||
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||
data: {'xx': 'xx'},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
common_alert(data.msg)
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
}, 1000)
|
||||
},
|
||||
async: false
|
||||
});
|
||||
},
|
||||
/**获得源页面*/
|
||||
get_page_tag: function () {
|
||||
return $('#src_page').html()
|
||||
},
|
||||
/**获得导图*/
|
||||
fetch_mind: function (current_page, page_size) {
|
||||
const me = this
|
||||
if (!current_page) {
|
||||
current_page = me.current_page_num
|
||||
}
|
||||
if (!page_size) {
|
||||
page_size = me.default_page_size
|
||||
}
|
||||
me.current_page_num = current_page
|
||||
|
||||
// 获得跳转源页面
|
||||
const page_tag = me.get_page_tag()
|
||||
$.ajax({
|
||||
type: `get`,
|
||||
url: `list?page=${current_page}&page_size=${page_size}&s_p=${page_tag}`,
|
||||
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||
dataType: "json",
|
||||
success: function (resp) {
|
||||
if (resp.code !== 0) {
|
||||
return
|
||||
}
|
||||
// clear container-fluid
|
||||
$('main .container-fluid').empty()
|
||||
|
||||
// 解析结果
|
||||
const results = resp.results
|
||||
let idx = 0
|
||||
let row = $(`<div class="row"></row>`)
|
||||
|
||||
results.forEach(function (item) {
|
||||
const uuid = me.get_uu_id()
|
||||
|
||||
// 添加按钮组
|
||||
let sub_btn = '';
|
||||
if (page_tag === 'b9b101e') {
|
||||
sub_btn = `<a class="dropdown-item" href="javascript:void(0);" onclick="window.open('2_d?id=${item.id}&s_p=b9b101e')">编辑</a>
|
||||
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.del_mind(${item.id},'card_${uuid}')">删除</a>
|
||||
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.share_mind(${item.id})">分享</a>`
|
||||
} else if (page_tag === 'share') {
|
||||
sub_btn = `<a class="dropdown-item" href="javascript:void(0);" onclick="mind.share_cancel(${item.id})">取消分享</a>
|
||||
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.fetch_share_info(${item.id})">查看分享链接</a>`
|
||||
} else if (page_tag === 'star') {
|
||||
sub_btn = `<a class="dropdown-item" href="javascript:void(0);" onclick="mind.un_star(${item.id})">取消收藏</a>`
|
||||
} else if (page_tag === 'recycle') {
|
||||
sub_btn = `<a class="dropdown-item" href="javascript:void(0);" onclick="mind.del_cancel(${item.id})">恢复</a>
|
||||
<a class="dropdown-item" href="javascript:void(0);" onclick="mind.del_final(${item.id})">彻底删除</a>`
|
||||
}
|
||||
|
||||
const content = `<div class="card col-2" style="margin: 6px; margin-left: 20px;" id='card_${uuid}'>
|
||||
<div class="card-body">
|
||||
<div class="card-title" style="margin-bottom: 0px;font-weight:bold;text-overflow:ellipsis;white-space:nowrap;overflow: hidden;">${item.coop_mind_name}</div>
|
||||
<hr style="margin: 0">
|
||||
<img src="/static/pic/demo_icon.png" class="card-img-top" style="margin-top: 8px;cursor: pointer;" onclick="window.open('2_d?id=${item.id}&s_p=b9b101e')">
|
||||
<div style="text-align:right;font-size: 0.8rem;margin-top: 5px;font-family: inherit;">
|
||||
<div class="btn-group btn-group-sm" role="group">
|
||||
<button id="btnGroupDrop1" type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">操作</button>
|
||||
<div class="dropdown-menu" aria-labelledby="btnGroupDrop1">${sub_btn}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`
|
||||
row.append(content)
|
||||
})
|
||||
|
||||
// 如果不是3的整数倍,将剩余的添加
|
||||
$('main .container-fluid').append(row)
|
||||
me.init_pagination(resp.count, me.default_page_size)
|
||||
// success end
|
||||
},
|
||||
async: false
|
||||
});
|
||||
},
|
||||
/**显示分享链接*/
|
||||
show_share_url: function (u, h) {
|
||||
const url = `s_2_d?u=${u}&h=${h}`
|
||||
$('#share_mind_modal .modal-body').html(`分享成功,请复制以下链接进行分享:<div>${window.location.protocol}//${window.location.host}/${url}</div>`)
|
||||
$('#share_mind_modal_a').click()
|
||||
},
|
||||
/**分页组件*/
|
||||
init_pagination: function (count, page_size) {
|
||||
const container = $('#pagination_div')
|
||||
/**计算页数*/
|
||||
if (count <= 0) {
|
||||
container.html(`<p class="text-center">无数据</p>`)
|
||||
return
|
||||
}
|
||||
|
||||
const all_page = (count <= page_size) ? 1 : (count % page_size > 0) ? Math.floor(count / page_size) + 1 : Math.floor(count / page_size)
|
||||
const navigation = $(`<nav aria-label="Page navigation example"></nav>`)
|
||||
const navigation_ul = $(`<ul class="pagination justify-content-center"></ul>`)
|
||||
|
||||
if (this.current_page_num > 1) {
|
||||
navigation_ul.append(`<li class="page-item"><a class="page-link" href="javascript:void(0)" onclick="mind.fetch_mind(mind.current_page_num-1)">上一页</a></li>`)
|
||||
}
|
||||
for (let i = 0; i < all_page; i++) {
|
||||
const ctt = $(`<li class="page-item"><a class="page-link" href="javascript:void(0)" onclick="mind.fetch_mind(${i + 1})">${i + 1}</a></li>`)
|
||||
if (i + 1 === this.current_page_num) {
|
||||
ctt.addClass('active')
|
||||
}
|
||||
navigation_ul.append(ctt)
|
||||
}
|
||||
if (this.current_page_num < all_page) {
|
||||
navigation_ul.append(`<li class="page-item"><a class="page-link" href="javascript:void(0)" onclick="mind.fetch_mind(mind.current_page_num+1)">下一页</a></li>`)
|
||||
}
|
||||
navigation.append(navigation_ul)
|
||||
container.empty()
|
||||
container.append(navigation)
|
||||
},
|
||||
/**删除导图*/
|
||||
del_mind: function (mind_id, card_id) {
|
||||
const me = this
|
||||
$.ajax({
|
||||
type: "delete",
|
||||
url: "delete",
|
||||
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||
data: {'coop_mind_id': mind_id, 'source': 'dashboard'},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.code === 0) {
|
||||
primary_alert(data.msg)
|
||||
// $('#' + card_id).remove()
|
||||
setTimeout(function () {
|
||||
me.fetch_mind()
|
||||
}, 1000)
|
||||
} else {
|
||||
common_alert(data.msg)
|
||||
}
|
||||
},
|
||||
async: false
|
||||
});
|
||||
},
|
||||
/**分享脑图*/
|
||||
share_mind: function (mind_id) {
|
||||
const me = this
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "share",
|
||||
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||
data: {'id': mind_id},
|
||||
dataType: "json",
|
||||
success: function (resp) {
|
||||
me.show_share_url(`${resp.data.u}`, `${resp.data.h}`)
|
||||
},
|
||||
async: false
|
||||
});
|
||||
},
|
||||
/**取消分享*/
|
||||
share_cancel: function (mind_id) {
|
||||
const me = this
|
||||
$.ajax({
|
||||
type: "delete",
|
||||
url: "share",
|
||||
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||
data: {'id': mind_id},
|
||||
dataType: "json",
|
||||
success: function (resp) {
|
||||
if (me.is_success_resp(resp)) {
|
||||
location.reload()
|
||||
} else {
|
||||
common_alert(resp.msg)
|
||||
}
|
||||
},
|
||||
async: false
|
||||
});
|
||||
},
|
||||
/** 删除恢复*/
|
||||
del_cancel: function (mind_id) {
|
||||
const me = this
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "delete_cancel",
|
||||
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||
data: {'coop_mind_id': mind_id, 'op_type': 'delete_cancel'},
|
||||
dataType: "json",
|
||||
success: function (resp) {
|
||||
common_alert(resp.msg)
|
||||
if (me.is_success_resp(resp)) {
|
||||
me.fetch_mind()
|
||||
}
|
||||
},
|
||||
async: false
|
||||
});
|
||||
},
|
||||
/**彻底删除*/
|
||||
del_final: function (mind_id) {
|
||||
const me = this
|
||||
$.ajax({
|
||||
type: "delete",
|
||||
url: "delete",
|
||||
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||
data: {'coop_mind_id': mind_id, 'source': 'recycle'},
|
||||
dataType: "json",
|
||||
success: function (resp) {
|
||||
common_alert(resp.msg)
|
||||
if (me.is_success_resp(resp)) {
|
||||
me.fetch_mind()
|
||||
}
|
||||
},
|
||||
async: false
|
||||
});
|
||||
},
|
||||
/** 取消收藏 */
|
||||
un_star: function (mind_id) {
|
||||
const me = this
|
||||
$.ajax({
|
||||
type: "delete",
|
||||
url: "star",
|
||||
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||
data: {'coop_mind_id': mind_id},
|
||||
dataType: "json",
|
||||
success: function (resp) {
|
||||
common_alert(resp.msg)
|
||||
if (me.is_success_resp(resp)) {
|
||||
me.fetch_mind()
|
||||
}
|
||||
},
|
||||
async: false
|
||||
});
|
||||
},
|
||||
/**获得分享信息*/
|
||||
fetch_share_info: function (mind_id) {
|
||||
const me = this
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "share",
|
||||
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||
data: {'coop_mind_id': mind_id},
|
||||
dataType: "json",
|
||||
success: function (resp) {
|
||||
if (me.is_success_resp(resp)) {
|
||||
const data = resp.data
|
||||
me.show_share_url(data.share_uuid, data.share_uuid_hash)
|
||||
} else {
|
||||
common_alert(resp.msg)
|
||||
}
|
||||
},
|
||||
async: false
|
||||
});
|
||||
},
|
||||
is_success_resp(resp) {
|
||||
return resp.code === 0
|
||||
},
|
||||
/** 清除注册时输入内容 */
|
||||
clear_reg_info: function () {
|
||||
$('#userName').val('');
|
||||
$('#inputPassword').val('');
|
||||
$('#inputPassword_').val('');
|
||||
},
|
||||
/**校验密码是否输入一致*/
|
||||
validate_pw_eq: function (obj, inputPassword, inputPassword_) {
|
||||
if (inputPassword !== inputPassword_) {
|
||||
common_alert('两次密码输入不一样,请确认!')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
},
|
||||
/** 设置窗口名称 */
|
||||
set_modal_title: function (title) {
|
||||
$('#exampleModal .modal-title').html(title);
|
||||
},
|
||||
|
||||
/************************************************************************************************/
|
||||
/**初始化jquery监听*/
|
||||
jq_listener_init: function () {
|
||||
const me = this
|
||||
/**监听modal窗口事件*/
|
||||
$('#exampleModal').on('show.bs.modal', function (event) {
|
||||
const ws = new WebSocket(`ws://${window.location.host}/ws/qr/?${me.uuid}`)
|
||||
ws.onmessage = function (e) {
|
||||
console.log('接收到websocket消息:' + e.data)
|
||||
}
|
||||
me.websocket = ws
|
||||
});
|
||||
$('#exampleModal').on('hidden.bs.modal', function (event) {
|
||||
// console.log('关闭');
|
||||
if (me.websocket) {
|
||||
me.websocket.close()
|
||||
}
|
||||
});
|
||||
|
||||
/**点击 扫码登录 */
|
||||
$('#s_login_a').click(function () {
|
||||
$('.modal-body').hide();
|
||||
$('.qr_login_group').show();
|
||||
me.set_modal_title('登录');
|
||||
})
|
||||
|
||||
// 点击注册控件
|
||||
$('#register_a').click(function () {
|
||||
$('.modal-body').hide();
|
||||
$('.register_group').show();
|
||||
me.set_modal_title('注册');
|
||||
})
|
||||
|
||||
// 用户名密码登录
|
||||
$('#p_login_a').click(function () {
|
||||
$('.modal-body').hide();
|
||||
$('.pw_login_group').show();
|
||||
me.set_modal_title('登录');
|
||||
})
|
||||
|
||||
/** 注册按钮 */
|
||||
$('#register_button').click(function () {
|
||||
const userName = $('#userName').val();
|
||||
const inputPassword = $('#inputPassword').val();
|
||||
const inputPassword_ = $('#inputPassword_').val();
|
||||
|
||||
if (!userName) {
|
||||
common_alert('请输入用户名')
|
||||
return
|
||||
}
|
||||
|
||||
if (!inputPassword) {
|
||||
common_alert('请输入密码')
|
||||
return
|
||||
}
|
||||
|
||||
// 校验输入是否一致
|
||||
const validate = me.validate_pw_eq(this, inputPassword, inputPassword_)
|
||||
if (validate) {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "register",
|
||||
data: {userName: userName, inputPassword: inputPassword},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
// 注册成功
|
||||
if (data.code === 0) {
|
||||
me.clear_reg_info()
|
||||
common_alert(data.msg, 'alert-primary')
|
||||
setTimeout(function () {
|
||||
$('#p_login_a').click()
|
||||
}, 1500)
|
||||
} else {
|
||||
// 注册失败
|
||||
common_alert(data.msg)
|
||||
}
|
||||
},
|
||||
async: false
|
||||
});
|
||||
}
|
||||
// validate end
|
||||
});
|
||||
|
||||
/**登录按钮*/
|
||||
$('#login_button').click(function () {
|
||||
const userName_login = $('#userName_login').val();
|
||||
const inputPassword_login = $('#inputPassword_login').val();
|
||||
if (!userName_login || !inputPassword_login) {
|
||||
common_alert('请输入用户名和密码')
|
||||
return
|
||||
}
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "login",
|
||||
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||
data: {username: userName_login, password: inputPassword_login},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
// 登录成功
|
||||
if (data.code === 0) {
|
||||
common_alert(data.msg, 'alert-primary')
|
||||
$('#exampleModal').modal('hide')
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
}, 500)
|
||||
} else {
|
||||
// 登录失败
|
||||
common_alert(data.msg)
|
||||
}
|
||||
},
|
||||
async: false
|
||||
});
|
||||
})
|
||||
|
||||
/**新建导图*/
|
||||
$('#new_mind_btn').click(function () {
|
||||
const mind_name = $('#mindName').val()
|
||||
if (!mind_name) {
|
||||
common_alert('请输入导图名称')
|
||||
return
|
||||
}
|
||||
|
||||
const post_data = {'mind_name': mind_name}
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "create",
|
||||
headers: {"X-CSRFToken": $.cookie("csrftoken")},
|
||||
data: post_data,
|
||||
dataType: "json",
|
||||
success: function (resp) {
|
||||
if (resp.code === 0) {
|
||||
me.fetch_mind()
|
||||
$('#newMindModal').modal('hide')
|
||||
if ($('#exampleCheck1').prop("checked")) {
|
||||
/**新页面打开*/
|
||||
setTimeout(function () {
|
||||
const id = resp.data
|
||||
window.open('2_d?id=' + id + `&s_p=b9b101e`)
|
||||
}, 500)
|
||||
}
|
||||
} else {
|
||||
common_alert(resp.msg)
|
||||
}
|
||||
},
|
||||
async: false
|
||||
});
|
||||
})
|
||||
/** 新建后打开复选框勾选事件*/
|
||||
$('#exampleCheck1').change(function () {
|
||||
const checked = $(this).prop("checked")
|
||||
$.cookie('open_aft_create', checked, {expires: 7, path: '/'});
|
||||
})
|
||||
|
||||
/** 创建导图modal 显示完毕后事件*/
|
||||
$('#newMindModal').on('shown.bs.modal', function () {
|
||||
const cookie_checked_ = $.cookie('open_aft_create')
|
||||
$('#mindName').val('')
|
||||
// 从cookie中获得的是字符串
|
||||
if (cookie_checked_ === 'true') {
|
||||
$('#exampleCheck1').attr('checked', 'checked')
|
||||
} else {
|
||||
$('#exampleCheck1').removeAttr('checked');
|
||||
}
|
||||
})
|
||||
/************************************* jq_listener_init end *******************************************/
|
||||
}
|
||||
/** prototype end **/
|
||||
}
|
||||
|
||||
|
||||
$(function () {
|
||||
const view = new DefaultView()
|
||||
/**初始化*/
|
||||
view.init_view()
|
||||
view.jq_listener_init()
|
||||
|
||||
/**如果已经登录则查询列表*/
|
||||
view.fetch_mind()
|
||||
window.mind = view
|
||||
// js end
|
||||
})
|
||||
</script>
|
||||
<!--script end-->
|
||||
</head>
|
||||
<body>
|
||||
<div style="display: none;">
|
||||
@@ -522,7 +18,7 @@
|
||||
|
||||
<!-- 页眉 start-->
|
||||
<nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
|
||||
<a class="navbar-brand col-md-2 col-lg-2 mr-0 px-3" href="#">协作思维导图</a>
|
||||
<a class="navbar-brand col-md-2 col-lg-2 mr-0 px-3" href="#">西安测试一组</a>
|
||||
<ul class="navbar-nav px-3">
|
||||
<li class="nav-item text-nowrap">
|
||||
<a id="login_register" class="nav-link" href="#" data-toggle="modal" data-target="#exampleModal">登录/注册</a>
|
||||
|
||||
+28
-1
@@ -192,11 +192,38 @@
|
||||
<div style="position: absolute;top: 0px;left:80px;z-index: 1000;cursor: pointer;" onclick="xxObj.expand_all()"><span data-feather="folder-plus"></span><span class="un_selected">展开</span></div>
|
||||
<div style="position: absolute;top: 0px;left:160px;z-index: 1000;cursor: pointer;" onclick="xxObj.star()"><span data-feather="star"></span><span class="un_selected">收藏</span></div>
|
||||
<div style="position: absolute;top: 0px;left:240px;z-index: 1000;cursor: pointer;" onclick="xxObj.un_star()"><span data-feather="arrow-up-circle"></span><span class="un_selected">取消收藏</span></div>
|
||||
|
||||
<div style="position: absolute;top: 0px;left:350px;z-index: 1000;cursor: pointer;" onclick="window.open(*http://127.0.0.1:63342/jsmindmulti/static/html/xmind_isg.html?_ijt=g5ujqru3nfvc35egnr4ldppb22&_ij_reload=RELOAD_ON_SAVE*)"><span data-feather="heart"></span><span class="un_selected">ChatGpt聚合生成测试用例</span></div>
|
||||
|
||||
|
||||
<form style="position: absolute;top: 32px;left:0px;z-index: 1000;cursor: pointer;" id="upload-form">
|
||||
<span data-feather="book"></span>
|
||||
<input class="un_selected" type="file" id="file-input" name="file"><button type="submit">导入Xmind</button>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3 id="h1" style="text-align: center;max-height: 40px;"></h3>
|
||||
<div id="jsmind_container"></div>
|
||||
</body>
|
||||
<script>
|
||||
if (window.feather) {
|
||||
const form = document.getElementById('upload-form');
|
||||
const resultDiv = document.getElementById('result');
|
||||
form.addEventListener('submit', async (event) => {
|
||||
event.preventDefault();
|
||||
const formData = new FormData(form);
|
||||
const response = await fetch('http://127.0.0.1:8000/xmind/list/', {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
});
|
||||
const data = await response.json();
|
||||
resultDiv.innerText = JSON.stringify(data, null, 2);
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
if (window.feather) {
|
||||
window.feather.replace();
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user