textbooks-practice-history.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <ie-page bg-color="#F6F8FA" :fix-height="true">
  3. <ie-navbar title="教材同步练习记录" />
  4. <view class="mt-20">
  5. <view v-for="(item, index) in historyList" :key="index"
  6. class="bg-white px-40 py-30 flex items-center sibling-border-top">
  7. <view class="flex-1">
  8. <view class="text-28">
  9. <text class=" text-fore-light">知识点:</text>
  10. <text class="text-fore-title">{{ item.paperName }}</text>
  11. </view>
  12. <view class="mt-10 text-28">
  13. <text class=" text-fore-light">完成时间:</text>
  14. <text class="text-fore-title">{{ item.endTime }}</text>
  15. </view>
  16. </view>
  17. <view class="text-24 text-white bg-primary w-fit px-40 py-12 rounded-full text-center"
  18. @click="handleViewHistory(item)">
  19. 查看
  20. </view>
  21. </view>
  22. </view>
  23. </ie-page>
  24. </template>
  25. <script lang="ts" setup>
  26. import { useNavbar } from '@/hooks/useNavbar';
  27. import { useTransferPage } from '@/hooks/useTransferPage';
  28. import { getTextbooksPracticeHistory } from '@/api/modules/study';
  29. import { Study } from '@/types';
  30. import { Transfer } from '@/types';
  31. import { EnumPaperType } from '@/common/enum';
  32. const { prevData, transferTo } = useTransferPage<{}, Transfer.PracticeResultPageOptions>();
  33. const { baseStickyTop } = useNavbar();
  34. const historyList = ref<Study.PracticeHistory[]>([]);
  35. const handleViewHistory = (value: Study.PracticeHistory) => {
  36. transferTo('/pagesStudy/pages/knowledge-practice-detail/knowledge-practice-detail', {
  37. data: {
  38. paperType: EnumPaperType.COURSE,
  39. examineeId: value.examineeId,
  40. name: value.paperName,
  41. directed: value.directed === 1
  42. } as Transfer.PracticeResultPageOptions,
  43. });
  44. }
  45. const loadData = async () => {
  46. uni.$ie.showLoading();
  47. try {
  48. const { rows } = await getTextbooksPracticeHistory();
  49. historyList.value = rows.map(item => {
  50. return {
  51. ...item,
  52. endTime: uni.$uv.timeFormat(item.endTime, 'yyyy-mm-dd hh:MM:ss')
  53. } as Study.PracticeHistory;
  54. });
  55. } finally {
  56. uni.$ie.hideLoading();
  57. }
  58. }
  59. onLoad(() => {
  60. console.log(prevData.value)
  61. loadData();
  62. });
  63. </script>
  64. <style lang="scss" scoped></style>