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

update

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