提交 5417c1d3 authored 作者: 王鹏飞's avatar 王鹏飞

chore: 适配saas-dml-pro

上级 74124d5d
VITE_LOGIN_URL=https://login.ezijing.com/auth/login/index VITE_LOGIN_URL=https://login.ezijing.com/auth/login/index
VITE_LAB_URL=https://bi.ezijing.com/bi/viewer?proc=0&action=index VITE_LAB_URL=https://bi.ezijing.com/bi/viewer?proc=0&action=index
VITE_DML_URL=https://saas-dml.ezijing.com VITE_DML_URL=https://saas-dml.ezijing.com
VITE_DML_PRO_URL=https://saas-dml-pro.ezijing.com
\ No newline at end of file
...@@ -2,3 +2,4 @@ VITE_LOGIN_URL=https://login.ezijing.com/auth/login/index ...@@ -2,3 +2,4 @@ VITE_LOGIN_URL=https://login.ezijing.com/auth/login/index
# VITE_LAB_URL=https://digitalmarketinglab.ezijing.com # VITE_LAB_URL=https://digitalmarketinglab.ezijing.com
VITE_LAB_URL=https://bi.ezijing.com/bi/viewer?proc=0&action=index VITE_LAB_URL=https://bi.ezijing.com/bi/viewer?proc=0&action=index
VITE_DML_URL=https://saas-dml.ezijing.com VITE_DML_URL=https://saas-dml.ezijing.com
VITE_DML_PRO_URL=https://saas-dml-pro.ezijing.com
\ No newline at end of file
VITE_LOGIN_URL=https://login.ezijing.com/auth/login/index VITE_LOGIN_URL=https://login.ezijing.com/auth/login/index
VITE_LAB_URL=https://bi.ezijing.com/bi/viewer?proc=0&action=index VITE_LAB_URL=https://bi.ezijing.com/bi/viewer?proc=0&action=index
VITE_DML_URL=https://saas-dml.ezijing.com VITE_DML_URL=https://saas-dml.ezijing.com
VITE_DML_PRO_URL=https://saas-dml-pro.ezijing.com
\ No newline at end of file
...@@ -40,7 +40,8 @@ const appConfigList = [ ...@@ -40,7 +40,8 @@ const appConfigList = [
system: 'dml', system: 'dml',
title: '数字营销实验室', title: '数字营销实验室',
logo: 'https://zws-imgs-pub.ezijing.com/pc/base/ezijing-logo.svg', logo: 'https://zws-imgs-pub.ezijing.com/pc/base/ezijing-logo.svg',
hosts: ['saas-dml-web'] hosts: ['saas-dml-web'],
dmlURL: import.meta.env.VITE_DML_PRO_URL
} }
] ]
...@@ -49,7 +50,7 @@ export function useAppConfig() { ...@@ -49,7 +50,7 @@ export function useAppConfig() {
return item.hosts.find(host => location.host.includes(host)) return item.hosts.find(host => location.host.includes(host))
}) })
const appConfig = found || appConfigList[0] const appConfig = found || appConfigList[3]
return { ...appConfig } return { ...appConfig }
} }
...@@ -6,6 +6,9 @@ import { getTripConfig, updateTripConfig } from '../api' ...@@ -6,6 +6,9 @@ import { getTripConfig, updateTripConfig } from '../api'
import { useConnection, useUserAttr, useMetaEvent, useTag, useGroup, useMaterial } from '../composables/useAllData' import { useConnection, useUserAttr, useMetaEvent, useTag, useGroup, useMaterial } from '../composables/useAllData'
import { useDocumentVisibility } from '@vueuse/core' import { useDocumentVisibility } from '@vueuse/core'
import { useAppConfig } from '@/composables/useAppConfig'
const appConfig = useAppConfig()
const props = defineProps<{ const props = defineProps<{
data: ExperimentItem data: ExperimentItem
}>() }>()
...@@ -23,7 +26,7 @@ const { groupList } = useGroup(props.data.id) ...@@ -23,7 +26,7 @@ const { groupList } = useGroup(props.data.id)
const { materialList } = useMaterial(props.data.id) const { materialList } = useMaterial(props.data.id)
const dmlURL = computed(() => { const dmlURL = computed(() => {
return `${import.meta.env.VITE_DML_URL}/trip/template?experiment_id=${props.data.id}` return `${appConfig.dmlURL || import.meta.env.VITE_DML_URL}/trip/template?experiment_id=${props.data.id}`
}) })
const formRef = $ref<FormInstance>() const formRef = $ref<FormInstance>()
...@@ -115,12 +118,7 @@ function handleSubmit() { ...@@ -115,12 +118,7 @@ function handleSubmit() {
</script> </script>
<template> <template>
<el-dialog <el-dialog title="配置数字营销实验" :close-on-click-modal="false" width="600px" @update:modelValue="$emit('update:modelValue')">
title="配置数字营销实验"
:close-on-click-modal="false"
width="600px"
@update:modelValue="$emit('update:modelValue')"
>
<el-form ref="formRef" :model="form" label-suffix=":"> <el-form ref="formRef" :model="form" label-suffix=":">
<el-row justify="space-between"> <el-row justify="space-between">
<el-form-item label="实验名称">{{ data.name }}</el-form-item> <el-form-item label="实验名称">{{ data.name }}</el-form-item>
...@@ -143,13 +141,7 @@ function handleSubmit() { ...@@ -143,13 +141,7 @@ function handleSubmit() {
</el-form-item> </el-form-item>
<el-form-item label="连接" label-width="82" prop="connect_ids"> <el-form-item label="连接" label-width="82" prop="connect_ids">
<el-select v-model="form.connect_ids" multiple style="width: 100%"> <el-select v-model="form.connect_ids" multiple style="width: 100%">
<el-option <el-option v-for="item in connectionList" :label="item.name" :value="item.id" :key="item.id" disabled></el-option>
v-for="item in connectionList"
:label="item.name"
:value="item.id"
:key="item.id"
disabled
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-tab-pane> </el-tab-pane>
...@@ -159,12 +151,7 @@ function handleSubmit() { ...@@ -159,12 +151,7 @@ function handleSubmit() {
<el-radio :label="true">全部</el-radio> <el-radio :label="true">全部</el-radio>
<el-radio :label="false">部分</el-radio> <el-radio :label="false">部分</el-radio>
</el-radio-group> </el-radio-group>
<el-select <el-select v-model="form.user_attr_config.items" multiple style="margin-left: 40px" v-if="!form.user_attr_config.is_all">
v-model="form.user_attr_config.items"
multiple
style="margin-left: 40px"
v-if="!form.user_attr_config.is_all"
>
<el-option v-for="item in userAttrList" :label="item.name" :value="item.id" :key="item.id"></el-option> <el-option v-for="item in userAttrList" :label="item.name" :value="item.id" :key="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -173,12 +160,7 @@ function handleSubmit() { ...@@ -173,12 +160,7 @@ function handleSubmit() {
<el-radio :label="true">全部</el-radio> <el-radio :label="true">全部</el-radio>
<el-radio :label="false">部分</el-radio> <el-radio :label="false">部分</el-radio>
</el-radio-group> </el-radio-group>
<el-select <el-select v-model="form.event_config.items" multiple style="margin-left: 40px" v-if="!form.event_config.is_all">
v-model="form.event_config.items"
multiple
style="margin-left: 40px"
v-if="!form.event_config.is_all"
>
<el-option v-for="item in metaEventList" :label="item.name" :value="item.id" :key="item.id"></el-option> <el-option v-for="item in metaEventList" :label="item.name" :value="item.id" :key="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import { CircleCloseFilled } from '@element-plus/icons-vue' import { CircleCloseFilled } from '@element-plus/icons-vue'
import { getQuestionTags } from '../../api' import { getQuestionTags } from '../../api'
import { useAppConfig } from '@/composables/useAppConfig'
const appConfig = useAppConfig()
const route = useRoute() const route = useRoute()
...@@ -21,16 +23,18 @@ onMounted(() => { ...@@ -21,16 +23,18 @@ onMounted(() => {
options = res.data.items options = res.data.items
}) })
}) })
const labelTitle = computed(() => {
return appConfig.system === 'dml' ? '标签目录' : '标签类型'
})
</script> </script>
<template> <template>
<el-card :id="`site-card${index}`" class="box-card" v-for="(item, index) in modelValue" :key="item"> <el-card :id="`site-card${index}`" class="box-card" v-for="(item, index) in modelValue" :key="item">
<el-icon @click="removeQuestion(index)" v-if="modelValue.length > 1" class="close" size="28" color="#c01c40" <el-icon @click="removeQuestion(index)" v-if="modelValue.length > 1" class="close" size="28" color="#c01c40"><CircleCloseFilled /></el-icon>
><CircleCloseFilled
/></el-icon>
<div class="head-box"> <div class="head-box">
<el-tabs v-model="item.type" type="card" class="demo-tabs"> <el-tabs v-model="item.type" type="card" class="demo-tabs">
<el-tab-pane label="标签类型" :name="201"></el-tab-pane> <el-tab-pane :label="labelTitle" :name="201"></el-tab-pane>
<el-tab-pane label="标签" :name="202"></el-tab-pane> <el-tab-pane label="标签" :name="202"></el-tab-pane>
</el-tabs> </el-tabs>
<el-form-item label="本题分值" class="head-r"> <el-form-item label="本题分值" class="head-r">
...@@ -45,7 +49,7 @@ onMounted(() => { ...@@ -45,7 +49,7 @@ onMounted(() => {
<el-input v-model="item.content" :rows="5" type="textarea" placeholder="请输入" /> <el-input v-model="item.content" :rows="5" type="textarea" placeholder="请输入" />
</el-form-item> </el-form-item>
<el-form-item label="正确答案" :required="true"> <el-form-item label="正确答案" :required="true">
<span v-if="item.type === 201">创建标签类型成功</span> <span v-if="item.type === 201">创建{{ labelTitle }}成功</span>
<el-select v-else v-model="item.answer" class="m-2" placeholder="请选择" size="large"> <el-select v-else v-model="item.answer" class="m-2" placeholder="请选择" size="large">
<el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id" /> <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id" />
</el-select> </el-select>
......
...@@ -5,6 +5,8 @@ import { ElMessage, ElMessageBox } from 'element-plus' ...@@ -5,6 +5,8 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import AppList from '@/components/base/AppList.vue' import AppList from '@/components/base/AppList.vue'
import { getExperiment, experimentAddClass } from '../api' import { getExperiment, experimentAddClass } from '../api'
import { useAppConfig } from '@/composables/useAppConfig'
const appConfig = useAppConfig()
const SelectClassDialog = defineAsyncComponent(() => import('../components/SelectClassDialog.vue')) const SelectClassDialog = defineAsyncComponent(() => import('../components/SelectClassDialog.vue'))
const StudentGroupDialog = defineAsyncComponent(() => import('../components/StudentGroupDialog.vue')) const StudentGroupDialog = defineAsyncComponent(() => import('../components/StudentGroupDialog.vue'))
...@@ -82,7 +84,7 @@ function handleRemoveClass(row: ClassItem) { ...@@ -82,7 +84,7 @@ function handleRemoveClass(row: ClassItem) {
const gradeRulesVisible = $ref(false) const gradeRulesVisible = $ref(false)
const reportRulesVisible = $ref(false) const reportRulesVisible = $ref(false)
const dmlURL = computed(() => { const dmlURL = computed(() => {
return `${import.meta.env.VITE_DML_URL}?experiment_id=${props.id}` return `${appConfig.dmlURL || import.meta.env.VITE_DML_URL}?experiment_id=${props.id}`
}) })
</script> </script>
...@@ -111,48 +113,21 @@ const dmlURL = computed(() => { ...@@ -111,48 +113,21 @@ const dmlURL = computed(() => {
<el-divider /> <el-divider />
<AppList v-bind="listOptions" ref="appList"> <AppList v-bind="listOptions" ref="appList">
<template #header-buttons> <template #header-buttons>
<el-button <el-button type="primary" :icon="CirclePlus" @click="selectClassVisible = true" v-permission="'v1-backend-experiment-class-add'">关联班级</el-button>
type="primary"
:icon="CirclePlus"
@click="selectClassVisible = true"
v-permission="'v1-backend-experiment-class-add'"
>关联班级</el-button
>
</template> </template>
<template #table-x="{ row }"> <template #table-x="{ row }">
<el-button <el-button type="primary" round @click="handleViewStudent(row)" v-permission="'v1-backend-experiment-class-students'">查看学生</el-button>
type="primary" <el-button type="primary" round @click="handleStudentGroup(row)" v-permission="'v1-backend-experiment-class-teams'">学生分组</el-button>
round <el-button type="primary" round @click="handleRemoveClass(row)" v-permission="'v1-backend-experiment-class-add'">移除</el-button>
@click="handleViewStudent(row)"
v-permission="'v1-backend-experiment-class-students'"
>查看学生</el-button
>
<el-button
type="primary"
round
@click="handleStudentGroup(row)"
v-permission="'v1-backend-experiment-class-teams'"
>学生分组</el-button
>
<el-button type="primary" round @click="handleRemoveClass(row)" v-permission="'v1-backend-experiment-class-add'"
>移除</el-button
>
</template> </template>
</AppList> </AppList>
</AppCard> </AppCard>
<!-- 关联班级 --> <!-- 关联班级 -->
<SelectClassDialog v-model="selectClassVisible" @update="handleRefetch" v-if="selectClassVisible"></SelectClassDialog> <SelectClassDialog v-model="selectClassVisible" @update="handleRefetch" v-if="selectClassVisible"></SelectClassDialog>
<!-- 学生分组 --> <!-- 学生分组 -->
<StudentGroupDialog <StudentGroupDialog v-model="studentGroupVisible" :data="rowData" v-if="studentGroupVisible && rowData"></StudentGroupDialog>
v-model="studentGroupVisible"
:data="rowData"
v-if="studentGroupVisible && rowData"></StudentGroupDialog>
<!-- 查看学生 --> <!-- 查看学生 -->
<StudentListDialog <StudentListDialog v-model="studentListVisible" :data="rowData" :experimentId="id" v-if="studentListVisible && rowData"></StudentListDialog>
v-model="studentListVisible"
:data="rowData"
:experimentId="id"
v-if="studentListVisible && rowData"></StudentListDialog>
<ViewGradeRules v-model="gradeRulesVisible" :data="detail" v-if="gradeRulesVisible && detail"></ViewGradeRules> <ViewGradeRules v-model="gradeRulesVisible" :data="detail" v-if="gradeRulesVisible && detail"></ViewGradeRules>
<ViewReportRules v-model="reportRulesVisible" :experiment_id="id" v-if="reportRulesVisible"></ViewReportRules> <ViewReportRules v-model="reportRulesVisible" :experiment_id="id" v-if="reportRulesVisible"></ViewReportRules>
</template> </template>
...@@ -3,6 +3,8 @@ import type { RecordItem, FileItem } from '../types' ...@@ -3,6 +3,8 @@ import type { RecordItem, FileItem } from '../types'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { getExperimentScore, getExperimentScoreTemplate, updateExperimentScore, getExperimentReport } from '../api' import { getExperimentScore, getExperimentScoreTemplate, updateExperimentScore, getExperimentReport } from '../api'
import { useAppConfig } from '@/composables/useAppConfig'
const appConfig = useAppConfig()
const ScoreViewPicturesDialog = defineAsyncComponent(() => import('./ScoreViewPicturesDialog.vue')) const ScoreViewPicturesDialog = defineAsyncComponent(() => import('./ScoreViewPicturesDialog.vue'))
const ScoreViewPrepareDialog = defineAsyncComponent(() => import('./ScoreViewPrepareDialog.vue')) const ScoreViewPrepareDialog = defineAsyncComponent(() => import('./ScoreViewPrepareDialog.vue'))
...@@ -21,8 +23,7 @@ const emit = defineEmits<{ ...@@ -21,8 +23,7 @@ const emit = defineEmits<{
let experiment = $ref<any>() let experiment = $ref<any>()
let detail = $ref<any>() let detail = $ref<any>()
async function fetchInfo() { async function fetchInfo() {
await getExperimentScore({ experiment_id: props.data.experiment_id, student_id: props.data.student_id }).then( await getExperimentScore({ experiment_id: props.data.experiment_id, student_id: props.data.student_id }).then(async res => {
async res => {
experiment = res.data.experiment experiment = res.data.experiment
detail = res.data.achievement detail = res.data.achievement
if (detail.score_details) { if (detail.score_details) {
...@@ -45,8 +46,7 @@ async function fetchInfo() { ...@@ -45,8 +46,7 @@ async function fetchInfo() {
if (experiment.report_upload_way === 2) { if (experiment.report_upload_way === 2) {
await fetchReport() await fetchReport()
} }
} })
)
} }
watchEffect(() => { watchEffect(() => {
fetchInfo() fetchInfo()
...@@ -68,8 +68,7 @@ async function fetchTemplate() { ...@@ -68,8 +68,7 @@ async function fetchTemplate() {
// 获取实验报告分数 // 获取实验报告分数
let report = $ref<any>() let report = $ref<any>()
async function fetchReport() { async function fetchReport() {
await getExperimentReport({ experiment_id: props.data.experiment_id, student_id: props.data.student_id }).then( await getExperimentReport({ experiment_id: props.data.experiment_id, student_id: props.data.student_id }).then(res => {
res => {
report = res.data.detail report = res.data.detail
const reportScore = parseFloat(report.score || 0) const reportScore = parseFloat(report.score || 0)
form.score_details = form.score_details.map((item: any) => { form.score_details = form.score_details.map((item: any) => {
...@@ -78,8 +77,7 @@ async function fetchReport() { ...@@ -78,8 +77,7 @@ async function fetchReport() {
} }
return item return item
}) })
} })
)
} }
// 实验报告文件 // 实验报告文件
...@@ -107,16 +105,14 @@ const score = $computed<number>(() => { ...@@ -107,16 +105,14 @@ const score = $computed<number>(() => {
// 提交 // 提交
function handleSubmit() { function handleSubmit() {
ElMessageBox.confirm('更改成绩之后将以最新成绩为准,您可以查看批改成绩历史数据,确定需要修改成绩吗?', '提示').then( ElMessageBox.confirm('更改成绩之后将以最新成绩为准,您可以查看批改成绩历史数据,确定需要修改成绩吗?', '提示').then(() => {
() => {
const params = { ...form, score_details: JSON.stringify(form.score_details) } const params = { ...form, score_details: JSON.stringify(form.score_details) }
updateExperimentScore(params).then(() => { updateExperimentScore(params).then(() => {
ElMessage({ message: '保存成功', type: 'success' }) ElMessage({ message: '保存成功', type: 'success' })
emit('update') emit('update')
emit('update:modelValue', false) emit('update:modelValue', false)
}) })
} })
)
} }
function scoreValue(value: any) { function scoreValue(value: any) {
...@@ -132,40 +128,28 @@ const prepareVisible = $ref(false) ...@@ -132,40 +128,28 @@ const prepareVisible = $ref(false)
const resultVisible = $ref(false) const resultVisible = $ref(false)
function getOperationUrl(type: number) { function getOperationUrl(type: number) {
const dmlURL = appConfig.dmlURL || import.meta.env.VITE_DML_URL
if (type === 1) { if (type === 1) {
// 批改实验报告 // 批改实验报告
return `/admin/lab/score/report?experiment_id=${props.data.experiment_id}&student_id=${props.data.student_id}` return `/admin/lab/score/report?experiment_id=${props.data.experiment_id}&student_id=${props.data.student_id}`
} else if (type === 6) { } else if (type === 6) {
// 用户标签 // 用户标签
return `${import.meta.env.VITE_DML_URL}/label?experiment_id=${props.data.experiment_id}&student_id=${ return `${dmlURL}/label?experiment_id=${props.data.experiment_id}&student_id=${props.data.student_id}`
props.data.student_id
}`
} else if (type === 7) { } else if (type === 7) {
// 用户群组 // 用户群组
return `${import.meta.env.VITE_DML_URL}/group?experiment_id=${props.data.experiment_id}&student_id=${ return `${dmlURL}/group?experiment_id=${props.data.experiment_id}&student_id=${props.data.student_id}`
props.data.student_id
}`
} else if (type === 8) { } else if (type === 8) {
// 用户旅程 // 用户旅程
return `${import.meta.env.VITE_DML_URL}/trip/review?experiment_id=${props.data.experiment_id}&student_id=${ return `${dmlURL}/trip/review?experiment_id=${props.data.experiment_id}&student_id=${props.data.student_id}`
props.data.student_id
}`
} else if (type === 9) { } else if (type === 9) {
// 营销资料 // 营销资料
return `${import.meta.env.VITE_DML_URL}/material?experiment_id=${props.data.experiment_id}&student_id=${ return `${dmlURL}/material?experiment_id=${props.data.experiment_id}&student_id=${props.data.student_id}`
props.data.student_id
}`
} }
} }
</script> </script>
<template> <template>
<el-dialog <el-dialog title="学生实验评分" :close-on-click-modal="false" width="800px" @update:modelValue="$emit('update:modelValue')">
title="学生实验评分"
:close-on-click-modal="false"
width="800px"
@update:modelValue="$emit('update:modelValue')"
>
<el-form label-width="120px" label-suffix=":" v-if="detail"> <el-form label-width="120px" label-suffix=":" v-if="detail">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
...@@ -204,12 +188,7 @@ function getOperationUrl(type: number) { ...@@ -204,12 +188,7 @@ function getOperationUrl(type: number) {
<p class="t1">{{ scoreValue(score) }}</p> <p class="t1">{{ scoreValue(score) }}</p>
<p class="t2">满分:{{ experiment.score }}</p> <p class="t2">满分:{{ experiment.score }}</p>
</div> </div>
<el-table <el-table :data="form.score_details" stripe :header-cell-style="{ background: '#ededed' }" style="margin-top: 20px">
:data="form.score_details"
stripe
:header-cell-style="{ background: '#ededed' }"
style="margin-top: 20px"
>
<el-table-column label="实验成绩组成项" prop="name" align="center"></el-table-column> <el-table-column label="实验成绩组成项" prop="name" align="center"></el-table-column>
<el-table-column label="权重" prop="percent" align="center"> <el-table-column label="权重" prop="percent" align="center">
<template #default="{ row }"> {{ row.percent }}% </template> <template #default="{ row }"> {{ row.percent }}% </template>
...@@ -226,20 +205,14 @@ function getOperationUrl(type: number) { ...@@ -226,20 +205,14 @@ function getOperationUrl(type: number) {
step-strictly step-strictly
placeholder="请输入成绩" placeholder="请输入成绩"
style="width: 100px" style="width: 100px"
v-if="!(row.type === 1 && experiment.report_upload_way === 2)" v-if="!(row.type === 1 && experiment.report_upload_way === 2)"></el-input-number>
></el-input-number>
<span v-else>{{ row.commit_score }}</span> <span v-else>{{ row.commit_score }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" prop="commit_score" align="center"> <el-table-column label="操作" prop="commit_score" align="center">
<template #default="{ row }"> <template #default="{ row }">
<template v-if="row.type === 1"> <template v-if="row.type === 1">
<el-button <el-button text type="primary" @click="$emit('update:modelValue')" v-if="experiment.report_upload_way === 2">
text
type="primary"
@click="$emit('update:modelValue')"
v-if="experiment.report_upload_way === 2"
>
<a :href="getOperationUrl(row.type)" target="_blank">批改</a> <a :href="getOperationUrl(row.type)" target="_blank">批改</a>
</el-button> </el-button>
<template v-if="experiment.report_upload_way === 1"> <template v-if="experiment.report_upload_way === 1">
...@@ -251,11 +224,7 @@ function getOperationUrl(type: number) { ...@@ -251,11 +224,7 @@ function getOperationUrl(type: number) {
</template> </template>
<template v-else-if="[6, 7, 8, 9, 10].includes(row.type)"> <template v-else-if="[6, 7, 8, 9, 10].includes(row.type)">
<el-button text type="primary"> <el-button text type="primary">
<a <a :href="`/admin/lab/score/score?id=${props.data.experiment_id}&sid=${props.data.student_id}&type=${row.type}`" target="_blank">查看结果</a>
:href="`/admin/lab/score/score?id=${props.data.experiment_id}&sid=${props.data.student_id}&type=${row.type}`"
target="_blank"
>查看结果</a
>
</el-button> </el-button>
</template> </template>
</template> </template>
...@@ -275,21 +244,15 @@ function getOperationUrl(type: number) { ...@@ -275,21 +244,15 @@ function getOperationUrl(type: number) {
v-model="prepareVisible" v-model="prepareVisible"
:experiment_id="data.experiment_id" :experiment_id="data.experiment_id"
:student_id="data.student_id" :student_id="data.student_id"
v-if="prepareVisible" v-if="prepareVisible"></ScoreViewPrepareDialog>
></ScoreViewPrepareDialog>
<!-- 实验结果 --> <!-- 实验结果 -->
<ScoreViewResultDialog <ScoreViewResultDialog
v-model="resultVisible" v-model="resultVisible"
:experiment_id="data.experiment_id" :experiment_id="data.experiment_id"
:student_id="data.student_id" :student_id="data.student_id"
v-if="resultVisible" v-if="resultVisible"></ScoreViewResultDialog>
></ScoreViewResultDialog>
<!-- 实验截图 --> <!-- 实验截图 -->
<ScoreViewPicturesDialog <ScoreViewPicturesDialog v-model="pictureVisible" :data="detail" v-if="pictureVisible && detail"></ScoreViewPicturesDialog>
v-model="pictureVisible"
:data="detail"
v-if="pictureVisible && detail"
></ScoreViewPicturesDialog>
</el-dialog> </el-dialog>
</template> </template>
......
...@@ -3,6 +3,8 @@ import DragPanel from '@/components/DragPanel.vue' ...@@ -3,6 +3,8 @@ import DragPanel from '@/components/DragPanel.vue'
import { getStudentTicket } from '../api' import { getStudentTicket } from '../api'
const StudentInfo = defineAsyncComponent(() => import('../components/StudentInfo.vue')) const StudentInfo = defineAsyncComponent(() => import('../components/StudentInfo.vue'))
const Question = defineAsyncComponent(() => import('../components/Question.vue')) const Question = defineAsyncComponent(() => import('../components/Question.vue'))
import { useAppConfig } from '@/composables/useAppConfig'
const appConfig = useAppConfig()
const route = useRoute() const route = useRoute()
...@@ -10,35 +12,28 @@ onMounted(() => { ...@@ -10,35 +12,28 @@ onMounted(() => {
getIframeUrl() getIframeUrl()
}) })
let resizeKey = $ref(0)
function handleResize() {
resizeKey = Date.now()
}
let iframeUrl = $ref('') let iframeUrl = $ref('')
const getIframeUrl = function () { const getIframeUrl = function () {
getStudentTicket({ student_id: route.query.sid as string }).then(res => { getStudentTicket({ student_id: route.query.sid as string }).then(res => {
if (res.data?.ticket) { if (res.data?.ticket) {
const type = route.query.type const type = route.query.type
const dmlURL = appConfig.dmlURL || import.meta.env.VITE_DML_URL
if (type === '6') { if (type === '6') {
// 用户标签 // 用户标签
iframeUrl = `${import.meta.env.VITE_DML_URL}/label?experiment_id=${route.query.id}&force_tgc=${res.data.ticket}` iframeUrl = `${dmlURL}/label?experiment_id=${route.query.id}&force_tgc=${res.data.ticket}`
} else if (type === '7') { } else if (type === '7') {
// 用户群组 // 用户群组
iframeUrl = `${import.meta.env.VITE_DML_URL}/group?experiment_id=${route.query.id}&force_tgc=${res.data.ticket}` iframeUrl = `${dmlURL}/group?experiment_id=${route.query.id}&force_tgc=${res.data.ticket}`
} else if (type === '8') { } else if (type === '8') {
// 用户旅程 // 用户旅程
iframeUrl = `${import.meta.env.VITE_DML_URL}/trip/review?experiment_id=${route.query.id}&force_tgc=${ iframeUrl = `${dmlURL}/trip/review?experiment_id=${route.query.id}&force_tgc=${res.data.ticket}`
res.data.ticket
}`
} else if (type === '9') { } else if (type === '9') {
// 营销资料 // 营销资料
iframeUrl = `${import.meta.env.VITE_DML_URL}/material?experiment_id=${route.query.id}&force_tgc=${ iframeUrl = `${dmlURL}/material?experiment_id=${route.query.id}&force_tgc=${res.data.ticket}`
res.data.ticket
}`
} else if (type === '10') { } else if (type === '10') {
// 用户事件 // 用户事件
iframeUrl = `${import.meta.env.VITE_DML_URL}/user?experiment_id=${route.query.id}&force_tgc=${res.data.ticket}` iframeUrl = `${dmlURL}/user?experiment_id=${route.query.id}&force_tgc=${res.data.ticket}`
} }
} }
}) })
...@@ -46,7 +41,7 @@ const getIframeUrl = function () { ...@@ -46,7 +41,7 @@ const getIframeUrl = function () {
</script> </script>
<template> <template>
<DragPanel @resize="handleResize"> <DragPanel>
<template #left> <template #left>
<div class="lab-left"> <div class="lab-left">
<el-tabs type="border-card"> <el-tabs type="border-card">
......
...@@ -4,6 +4,8 @@ import { getExperimentScore } from '../api' ...@@ -4,6 +4,8 @@ import { getExperimentScore } from '../api'
interface Props { interface Props {
experiment_id: string experiment_id: string
} }
import { useAppConfig } from '@/composables/useAppConfig'
const appConfig = useAppConfig()
const props = defineProps<Props>() const props = defineProps<Props>()
let experiment = $ref<any>() let experiment = $ref<any>()
...@@ -40,9 +42,7 @@ function getOperationUrl(type: number) { ...@@ -40,9 +42,7 @@ function getOperationUrl(type: number) {
return `/student/lab/report/view/${experiment.id}` return `/student/lab/report/view/${experiment.id}`
} else if (type === 8) { } else if (type === 8) {
// 用户旅程 // 用户旅程
return `${import.meta.env.VITE_DML_URL}/trip/my/score?experiment_id=${experiment.id}&student_id=${ return `${appConfig.dmlURL || import.meta.env.VITE_DML_URL}/trip/my/score?experiment_id=${experiment.id}&student_id=${experiment.student.id}`
experiment.student.id
}`
} }
} }
</script> </script>
...@@ -71,9 +71,7 @@ function getOperationUrl(type: number) { ...@@ -71,9 +71,7 @@ function getOperationUrl(type: number) {
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="评分教师"> <el-form-item label="评分教师">
{{ {{ detail.checker_sso_user.real_name || detail.checker_sso_user.nickname || detail.checker_sso_user.username }}
detail.checker_sso_user.real_name || detail.checker_sso_user.nickname || detail.checker_sso_user.username
}}
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -85,11 +83,7 @@ function getOperationUrl(type: number) { ...@@ -85,11 +83,7 @@ function getOperationUrl(type: number) {
<p>实验得分</p> <p>实验得分</p>
<p class="t1">{{ detail.score }}</p> <p class="t1">{{ detail.score }}</p>
</div> </div>
<el-table <el-table :data="detail.score_details" stripe :header-cell-style="{ background: '#ededed' }" v-if="detail.is_show === '1'">
:data="detail.score_details"
stripe
:header-cell-style="{ background: '#ededed' }"
v-if="detail.is_show === '1'">
<el-table-column label="实验成绩组成项" prop="name" align="center"></el-table-column> <el-table-column label="实验成绩组成项" prop="name" align="center"></el-table-column>
<el-table-column label="权重" prop="percent" align="center"> <el-table-column label="权重" prop="percent" align="center">
<template #default="{ row }">{{ row.percent }}%</template> <template #default="{ row }">{{ row.percent }}%</template>
......
...@@ -10,6 +10,8 @@ import dayjs from 'dayjs' ...@@ -10,6 +10,8 @@ import dayjs from 'dayjs'
import { saveAs } from 'file-saver' import { saveAs } from 'file-saver'
import html2pdf from 'html2pdf.js' import html2pdf from 'html2pdf.js'
import { useCookies } from '@vueuse/integrations/useCookies' import { useCookies } from '@vueuse/integrations/useCookies'
import { useAppConfig } from '@/composables/useAppConfig'
const appConfig = useAppConfig()
const Question = defineAsyncComponent(() => import('../components/Question.vue')) const Question = defineAsyncComponent(() => import('../components/Question.vue'))
const Info = defineAsyncComponent(() => import('../components/Info.vue')) const Info = defineAsyncComponent(() => import('../components/Info.vue'))
...@@ -95,17 +97,15 @@ watchEffect(() => { ...@@ -95,17 +97,15 @@ watchEffect(() => {
const cookies = useCookies(['TGC']) const cookies = useCookies(['TGC'])
const LAB_URL = computed(() => { const LAB_URL = computed(() => {
return experimentInfo?.type === 4 return experimentInfo?.type === 4
? `${import.meta.env.VITE_DML_URL}/trip/my?experiment_id=${form.experiment_id}` ? `${appConfig.dmlURL || import.meta.env.VITE_DML_URL}/trip/my?experiment_id=${form.experiment_id}`
: `${import.meta.env.VITE_LAB_URL}&token=${cookies.get('TGC')}` : `${appConfig.dmlURL || import.meta.env.VITE_LAB_URL}&token=${cookies.get('TGC')}`
}) })
let iframeKey = $ref(Date.now()) let iframeKey = $ref(Date.now())
// 返回首页 // 返回首页
function handleBackHome() { function handleBackHome() {
ElMessageBox.confirm('此操作将会强制返回到实验室首页,您当前的操作内容有可能丢失,确定返回首页吗?', '提示').then( ElMessageBox.confirm('此操作将会强制返回到实验室首页,您当前的操作内容有可能丢失,确定返回首页吗?', '提示').then(() => {
() => {
iframeKey = Date.now() iframeKey = Date.now()
} })
)
} }
const reportDialogVisible = $ref(false) const reportDialogVisible = $ref(false)
...@@ -162,14 +162,12 @@ function uploadPicture(url: string) { ...@@ -162,14 +162,12 @@ function uploadPicture(url: string) {
} }
// 提交实验 // 提交实验
function handleSubmit() { function handleSubmit() {
ElMessageBox.confirm('此操作将会提交该实验,状态会变为已提交,您将不能再操作该实验,确定提交实验吗?', '提示').then( ElMessageBox.confirm('此操作将会提交该实验,状态会变为已提交,您将不能再操作该实验,确定提交实验吗?', '提示').then(() => {
() => {
submitExperimentRecord({ experiment_id: form.experiment_id }).then(() => { submitExperimentRecord({ experiment_id: form.experiment_id }).then(() => {
ElMessage({ message: '提交成功', type: 'success' }) ElMessage({ message: '提交成功', type: 'success' })
fetchExperimentRecord() fetchExperimentRecord()
}) })
} })
)
} }
let resizeKey = $ref(0) let resizeKey = $ref(0)
function handleResize() { function handleResize() {
...@@ -264,39 +262,21 @@ function handleReportPreviewReady() { ...@@ -264,39 +262,21 @@ function handleReportPreviewReady() {
<AppCard> <AppCard>
<el-row justify="space-between"> <el-row justify="space-between">
<div> <div>
<el-button type="primary" :icon="HomeFilled" :disabled="submitted" @click="handleBackHome" <el-button type="primary" :icon="HomeFilled" :disabled="submitted" @click="handleBackHome">返回首页</el-button>
>返回首页</el-button
>
<el-button type="primary" :disabled="disabled" @click="handleSubmit">提交实验</el-button> <el-button type="primary" :disabled="disabled" @click="handleSubmit">提交实验</el-button>
</div> </div>
<div> <div>
<el-button type="primary" :disabled="disabled" :loading="screenshotLoading" @click="handleCapture" <el-button type="primary" :disabled="disabled" :loading="screenshotLoading" @click="handleCapture">截图</el-button>
>截图</el-button
>
<el-button type="primary" :disabled="disabled" @click="prepareDialogVisible = true">实验准备</el-button> <el-button type="primary" :disabled="disabled" @click="prepareDialogVisible = true">实验准备</el-button>
<el-button type="primary" :disabled="disabled" @click="resultDialogVisible = true">实验结果</el-button> <el-button type="primary" :disabled="disabled" @click="resultDialogVisible = true">实验结果</el-button>
<el-button <el-button type="primary" :disabled="disabled" v-if="experimentInfo?.report_upload_way === 2 && !experimentInfo?.is_commit_report">
type="primary"
:disabled="disabled"
v-if="experimentInfo?.report_upload_way === 2 && !experimentInfo?.is_commit_report">
<router-link :to="`/student/lab/report/${form.experiment_id}`" target="_blank">在线实验报告</router-link> <router-link :to="`/student/lab/report/${form.experiment_id}`" target="_blank">在线实验报告</router-link>
</el-button> </el-button>
<el-button <el-button type="primary" :disabled="disabled" @click="reportDialogVisible = true" v-if="experimentInfo?.report_upload_way === 1 && !submitted"
type="primary"
:disabled="disabled"
@click="reportDialogVisible = true"
v-if="experimentInfo?.report_upload_way === 1 && !submitted"
>上传实验报告</el-button >上传实验报告</el-button
> >
<el-button type="primary" @click="handleReportView" v-if="experimentInfo?.is_commit_report" <el-button type="primary" @click="handleReportView" v-if="experimentInfo?.is_commit_report">查看实验报告</el-button>
>查看实验报告</el-button <el-button type="primary" @click="handleReportExport" v-if="detail?.status === 2 && experimentInfo?.is_commit_report">导出实验报告</el-button>
>
<el-button
type="primary"
@click="handleReportExport"
v-if="detail?.status === 2 && experimentInfo?.is_commit_report"
>导出实验报告</el-button
>
</div> </div>
</el-row> </el-row>
</AppCard> </AppCard>
...@@ -313,21 +293,12 @@ function handleReportPreviewReady() { ...@@ -313,21 +293,12 @@ function handleReportPreviewReady() {
:data="experimentInfo" :data="experimentInfo"
@update="fetchExperimentRecord" @update="fetchExperimentRecord"
v-if="reportDialogVisible && experimentInfo"></ReportDialog> v-if="reportDialogVisible && experimentInfo"></ReportDialog>
<ReportFilePreview <ReportFilePreview v-model="reportFilePreviewVisible" :data="experimentInfo" v-if="reportFilePreviewVisible && experimentInfo"></ReportFilePreview>
v-model="reportFilePreviewVisible"
:data="experimentInfo"
v-if="reportFilePreviewVisible && experimentInfo"></ReportFilePreview>
<!-- 实验准备 --> <!-- 实验准备 -->
<PrepareDialog <PrepareDialog v-model="prepareDialogVisible" :data="experimentInfo" v-if="prepareDialogVisible && experimentInfo"></PrepareDialog>
v-model="prepareDialogVisible"
:data="experimentInfo"
v-if="prepareDialogVisible && experimentInfo"></PrepareDialog>
<!-- 实验结果 --> <!-- 实验结果 -->
<ResultDialog <ResultDialog v-model="resultDialogVisible" :data="experimentInfo" v-if="resultDialogVisible && experimentInfo"></ResultDialog>
v-model="resultDialogVisible"
:data="experimentInfo"
v-if="resultDialogVisible && experimentInfo"></ResultDialog>
<!-- 导出在线报告 --> <!-- 导出在线报告 -->
<template v-if="experimentInfo?.id && isExport"> <template v-if="experimentInfo?.id && isExport">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论