index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <view>
  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/user-paging" :params="queryParams" ref="moreList">
  8. <template v-slot:item="{ data }">
  9. <uni-list-item
  10. :show-arrow="true"
  11. :title="data.title"
  12. :note="data.quCount+'道题'"
  13. link="navigateTo"
  14. :to="'/pages/repo/detail?id='+data.id"
  15. >
  16. </uni-list-item>
  17. </template>
  18. </yf-more-list>
  19. </view>
  20. </template>
  21. <script>
  22. import { checkProcess } from '@/api/repo/repo'
  23. export default {
  24. components: { },
  25. data() {
  26. return {
  27. queryParams:{
  28. isTran: true,
  29. title: ''
  30. },
  31. trainData: {}
  32. }
  33. },
  34. onPullDownRefresh(){
  35. this.$refs.moreList.initData()
  36. },
  37. onReachBottom() {
  38. // 加载数据
  39. this.$refs.moreList.loadData()
  40. },
  41. onShow() {
  42. if(this.$refs.moreList){
  43. this.$refs.moreList.initData()
  44. }
  45. this.checkRepo()
  46. },
  47. methods: {
  48. checkRepo(){
  49. checkProcess().then(data => {
  50. if(data!=null && data.id!=null){
  51. uni.showModal({
  52. cancelText: "取消", // 取消按钮的文字
  53. confirmText: "确认", // 确认按钮文字
  54. title: '删除提示',
  55. content: '是否要继续上一次的训练?',
  56. success: res => {
  57. if (res.confirm) {
  58. this.conTrain(data)
  59. }
  60. }
  61. });
  62. }
  63. })
  64. },
  65. search(e) {
  66. this.queryParams.title = e
  67. },
  68. conTrain(data) {
  69. uni.navigateTo({
  70. url: '/pages/repo/train?repoId='+data.repoId+'&mode='+data.mode
  71. });
  72. }
  73. }
  74. }
  75. </script>
  76. <style>
  77. .container {
  78. font-size: 14rpx;
  79. }
  80. .exam-item{
  81. display: flex; align-items: center;
  82. line-height: 25px;
  83. }
  84. .exam-item .left{
  85. width: 80%; text-align: left;
  86. }
  87. .exam-item .left .title{
  88. font-size: 14px;
  89. }
  90. .exam-item .left .desc{
  91. font-size: 14px;
  92. color: #888;
  93. }
  94. .exam-item .left .icons{
  95. font-size: 10px;
  96. display: flex;
  97. align-items: center;
  98. color: #666;
  99. }
  100. .exam-item .right{
  101. width: 20%; text-align: right;
  102. }
  103. </style>