提交 9684b9a6 authored 作者: lhh's avatar lhh

update

上级 c06164c3
......@@ -2,7 +2,7 @@ import httpRequest from '@/utils/axios'
import type { ContestantCreateParams, ContestantUpdateParams } from './types'
// 获取参赛选手列表
export function getContestantList(params?: { student_name?: string; page?: number; 'per-page'?: number }) {
export function getContestantList(params?: { student_name?: string; order_params?: string; page?: number; 'per-page'?: number }) {
return httpRequest.get('/api/resource/v1/backend/competition-competitor/list', { params })
}
......
......@@ -15,11 +15,15 @@ const appList = $ref<InstanceType<typeof AppList> | null>(null)
const genderList = useMapStore().getMapValuesByKey('system_gender')
const { contests } = useGetContestList()
// 列表配置
let orderParamsValue = $ref('')
const listOptions = $computed(() => {
return {
remote: {
httpRequest: getContestantList,
params: { competition_id: '', student_name: '' }
params: { competition_id: '', student_name: '' },
beforeRequest(params: any) {
return { ...params, order_params: orderParamsValue }
}
},
filters: [
{
......@@ -50,7 +54,12 @@ const listOptions = $computed(() => {
{ label: '所在专业', prop: 'student.specialty.name' },
{ label: '所在年级', prop: 'grade' },
{ label: '所在班级', prop: 'student.class.name' },
{ label: '训练次数', prop: 'train_count' },
{
label: '训练次数',
prop: 'train_count',
sortable: 'custom',
width: 110
},
{ label: '更新时间', prop: 'updated_time' },
{ label: '操作', slots: 'table-x', width: 200 }
]
......@@ -83,11 +92,22 @@ function handleUpdate(row: Contestant) {
function onUpdateSuccess() {
appList?.refetch()
}
const sortChange = function (column: any) {
if (column.order === 'ascending') {
orderParamsValue = JSON.stringify([{ param: 'train_count', way: 'DESC' }])
} else if (column.order === 'descending') {
orderParamsValue = JSON.stringify([{ param: 'train_count', way: 'ASC' }])
} else {
orderParamsValue = ''
}
console.log(orderParamsValue, 'orderParamsValue')
appList?.refetch()
}
</script>
<template>
<AppCard title="参赛选手管理">
<AppList v-bind="listOptions" ref="appList">
<AppList v-bind="listOptions" ref="appList" @sort-change="sortChange">
<template #header-buttons>
<!-- <el-button type="primary" round :icon="CirclePlus" @click="handleAdd">新增参赛选手</el-button> -->
<el-button
......@@ -115,13 +135,15 @@ function onUpdateSuccess() {
v-model="dialogVisible"
:data="rowData"
@update="onUpdateSuccess"
v-if="dialogVisible && rowData"></FormDialog>
v-if="dialogVisible && rowData"
></FormDialog>
<!-- 查看 -->
<ViewDialog
v-model="viewVisible"
:data="rowData"
@update="onUpdateSuccess"
v-if="viewVisible && rowData"></ViewDialog>
v-if="viewVisible && rowData"
></ViewDialog>
<!-- 批量导入 -->
<ImportDialog v-model="importVisible" @update="onUpdateSuccess" v-if="importVisible"></ImportDialog>
</template>
......@@ -4,8 +4,12 @@ import { CloseBold } from '@element-plus/icons-vue'
import Preview from '@/components/Preview.vue'
import { getExperimentBooks } from '../api'
import { useLog } from '@/composables/useLog'
const log = useLog()
interface Props {
competition_id: string
experiment_id?: any
}
const props = defineProps<Props>()
......@@ -38,6 +42,18 @@ function handleView(row: ExperimentBookType) {
currentRaw = row
currentRawUrl = row.url ? (JSON.parse(row.url)?.url as string) : ''
show = true
// 日志上送
// console.log(props, props.student_id, '111')
log.upload({
event: 'file_event',
action: 'competition_book_stu_watch_action',
data: {
competition_id: props.competition_id,
experiment_id: props.experiment_id,
book_id: row.id,
student_id: route.query?.student_id
}
})
}
// 关闭
function handleClose() {
......
......@@ -25,7 +25,7 @@ const canTrain = $computed(() => {
function handleTrain(id: string, type: string) {
// 训练计数
updateTrainCount({ competition_id: id })
window.open(`/student/contest/lab/${id}?type=${type}`)
window.open(`/student/contest/lab/${id}?type=${type}&student_id=${props.data?.student_id}`)
// router.push({ path: `/student/contest/lab/${id}`, query: { type: type } })
}
// 是否可以报名
......
......@@ -121,6 +121,18 @@ let isHeadShow = $ref(true)
const handleShowHead = function () {
isHeadShow = !isHeadShow
}
const getExperimentId = computed(() => {
const item = competition?.train_platform_configs.find((item: any) => item.platform_key === route.query.type)
let value = '0'
if (item?.url) {
value =
item?.url.indexOf('experiment_id') !== -1
? item?.url.substring(item?.url.indexOf('experiment_id=') + 14, item?.url.length + 1)
: '0'
}
return value
})
</script>
<template>
......@@ -131,7 +143,7 @@ const handleShowHead = function () {
<el-tabs type="border-card">
<el-tab-pane label="实训指导" lazy>
<!-- <Book :competition_id="id" :key="resizeKey"></Book> -->
<Book :competition_id="id"></Book>
<Book :competition_id="id" :experiment_id="getExperimentId"></Book>
</el-tab-pane>
<el-tab-pane label="操作视频" lazy v-if="false">
<Video :competition_id="id"></Video>
......
......@@ -26,16 +26,16 @@ export default defineConfig(({ mode }) => ({
cert: fs.readFileSync(path.join(__dirname, './https/ezijing.com.pem'))
},
proxy: {
'/api/resource': {
target: 'http://com-resource-admin-test.ezijing.com',
changeOrigin: true,
rewrite: path => path.replace(/^\/api\/resource/, '')
},
'/api/lab': {
target: 'http://com-resource-api-test.ezijing.com',
changeOrigin: true,
rewrite: path => path.replace(/^\/api\/lab/, '')
},
// '/api/resource': {
// target: 'http://com-resource-admin-test.ezijing.com',
// changeOrigin: true,
// rewrite: path => path.replace(/^\/api\/resource/, '')
// },
// '/api/lab': {
// target: 'http://com-resource-api-test.ezijing.com',
// changeOrigin: true,
// rewrite: path => path.replace(/^\/api\/lab/, '')
// },
'/api': 'https://saas-lab.ezijing.com'
}
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论