update
This commit is contained in:
@@ -17,7 +17,6 @@ import { useUserStore } from "shared/store/user"
|
|||||||
import storage from "utils/storage"
|
import storage from "utils/storage"
|
||||||
import type { LANGUAGE } from "utils/types"
|
import type { LANGUAGE } from "utils/types"
|
||||||
import StatisticsPanel from "shared/components/StatisticsPanel.vue"
|
import StatisticsPanel from "shared/components/StatisticsPanel.vue"
|
||||||
import IconButton from "shared/components/IconButton.vue"
|
|
||||||
import { Icon } from "@iconify/vue"
|
import { Icon } from "@iconify/vue"
|
||||||
import { NFlex } from "naive-ui"
|
import { NFlex } from "naive-ui"
|
||||||
import SubmitCode from "./SubmitCode.vue"
|
import SubmitCode from "./SubmitCode.vue"
|
||||||
@@ -72,35 +71,28 @@ const showGoSubmissionButton = computed(() => {
|
|||||||
else return false
|
else return false
|
||||||
})
|
})
|
||||||
|
|
||||||
// 移动端把「提交信息 / 统计信息 / 复制代码 / 重置代码」收进下拉菜单,节省横向空间
|
|
||||||
const renderIcon = (icon: string) => () => h(Icon, { icon, width: 18 })
|
|
||||||
|
|
||||||
const mobileMenuOptions = computed<DropdownOption[]>(() => {
|
const mobileMenuOptions = computed<DropdownOption[]>(() => {
|
||||||
const options: DropdownOption[] = []
|
const options: DropdownOption[] = []
|
||||||
if (showGoSubmissionButton.value) {
|
if (showGoSubmissionButton.value) {
|
||||||
options.push({
|
options.push({
|
||||||
label: "提交信息",
|
label: "提交信息",
|
||||||
key: "submissions",
|
key: "submissions",
|
||||||
icon: renderIcon("streamline-ultimate-color:task-list-text-1"),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (userStore.isTeacherOrAbove) {
|
if (userStore.isTeacherOrAbove) {
|
||||||
options.push({
|
options.push({
|
||||||
label: "统计信息",
|
label: "统计信息",
|
||||||
key: "statistics",
|
key: "statistics",
|
||||||
icon: renderIcon("streamline-ultimate-color:analytics-pie-2"),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (codeStore.code.language !== "Flowchart") {
|
if (codeStore.code.language !== "Flowchart") {
|
||||||
options.push({
|
options.push({
|
||||||
label: "复制代码",
|
label: "复制代码",
|
||||||
key: "copy",
|
key: "copy",
|
||||||
icon: renderIcon("streamline-ultimate-color:copy-paste-1"),
|
|
||||||
})
|
})
|
||||||
options.push({
|
options.push({
|
||||||
label: "重置代码",
|
label: "重置代码",
|
||||||
key: "reset",
|
key: "reset",
|
||||||
icon: renderIcon("streamline-ultimate-color:synchronize-arrow"),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return options
|
return options
|
||||||
@@ -211,41 +203,38 @@ onMounted(() => {
|
|||||||
|
|
||||||
<SubmitCode v-else />
|
<SubmitCode v-else />
|
||||||
|
|
||||||
<IconButton
|
<n-button
|
||||||
v-if="isDesktop && showGoSubmissionButton"
|
v-if="isDesktop && showGoSubmissionButton"
|
||||||
icon="streamline-ultimate-color:task-list-text-1"
|
:size="buttonSize"
|
||||||
tip="提交信息"
|
|
||||||
@click="goSubmissions"
|
@click="goSubmissions"
|
||||||
/>
|
>
|
||||||
|
提交信息
|
||||||
|
</n-button>
|
||||||
|
|
||||||
<IconButton
|
<n-button
|
||||||
v-if="isDesktop && userStore.isTeacherOrAbove"
|
v-if="isDesktop && userStore.isTeacherOrAbove"
|
||||||
icon="streamline-ultimate-color:analytics-pie-2"
|
:size="buttonSize"
|
||||||
tip="统计信息"
|
|
||||||
@click="statisticPanel = true"
|
@click="statisticPanel = true"
|
||||||
/>
|
>
|
||||||
|
统计信息
|
||||||
|
</n-button>
|
||||||
|
|
||||||
<template v-if="codeStore.code.language !== 'Flowchart'">
|
<template v-if="codeStore.code.language !== 'Flowchart'">
|
||||||
<IconButton
|
<n-button
|
||||||
v-if="codeStore.code.language !== 'SQL'"
|
v-if="codeStore.code.language !== 'SQL'"
|
||||||
icon="streamline-ultimate-color:business-lucky-cat"
|
:size="buttonSize"
|
||||||
tip="自测猫"
|
|
||||||
@click="goTestCat"
|
@click="goTestCat"
|
||||||
/>
|
>
|
||||||
|
自测猫
|
||||||
|
</n-button>
|
||||||
|
|
||||||
<IconButton
|
<n-button v-if="isDesktop" :size="buttonSize" @click="copy">
|
||||||
v-if="isDesktop"
|
复制代码
|
||||||
icon="streamline-ultimate-color:copy-paste-1"
|
</n-button>
|
||||||
tip="复制代码"
|
|
||||||
@click="copy"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<IconButton
|
<n-button v-if="isDesktop" :size="buttonSize" @click="reset">
|
||||||
v-if="isDesktop"
|
重置代码
|
||||||
icon="streamline-ultimate-color:synchronize-arrow"
|
</n-button>
|
||||||
tip="重置代码"
|
|
||||||
@click="reset"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 移动端:提交信息 / 统计信息 / 复制代码 / 重置代码 收进下拉菜单 -->
|
<!-- 移动端:提交信息 / 统计信息 / 复制代码 / 重置代码 收进下拉菜单 -->
|
||||||
@@ -255,25 +244,17 @@ onMounted(() => {
|
|||||||
:options="mobileMenuOptions"
|
:options="mobileMenuOptions"
|
||||||
@select="handleMobileSelect"
|
@select="handleMobileSelect"
|
||||||
>
|
>
|
||||||
<n-button round size="small">
|
<n-button size="small">更多</n-button>
|
||||||
更多
|
|
||||||
<template #icon>
|
|
||||||
<Icon icon="streamline-ultimate-color:navigation-menu-vertical" />
|
|
||||||
</template>
|
|
||||||
</n-button>
|
|
||||||
</n-dropdown>
|
</n-dropdown>
|
||||||
|
|
||||||
<template v-if="showSyncFeature">
|
<template v-if="showSyncFeature">
|
||||||
<IconButton
|
<n-button
|
||||||
:icon="
|
:size="buttonSize"
|
||||||
syncEnabled
|
|
||||||
? 'streamline-ultimate-color:wifi-off'
|
|
||||||
: 'streamline-ultimate-color:wifi-signal-2'
|
|
||||||
"
|
|
||||||
:tip="syncEnabled ? SYNC_MESSAGES.SYNC_ON : SYNC_MESSAGES.SYNC_OFF"
|
|
||||||
:type="syncEnabled ? 'warning' : 'default'"
|
:type="syncEnabled ? 'warning' : 'default'"
|
||||||
@click="toggleSync"
|
@click="toggleSync"
|
||||||
/>
|
>
|
||||||
|
{{ syncEnabled ? SYNC_MESSAGES.SYNC_ON : SYNC_MESSAGES.SYNC_OFF }}
|
||||||
|
</n-button>
|
||||||
|
|
||||||
<!-- 同步状态标签 -->
|
<!-- 同步状态标签 -->
|
||||||
<template v-if="isConnected">
|
<template v-if="isConnected">
|
||||||
@@ -293,12 +274,13 @@ onMounted(() => {
|
|||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<IconButton
|
<n-button
|
||||||
v-if="isDesktop && userStore.isSuperAdmin"
|
v-if="isDesktop && userStore.isSuperAdmin"
|
||||||
icon="streamline-ultimate-color:common-file-edit"
|
:size="buttonSize"
|
||||||
tip="编辑题目"
|
|
||||||
@click="goEdit"
|
@click="goEdit"
|
||||||
/>
|
>
|
||||||
|
编辑题目
|
||||||
|
</n-button>
|
||||||
</n-flex>
|
</n-flex>
|
||||||
|
|
||||||
<n-modal
|
<n-modal
|
||||||
|
|||||||
Reference in New Issue
Block a user