|
@@ -57,14 +57,16 @@ class SimpleService{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- async uploadFile(fd) {
|
|
|
|
|
|
|
+ async uploadFile(fd, navigate) {
|
|
|
|
|
+ fd.append("token", this.token_);
|
|
|
const response = await fetch(this.ip().concat( "/upload/"), {
|
|
const response = await fetch(this.ip().concat( "/upload/"), {
|
|
|
method : "POST",
|
|
method : "POST",
|
|
|
body : fd
|
|
body : fd
|
|
|
});
|
|
});
|
|
|
if (!response.ok) {
|
|
if (!response.ok) {
|
|
|
- //const error = await response.json();
|
|
|
|
|
- console.error('error');
|
|
|
|
|
|
|
+ if (response.status == 401) {
|
|
|
|
|
+ navigate("/editor/signin");
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
const data = await response.json();
|
|
const data = await response.json();
|
|
|
return data;
|
|
return data;
|
|
@@ -202,11 +204,13 @@ class SimpleService{
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- async generateZygczgj(name, id) {
|
|
|
|
|
|
|
+ async generateZygczgj(name, id, navigate) {
|
|
|
const response = await fetch(this.ip().concat( "/zygczgj/"), {
|
|
const response = await fetch(this.ip().concat( "/zygczgj/"), {
|
|
|
method : "POST",
|
|
method : "POST",
|
|
|
headers: {
|
|
headers: {
|
|
|
- "Content-type": "application/json"
|
|
|
|
|
|
|
+ "Content-type": "application/json",
|
|
|
|
|
+ 'Authorization': `Bearer ${this.token_}`
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
body: JSON.stringify({
|
|
body: JSON.stringify({
|
|
|
name: name,
|
|
name: name,
|
|
@@ -214,8 +218,9 @@ class SimpleService{
|
|
|
})
|
|
})
|
|
|
});
|
|
});
|
|
|
if (!response.ok) {
|
|
if (!response.ok) {
|
|
|
- //const error = await response.json();
|
|
|
|
|
- console.error('error');
|
|
|
|
|
|
|
+ if (response.status == 401) {
|
|
|
|
|
+ navigate("/editor/signin");
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
const data = await response.json();
|
|
const data = await response.json();
|
|
|
return data;
|
|
return data;
|
|
@@ -225,11 +230,12 @@ class SimpleService{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- async generateZongchengbaofuwufei2(name, id) {
|
|
|
|
|
|
|
+ async generateZongchengbaofuwufei2(name, id, navigate) {
|
|
|
const response = await fetch(this.ip().concat( "/zongchengbaofuwufei2/"), {
|
|
const response = await fetch(this.ip().concat( "/zongchengbaofuwufei2/"), {
|
|
|
method : "POST",
|
|
method : "POST",
|
|
|
headers: {
|
|
headers: {
|
|
|
- "Content-type": "application/json"
|
|
|
|
|
|
|
+ "Content-type": "application/json",
|
|
|
|
|
+ 'Authorization': `Bearer ${this.token_}`
|
|
|
},
|
|
},
|
|
|
body: JSON.stringify({
|
|
body: JSON.stringify({
|
|
|
name: name,
|
|
name: name,
|
|
@@ -237,19 +243,21 @@ class SimpleService{
|
|
|
})
|
|
})
|
|
|
});
|
|
});
|
|
|
if (!response.ok) {
|
|
if (!response.ok) {
|
|
|
- //const error = await response.json();
|
|
|
|
|
- console.error('error');
|
|
|
|
|
|
|
+ if (response.status == 401) {
|
|
|
|
|
+ navigate("/editor/signin");
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
const data = await response.json();
|
|
const data = await response.json();
|
|
|
return data;
|
|
return data;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- async generateFabaorengongyingcailiao2(name, id) {
|
|
|
|
|
|
|
+ async generateFabaorengongyingcailiao2(name, id, navigate) {
|
|
|
const response = await fetch(this.ip().concat( "/fabaorengongyingcailiao2/"), {
|
|
const response = await fetch(this.ip().concat( "/fabaorengongyingcailiao2/"), {
|
|
|
method : "POST",
|
|
method : "POST",
|
|
|
headers: {
|
|
headers: {
|
|
|
- "Content-type": "application/json"
|
|
|
|
|
|
|
+ "Content-type": "application/json",
|
|
|
|
|
+ 'Authorization': `Bearer ${this.token_}`
|
|
|
},
|
|
},
|
|
|
body: JSON.stringify({
|
|
body: JSON.stringify({
|
|
|
name: name,
|
|
name: name,
|
|
@@ -257,8 +265,9 @@ class SimpleService{
|
|
|
})
|
|
})
|
|
|
});
|
|
});
|
|
|
if (!response.ok) {
|
|
if (!response.ok) {
|
|
|
- //const error = await response.json();
|
|
|
|
|
- console.error('error');
|
|
|
|
|
|
|
+ if (response.status == 401) {
|
|
|
|
|
+ navigate("/editor/signin");
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
const data = await response.json();
|
|
const data = await response.json();
|
|
|
return data;
|
|
return data;
|
|
@@ -270,11 +279,12 @@ class SimpleService{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- async generateJirigong2(name, id) {
|
|
|
|
|
|
|
+ async generateJirigong2(name, id, navigate) {
|
|
|
const response = await fetch(this.ip().concat("/jirigong2/"), {
|
|
const response = await fetch(this.ip().concat("/jirigong2/"), {
|
|
|
method : "POST",
|
|
method : "POST",
|
|
|
headers: {
|
|
headers: {
|
|
|
- "Content-type": "application/json"
|
|
|
|
|
|
|
+ "Content-type": "application/json",
|
|
|
|
|
+ 'Authorization': `Bearer ${this.token_}`
|
|
|
},
|
|
},
|
|
|
body: JSON.stringify({
|
|
body: JSON.stringify({
|
|
|
name: name,
|
|
name: name,
|
|
@@ -282,8 +292,9 @@ class SimpleService{
|
|
|
})
|
|
})
|
|
|
});
|
|
});
|
|
|
if (!response.ok) {
|
|
if (!response.ok) {
|
|
|
- //const error = await response.json();
|
|
|
|
|
- console.error('error');
|
|
|
|
|
|
|
+ if (response.status == 401) {
|
|
|
|
|
+ navigate("/editor/signin");
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
const data = await response.json();
|
|
const data = await response.json();
|
|
|
return data;
|
|
return data;
|
|
@@ -291,11 +302,12 @@ class SimpleService{
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- async generateZanliejine2(name, id) {
|
|
|
|
|
|
|
+ async generateZanliejine2(name, id, navigate) {
|
|
|
const response = await fetch(this.ip().concat( "/zanliejine2/"), {
|
|
const response = await fetch(this.ip().concat( "/zanliejine2/"), {
|
|
|
method : "POST",
|
|
method : "POST",
|
|
|
headers: {
|
|
headers: {
|
|
|
- "Content-type": "application/json"
|
|
|
|
|
|
|
+ "Content-type": "application/json",
|
|
|
|
|
+ 'Authorization': `Bearer ${this.token_}`
|
|
|
},
|
|
},
|
|
|
body: JSON.stringify({
|
|
body: JSON.stringify({
|
|
|
name: name,
|
|
name: name,
|
|
@@ -303,8 +315,9 @@ class SimpleService{
|
|
|
})
|
|
})
|
|
|
});
|
|
});
|
|
|
if (!response.ok) {
|
|
if (!response.ok) {
|
|
|
- //const error = await response.json();
|
|
|
|
|
- console.error('error');
|
|
|
|
|
|
|
+ if (response.status == 401) {
|
|
|
|
|
+ navigate("/editor/signin");
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
const data = await response.json();
|
|
const data = await response.json();
|
|
|
return data;
|
|
return data;
|
|
@@ -420,11 +433,12 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
return data;
|
|
return data;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- async deleteFiles(id) {
|
|
|
|
|
|
|
+ async deleteFiles(id, navigate) {
|
|
|
const response = await fetch(this.ip().concat( "/deleteFile/"), {
|
|
const response = await fetch(this.ip().concat( "/deleteFile/"), {
|
|
|
method : "POST",
|
|
method : "POST",
|
|
|
headers: {
|
|
headers: {
|
|
|
- "Content-type": "application/json"
|
|
|
|
|
|
|
+ "Content-type": "application/json",
|
|
|
|
|
+ 'Authorization': `Bearer ${this.token_}`
|
|
|
},
|
|
},
|
|
|
body: JSON.stringify(
|
|
body: JSON.stringify(
|
|
|
{
|
|
{
|
|
@@ -434,8 +448,9 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
)
|
|
)
|
|
|
});
|
|
});
|
|
|
if (!response.ok) {
|
|
if (!response.ok) {
|
|
|
- //const error = await response.json();
|
|
|
|
|
- console.error('error');
|
|
|
|
|
|
|
+ if (response.status == 401) {
|
|
|
|
|
+ navigate("/editor/signin");
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
const data = await response.json();
|
|
const data = await response.json();
|
|
|
return data;
|
|
return data;
|
|
@@ -582,11 +597,12 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- async generateJiagongcai(name) {
|
|
|
|
|
|
|
+ async generateJiagongcai(name, navigate) {
|
|
|
const response = await fetch(this.ip().concat( "/jiagongcai/"), {
|
|
const response = await fetch(this.ip().concat( "/jiagongcai/"), {
|
|
|
method : "POST",
|
|
method : "POST",
|
|
|
headers: {
|
|
headers: {
|
|
|
- "Content-type": "application/json"
|
|
|
|
|
|
|
+ "Content-type": "application/json",
|
|
|
|
|
+ 'Authorization': `Bearer ${this.token_}`
|
|
|
},
|
|
},
|
|
|
body: JSON.stringify(
|
|
body: JSON.stringify(
|
|
|
{
|
|
{
|
|
@@ -596,8 +612,9 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
)
|
|
)
|
|
|
});
|
|
});
|
|
|
if (!response.ok) {
|
|
if (!response.ok) {
|
|
|
- //const error = await response.json();
|
|
|
|
|
- console.error('error');
|
|
|
|
|
|
|
+ if (response.status == 401) {
|
|
|
|
|
+ navigate("/editor/signin");
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
const data = await response.json();
|
|
const data = await response.json();
|
|
|
return data;
|
|
return data;
|
|
@@ -609,7 +626,8 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
const response = await fetch(this.ip().concat( "/applyFL/"), {
|
|
const response = await fetch(this.ip().concat( "/applyFL/"), {
|
|
|
method : "POST",
|
|
method : "POST",
|
|
|
headers: {
|
|
headers: {
|
|
|
- "Content-type": "application/json"
|
|
|
|
|
|
|
+ "Content-type": "application/json",
|
|
|
|
|
+ 'Authorization': `Bearer ${this.token_}`
|
|
|
},
|
|
},
|
|
|
body: JSON.stringify(
|
|
body: JSON.stringify(
|
|
|
{
|
|
{
|
|
@@ -628,7 +646,14 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async download(id) {
|
|
async download(id) {
|
|
|
- const response = await fetch(this.ip().concat( "/download/").concat(id.toString()));
|
|
|
|
|
|
|
+ const response = await fetch(this.ip().concat( "/download/").concat(id.toString()),
|
|
|
|
|
+ {
|
|
|
|
|
+ method: "GET",
|
|
|
|
|
+ headers : {
|
|
|
|
|
+ 'Authorization': `Bearer ${this.token_}`
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
if (!response.ok) {
|
|
if (!response.ok) {
|
|
|
//const error = await response.json();
|
|
//const error = await response.json();
|
|
@@ -646,7 +671,8 @@ async generateQingdanTuijian(name, bh, bt, bm) {
|
|
|
const response = await fetch(this.ip().concat( "/updatezjcs/"), {
|
|
const response = await fetch(this.ip().concat( "/updatezjcs/"), {
|
|
|
method : "POST",
|
|
method : "POST",
|
|
|
headers: {
|
|
headers: {
|
|
|
- "Content-type": "application/json"
|
|
|
|
|
|
|
+ "Content-type": "application/json",
|
|
|
|
|
+ 'Authorization': `Bearer ${this.token_}`
|
|
|
},
|
|
},
|
|
|
body: JSON.stringify(
|
|
body: JSON.stringify(
|
|
|
{
|
|
{
|