Skip to content

Commit

Permalink
解决刷新导致后台断开连接的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Pupil59 committed Apr 27, 2020
1 parent 6b4944c commit 2ab1584
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Binary file modified textMark/db.sqlite3
Binary file not shown.
2 changes: 2 additions & 0 deletions textMark/static/js/cb_entitylist.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
$(document).ready(function()
{
var name = $("#entity_name").val();
//location.reload();
$.ajax({
type:"GET",
url:"/api/project/entities?action=list_entity",
Expand Down Expand Up @@ -38,6 +39,7 @@ $(document).on("click","#submene li",function(){
url:"/api/project/entities",
contentType: "application/json",
dataType:"json",
async:false,
data:JSON.stringify({
"action":"del_entity",
"id": $(this)[0].id.slice(2)
Expand Down
12 changes: 7 additions & 5 deletions textMark/templates/textMark/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h1>
<a target="_top" href="/mgraph" data-title='Graph'>Graph</a>
</li>
<li>
<a data-title='Entity'>Entity</a>
<a data-title='Entity' id="entity">Entity</a>
</li>
<ul id = "submene"></ul>
<li>
Expand Down Expand Up @@ -162,7 +162,8 @@ <h3>
//function sendText() {}
function entitySubmit() {
sendEntity();
getEntities();
location.reload();
//getEntities();
}

function sendEntity() {
Expand All @@ -171,6 +172,7 @@ <h3>
type:"POST",
url:"/api/project/entities",
contentType: "application/json",
async:false,
dataType:"json",
data:JSON.stringify({
"action":"add_entity",
Expand All @@ -184,15 +186,14 @@ <h3>
}
},
})
getEntities();
location.reload();
}

function getEntities() {
//更新添加关系的两个实体下拉栏
$.ajax({
type:"GET",
url:"/api/project/entities?action=list_entity",
async:false,
success: function (data) {
var srcEntity = document.getElementById("source_id");
var dstEntity = document.getElementById("destination_id");
Expand Down Expand Up @@ -230,7 +231,6 @@ <h3>
    }    
    return isExit;
}

function sendRelation() {
var source_id = $("#source_id").val();
var destination_id = $("#destination_id").val();
Expand All @@ -244,6 +244,7 @@ <h3>
url:"/api/project/relations",
contentType: "application/json",
dataType:"json",
async:false,
data:JSON.stringify({
"action":"add_relation",
"data":{
Expand All @@ -270,6 +271,7 @@ <h3>
type:"GET",
url:"/user/other",
contentType: "application/json",
async:false,
success: function (data) {
if (data.ret == 0) {
console.log(data);
Expand Down

0 comments on commit 2ab1584

Please sign in to comment.