<template>
|
<view class="content">
|
<view class="select-show" v-if="userStore.subject">
|
<text>年级:{{ userStore.grade.name }} 科目:{{ 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>
|