xuruiqian
2025-06-04 17ce21955b4e3402d3d5868b52e50bfdd55bc572
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<template>
  <view class="content">
    <view class="select-show" v-if="userStore.subject">
      <text>年级:{{ userStore.grade.name }}&nbsp;&nbsp;科目:{{ userStore.subject.subjectname }}</text>
    </view>
    <scroll-view scroll-y class="test-list" v-if="userStore.subject">
      <view class="menu" v-for="(item, index) in testList" :key="index" @click="practice(item, index)">
        <text>{{ item.papername }}</text>
        <u-icon size="20px" color="#f3d95b" name="integral-fill"
          custom-style="margin-top:10rpx;margin-left:10rpx;"></u-icon>
      </view>
      <view class="empty-show" v-if="testList.length == 0">
        <u-empty text="暂无数据" mode="list"></u-empty>
      </view>
    </scroll-view>
  </view>
</template>
 
<script>
import { ref, reactive, toRefs, onMounted, getCurrentInstance } from "vue";
import { useBasicInfoStore } from "../../store/basicInfo"
import { getMyPaperList } from "../../apis/api"
export default {
  setup() {
    const userStore = useBasicInfoStore()
    const { proxy } = getCurrentInstance();
    const state = reactive({
      testList: [],
      testSel: {},
    })
 
    onMounted(() => {
      Init();
    });
 
    const Init = () => {
      getPaperList()
    }
 
    const getPaperList = () => {
      getMyPaperList(userStore.userinfo.id).then((res) => {
        if (res.data.length > 0) {
          state.testList = res.data
        }
      })
    }
 
 
 
    const practice = (item, index) => {
      state.testSel = item
      userStore.testTitle = item.papername
      uni.navigateTo({
        url: '/pages/question/type'
      });
    }
 
 
    return {
      ...toRefs(state),
      userStore,
      practice,
    }
  }
}
 
 
 
</script>
 
<style scoped lang="scss">
.center {
  display: flex;
  flex-direction: column;
  align-items: center;
}
 
.content {
  @extend .center;
  height: 100vh;
  width: 100%;
  background-color: #f5f5f5;
}
 
.select-show {
  width: calc(100% - 40rpx);
  height: 40rpx;
  background-color: #fff;
  display: flex;
  justify-content: flex-start;
  padding: 20rpx;
  font-size: 24rpx;
  line-height: 40rpx;
}
 
.test-list {
  width: 100%;
  height: calc(100vh - 140rpx);
  padding: 15rpx;
 
  .menu {
    // width: calc(95% - 40rpx);
    // overflow: auto;
    // background-color: #fff;
    // border-radius: 15rpx;
    // padding: 20rpx;
    // display: flex;
    // justify-content: flex-start;
    // margin: 20rpx auto;
    width: calc(95% - 40rpx);
    height: 80rpx;
    line-height: 80rpx;
    margin: 20rpx auto;
    display: flex;
    justify-content: flex-start;
    background-color: #fff;
    border-radius: 15rpx;
    padding: 0rpx 20rpx;
  }
}
 
.empty-show {
  margin-top: 30vh;
}
</style>