history.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <view class="container">
  3. <!-- 设置圆角 -->
  4. <view style="padding: 10px 30px 10px 30px;">
  5. <uni-search-bar :radius="100" @input="search" placeholder="搜索训练记录"></uni-search-bar>
  6. </view>
  7. <yf-more-list url="/api/repo/train/paging" :params="queryParams" ref="moreList">
  8. <template v-slot:item="{ data }">
  9. <uni-list-item
  10. :show-arrow="true"
  11. :title="data.repoId_dictText"
  12. :note="'进度:'+data.answerCount+'/'+data.totalCount+' 正确率:'+data.percent+'%'"
  13. :rightText="data.state===1?'已完成':'训练中'"
  14. link="navigateTo"
  15. @click="toTrain(data.state, data.repoId, data.mode)"
  16. >
  17. </uni-list-item>
  18. </template>
  19. </yf-more-list>
  20. </view>
  21. </template>
  22. <script>
  23. import { trainPaging } from '@/api/repo/train.js'
  24. export default {
  25. components: { },
  26. data() {
  27. return {
  28. queryParams: {
  29. title: ''
  30. }
  31. }
  32. },
  33. onReachBottom() {
  34. // 加载数据
  35. this.$refs.moreList.loadData()
  36. },
  37. onShow() {
  38. if(this.$refs.moreList){
  39. this.$refs.moreList.initData()
  40. }
  41. },
  42. methods: {
  43. // 搜索
  44. search(e) {
  45. console.log('搜索', e)
  46. this.queryParams.title = e
  47. },
  48. toTrain(state, repoId, mode){
  49. if(state===1){
  50. uni.showToast({
  51. title: '此训练已完毕,无法查看!',
  52. icon:'none',
  53. duration: 2000
  54. })
  55. return;
  56. }
  57. uni.navigateTo({
  58. url: '/pages/repo/train?repoId='+repoId+'&mode='+mode
  59. });
  60. }
  61. }
  62. }
  63. </script>
  64. <style>
  65. .container {
  66. font-size: 14rpx;
  67. }
  68. .exam-item{
  69. display: flex; align-items: center;
  70. line-height: 25px;
  71. }
  72. .exam-item .left{
  73. width: 80%; text-align: left;
  74. }
  75. .exam-item .left .title{
  76. font-size: 14px;
  77. }
  78. .exam-item .left .desc{
  79. font-size: 14px;
  80. color: #888;
  81. }
  82. .exam-item .left .icons{
  83. font-size: 10px;
  84. display: flex;
  85. align-items: center;
  86. color: #666;
  87. }
  88. .exam-item .right{
  89. width: 20%; text-align: right;
  90. }
  91. </style>