Skip to content

Commit 83d3c92

Browse files
committed
fix: resp data changed
1 parent b0fac62 commit 83d3c92

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/components/tabList.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,22 @@ let isRunning = ref(false);
1818
async function run(params: string) {
1919
isRunning.value = true;
2020
try {
21-
let re = await axios.post<{ result: string }>(
21+
let re = await axios.post<{ runOutput: string, status:number, compileOutput: string }>(
2222
"https://code.lang.pivotstudio.cn/coderunner",
2323
{
2424
code: params,
2525
}
2626
);
2727
isRunning.value = false;
28-
if (!re.data.result) {
28+
if (re.data.status === 1) {
29+
emit("updateOutput", re.data.compileOutput);
30+
return;
31+
}
32+
if (!re.data.runOutput && re.data.status === 0) {
2933
emit("updateOutput", "run success with no output");
3034
return;
3135
}
32-
emit("updateOutput", re.data.result);
36+
emit("updateOutput", re.data.runOutput);
3337
} catch (error) {
3438
isRunning.value = false;
3539
emit("updateOutput", error);

src/constant/monacoCodes.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ pub fn main() i64 {
9696
// 0, 1, 1, 0, 0
9797
// 1, 0, 0, 1, 1
9898
let mp = [[1, 0, 1, 1, 1], [1, 1, 0, 1, 1], [1, 0, 0, 1, 1], [0, 1, 1, 0, 0], [1, 0, 0, 1, 1]];
99-
panic::assert(count(mp) == 5);
100-
println!(count(mp));
99+
let c = count(mp);
100+
panic::assert(c == 5);
101+
println!(c);
101102
return 0;
102103
}
103104
@@ -129,7 +130,8 @@ pub fn count(mp: [[i64]]) i64 {
129130
return res;
130131
}
131132
132-
133+
134+
133135
`,
134136
},
135137
];

0 commit comments

Comments
 (0)