Merge branch 'develop' of http://25.13.9.101:9000/K17_AITS/tra-app into develop

This commit is contained in:
田岩
2026-03-10 11:04:17 +08:00
3 changed files with 137 additions and 97 deletions
+4 -2
View File
@@ -106,11 +106,13 @@
}
return _arr
})
onMounted(() => {
const initDate = () => {
nowDate.value = new Date()
activeDate.value = formatDate(nowDate.value, 'yyyy-MM-dd')
todayWeek.value = nowDate.value.getDay()
})
}
defineExpose({ initDate })
onMounted(() => {})
</script>
<style lang="scss" scoped>
+130 -94
View File
@@ -7,14 +7,10 @@
</view>
<view class="cont-box">
<!-- {{activeDate}} -->
<calendarCom @change="changeDate" />
<calendarCom ref="calendarComRef" @change="changeDate" />
<view class="table-list">
<todoItem
v-for="(item, index) in tableData"
:dataInfo="item"
:class="index === tableData.length - 1 ? 'last-item' : ''"
@click="handleDetail(item)"
></todoItem>
<todoItem v-for="(item, index) in tableData" :dataInfo="item"
:class="index === tableData.length - 1 ? 'last-item' : ''" @click="handleDetail(item)"></todoItem>
<view class="empty-box" v-show="tableData.length === 0">暂无数据</view>
</view>
<view class="more-btn" v-show="showMoreBtn" @click="getMoreData">点击加载更多</view>
@@ -22,139 +18,178 @@
</template>
<script setup>
import { ref, onMounted, computed } from 'vue';
import calendarCom from './calendar.vue';
import todoItem from './todo-item.vue';
import common from '@/common/common.js';
import { queryHaveToDo } from '@/api/index';
import { queryTraExamPapersByPapersId } from '@/api/examination.js';
import { queryTestPapers, queryOrgTree } from '@/api/competition.js';
import { checkTraPartnerInfoById } from '@/api/sparring.js';
import { queryTraUserAnonyByUserId } from '@/api/user.js';
const activeDate = ref('');
const tableData = ref([]);
import {
ref,
onMounted,
computed
} from 'vue'
import calendarCom from './calendar.vue'
import todoItem from './todo-item.vue'
import common from '@/common/common.js'
import {
queryHaveToDo
} from '@/api/index'
import {
queryTraExamPapersByPapersId
} from '@/api/examination.js'
import {
queryTestPapers,
queryOrgTree
} from '@/api/competition.js'
import {
checkTraPartnerInfoById
} from '@/api/sparring.js'
import {
queryTraUserAnonyByUserId
} from '@/api/user.js'
const activeDate = ref('')
const tableData = ref([])
const pageObj = ref({
totalNum: 0,
page: 1,
limit: 10
});
const changeDate = (date) => {
activeDate.value = date;
getDataList(date, 1);
};
})
const calendarComRef = ref(null)
const changeDate = date => {
activeDate.value = date
getDataList(date, 1)
}
const showMoreBtn = computed(() => {
return pageObj.value.totalNum > pageObj.value.page * pageObj.value.limit;
});
return pageObj.value.totalNum > pageObj.value.page * pageObj.value.limit
})
const getMoreData = () => {
pageObj.value.page += 1;
getDataList(activeDate.value);
};
pageObj.value.page += 1
getDataList(activeDate.value)
}
const initCalendar = () => {
calendarComRef.value && calendarComRef.value.initDate()
}
const getDataList = (date, flag) => {
common.loading();
common.loading()
if (flag === 1) {
tableData.value = [];
tableData.value = []
pageObj.value = {
totalNum: 0,
page: 1,
limit: 10
};
}
}
queryHaveToDo({
date,
...pageObj.value
})
.then((res) => {
let _arr = res.body || [];
pageObj.value.totalNum = res.total;
tableData.value = tableData.value.concat(_arr);
date,
...pageObj.value
})
.then(res => {
let _arr = res.body || []
pageObj.value.totalNum = res.total
tableData.value = tableData.value.concat(_arr)
})
.finally(() => {
common.hideLoading();
});
};
const handleDetail = (item) => {
console.log(item);
common.hideLoading()
})
}
const handleDetail = item => {
console.log(item)
switch (item.type) {
case '00':
common.navigateTo('/pages/courseDetail/index?crsId=' + item.id);
break;
common.navigateTo('/pages/courseDetail/index?crsId=' + item.id)
break
case '01':
toSparringDetail(item);
break;
toSparringDetail(item)
break
case '02':
toPKDetail(item);
break;
toPKDetail(item)
break
case '03':
toExaminationDetail(item);
break;
toExaminationDetail(item)
break
case '04':
common.setPageCache('learning_tasks_details', {
...item,
taskId: item.id,
taskName: item.name,
taskSums:item.planPersionNumber,
taskFinishSums:item.realPersionNumber,
ossAddr:item.ossKey,
});
common.navigateTo('/pages/learningTasks/details?taskId=' + item.id);
break;
toTaskDetail(item)
break
default:
break;
break
}
};
}
const toTaskDetail = (item) => {
if (item.limitTyp === '02') {
if (item.isTimeOut === '01') {
return common.msg('任务未开始');
} else if (item.isTimeOut === '02') {
return common.msg('任务已结束');
}
}
common.setPageCache('learning_tasks_details', {
...item,
taskId: item.id,
taskName: item.name,
taskSums: item.planPersionNumber,
taskFinishSums: item.realPersionNumber,
ossAddr: item.ossKey
})
common.navigateTo('/pages/learningTasks/details?taskId=' + item.id)
}
// 去PK
const toPKDetail = async (item) => {
const comId = item.id;
common.loading();
const result = Promise.all([queryTestPapers({ comId }), queryTraUserAnonyByUserId(), queryOrgTree()]);
const toPKDetail = async item => {
console.log(item)
if (item.isTimeOut !== '00') {
if (item.isTimeOut === '01') common.msg('竞赛未开始');
if (item.isTimeOut === '02') common.msg('竞赛已结束');
return;
}
const comId = item.id
common.loading()
const result = Promise.all([queryTestPapers({
comId
}), queryTraUserAnonyByUserId(), queryOrgTree()])
result
.then((res) => {
const papersId = res[0].body;
.then(res => {
const papersId = res[0].body
common.setPageCache('competition_list', {
papersId: papersId, // 试卷id
isAnony: res[1].body.isAnony, // 是否匿名 Y是N否
ruleDesc: item.ruleDesc, // 规则说明
comName: item.comName, // 标题
comId: comId
});
common.setValue('orgTree', res[2].body ?? []);
common.hideLoading();
common.navigateTo(`/pages/competition/matching?papersId=${papersId}&comId=${comId}`);
})
common.setValue('orgTree', res[2].body ?? [])
common.hideLoading()
common.navigateTo(`/pages/competition/matching?papersId=${papersId}&comId=${comId}`)
})
.catch(() => {
common.msg('网络繁忙,请稍后再试!');
});
};
common.msg('网络繁忙,请稍后再试!')
})
}
// 去考试
const toExaminationDetail = async (item) => {
common.loading();
const toExaminationDetail = async item => {
common.loading()
queryTraExamPapersByPapersId({
papersId: item.id
})
.then((res) => {
common.setPageCache('testing_hall_details', res.body);
common.navigateTo('/pages/testingHall/details');
papersId: item.id
})
.then(res => {
common.setPageCache('testing_hall_details', res.body)
common.navigateTo('/pages/testingHall/details')
})
.catch(() => {})
.finally(() => {
common.hideLoading();
});
};
common.hideLoading()
})
}
// 跳转 课程详情
const toSparringDetail = (item) => {
const toSparringDetail = item => {
if (item.id) {
checkTraPartnerInfoById({
traId: item.id
}).then((res) => {
}).then(res => {
if (res.body.inRange) {
common.navigateTo('/pages/sparring/detail?traId=' + item.id);
common.navigateTo('/pages/sparring/detail?traId=' + item.id)
} else {
common.show('提示', res.body.message, false);
common.show('提示', res.body.message, false)
}
});
})
}
};
}
defineExpose({
initCalendar
})
</script>
<style lang="scss" scoped>
@@ -186,6 +221,7 @@
}
.icon_3 {
// margin-top: 10rpx;
.img {
width: 38rpx;
@@ -229,4 +265,4 @@
font-size: 24rpx;
line-height: 120rpx;
}
</style>
</style>
+3 -1
View File
@@ -143,7 +143,7 @@
</view>
<classScroll :ref="(el) => (classScrollRef[1] = el)" name="recommend_class"></classScroll>
<classScroll :ref="(el) => (classScrollRef[2] = el)" name="new_class"></classScroll>
<toDoCom></toDoCom>
<toDoCom ref="toduRef"></toDoCom>
<view class="bottom_line">
<uv-divider text="我是有底线的" lineColor="#9cB0DC" :hairline="true"></uv-divider>
</view>
@@ -180,6 +180,7 @@
const no_read_message_num = ref(0);
const classScrollRef = ref([]);
const toduRef = ref(null)
// 处理显示的消息数量文本
const messageDisplayText = computed(() => {
return no_read_message_num.value > 99 ? '99+' : no_read_message_num.value;
@@ -333,6 +334,7 @@
statistics_data['get_statistics_data'](); // 获取统计数据
nextTick(() => {
classScrollRef.value.forEach((item) => item?.get_data());
toduRef.value.initCalendar()
});
noticeMessageCount().then((res) => {
no_read_message_num.value = res.body;