提交 77229fcc authored 作者: 王鹏飞's avatar 王鹏飞

chore: update

上级 d36d9426
...@@ -8,12 +8,12 @@ import type { ...@@ -8,12 +8,12 @@ import type {
} from './types' } from './types'
// 获取赛项列表 // 获取赛项列表
export function getContestItemList(params?: { page?: number; 'per-page'?: number }) { export function getContestList(params?: { page?: number; 'per-page'?: number }) {
return httpRequest.get('/api/resource/v1/backend/competition/list', { params }) return httpRequest.get('/api/resource/v1/backend/competition/list', { params })
} }
// 获取赛项详情 // 获取赛项详情
export function getContestItem(params: { id: string }) { export function getContest(params: { id: string }) {
return httpRequest.get('/api/resource/v1/backend/competition/detail', { params }) return httpRequest.get('/api/resource/v1/backend/competition/detail', { params })
} }
...@@ -32,9 +32,32 @@ export function getTeacherList(params?: { name?: string }) { ...@@ -32,9 +32,32 @@ export function getTeacherList(params?: { name?: string }) {
return httpRequest.get('/api/resource/v1/backend/teacher/faculty-advisers', { params }) return httpRequest.get('/api/resource/v1/backend/teacher/faculty-advisers', { params })
} }
// 获取评分规则详情
export function getContestRules(params: { competition_id: string }) {
return httpRequest.get('/api/resource/v1/backend/competition-rule/detail', { params })
}
// 更新评分规则 // 更新评分规则
export function updateContestRules(data: ContestUpdateParams) { export function updateContestRules(data: ContestUpdateParams) {
return httpRequest.post('/api/resource/v1/backend/competition-rule/save', data) return httpRequest.post('/api/resource/v1/backend/competition-rule/save', data, {
headers: { 'Content-Type': 'application/json' }
})
}
// 获取考试列表
export function getExamList(params: { project: string; q?: string; name?: string; page?: number; per_page?: number }) {
return httpRequest.get('/api/resource/v1/backend/exam/search-all-exam', { params })
}
// 获取评分细则详情
export function getContestRuleBook(params: { competition_id: string }) {
return httpRequest.get('/api/resource/v1/backend/competition-rubric/detail', { params })
}
// 创建评分细则
export function createContestRuleBook(data: ContestBookUpdateParams) {
return httpRequest.post('/api/resource/v1/backend/competition-rubric/create', data)
}
// 更新评分细则
export function updateContestRuleBook(data: ContestBookUpdateParams) {
return httpRequest.post('/api/resource/v1/backend/competition-rubric/update', data)
} }
// 获取赛项指导书详情 // 获取赛项指导书详情
...@@ -80,25 +103,25 @@ export function deleteContestVideo(data: { id: string }) { ...@@ -80,25 +103,25 @@ export function deleteContestVideo(data: { id: string }) {
} }
// 获取赛项评分专家列表 // 获取赛项评分专家列表
export function getContestJudgeList(params: { id: string }) { export function getContestExpertList(params: { id: string }) {
return httpRequest.get('/api/resource/v1/backend/competition/experts', { params }) return httpRequest.get('/api/resource/v1/backend/competition/experts', { params })
} }
// 获取赛项未绑定的评分专家列表 // 获取赛项未绑定的评分专家列表
export function getContestUnbindJudgeList(params: { competition_id: string }) { export function getContestUnbindExpertList(params: { competition_id: string }) {
return httpRequest.get('/api/resource/v1/backend/expert/unbind-competition-list', { params }) return httpRequest.get('/api/resource/v1/backend/expert/unbind-competition-list', { params })
} }
// 更新赛项评分专家 // 更新赛项评分专家
export function updateContestJudge(data: { id: string; experts: Record<string, any>[] }) { export function updateContestExpert(data: { id: string; experts: Record<string, any>[] }) {
return httpRequest.post('/api/resource/v1/backend/competition/bind-experts', data, { return httpRequest.post('/api/resource/v1/backend/competition/bind-experts', data, {
headers: { 'Content-Type': 'application/json' } headers: { 'Content-Type': 'application/json' }
}) })
} }
// 获取评分专家详情 // 获取评分专家详情
export function getJudge(params: { id: string }) { export function getExpert(params: { id: string }) {
return httpRequest.get('/api/resource/v1/backend/expert/detail', { params }) return httpRequest.get('/api/resource/v1/backend/expert/detail', { params })
} }
// 获取赛项选手列表 // 获取赛项选手列表
export function getContestContestantList(params?: { student_name?: string; page?: number; 'per-page'?: number }) { export function getContestantList(params?: { student_name?: string; page?: number; 'per-page'?: number }) {
return httpRequest.get('/api/resource/v1/backend/competition-competitor/list', { params }) return httpRequest.get('/api/resource/v1/backend/competition-competitor/list', { params })
} }
<script setup lang="ts"> <script setup lang="ts">
import type { ContestItem } from '../types' import type { ContestItem } from '../types'
import AppList from '@/components/base/AppList.vue' import AppList from '@/components/base/AppList.vue'
import { getContestContestantList } from '../api' import { getContestantList } from '../api'
import { useMapStore } from '@/stores/map' import { useMapStore } from '@/stores/map'
const detail = $ref<ContestItem>(inject('detail')) const detail = $ref<ContestItem>(inject('detail'))
...@@ -12,7 +12,7 @@ const genderList = useMapStore().getMapValuesByKey('system_gender') ...@@ -12,7 +12,7 @@ const genderList = useMapStore().getMapValuesByKey('system_gender')
const listOptions = { const listOptions = {
remote: { remote: {
httpRequest: getContestContestantList, httpRequest: getContestantList,
params: { competition_id: detail.id, student_name: '' } params: { competition_id: detail.id, student_name: '' }
}, },
filters: [{ type: 'input', prop: 'student_name', label: '选手姓名', placeholder: '请输入选手姓名' }], filters: [{ type: 'input', prop: 'student_name', label: '选手姓名', placeholder: '请输入选手姓名' }],
......
<script setup lang="ts"> <script setup lang="ts">
import type { FormInstance, FormRules } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus'
import type { ContestItem } from '../types' import type { ContestItem } from '../types'
import { getContestUnbindJudgeList, getJudge } from '../api' import { getContestUnbindExpertList, getExpert } from '../api'
import { useMapStore } from '@/stores/map' import { useMapStore } from '@/stores/map'
const emit = defineEmits<{ const emit = defineEmits<{
...@@ -15,14 +15,14 @@ const detail = $ref<ContestItem>(inject('detail')) ...@@ -15,14 +15,14 @@ const detail = $ref<ContestItem>(inject('detail'))
let list = $ref<any>([]) let list = $ref<any>([])
function fetchList() { function fetchList() {
getContestUnbindJudgeList({ competition_id: detail.id }).then(res => { getContestUnbindExpertList({ competition_id: detail.id }).then(res => {
list = res.data.list || [] list = res.data.list || []
}) })
} }
let info = $ref<any>() let info = $ref<any>()
function fetchInfo(id: string) { function fetchInfo(id: string) {
if (id) { if (id) {
getJudge({ id }).then(res => { getExpert({ id }).then(res => {
info = res.data.detail info = res.data.detail
}) })
} else { } else {
......
...@@ -3,7 +3,7 @@ import type { ContestItem } from '../types' ...@@ -3,7 +3,7 @@ import type { ContestItem } from '../types'
import { CirclePlus } from '@element-plus/icons-vue' import { CirclePlus } from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import AppList from '@/components/base/AppList.vue' import AppList from '@/components/base/AppList.vue'
import { getContestJudgeList, updateContestJudge } from '../api' import { getContestExpertList, updateContestExpert } from '../api'
import { useMapStore } from '@/stores/map' import { useMapStore } from '@/stores/map'
const emit = defineEmits<{ const emit = defineEmits<{
...@@ -22,7 +22,7 @@ const roleList = useMapStore().getMapValuesByKey('expert_role') ...@@ -22,7 +22,7 @@ const roleList = useMapStore().getMapValuesByKey('expert_role')
let list = $ref<any>([]) let list = $ref<any>([])
function fetchList() { function fetchList() {
getContestJudgeList({ id: detail.id }).then((res: any) => { getContestExpertList({ id: detail.id }).then((res: any) => {
list = res.data.detail list = res.data.detail
}) })
} }
...@@ -73,7 +73,7 @@ function handleSubmit() { ...@@ -73,7 +73,7 @@ function handleSubmit() {
const experts = list.map((item: any) => { const experts = list.map((item: any) => {
return { id: item.id, expert_id: item.expert_id, role: item.info.role } return { id: item.id, expert_id: item.expert_id, role: item.info.role }
}) })
updateContestJudge({ id: detail.id, experts }).then(() => { updateContestExpert({ id: detail.id, experts }).then(() => {
ElMessage.success('保存成功') ElMessage.success('保存成功')
emit('update:modelValue', false) emit('update:modelValue', false)
}) })
......
<script setup lang="ts"> <script setup lang="ts">
import type { FormInstance, FormRules } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus'
import type { ContestItem, ContestBookItem, ContestBookUpdateParams } from '../types' import type { ContestItem, ContestBookUpdateParams } from '../types'
import { ElMessageBox, ElMessage } from 'element-plus' import { ElMessageBox, ElMessage } from 'element-plus'
import { pick } from 'lodash-es' import { pick } from 'lodash-es'
import AppUpload from '@/components/base/AppUpload.vue' import AppUpload from '@/components/base/AppUpload.vue'
import { createContestBook, updateContestBook } from '../api' import { getContestRuleBook, createContestRuleBook, updateContestRuleBook } from '../api'
import { useMapStore } from '@/stores/map' import { useMapStore } from '@/stores/map'
interface Props {
data: ContestBookItem
}
const props = defineProps<Props>()
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'update'): void (e: 'update'): void
(e: 'update:modelValue', visible: boolean): void (e: 'update:modelValue', visible: boolean): void
...@@ -24,6 +19,7 @@ const status = useMapStore().getMapValuesByKey('system_status') ...@@ -24,6 +19,7 @@ const status = useMapStore().getMapValuesByKey('system_status')
const formRef = $ref<FormInstance>() const formRef = $ref<FormInstance>()
const form = reactive<any>({ const form = reactive<any>({
id: '',
competition_id: detail.id, competition_id: detail.id,
files: [], files: [],
url: '', url: '',
...@@ -32,10 +28,18 @@ const form = reactive<any>({ ...@@ -32,10 +28,18 @@ const form = reactive<any>({
status: '1', status: '1',
protocol: false protocol: false
}) })
watchEffect(() => {
if (!props.data) return function fetchInfo() {
form.files = [JSON.parse(props.data.url)] getContestRuleBook({ competition_id: detail.id }).then(res => {
Object.assign(form, { protocol: true }, props.data) const data = res.data.detail
if (data?.id) {
form.files = [JSON.parse(data.url)]
Object.assign(form, { protocol: true }, data)
}
})
}
onMounted(() => {
fetchInfo()
}) })
const checkProtocol = (rule: any, value: any, callback: any) => { const checkProtocol = (rule: any, value: any, callback: any) => {
...@@ -52,8 +56,9 @@ const rules = ref<FormRules>({ ...@@ -52,8 +56,9 @@ const rules = ref<FormRules>({
experiment_id: [{ required: true, message: '请选择关联训练', trigger: 'change' }], experiment_id: [{ required: true, message: '请选择关联训练', trigger: 'change' }],
protocol: [{ validator: checkProtocol, message: '请阅读并同意', trigger: 'change' }] protocol: [{ validator: checkProtocol, message: '请阅读并同意', trigger: 'change' }]
}) })
const isUpdate = $computed(() => { const isUpdate = $computed(() => {
return !!props.data?.id return !!form.id
}) })
function handleBeforeUpload() { function handleBeforeUpload() {
...@@ -79,16 +84,16 @@ function handleSubmit() { ...@@ -79,16 +84,16 @@ function handleSubmit() {
} }
// 新增 // 新增
function handleCreate(params: ContestBookUpdateParams) { function handleCreate(params: ContestBookUpdateParams) {
createContestBook(params).then(() => { createContestRuleBook(params).then(() => {
ElMessage({ message: '创建成功', type: 'success' }) ElMessage({ message: '保存成功', type: 'success' })
emit('update') emit('update')
emit('update:modelValue', false) emit('update:modelValue', false)
}) })
} }
// 修改 // 修改
function handleUpdate(params: ContestBookUpdateParams) { function handleUpdate(params: ContestBookUpdateParams) {
updateContestBook(params).then(() => { updateContestRuleBook(params).then(() => {
ElMessage({ message: '修改成功', type: 'success' }) ElMessage({ message: '保存成功', type: 'success' })
emit('update') emit('update')
emit('update:modelValue', false) emit('update:modelValue', false)
}) })
...@@ -126,14 +131,14 @@ function handleUpdate(params: ContestBookUpdateParams) { ...@@ -126,14 +131,14 @@ function handleUpdate(params: ContestBookUpdateParams) {
<el-radio v-for="item in status" :key="item.id" :label="item.value">{{ item.label }}</el-radio> <el-radio v-for="item in status" :key="item.id" :label="item.value">{{ item.label }}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item prop="protocol"> <!-- <el-form-item prop="protocol">
<el-checkbox label="我已阅读并同意" v-model="form.protocol" /> <el-checkbox label="我已阅读并同意" v-model="form.protocol" />
<a <a
href="https://view.officeapps.live.com/op/view.aspx?src=https://webapp-pub.oss-cn-beijing.aliyuncs.com/center_resource/%E7%B4%AB%E8%8D%86%E6%95%99%E8%82%B2%E7%94%A8%E6%88%B7%E5%85%A5%E9%A9%BB%E5%8F%8A%E7%BD%91%E7%BB%9C%E6%95%99%E5%AD%A6%E8%B5%84%E6%BA%90%E5%8D%8F%E8%AE%AE(1).docx" href="https://view.officeapps.live.com/op/view.aspx?src=https://webapp-pub.oss-cn-beijing.aliyuncs.com/center_resource/%E7%B4%AB%E8%8D%86%E6%95%99%E8%82%B2%E7%94%A8%E6%88%B7%E5%85%A5%E9%A9%BB%E5%8F%8A%E7%BD%91%E7%BB%9C%E6%95%99%E5%AD%A6%E8%B5%84%E6%BA%90%E5%8D%8F%E8%AE%AE(1).docx"
target="_blank" target="_blank"
>《紫荆教育用户入驻及网络教学资源协议》</a >《紫荆教育用户入驻及网络教学资源协议》</a
> >
</el-form-item> </el-form-item> -->
<el-row justify="center"> <el-row justify="center">
<el-button type="primary" round auto-insert-space @click="handleSubmit">保存</el-button> <el-button type="primary" round auto-insert-space @click="handleSubmit">保存</el-button>
<el-button round auto-insert-space @click="$emit('update:modelValue', false)">取消</el-button> <el-button round auto-insert-space @click="$emit('update:modelValue', false)">取消</el-button>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import type { ContestItem } from '../types' import type { ContestItem } from '../types'
import { CirclePlus } from '@element-plus/icons-vue' import { CirclePlus } from '@element-plus/icons-vue'
import AppList from '@/components/base/AppList.vue' import AppList from '@/components/base/AppList.vue'
import { getContestItemList } from '../api' import { getContestList } from '../api'
import { useMapStore } from '@/stores/map' import { useMapStore } from '@/stores/map'
// 赛项类型 // 赛项类型
...@@ -15,7 +15,7 @@ const appList = $ref<InstanceType<typeof AppList> | null>(null) ...@@ -15,7 +15,7 @@ const appList = $ref<InstanceType<typeof AppList> | null>(null)
// 列表配置 // 列表配置
const listOptions = { const listOptions = {
remote: { remote: {
httpRequest: getContestItemList httpRequest: getContestList
}, },
columns: [ columns: [
{ label: '序号', type: 'index', width: 60 }, { label: '序号', type: 'index', width: 60 },
......
<script setup lang="ts"> <script setup lang="ts">
import type { ContestItem } from '../types' import type { ContestItem } from '../types'
import { getContestItem } from '../api' import { getContest } from '../api'
import { useMapStore } from '@/stores/map' import { useMapStore } from '@/stores/map'
import dayjs from 'dayjs' import dayjs from 'dayjs'
...@@ -9,7 +9,7 @@ const ViewVideo = defineAsyncComponent(() => import('../components/ViewVideo.vue ...@@ -9,7 +9,7 @@ const ViewVideo = defineAsyncComponent(() => import('../components/ViewVideo.vue
const ScoringRulesDialog = defineAsyncComponent(() => import('../components/ScoringRulesDialog.vue')) const ScoringRulesDialog = defineAsyncComponent(() => import('../components/ScoringRulesDialog.vue'))
const ScoringExpertsDialog = defineAsyncComponent(() => import('../components/ScoringExpertsDialog.vue')) const ScoringExpertsDialog = defineAsyncComponent(() => import('../components/ScoringExpertsDialog.vue'))
const ContestantDialog = defineAsyncComponent(() => import('../components/ContestantDialog.vue')) const ContestantDialog = defineAsyncComponent(() => import('../components/ContestantDialog.vue'))
const ScoringBookDialog = defineAsyncComponent(() => import('../components/ScoringBookDialog.vue')) const ScoringRulesBookDialog = defineAsyncComponent(() => import('../components/ScoringRulesBookDialog.vue'))
interface Props { interface Props {
id: string id: string
...@@ -42,7 +42,7 @@ const statusText = $computed(() => { ...@@ -42,7 +42,7 @@ const statusText = $computed(() => {
}) })
function fetchInfo() { function fetchInfo() {
getContestItem({ id: props.id }).then(res => { getContest({ id: props.id }).then(res => {
detail = res.data.detail detail = res.data.detail
}) })
} }
...@@ -56,22 +56,22 @@ function formatDateTime(timestamp: number): string { ...@@ -56,22 +56,22 @@ function formatDateTime(timestamp: number): string {
return dayjs(timestamp * 1000).format('YYYY-MM-DD HH:mm:ss') return dayjs(timestamp * 1000).format('YYYY-MM-DD HH:mm:ss')
} }
// 评分规则 // 评分规则
const judgingRulesVisible = $ref(false) const scoringRulesVisible = $ref(false)
// 评分专家 // 评分专家
const judgeVisible = $ref(false) const scoringExpertsVisible = $ref(false)
// 参赛选手 // 参赛选手
const contestantVisible = $ref(false) const contestantVisible = $ref(false)
// 评分细则 // 评分细则
const judgingBookVisible = $ref(false) const scoringRulesBookVisible = $ref(false)
</script> </script>
<template> <template>
<AppCard title="查看赛项信息"> <AppCard title="查看赛项信息">
<template #header-aside> <template #header-aside>
<el-button type="primary" @click="judgingRulesVisible = true">评分规则</el-button> <el-button type="primary" @click="scoringRulesVisible = true">评分规则</el-button>
<el-button type="primary" @click="judgeVisible = true">评分专家</el-button> <el-button type="primary" @click="scoringExpertsVisible = true">评分专家</el-button>
<el-button type="primary" @click="contestantVisible = true">参赛选手</el-button> <el-button type="primary" @click="contestantVisible = true">参赛选手</el-button>
<el-button type="primary" @click="judgingBookVisible = true">评分细则</el-button> <el-button type="primary" @click="scoringRulesBookVisible = true">评分细则</el-button>
</template> </template>
<div class="top" v-if="detail"> <div class="top" v-if="detail">
<div class="top-cover"> <div class="top-cover">
...@@ -102,13 +102,16 @@ const judgingBookVisible = $ref(false) ...@@ -102,13 +102,16 @@ const judgingBookVisible = $ref(false)
<ViewVideo :id="id"></ViewVideo> <ViewVideo :id="id"></ViewVideo>
</AppCard> </AppCard>
<!-- 评分规则 --> <!-- 评分规则 -->
<ScoringRulesDialog v-model="judgingRulesVisible" v-if="judgingRulesVisible && detail"></ScoringRulesDialog> <ScoringRulesDialog v-model="scoringRulesVisible" v-if="scoringRulesVisible && detail"></ScoringRulesDialog>
<!-- 评分专家 --> <!-- 评分专家 -->
<ScoringExpertsDialog v-model="judgeVisible" v-if="judgeVisible && detail"></ScoringExpertsDialog> <ScoringExpertsDialog v-model="scoringExpertsVisible" v-if="scoringExpertsVisible && detail"></ScoringExpertsDialog>
<!-- 参赛选手 --> <!-- 参赛选手 -->
<ContestantDialog v-model="contestantVisible" v-if="contestantVisible && detail"></ContestantDialog> <ContestantDialog v-model="contestantVisible" v-if="contestantVisible && detail"></ContestantDialog>
<!-- 评分细则 --> <!-- 评分细则 -->
<ScoringBookDialog v-model="judgingBookVisible" v-if="judgingBookVisible && detail"></ScoringBookDialog> <ScoringRulesBookDialog
v-model="scoringRulesBookVisible"
v-if="scoringRulesBookVisible && detail"
></ScoringRulesBookDialog>
</template> </template>
<style lang="scss"> <style lang="scss">
......
...@@ -9,3 +9,13 @@ export const contestMode: Record<string, any> = { ...@@ -9,3 +9,13 @@ export const contestMode: Record<string, any> = {
} }
// 参赛模式列表 // 参赛模式列表
export const contestModeList = json2Array(contestMode, false) export const contestModeList = json2Array(contestMode, false)
// 评分规则
export const scoreRule: Record<string, any> = {
1: '平均法',
2: '加权平均法',
3: '综合得分法',
4: '最高分'
}
// 参赛模式列表
export const scoreRuleList = json2Array(scoreRule, false)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论