Forráskód Böngészése

个人中心/我的考试(任务)/调查问卷(任务)/我的作业(接口)

canghailong 7 hónapja
szülő
commit
854fdf8503

BIN
public/favicon.ico


BIN
public/img/logo.png


+ 1 - 1
src/router/student.js

@@ -81,7 +81,7 @@ const forum = [
 				}
 			},
 			{
-				path: 'paper/:examType(\\d+)',
+				path: 'paper/:paperType(\\d+)',
 				component: () => import('@/views/student/paper/index.vue'),
 				meta: {
 					title: '学生试卷'

+ 3 - 3
src/views/portal/components/Header.vue

@@ -9,9 +9,9 @@
 				<a-menu-item key="student/courseCenter">课程中心</a-menu-item>
 				<a-sub-menu key="myList">
 					<template #title>我的</template>
-					<a-menu-item key="student/paper/1">我的考试</a-menu-item>
-					<a-menu-item key="student/paper/4">我的作业</a-menu-item>
-					<a-menu-item key="student/paper/3">调查问卷</a-menu-item>
+					<a-menu-item key="student/paper/6">我的考试</a-menu-item>
+					<a-menu-item key="student/paper/2">我的作业</a-menu-item>
+					<a-menu-item key="student/paper/5">调查问卷</a-menu-item>
 					<a-menu-item key="student/classCollect">课程收藏</a-menu-item>
 				</a-sub-menu>
 			</a-menu>

+ 3 - 3
src/views/resourceDetails/components/TallList.vue

@@ -312,7 +312,7 @@
 	}
 
 	.resource-container {
-		width: 850px;
+		width: 100%;
 		margin: 0 auto;
 		padding: 20px;
 		border: 1px solid #dfe2e5;
@@ -388,7 +388,7 @@
 	}
 
 	.resource-container {
-		width: 850px;
+		width: 100%;
 		margin: 0 auto;
 		padding: 20px;
 		border: 1px solid #dfe2e5;
@@ -439,10 +439,10 @@
 	.tallList {
 		display: flex;
 		flex-direction: column;
-		width: 850px;
 		border: 1px solid #dfe2e5;
 		padding: 20px;
 		margin-top: 10px;
+		flex:1;
 	}
 
 	.tallListInfo {

+ 9 - 11
src/views/resourceDetails/components/VideoDetails.vue

@@ -3,14 +3,14 @@
 		<h1>{{ resName }}</h1>
 		<div style="height: 25px"></div>
 		<div class="user-info-container">
-			<div class="video-info" style="width: 850px">
+			<div class="video-info">
 				<div
 					v-if="videoFormat == 'jpg' || videoFormat == 'bmp' || videoFormat == 'png' || videoFormat == 'jpeg'"
-					style="width: 850px; height: 350px"
+					style="width: 100%; height: 350px"
 				>
 					<!-- <img :src="imgs + itemData.coverImagePath" style="width: 100%; height: 100%" /> -->
 					<!-- <img :v-lazy="imagess" style="width: 100%; height: 100%" /> -->
-					<a-image width="850px" height="350px" :src="resSrc" :preview="true" />
+					<a-image width="100%" height="350px" :src="resSrc" :preview="true" />
 					<!-- <image :src="resSrc" style="object-fit: cover" /> -->
 				</div>
 				<!-- "wmv","avi","flv","mpeg","mpg","rmvb","mov","mkv" -->
@@ -26,7 +26,7 @@
 						videoFormat == 'rmvb' ||
 						videoFormat == 'mov'
 					"
-					style="width: 850px; height: 350px"
+					style="width: 100%; height: 350px"
 				>
 					<video :src="resSrc" controls style="width: 100%; height: 100%" />
 				</div>
@@ -41,7 +41,7 @@
 						videoFormat == 'xlsx' ||
 						videoFormat == 'pdf'
 					"
-					style="width: 850px; height: 350px"
+					style="width: 100%; height: 350px"
 				>
 					<!-- <PDF :src="resSrc" :width="850" :height="350" /> -->
 					<FilePreviewer :fileUrl="resSrc" :fileName="resName" :fileType="fileType" />
@@ -384,9 +384,6 @@
 		color: white;
 	}
 
-	.tab-switcher div:not(:last-child) {
-	}
-
 	.user-info {
 		display: flex;
 		align-items: center;
@@ -397,7 +394,7 @@
 	}
 
 	.resource-container {
-		width: 850px;
+		width: 100%;
 		margin: 0 auto;
 		padding: 20px;
 		border: 1px solid #dfe2e5;
@@ -475,7 +472,7 @@
 	}
 
 	.resource-container {
-		width: 850px;
+		width: 100%;
 		margin: 0 auto;
 		padding: 20px;
 		border: 1px solid #dfe2e5;
@@ -503,6 +500,7 @@
 	}
 	.video-info {
 		height: 100%; /* 确保填满容器高度 */
+		flex:1;
 	}
 	.resInfo {
 		margin-left: 10px;
@@ -526,7 +524,7 @@
 	.tallList {
 		display: flex;
 		flex-direction: column;
-		width: 850px;
+		width: 100%;
 		height: 200px;
 		border: 1px solid #dfe2e5;
 		padding: 20px;

+ 161 - 64
src/views/student/paper/index.vue

@@ -4,64 +4,81 @@
 			<!-- 任务中心开始 -->
 			<div class="task-center" style="margin-bottom: 24px">
 				<h3 style="border-left: solid 4px #3651d4; padding-left: 8px; margin-bottom: 12px; font-size: 18px">
-					<div v-if="examType == 1">考试</div>
-					<div v-if="examType == 2">章节测验</div>
-					<div v-if="examType == 3">调查问卷</div>
-					<div v-if="examType == 4">我的作业</div>
+					<div>{{ paperName }}</div>
 				</h3>
+				<div style="display: flex; align-items: center" class="mb-4" v-if="examType == 4">
+					<div class="mr-4">学科分类</div>
+					<a-select ref="select" v-model:value="tabId" style="width: 120px" allowClear @change="handleChange">
+						<a-select-option :value="item.id" v-for="(item, idx) in subjectList">{{ item.name }}</a-select-option>
+					</a-select>
+				</div>
 				<a-spin :spinning="taskLoading">
 					<a-table
-						v-if="taskList.length !== 0"
-						:dataSource="taskList"
+						ref="selectedTable"
 						:columns="taskColumns"
-						:pagination="false"
+						:data-source="taskList"
+						:expand-row-by-click="true"
 						rowKey="id"
 						size="middle"
 					>
 						<template #bodyCell="{ column, record }">
-							<template v-if="column.key === 'examName'">
-								{{ record.examName }}
-							</template>
-							<template v-else-if="column.key === 'examType'">
-								{{ examTypeName(record.examType) }}
-							</template>
-							<template v-else-if="column.key === 'startTime'">
-								{{ record.startTime }}
-							</template>
-							<template v-else-if="column.key === 'endTime'">
-								{{ record.endTime }}
-							</template>
-							<template v-else-if="column.key === 'examStatus'">
-								<a-tag :color="statusTagFormatter(record.examStatus)" size="small">
-									{{ statusTextFormatter(record.examStatus) }}
-								</a-tag>
-							</template>
-							<template v-else-if="column.key === 'action'">
-								<router-link
-									v-if="record.examStatus === 0"
-									:to="{ path: '/student/do', query: { id: record.paperId } }"
-									target="_blank"
-								>
-									<a-button type="link" size="small">查看问卷</a-button>
-								</router-link>
-								<router-link
-									v-else-if="record.examStatus === 1"
-									:to="{ path: '/student/do', query: { id: record.paperId } }"
-									target="_blank"
-								>
-									<a-button type="link" size="small">填写问卷</a-button>
-								</router-link>
-								<router-link
-									v-else-if="record.examStatus === 2"
-									:to="{ path: '/student/read', query: { id: record.paperId } }"
-									target="_blank"
-								>
-									<a-button type="link" size="small">查看结果</a-button>
-								</router-link>
-							</template>
+							<div v-if="examType.value != 4">
+								<template v-if="column.key === 'examName'">
+									{{ record.examName }}
+								</template>
+								<template v-if="column.key === 'examType'">
+									{{ examTypeName(record.examType) }}
+								</template>
+								<template v-if="column.key === 'startTime'">
+									{{ formatDateTime(record.startTime) }}
+								</template>
+								<template v-if="column.key === 'endTime'">
+									{{ formatDateTime(record.endTime) }}
+								</template>
+								<template v-if="column.key === 'examStatus'">
+									<a-tag :color="statusTagFormatter(record.examStatus)" size="small">
+										{{ statusTextFormatter(record.examStatus) }}
+									</a-tag>
+								</template>
+								<template v-if="column.key === 'action'">
+									<router-link
+										v-if="record.examStatus === 0"
+										:to="{ path: '/student/do', query: { id: record.paperId } }"
+										target="_blank"
+									>
+										<a-button type="link" size="small">查看{{ paperName }}</a-button>
+									</router-link>
+									<router-link
+										v-if="record.examStatus === 1"
+										:to="{ path: '/student/do', query: { id: record.paperId } }"
+										target="_blank"
+									>
+										<a-button type="link" size="small">填写{{ paperName }}</a-button>
+									</router-link>
+									<router-link
+										v-if="record.examStatus === 2"
+										:to="{ path: '/student/read', query: { id: record.paperId } }"
+										target="_blank"
+									>
+										<a-button type="link" size="small">查看结果</a-button>
+									</router-link>
+								</template>
+							</div>
+							<div v-if="examType.value == 4">
+								<template v-if="column.key === 'paperType'">
+									{{ paperTypeEnum(record.paperType) }}
+								</template>
+								<template v-if="column.key === 'subjectId'">
+									{{ subjectName(record.subjectId) }}
+								</template>
+								<template v-if="column.key === 'action'">
+									<router-link :to="{ path: '/student/do', query: { id: record.id } }" target="_blank">
+										<a-button type="link" size="small">开始答题</a-button>
+									</router-link>
+								</template>
+							</div>
 						</template>
 					</a-table>
-					<div v-else style="color: #999; padding: 16px 0">暂无任务</div>
 				</a-spin>
 			</div>
 		</div>
@@ -74,25 +91,72 @@
 	import taskApi from '@/api/student/examPaper'
 	import { useRoute } from 'vue-router'
 	import tool from '@/utils/tool'
-	const examNameOption = tool.dictList('EXAM_TYPE')
+	import { parseTime } from '@/utils/exam'
 	const route = useRoute()
+	const formatDateTime = (val) => {
+		if (!val) return ''
+		return parseTime(val, '{y}-{m}-{d} {h}:{i}:{s}')
+	}
+	// store
+	const examStore = useExamStore()
+	const paperTypeEnum = computed(() => {
+		return (key) => {
+			return examStore.paperTypeEnum.filter((item) => item.key == key)[0]?.value
+		}
+	})
+	const examNameOption = tool.dictList('EXAM_TYPE')
 	const examTypeName = computed(() => {
 		return (id) => {
 			return examNameOption.filter((r) => r.value == id)[0].label
 		}
 	})
 
+	const paperName = computed(() => {
+		switch (paperType.value) {
+			case '6':
+				return '考试'
+				break
+			case '3':
+				return '章节测验'
+				break
+			case '5':
+				return '调查问卷'
+				break
+			case '2':
+				return '我的作业'
+				break
+		}
+	})
 	// 任务中心相关
 	const taskList = ref([])
 	const taskLoading = ref(false)
-	const taskColumns = [
-		{ title: '问卷名称', dataIndex: 'examName', key: 'examName' },
-		{ title: '问卷类型', dataIndex: 'examType', key: 'examType', width: 120 },
-		{ title: '开始时间', dataIndex: 'startTime', key: 'startTime', width: 180 },
-		{ title: '结束时间', dataIndex: 'endTime', key: 'endTime', width: 180 },
-		{ title: '状态', dataIndex: 'examStatus', key: 'examStatus', width: 90 },
-		{ title: '操作', key: 'action', align: 'right', width: 120 }
+	// 选中表格的表格common
+	const selectedCommons = [
+		{
+			title: '操作',
+			dataIndex: 'action',
+			align: 'center',
+			width: 80
+		},
+		{
+			title: '机构名',
+			dataIndex: 'name',
+			ellipsis: true
+		}
 	]
+	const taskColumns = computed(()=>taskAllColumns.value.filter(r=>r.examType.includes(examType.value)))
+	const taskAllColumns = ref([
+		{ title: '问卷名称', dataIndex: 'name', key: 'name', examType: [4] },
+		{ title: '试卷类型', dataIndex: 'paperType', key: 'paperType', width: 120, examType: [4] },
+		{ title: '学科', dataIndex: 'subjectId', key: 'subjectId', width: 120, examType: [4] },
+
+		{ title: '问卷名称', dataIndex: 'examName', key: 'examName',examType:[1,2,3] },
+		{ title: '问卷类型', dataIndex: 'examType', key: 'examType', width: 120,examType:[1,2,3] },
+		{ title: '开始时间', dataIndex: 'startTime', key: 'startTime', width: 180 ,examType:[1,2,3]},
+		{ title: '结束时间', dataIndex: 'endTime', key: 'endTime', width: 180,examType:[1,2,3] },
+		{ title: '状态', dataIndex: 'examStatus', key: 'examStatus', width: 90,examType:[1,2,3] },
+		{ title: '操作', key: 'action', align: 'right', width: 120,examType:[1,2,3,4] }
+	])
 
 	const statusTextFormatter = (status) => {
 		if (status === 0) return '未开始'
@@ -112,16 +176,14 @@
 			let res = []
 			if (examType.value == 4) {
 				const params = {
-					current: 1,
-					size: 999999,
-					examType: examType.value,
-					paperType: '2'
+					...queryParam.value,
+					courseId: route.query.id,
+					paperType: paperType.value
 				}
 				res = await examPaperApi.pageList(params)
 			} else {
 				res = await taskApi.pageExamList({
-					current: 1,
-					size: 10,
+					...queryParam.value,
 					examType: examType.value,
 					courseId: route.query.id
 				})
@@ -133,11 +195,46 @@
 		}
 		taskLoading.value = false
 	}
-
+	// 学科分类
+	const queryParam = ref({
+		current: 1,
+		size: 10
+	})
+	const tabId = ref('')
+	const subjectList = ref([])
+	const initSubject = async () => {
+		await examStore.initSubject()
+		subjectList.value = examStore.subjects
+	}
+	const subjectName = computed(() => {
+		return (id) => {
+			return subjectList.value.filter((r) => r.id == id)[0]?.name
+		}
+	})
+	const handleChange = (value) => {
+		queryParam.value.subjectId = value
+		getTaskList()
+	}
 	// lifecycle
 	const examType = ref()
+	const paperType = ref()
 	onMounted(() => {
-		examType.value = route.params && route.params.examType
+		paperType.value = route.params && route.params.paperType
+		switch (paperType.value) {
+			case '6':
+				examType.value = 1
+				break
+			case '2':
+				examType.value = 4
+				break
+			case '5':
+				examType.value = 3
+				break
+			case '3':
+				examType.value = 2
+				break
+		}
+		initSubject()
 		getTaskList()
 	})
 </script>

+ 53 - 15
src/views/student/user/index.vue

@@ -1,23 +1,61 @@
 <template>
-	<a-card>
-		<a-descriptions :title="userInfo.name">
-			<a-descriptions-item label="性别">{{ userInfo.gender }}</a-descriptions-item>
-			<a-descriptions-item label="邮箱">{{ userInfo.email }}</a-descriptions-item>
-			<a-descriptions-item label="手机">{{ userInfo.phone }}</a-descriptions-item>
-			<a-descriptions-item label="生日">{{ userInfo.birthday }}</a-descriptions-item>
-			<a-descriptions-item label="学号">{{ userInfo.name }}</a-descriptions-item>
-			<a-descriptions-item label="第几届">{{ userInfo.name }}</a-descriptions-item>
-			<a-descriptions-item label="院系">{{ userInfo.name }}</a-descriptions-item>
-			<a-descriptions-item label="班级">{{ userInfo.name }}</a-descriptions-item>
-			<a-descriptions-item label="专业">{{ userInfo.name }}</a-descriptions-item>
-		</a-descriptions>
-	</a-card>
+	<a-row :gutter="10">
+		<a-col :xs="24" :sm="24" :md="7" :lg="7" :xl="7" class="mb-3">
+			<a-card :bordered="false">
+				<div class="account-center-avatarHolder">
+					<div class="avatar">
+						<img :src="userInfo.avatar" />
+					</div>
+					<div class="username">{{ userInfo.name }}</div>
+					<div class="bio">{{ userInfo.nickname }}</div>
+				</div>
+				<div class="account-center-detail">
+					<p>{{ userInfo.fallDue }}</p>
+					<p>{{ userInfo.gradesIdName }}</p>
+					<p>{{ userInfo.majorIdName }}</p>
+				</div>
+			</a-card>
+		</a-col>
+		<a-col :xs="24" :sm="24" :md="17" :lg="17" :xl="17">
+			<a-card>
+				<a-descriptions :title="`${userInfo.name}个人信息`" :column="1">
+					<a-descriptions-item label="性别">{{ userInfo.gender }}</a-descriptions-item>
+					<a-descriptions-item label="邮箱">{{ userInfo.email }}</a-descriptions-item>
+					<a-descriptions-item label="手机">{{ userInfo.phone }}</a-descriptions-item>
+					<a-descriptions-item label="生日">{{ userInfo.birthday }}</a-descriptions-item>
+					<a-descriptions-item label="学号">{{ userInfo.studentNum }}</a-descriptions-item>
+					<a-descriptions-item label="入学时间">{{ userInfo.fallDue }}</a-descriptions-item>
+					<a-descriptions-item label="班级">{{ userInfo.gradesIdName }}</a-descriptions-item>
+					<a-descriptions-item label="专业">{{ userInfo.majorIdName }}</a-descriptions-item>
+				</a-descriptions>
+			</a-card>
+		</a-col>
+	</a-row>
 </template>
 
 <script setup>
 	import tool from '@/utils/tool'
 	const userInfo = tool.data.get('USER_INFO')
-	console.log("🚀 ~ userInfo:", userInfo)
 </script>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+	.avatar {
+		margin: 0 auto;
+		width: 104px;
+		height: 104px;
+		margin-bottom: 20px;
+		border-radius: 50%;
+		overflow: hidden;
+		img {
+			height: 100%;
+			width: 100%;
+		}
+	}
+	.username {
+		font-size: 20px;
+		line-height: 28px;
+		font-weight: 500;
+		margin-bottom: 4px;
+		text-align: center;
+	}
+</style>