add role
This commit is contained in:
@@ -270,5 +270,4 @@ watch([() => messages.value.length, streamingContent], () => {
|
|||||||
padding: 12px;
|
padding: 12px;
|
||||||
border-top: 1px solid #e0e0e0;
|
border-top: 1px solid #e0e0e0;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -195,7 +195,10 @@ async function loadMessages() {
|
|||||||
messages.value = []
|
messages.value = []
|
||||||
selectedRound.value = 0
|
selectedRound.value = 0
|
||||||
try {
|
try {
|
||||||
messages.value = await Prompt.getMessagesByUserTask(props.taskId, props.userId)
|
messages.value = await Prompt.getMessagesByUserTask(
|
||||||
|
props.taskId,
|
||||||
|
props.userId,
|
||||||
|
)
|
||||||
const last = rounds.value.length - 1
|
const last = rounds.value.length - 1
|
||||||
if (last >= 0) selectedRound.value = last
|
if (last >= 0) selectedRound.value = last
|
||||||
} finally {
|
} finally {
|
||||||
@@ -205,6 +208,8 @@ async function loadMessages() {
|
|||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => [props.show, props.userId, props.taskId] as const,
|
() => [props.show, props.userId, props.taskId] as const,
|
||||||
([visible]) => { if (visible) loadMessages() },
|
([visible]) => {
|
||||||
|
if (visible) loadMessages()
|
||||||
|
},
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -45,7 +45,10 @@
|
|||||||
<n-flex vertical>
|
<n-flex vertical>
|
||||||
<n-form inline>
|
<n-form inline>
|
||||||
<n-form-item label="序号" label-placement="left">
|
<n-form-item label="序号" label-placement="left">
|
||||||
<n-input-number v-model:value="challenge.display" />
|
<n-input-number
|
||||||
|
style="width: 100px"
|
||||||
|
v-model:value="challenge.display"
|
||||||
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
|
||||||
<n-form-item label="标题" label-placement="left">
|
<n-form-item label="标题" label-placement="left">
|
||||||
@@ -53,7 +56,11 @@
|
|||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
|
||||||
<n-form-item label="分数" label-placement="left">
|
<n-form-item label="分数" label-placement="left">
|
||||||
<n-input-number v-model:value="challenge.score" :min="0" />
|
<n-input-number
|
||||||
|
style="width: 100px"
|
||||||
|
v-model:value="challenge.score"
|
||||||
|
:min="0"
|
||||||
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
|
||||||
<n-form-item label="公开" label-placement="left">
|
<n-form-item label="公开" label-placement="left">
|
||||||
|
|||||||
@@ -19,22 +19,36 @@
|
|||||||
</n-flex>
|
</n-flex>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { computed } from "vue"
|
||||||
import { taskTab } from "../store/task"
|
import { taskTab } from "../store/task"
|
||||||
import { step } from "../store/tutorial"
|
import { step } from "../store/tutorial"
|
||||||
|
import { roleAdmin, roleSuper } from "../store/user"
|
||||||
import { goHome } from "../utils/helper"
|
import { goHome } from "../utils/helper"
|
||||||
|
|
||||||
const menu = [
|
const menu = computed(() =>
|
||||||
{
|
[
|
||||||
label: "教程",
|
{
|
||||||
route: { name: "tutorial-editor", params: { display: step.value } },
|
label: "教程",
|
||||||
},
|
route: { name: "tutorial-editor", params: { display: step.value } },
|
||||||
{
|
show: roleSuper.value,
|
||||||
label: "挑战",
|
},
|
||||||
route: { name: "challenge-editor", params: { display: 0 } },
|
{
|
||||||
},
|
label: "挑战",
|
||||||
{ label: "用户", route: { name: "user-manage", params: { page: 1 } } },
|
route: { name: "challenge-editor", params: { display: 0 } },
|
||||||
{ label: "提交", route: { name: "submissions", params: { page: 1 } } },
|
show: roleAdmin.value || roleSuper.value,
|
||||||
]
|
},
|
||||||
|
{
|
||||||
|
label: "用户",
|
||||||
|
route: { name: "user-manage", params: { page: 1 } },
|
||||||
|
show: roleSuper.value,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "提交",
|
||||||
|
route: { name: "submissions", params: { page: 1 } },
|
||||||
|
show: roleAdmin.value || roleSuper.value,
|
||||||
|
},
|
||||||
|
].filter((item) => item.show),
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.container {
|
.container {
|
||||||
|
|||||||
@@ -109,7 +109,6 @@ export function sendPrompt(content: string) {
|
|||||||
ws.send(JSON.stringify({ type: "message", content }))
|
ws.send(JSON.stringify({ type: "message", content }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function applyCode(code: {
|
function applyCode(code: {
|
||||||
html: string | null
|
html: string | null
|
||||||
css: string | null
|
css: string | null
|
||||||
|
|||||||
Reference in New Issue
Block a user