remove useAxios.

This commit is contained in:
2023-01-23 21:35:10 +08:00
parent 8e05cb601d
commit b060262f70
18 changed files with 459 additions and 194 deletions

View File

@@ -39,12 +39,11 @@ const theme = useThemeVars()
const userStore = useUserStore()
const problems = ref<ProblemFiltered[]>([])
const total = ref(0)
const { data } = getProblemTagList()
const tags = ref<{ id: number; name: string }[]>([])
const tagOptions = computed(() => [
{ label: "全部", value: "" },
...(data.value?.map((t) => ({ label: t.name, value: t.name })) || []),
...(tags.value?.map((t) => ({ label: t.name, value: t.name })) || []),
])
const query = reactive<Query>({
@@ -73,6 +72,11 @@ async function listProblems() {
problems.value = res.results
}
async function listTags() {
const res = await getProblemTagList()
tags.value = res.data
}
function routerPush() {
router.push({
path: route.path,
@@ -115,13 +119,16 @@ watch(
// TODO: 这里会在登录时候执行两次有BUG
watch(() => userStore.isFinished && userStore.isAuthed, listProblems)
onMounted(listProblems)
onMounted(() => {
listProblems()
listTags()
})
const columns: DataTableColumn<ProblemFiltered>[] = [
{
title: "状态",
key: "status",
width: 80,
width: 60,
render: (row) => {
if (row.status === "passed") {
return h(NIcon, { color: theme.value.successColor }, () => h(Select))