From 893ff90c6e21fa3a5241a8ae9b33836037cd5912 Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期四, 29 八月 2024 15:19:17 +0800 Subject: [PATCH] 提交 --- pages/tabBar/firstPage/firstPage.vue | 85 ++++++++++++++++++++++++++++++++++-------- 1 files changed, 69 insertions(+), 16 deletions(-) diff --git a/pages/tabBar/firstPage/firstPage.vue b/pages/tabBar/firstPage/firstPage.vue index 9b444ba..12619cf 100644 --- a/pages/tabBar/firstPage/firstPage.vue +++ b/pages/tabBar/firstPage/firstPage.vue @@ -15,6 +15,9 @@ <view style="width: 100%;padding: 0 15px;box-sizing: border-box;margin: 20px 0"> <u-swiper :list="swiperList" indicatorMode="dot" circular height="160" indicator previousMargin="30" nextMargin="30"></u-swiper> </view> + + <scroll-view scroll-y="true" class="scroll-Y" @scrolltoupper="upper" + @scrolltolower="lower" lower-threshold="150" @scroll="scrollView" style="height:calc(100vh - 335px)"> <view class="m-p-15"> <view class="card" style="width:100%"> <view class="card-t"> @@ -33,7 +36,7 @@ </view> <view class="card-i-r-b"> <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.id)"></u-button> + <u-button class="study-button" type="primary" text="开始学习" shape="circle" size="small" @click="toStudy(item)"></u-button> </view> </view> </view> @@ -44,29 +47,38 @@ <view class="card" style="width:100%"> <view class="card-t"> <span class="card-t-l">我的考试</span> + <uni-data-select + v-model="examParams.state" + placeholder="完成状态" + :localdata="examSelect" + :clear="true" + @change="changeExam" + ></uni-data-select> </view> - <view class="card-c card-d"> - <scroll-view scroll-y="true" class="scroll-Y" @scrolltoupper="upper" - @scrolltolower="lower" lower-threshold="150" @scroll="scrollView" style="height:350px"> + <view class="card-c card-d" v-if="examList && examList.length>0"> <view class="paper-card" v-for="(item,index) in examList" :key="index"> - <view class="paper-card-t"><span :class="item.completed == 1?'green':'red'">[{{item.completed == 1?'已完成':'未完成'}}]</span>{{item.examPaper.name}}</view> + <view class="paper-card-t"><span :class="item.state == 0?'blue':item.state == 1?'red':'green'">[{{item.state == 0?'待考试':item.state == 1?'待批阅':'批阅完成'}}]</span>{{item.examPaper.name}}</view> <u-tag style="margin-right: 20rpx;display: inline-block" :text="item.examPaper.categoryName" size="mini"></u-tag> - <u-tag style="display: inline-block" :text="'时长:' + item.examPaper.limitTime + '分钟'" plain plainFill size="mini"></u-tag> + <u-tag style="display: inline-block" :text="item.examPaper.limited == 1?'时长:' + item.examPaper.limitTime + '分钟':'不限时'" plain plainFill size="mini"></u-tag> <view class="paper-card-b"> <view style="font-size: 12px;margin-top: 10px;color: #999"> <view>创建人:{{item.createName}}</view> <view>截止日期:{{item.examPaper.deadline.substring(0,10)}}</view> </view> <view> - <u-button v-if="item.completed == 0" @click="toExam(item,1)" class="exam-button" type="primary" text="开始考试" shape="circle" size="small"></u-button> - <u-button v-if="item.completed == 1" @click="toExam(item,2)" class="exam-button" type="primary" text="查看" shape="circle" size="small"></u-button> + <u-button v-if="item.state == 0" @click="toExam(item,1)" class="exam-button" type="primary" text="开始考试" shape="circle" size="small"></u-button> + <u-button v-if="item.state == 2" @click="toExam(item,2)" class="exam-button" type="primary" text="查看" shape="circle" size="small"></u-button> </view> </view> </view> - </scroll-view> + </view> + <view class="card-c card-d" v-else> + <u-empty text="该状态暂无记录" mode="data"></u-empty> </view> </view> </view> + + </scroll-view> <tabBar :currentPagePath="page"></tabBar> </view> </template> @@ -104,7 +116,13 @@ examParams: { pageNum: 1, pageSize: 10, + state: 0 }, + examSelect: [ + { value: 0, text: "待考试" }, + { value: 1, text: "待批阅" }, + { value: 2, text: "批阅完成" }, + ], role: '', realname:'' } @@ -127,6 +145,9 @@ // this.tabBarLists = uni.getStorageSync('tabBarList'); }, + created(){ + uni.hideTabBar() + }, methods: { loginOut() { uni.clearStorageSync(); @@ -135,6 +156,11 @@ url: '/pages/index/index' }) }, + + changeExam(e) { + this.examParams.pageNum = 1 + this.getExamList() + }, async getSwiper(){ const res = await getSwiperList() @@ -165,7 +191,7 @@ getExamList(this.examParams).then(res => { if(res.code == 200) { let list = res.data.list?res.data.list: []; - if (res.pageNum != 1) { + if (res.data.pageNum != 1) { this.examList = this.examList.concat(list) } else { this.examList = res.data.list @@ -181,15 +207,15 @@ return logo ? VUE_APP_BASE_URL + '/api/' + logo : '/static/defaultCover.jpg'; }, - toStudy(id) { + toStudy(item) { uni.setStorageSync("prevPage", '/pages/tabBar/firstPage/firstPage'); uni.navigateTo({ - url: `/pages/tabBar/current/detail?phase_id=` + encodeURIComponent(JSON.stringify(id)) + url: `/pages/tabBar/current/detail?bank=` + encodeURIComponent(JSON.stringify(item)) }) }, toExam(item,type){ - if(type == 1 && !item.startTime){ + if(type == 1 && !item.startTime && item.examPaper.limited == 1){ uni.showModal({ title: '提示', content: '该考试限制时长为:' + item.examPaper.limitTime + '分钟,进入后开始计时,计时结束自动交卷,是否继续?', @@ -307,6 +333,28 @@ color: #999; cursor: pointer; } + /deep/ .uni-stat__select{ + display: flex; + flex: 0; + justify-content: right; + .uni-stat-box{ + display: flex; + + flex: 0; + justify-content: right; + .uni-select{ + width: 320rpx; + border-radius: 99px; + padding: 0 10px; + background: #fff; + + .uni-select__input-placeholder{ + color: #999; + } + } + } + + } } .card-c{ @@ -368,7 +416,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); @@ -379,7 +427,7 @@ } .card-d{ background: none; - padding: 0; + padding: 0 0 15px; .paper-card{ background: #fff; margin-bottom: 15px; @@ -401,6 +449,11 @@ overflow: hidden; text-overflow: ellipsis; + .blue{ + font-size: 28rpx; + color: #0f7ff9 + } + .green{ font-size: 28rpx; color: #5ac725 @@ -417,7 +470,7 @@ justify-content: space-between; .exam-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