Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
健杭 徐
intern_project_frontend_backend
Commits
4ab1ada5
Commit
4ab1ada5
authored
Aug 27, 2025
by
健杭 徐
Browse files
111
parent
2be90194
Changes
2
Hide whitespace changes
Inline
Side-by-side
comment-system/static/src/App.tsx
View file @
4ab1ada5
...
@@ -16,9 +16,9 @@ async function AddComment({ name, onSuccess }: { name: string; onSuccess: () =>
...
@@ -16,9 +16,9 @@ async function AddComment({ name, onSuccess }: { name: string; onSuccess: () =>
const
response
=
await
fetch
(
COMMENT_ADD
,
{
const
response
=
await
fetch
(
COMMENT_ADD
,
{
method
:
'
POST
'
,
method
:
'
POST
'
,
headers
:
{
'
Content-Type
'
:
'
application/json
'
},
headers
:
{
'
Content-Type
'
:
'
application/json
'
},
body
:
JSON
.
stringify
({
name
,
content
,
created_at
:
new
Date
().
toISOString
()
})
body
:
JSON
.
stringify
({
name
,
content
})
});
});
const
result
=
await
response
.
json
();
const
result
=
await
response
.
json
();
if
(
result
.
code
!==
0
)
{
if
(
result
.
code
!==
0
)
{
alert
(
`操作失败:
${
result
.
msg
}
`
);
alert
(
`操作失败:
${
result
.
msg
}
`
);
...
@@ -28,7 +28,6 @@ async function AddComment({ name, onSuccess }: { name: string; onSuccess: () =>
...
@@ -28,7 +28,6 @@ async function AddComment({ name, onSuccess }: { name: string; onSuccess: () =>
textInput
.
value
=
''
;
textInput
.
value
=
''
;
(
document
.
getElementById
(
'
nameInput
'
)
as
HTMLInputElement
).
value
=
''
;
(
document
.
getElementById
(
'
nameInput
'
)
as
HTMLInputElement
).
value
=
''
;
onSuccess
();
onSuccess
();
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'
添加评论失败:
'
,
error
);
console
.
error
(
'
添加评论失败:
'
,
error
);
}
}
...
...
comment-system/static/src/assets/const.tsx
View file @
4ab1ada5
export
const
COMMENT_ADD
:
string
=
'
http://localhost:8080/comment/add
'
const
IP
:
string
=
'
http://10.197.150.54:8080
'
export
const
COMMENT_GET
:
string
=
'
http://localhost:8080/comment/get
'
export
const
COMMENT_DEL
:
string
=
'
http://localhost:8080/comment/delete
'
export
const
COMMENT_ADD
:
string
=
IP
+
'
/comment/add
'
\ No newline at end of file
export
const
COMMENT_GET
:
string
=
IP
+
'
/comment/get
'
export
const
COMMENT_DEL
:
string
=
IP
+
'
/comment/delete
'
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment