|
|
@@ -196,6 +196,7 @@ provide('currentEngagement',currentEngagement);
|
|
|
|
|
|
watch(currentEngagement,()=>{
|
|
|
activeNames.value = []
|
|
|
+ currentVersionIndex.value = 0
|
|
|
})
|
|
|
/**
|
|
|
* 切换作业题目
|
|
|
@@ -204,6 +205,7 @@ watch(currentEngagement,()=>{
|
|
|
*/
|
|
|
function AssignmentChanged(value:AssignmentVO){
|
|
|
console.log("用户切换了作业")
|
|
|
+ currentVersionIndex.value = 0
|
|
|
if (value.assignmentId === -1){
|
|
|
currentEngagementIndex.value = -1;
|
|
|
return;
|
|
|
@@ -320,62 +322,45 @@ function getHistory(array:string[]) {
|
|
|
if (array.length == 0)return
|
|
|
dataHistory.value = []
|
|
|
activeVersion.value = '1'
|
|
|
-
|
|
|
// 生成测试数据
|
|
|
- const now = Date.now()
|
|
|
- dataHistory.value = [
|
|
|
- {
|
|
|
- id: '1',
|
|
|
- timestamp: now - 1000 * 60 * 60 * 24,
|
|
|
- name: '版本v1.0.0',
|
|
|
- time: '2024/01/27 14:30:00',
|
|
|
- author: currentEngagement.value.studentName
|
|
|
- },
|
|
|
- {
|
|
|
- id: '2',
|
|
|
- timestamp: now - 1000 * 60 * 60 * 24 * 2,
|
|
|
- name: '版本v1.0.1',
|
|
|
- time: '2024/01/26 10:15:00',
|
|
|
- author: currentEngagement.value.studentName
|
|
|
- },
|
|
|
- {
|
|
|
- id: '3',
|
|
|
- timestamp: now - 1000 * 60 * 60 * 24 * 3,
|
|
|
- name: '修复登录问题',
|
|
|
- time: '2024/01/25 16:45:00',
|
|
|
- author: currentEngagement.value.studentName
|
|
|
- },
|
|
|
- {
|
|
|
- id: '4',
|
|
|
- timestamp: now - 1000 * 60 * 60 * 24 * 4,
|
|
|
- name: '优化界面UI',
|
|
|
- time: '2024/01/24 09:20:00',
|
|
|
- author: currentEngagement.value.studentName
|
|
|
- },
|
|
|
- {
|
|
|
- id: '5',
|
|
|
- timestamp: now - 1000 * 60 * 60 * 24 * 5,
|
|
|
- name: '版本v1.1.0',
|
|
|
- time: '2024/01/23 11:00:00',
|
|
|
- author: currentEngagement.value.studentName
|
|
|
- },
|
|
|
- {
|
|
|
- id: '6',
|
|
|
- timestamp: now - 1000 * 60 * 60 * 24 * 6,
|
|
|
- name: '新增搜索功能',
|
|
|
- time: '2024/01/22 15:10:00',
|
|
|
- author: currentEngagement.value.studentName
|
|
|
- },
|
|
|
- {
|
|
|
- id: '7',
|
|
|
- timestamp: now - 1000 * 60 * 60 * 24 * 7,
|
|
|
- name: '修复数据同步问题',
|
|
|
- time: '2024/01/21 13:25:00',
|
|
|
- author: '张三'
|
|
|
- }
|
|
|
- ]
|
|
|
+ getVersionList()
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * 版本控制
|
|
|
+ */
|
|
|
+const currentVersionIndex:Ref<number> = ref(0)
|
|
|
+provide('currentVersionIndex',currentVersionIndex)
|
|
|
+const versionIsLoading = ref(false)
|
|
|
+import * as dayjs from 'dayjs';
|
|
|
+const formatDateTime = (isoString: string): string => {
|
|
|
+ let tempDate = new Date(isoString)
|
|
|
+ return `${tempDate.getFullYear()}/${tempDate.getMonth()+1}/${tempDate.getDate()} `+
|
|
|
+ `${tempDate.getHours().toString().padStart(2,'0')}:${tempDate.getMinutes().toString().padStart(2,'0')}:${tempDate.getSeconds().toString().padStart(2,'0')}`
|
|
|
+};
|
|
|
+async function getVersionList(){
|
|
|
+ versionIsLoading.value = true
|
|
|
+ let res = await apis.selectBehaviorRecord(currentEngagement.value.studentId,currentEngagement.value.assignmentId)
|
|
|
+ console.log('版本号',res)
|
|
|
+ if (res && res.data && res.data.code === 200 && Array.isArray(res.data.data)){
|
|
|
+ let events = res.data.data as any[]
|
|
|
+ dataHistory.value = events.map((value,index)=>{
|
|
|
+ return {
|
|
|
+ name:`版本${index+1}`,
|
|
|
+ time:formatDateTime(value.createdAt),
|
|
|
+ author:currentEngagement.value.studentName
|
|
|
+ }
|
|
|
+ })
|
|
|
+ versionIsLoading.value = false
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ ElMessage.error('获取版本信息失败')
|
|
|
+ versionIsLoading.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
onMounted(()=>{
|
|
|
getCourseList();
|
|
|
})
|
|
|
@@ -458,9 +443,8 @@ onMounted(()=>{
|
|
|
</div>
|
|
|
<el-empty v-else :description="emptyText" style="height: 227px" />
|
|
|
</el-card>
|
|
|
-
|
|
|
- <el-card class="info-card" style="margin-top: 0">
|
|
|
- <el-collapse style="border: none;" v-model="activeNames" @change="getHistory">
|
|
|
+ <el-card class="info-card" style="margin-top: 0;max-height: 500px;overflow-y:auto;">
|
|
|
+ <el-collapse v-loading="versionIsLoading" style="border: none;" v-model="activeNames" @change="getHistory">
|
|
|
<el-collapse-item id="timeline-collapse" name="1">
|
|
|
<template #title>
|
|
|
<span style="font-weight: bold;font-size: 16px">版本选择</span>
|
|
|
@@ -469,10 +453,10 @@ onMounted(()=>{
|
|
|
<el-timeline-item
|
|
|
v-for="(activity, index) in dataHistory"
|
|
|
:key="index"
|
|
|
- :color="activeVersion == activity.id?'#409EFFFF':''"
|
|
|
- @click="activeVersion = activity.id"
|
|
|
+ :color="index == currentVersionIndex?'#409EFFFF':''"
|
|
|
+ @click="currentVersionIndex = index"
|
|
|
>
|
|
|
- <div :class="{'timeline-item-row':true,'is-active':activeVersion == activity.id}" >
|
|
|
+ <div :class="{'timeline-item-row':true,'is-active':currentVersionIndex == index}" >
|
|
|
<span >{{activity.name}}</span>
|
|
|
<span >{{activity.author}}</span>
|
|
|
<span>{{activity.time}}</span>
|