From 893ff90c6e21fa3a5241a8ae9b33836037cd5912 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: Thu, 29 Aug 2024 15:19:17 +0800
Subject: [PATCH] 提交
---
pages/tabBar/current/current.vue | 46 ++++++++++++++++++++++++++++++++--------------
1 files changed, 32 insertions(+), 14 deletions(-)
diff --git a/pages/tabBar/current/current.vue b/pages/tabBar/current/current.vue
index f7fe952..3ba1601 100644
--- a/pages/tabBar/current/current.vue
+++ b/pages/tabBar/current/current.vue
@@ -15,9 +15,10 @@
</view>
<!-- 页面内容 -->
<view class="m-p-15">
- <view class="cardList">
+ <view class="cardList" v-if="classList && classList.length>0">
<scroll-view scroll-y="true" class="scroll-Y" @scrolltoupper="upper"
@scrolltolower="lower" lower-threshold="150" @scroll="scrollView" style="height:100%">
+ <view style="padding: 20px 0 20px">
<view class="card-i" v-for="(item,index) in classList" :key="index">
<u-image radius="16px" width="200rpx" height="200rpx" :show-loading="true" :src="getImageUrl(item.course.logo)" mode="aspectFill">
</u-image>
@@ -28,13 +29,15 @@
<span style="color: #999;font-size: 12px;display: flex;align-items: center"><u-icon name="account" color="#999" size="18" style="margin-bottom: 0;margin-right: 2px"></u-icon>{{item.createName +'('+ item.createTime +')'}}</span>
</view>
<view class="card-i-r-b">
- <u-tag icon="clock" :text="item.course.period + '分钟'" type="success" size="mini" shape="circle" plain plainFill></u-tag>
- <u-button class="study-button" type="primary" text="开始学习" shape="circle" size="small" @click="toStudy(item.id)"></u-button>
+ <u-tag icon="clock" :text="secondsToHms(item.course.period)" type="success" size="mini" shape="circle" plain plainFill></u-tag>
+ <u-button class="study-button" type="primary" text="开始学习" shape="circle" size="small" @click="toStudy(item)"></u-button>
</view>
</view>
</view>
+ </view>
</scroll-view>
</view>
+ <u-empty style="margin-top: 80px" v-else text="暂无记录" mode="data"></u-empty>
</view>
<tabBar :currentPagePath="page"></tabBar>
</view>
@@ -71,6 +74,9 @@
onShow() {
// this.role = uni.getStorageSync('roleName');
},
+ created(){
+ uni.hideTabBar()
+ },
methods: {
loginOut() {
uni.clearStorageSync();
@@ -88,7 +94,7 @@
getClassList(this.classParams).then(res => {
if(res.code == 200) {
let list = res.data.list?res.data.list: [];
- if (res.pageNum != 1) {
+ if (res.data.pageNum != 1) {
this.classList = this.classList.concat(list)
} else {
this.classList = res.data.list
@@ -104,25 +110,37 @@
return logo ? VUE_APP_BASE_URL + '/api/' + logo : '/static/defaultCover.jpg';
},
- toStudy(id) {
+ toStudy(item) {
uni.setStorageSync("prevPage", '/pages/tabBar/current/current');
uni.navigateTo({
- url: `/pages/tabBar/current/detail?phase_id=` + encodeURIComponent(JSON.stringify(id))
+ url: `/pages/tabBar/current/detail?bank=` + encodeURIComponent(JSON.stringify(item))
})
},
+
+ secondsToHms(seconds) {
+ seconds = Number(seconds);
+ const h = Math.floor(seconds / 3600);
+ const m = Math.floor(seconds % 3600 / 60);
+ const s = Math.floor(seconds % 3600 % 60);
+
+ const hDisplay = h > 0 ? String(h).padStart(2, '0') : '00';
+ const mDisplay = m > 0 ? String(m).padStart(2, '0') : '00';
+ const sDisplay = s > 0 ? String(s).padStart(2, '0') : '00';
+ return `${hDisplay}:${mDisplay}:${sDisplay}`;
+ },
upper(e) {
// console.log(e)
},
lower(e) {
//并且让页码+1,调用获取数据的方法获取第二页数据
- this.examParams.pageNum++
- if (this.examParams.pageNum > this.totalPage){
+ this.classParams.pageNum++
+ if (this.classParams.pageNum > this.totalPage){
uni.$u.toast('已加载全部数据')
return
}
//此处调用自己获取数据列表的方法
- this.getExamList()
+ this.getClass()
},
scrollView(e) {
// console.log(e)
@@ -200,13 +218,13 @@
}
.cardList{
width: 100%;
- height: calc(100vh - 160px);
- margin: 20px 0;
+ height: calc(100vh - 130px);
+ box-sizing: border-box;
.card-i{
width: calc(100% - 30px);
background: #fff;
- border-radius: 16px;
+ border-radius: 20px;
padding: 15px;
margin: 0 auto 15px;
position: relative;
@@ -222,7 +240,7 @@
position: absolute;
width: 250rpx;
height: 30px;
- border-radius: 16px;
+ border-radius: 20px;
line-height: 30px;
color: #fff;
padding: 0 10rpx;
@@ -258,7 +276,7 @@
justify-content: space-between;
.study-button{
- width: 240rpx;
+ width: 220rpx;
margin: 0;
box-shadow: 3px 3px 12px rgba(51,133,217,.3), -2px -2px 6px #fff;
border: 1px solid rgba(255,255,255,.8);
--
Gitblit v1.9.2