Commit b36d2c4c authored by Yuan Zhixiang's avatar Yuan Zhixiang
Browse files

添加了网络请求报错提示

parent 2661d45f
......@@ -14,7 +14,7 @@ const stdin_input = ref('') // 用户输入的测试用例
function send_request() { // 将输入的代码/测试用例发送给后端
data.value = {}
let code = code_input.value
code = code.replace(/ /g,' ')
code = code.replace(/ /g, ' ')
if (stdin_input.value.length == 0) {
axios.post(base_url + '/visualize', {
code: code
......@@ -28,7 +28,17 @@ function send_request() { // 将输入的代码/测试用例发送给后端
parse_result()
})
.catch(error => {
data.value = {
"trace": [
{
"event": "uncaught_exception",
"exception_msg": "network error",
"line": 1
}
]
}
console.error(error);
parse_result()
});
} else {
axios.post(base_url + '/visualize', {
......@@ -44,7 +54,17 @@ function send_request() { // 将输入的代码/测试用例发送给后端
parse_result()
})
.catch(error => {
data.value = {
"trace": [
{
"event": "uncaught_exception",
"exception_msg": "network error",
"line": 1
}
]
}
console.error(error);
parse_result()
});
}
}
......
......@@ -12,7 +12,7 @@ const { exception_msg, try_failed } = inject('app')
</div>
<div class="info-view" v-show="try_failed">
<p class="big-face">🤔</p>
<p>你的代码好像有问题?</p><br>
<p>好像出了点问题?</p><br>
<p>{{ exception_msg }}</p>
</div>
</template>
......@@ -25,6 +25,6 @@ const { exception_msg, try_failed } = inject('app')
}
.big-face {
font-size: 8rem;
font-size: 7rem;
}
</style>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment