123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233 |
- <template>
- <view class="container">
- <view class="list-box">
- <view class="list-item-box">
- <view class="list-item">
- 获得时间
- </view>
- <view class="list-item" style="width: 50%;">
- 课程名称
- </view>
- <view class="list-item" style="width: 25%;">
- 学分
- </view>
- <!-- <view class="list-item">
- 年检情况
- </view>
- <view class="list-item">
- 是否完成观看
- </view> -->
- </view>
- <scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="scrolltolower" v-if="list.length > 0">
- <view class="list-item-content" v-for="(item, index) in list" :key="index">
- <view class="list-item">
- {{item.date}}
- </view>
- <view class="list-item" style="width: 50%;">
- {{item.source}}
- </view>
- <view class="list-item" style="width: 25%;">
- {{ item.credit }}
- </view>
- <!-- <view class="list-item" v-html="item.annIns!=='学分未达标不能申请年检' ? item.annIns : '学分未达标,<br/>不能申请年检'"></view>
- <view class="list-item">
- <view class="button" :class="[item.finish ? 'primary' : 'error']">
- {{item.finish ? '已完成观看' : '未完成'}}
- </view>
- </view> -->
- </view>
- </scroll-view>
- <u-empty v-else text="暂无数据" mode="list" style="margin: 20rpx"></u-empty>
- </view>
- </view>
- </template>
- <script setup>
- import {
- ref
- } from 'vue'
- import {
- onLoad
- } from '@dcloudio/uni-app'
- import {
- loadCreditDatial
- } from '@/api/edu.js'
- const list = ref([])
- const currentYear = ref("");
- const pageNumber = ref(1);
- const pageSize = ref(30);
- const count = ref(0);
- const status = ref("loadmore")
- const initList = () => {
- const data = {
- "pageNumber": pageNumber.value,
- "pageSize": pageSize.value,
- "year": currentYear.value
- }
- if(pageNumber.value===1){
- list.value = []
- }
- uni.showLoading({
- title: '加载中',
- })
- loadCreditDatial(data).then(res => {
- uni.hideLoading()
- if (res && res?.code === 0) {
- count.value = res.count;
- list.value = [...list.value, ...res.data];
- if(list.value.length ===count.value){
- status.value = 'nomore'
- }
- pageNumber.value = pageNumber.value + 1;
- }
- })
- }
- const scrolltolower = () => {
- if(status.value === 'nomore'){
- return
- }
- initList()
- }
- onLoad((options) => {
- const {
- year
- } = options;
- // console.log(year)
- currentYear.value = year
- pageNumber.value = 1
- initList()
- // console.log('onLoad')
- })
- </script>
- <style lang="scss">
- page {
- background-color: $uni-bg-color;
- }
- .container {
- box-sizing: border-box;
- height: 100vh;
- width: 100vw;
- background-color: $uni-bg-color;
- // background-color: #fff;
- // padding: 0 20rpx env(safe-area-inset-bottom, 0);
- padding: 30rpx;
- }
- .scroll-Y {
- flex: 1;
- overflow: hidden;
- }
- .list-box {
- height: 100%;
- display: flex;
- flex-direction: column;
- // margin: 20rpx 20rpx;
- background-color: $uni-bg-color-grey;
- border-radius: $uni-card-border-radius;
- // padding: 20rpx 15rpx;
- // margin-bottom: 30rpx;
- .list-item-box {
- &:first-child {
- border-bottom: 5rpx solid #E6E6E6;
- font-size: $uni-font-size-1;
- font-weight: bold;
- flex: 0 0 auto;
- .list-item {
- width: 25%;
- text-align: center;
- &:last-child {
- color: #303133;
- font-weight: bold;
- }
- }
- }
- padding: 15rpx 0;
- text-align: center;
- font-size: $uni-font-size-2;
- font-weight: bold;
- display: flex;
- align-items: center;
- .list-item {
- width: 25%;
- text-align: center;
- &:last-child {
- color: $uni-text-color-inverse;
- font-weight: normal;
- }
- }
- .button {
- width: fit-content;
- border-radius: $uni-card-border-radius;
- margin: 0 auto;
- }
- .primary {
- padding: 5rpx 25rpx;
- background-color: $uni-color-primary;
- }
- .error {
- padding: 5rpx 15rpx;
- background-color: $uni-color-error;
- }
- }
- .list-item-content {
- // &:first-child {
- // border-bottom: 5rpx solid #E6E6E6;
- // font-size: $uni-font-size-1;
- // font-weight: bold;
- // .list-item {
- // width: 25%;
- // text-align: center;
- // &:last-child {
- // color: #303133;
- // font-weight: bold;
- // }
- // }
- // }
- padding: 15rpx 0;
- text-align: center;
- font-size: $uni-font-size-2;
- font-weight: bold;
- display: flex;
- align-items: center;
- .list-item {
- width: 25%;
- text-align: center;
- &:last-child {
- color: $uni-text-color-inverse;
- font-weight: normal;
- }
- }
- .button {
- width: fit-content;
- border-radius: $uni-card-border-radius;
- margin: 0 auto;
- }
- .primary {
- padding: 5rpx 25rpx;
- background-color: $uni-color-primary;
- }
- .error {
- padding: 5rpx 15rpx;
- background-color: $uni-color-error;
- }
- }
- }
- </style>
|