Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Yuan Zhixiang
c-render-vue
Commits
b36d2c4c
Commit
b36d2c4c
authored
Apr 13, 2024
by
Yuan Zhixiang
Browse files
添加了网络请求报错提示
parent
2661d45f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/App.vue
View file @
b36d2c4c
...
@@ -14,7 +14,7 @@ const stdin_input = ref('') // 用户输入的测试用例
...
@@ -14,7 +14,7 @@ const stdin_input = ref('') // 用户输入的测试用例
function
send_request
()
{
// 将输入的代码/测试用例发送给后端
function
send_request
()
{
// 将输入的代码/测试用例发送给后端
data
.
value
=
{}
data
.
value
=
{}
let
code
=
code_input
.
value
let
code
=
code_input
.
value
code
=
code
.
replace
(
/ /g
,
'
'
)
code
=
code
.
replace
(
/ /g
,
'
'
)
if
(
stdin_input
.
value
.
length
==
0
)
{
if
(
stdin_input
.
value
.
length
==
0
)
{
axios
.
post
(
base_url
+
'
/visualize
'
,
{
axios
.
post
(
base_url
+
'
/visualize
'
,
{
code
:
code
code
:
code
...
@@ -28,7 +28,17 @@ function send_request() { // 将输入的代码/测试用例发送给后端
...
@@ -28,7 +28,17 @@ function send_request() { // 将输入的代码/测试用例发送给后端
parse_result
()
parse_result
()
})
})
.
catch
(
error
=>
{
.
catch
(
error
=>
{
data
.
value
=
{
"
trace
"
:
[
{
"
event
"
:
"
uncaught_exception
"
,
"
exception_msg
"
:
"
network error
"
,
"
line
"
:
1
}
]
}
console
.
error
(
error
);
console
.
error
(
error
);
parse_result
()
});
});
}
else
{
}
else
{
axios
.
post
(
base_url
+
'
/visualize
'
,
{
axios
.
post
(
base_url
+
'
/visualize
'
,
{
...
@@ -44,7 +54,17 @@ function send_request() { // 将输入的代码/测试用例发送给后端
...
@@ -44,7 +54,17 @@ function send_request() { // 将输入的代码/测试用例发送给后端
parse_result
()
parse_result
()
})
})
.
catch
(
error
=>
{
.
catch
(
error
=>
{
data
.
value
=
{
"
trace
"
:
[
{
"
event
"
:
"
uncaught_exception
"
,
"
exception_msg
"
:
"
network error
"
,
"
line
"
:
1
}
]
}
console
.
error
(
error
);
console
.
error
(
error
);
parse_result
()
});
});
}
}
}
}
...
...
src/components/InfoView.vue
View file @
b36d2c4c
...
@@ -12,7 +12,7 @@ const { exception_msg, try_failed } = inject('app')
...
@@ -12,7 +12,7 @@ const { exception_msg, try_failed } = inject('app')
</div>
</div>
<div
class=
"info-view"
v-show=
"try_failed"
>
<div
class=
"info-view"
v-show=
"try_failed"
>
<p
class=
"big-face"
>
🤔
</p>
<p
class=
"big-face"
>
🤔
</p>
<p>
你的代码好像有
问题?
</p><br>
<p>
好像出了点
问题?
</p><br>
<p>
{{
exception_msg
}}
</p>
<p>
{{
exception_msg
}}
</p>
</div>
</div>
</
template
>
</
template
>
...
@@ -25,6 +25,6 @@ const { exception_msg, try_failed } = inject('app')
...
@@ -25,6 +25,6 @@ const { exception_msg, try_failed } = inject('app')
}
}
.big-face
{
.big-face
{
font-size
:
8
rem
;
font-size
:
7
rem
;
}
}
</
style
>
</
style
>
\ 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