From 117da08d652db513d8889924ea12b13aed68fba2 Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期二, 16 七月 2024 14:59:09 +0800 Subject: [PATCH] 提交 --- pages/tabBar/wearhouse/wearhouse.vue | 268 +++++++++++++--------------------------------------- 1 files changed, 69 insertions(+), 199 deletions(-) diff --git a/pages/tabBar/wearhouse/wearhouse.vue b/pages/tabBar/wearhouse/wearhouse.vue index f2a3ed3..533143a 100644 --- a/pages/tabBar/wearhouse/wearhouse.vue +++ b/pages/tabBar/wearhouse/wearhouse.vue @@ -6,11 +6,11 @@ <view class="statusBar" :style="{ paddingTop: statusBarHeight + 'px' }"></view> <!-- 真正的导航栏内容 --> <view class="navBar"> - <u-icon style=" margin-left: 13px;" name="arrow-left" color="black" size="17" @click="goBack"/> +<!-- <u-icon style=" margin-left: 13px;" name="arrow-left" color="black" size="17" @click="goBack"/>--> <view class="barText">刷题</view> - <view > - <u-button type="text" @click="loginOut" style="color: #1890ff;margin-right: 5px;width: 65px;">退出</u-button> - </view> +<!-- <view >--> +<!-- <u-button type="text" @click="loginOut" style="color: #1890ff;margin-right: 5px;width: 65px;">退出</u-button>--> +<!-- </view>--> </view> </view> <!-- 页面内容 --> @@ -22,12 +22,12 @@ <view class="card-i-l"> <view>{{item.name}}</view> <span style="display:block;color: #999;font-size: 12px;margin-bottom: 20px;">已刷{{item.exerciseCount}}/{{item.totalCount}}</span> - <span style="display:block;color: #999;font-size: 12px;">创建时间:{{item.createTime}}</span> + <span style="display:flex;align-items: center;color: #999;font-size: 12px;"><u-icon name="clock" color="#999" size="18" style="margin-bottom: 0;margin-right: 2px"></u-icon>{{item.createTime}}</span> </view> <view class="card-i-r"> <u-button v-if="item.exerciseCount == 0" class="study-button" type="success" text="开始刷题" shape="circle" size="small" @click="getQuestionIds(item,1)"></u-button> <u-button v-if="item.exerciseCount > 0" class="study-button" type="success" text="继续刷题" shape="circle" size="small" @click="getQuestionIds(item,2)"></u-button> - <u-button class="study-button" type="error" text="查看错题" shape="circle" size="small" @click="getQuestionIds(item.id,3)"></u-button> + <u-button class="study-button" type="error" text="查看错题" shape="circle" size="small" @click="getQuestionIds(item,3)"></u-button> <u-button class="study-button" text="重置" shape="circle" size="small" @click="reSet(item.id)"></u-button> </view> </view> @@ -56,21 +56,21 @@ pageSize: 10, }, quizList: [], - totalPage: 0 + totalPage: 0, } }, onLoad() { // this.unitType = uni.getStorageSync('unittype') + 1; //获取手机状态栏高度 this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight']; + this.classParams.pageNum = 1 + this.getQuizList() }, onShow() { // this.role = uni.getStorageSync('roleName'); - this.classParams.pageNum = 1 - }, mounted(){ - this.getQuizList() + }, methods: { loginOut() { @@ -86,16 +86,16 @@ }); }, getQuizList(){ - getQuizHouse(this.classParams).then(res => { + const t = this + getQuizHouse(t.classParams).then(res => { if(res.code == 200) { let list = res.data.list?res.data.list: []; if (res.pageNum != 1) { - this.quizList = this.quizList.concat(list) + t.quizList = t.quizList.concat(list) } else { - this.quizList = list - // this.$set(this, 'quizList', list) + t.quizList = list } - this.totalPage = res.data.totalPage + t.totalPage = res.data.totalPage }else{ uni.$u.toast(res.message) } @@ -103,17 +103,23 @@ }, async getQuestionIds(item,type){ - if(type == 1 && item.totalCount == 0){ - uni.$u.toast('该题库暂无题目') + if(item.totalCount == 0){ + uni.showToast({ + title: '该题库暂无题目', + duration: 1000 + }); return } if(type == 2 && item.totalCount == item.exerciseCount){ - uni.$u.toast('该题库所有题目已刷完') + uni.showToast({ + title: '该题库所有题目已刷完', + duration: 1000 + }); return } uni.setStorageSync("prevPage", '/pages/tabBar/wearhouse/wearhouse'); uni.navigateTo({ - url: `/pages/tabBar/wearhouse/questions?bank=` + encodeURIComponent(JSON.stringify(item)) + url: `/pages/tabBar/wearhouse/questions?bank=` + encodeURIComponent(JSON.stringify(item)) + `&type=` + encodeURIComponent(JSON.stringify(type)) }) }, @@ -130,7 +136,8 @@ title: '刷题记录已重置', duration: 1000 }); - + // t.classParams.pageNum = 1 + // t.getQuizList() uni.reLaunch({ url: '/pages/tabBar/wearhouse/wearhouse' }) @@ -144,7 +151,7 @@ console.log('用户点击取消'); } } - }); + }) }, upper(e) { // console.log(e) @@ -168,210 +175,73 @@ </script> <style lang="scss" scoped> -.box { - display: flex; - flex-direction: column; - width: 100%; - height: 100%; +.navBarBox .navBar { + background-color:#fff; + height: 50px; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + box-shadow: 0 3px 12px rgba(0,0,0,0.05); + } .fix{ - position: sticky; - top: 0; - left: 0; - right: 0; - width: 100%; - z-index: 1; -} -.navBarBox .navBar { - background-color:#fff; - height: 50px; - display: flex; - flex-direction: row; - justify-content: center; - align-items: center; - box-shadow: 0 3px 12px rgba(0,0,0,0.05); + position: sticky; + top: 0; + left: 0; + right: 0; + width: 100%; + z-index: 1; } .barText{ - margin-left: 55px; - text-align: center; - width: 85%; - font-size: 16px; - /* text-align: center; */ - font-weight: 600; + /* text-align: center; */ + font-size: 16px; + font-weight: 600; + flex: 2; + margin-left: 45%; } .statusBar{ - background-color:lightgrey; + background-color:lightgrey; } -.controlBar{ - margin: 12px 12px 0; - padding: 12px; - height: 90px; - box-sizing: border-box; - display: flex; - flex-direction: column; - justify-content: space-between; - width: calc(100% - 24px); - background: #fff; - border-radius: 5px; - box-shadow: 0 3px 12px rgba(0,0,0,0.05); - - .buttonGroup{ - display: flex; - align-items: center; - justify-content: space-between; - margin-bottom: 12px; - } - - .listHead{ - display: flex; - align-items: center; - justify-content: flex-end; - } -} -.buttonItem{ - width: calc(20% - 4px); - color: white; - display: flex; - flex-direction: row; - justify-content: center; - align-items: center; - height: 30px; - border-radius: 5px; - &.active{ - border: 1px solid rgba(0,0,0,.4); - box-shadow: 0 1px 3px rgba(0,0,0,0.1); - } -} -.all { - background-color: rgb(17,204,33); - &.active{ - background-image: linear-gradient(#22992d,#12da23); - } -} -.active { - border: 1.5px solid #8d8d8d; -} -.red { - background-color: #ff5555; - &.active{ - background:linear-gradient(#dc2f2f, #ff5b5b); - } -} -.orange { - background-color: rgb(251, 158, 13); - &.active{ - background: linear-gradient(#e28e0c,#ffa90e); - } -} -.yellow { - background-color: rgb(255, 223, 37); - &.active{ - background: linear-gradient(#e6c921,#ffef28); - } -} -.blue { - background-color: #409EFF; - &.active{ - background: linear-gradient(#3a8ee6,#44a9ff); - } -} -.switchBtn{ - display: flex; - align-items: center; -} -.examineList{ - margin-top: 12px; - height: calc(100vh - 246px); - overflow: hidden; - overflow-y: scroll; -} -.listContent{ - display: flex; - flex-direction: column; - width: calc(100% - 24px); - margin: 0 12px; - // margin-bottom: 30px; - background: #fff; - border-radius: 5px; - box-shadow: 0 3px 12px rgba(0,0,0,0.05); - height: 100%; -} -.itemContent{ - color: #333; - font-size: 16px; - margin-top: 15px; - padding: 0 12px 10px; - border-bottom: 1px solid #ebebeb; -} -.content{ - .tit{ - width: 100%; - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; - } - .cont{ - width: 100%; - font-size: 14px; - color: #666; - display: block; - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; - margin-bottom: 6px; - } - .btnGroup{ - width: 100%; - display: flex; - justify-content: space-between; - } -} -.buttonCo{ - margin-top: 5px; - margin-bottom: 10px; -} .m-p-15{ width: 100%; - box-sizing: border-box; - padding: 0 15px; } .cardList{ width: 100%; height: calc(100vh - 160px); - background: #fff; - border-radius: 8px; margin: 20px 0; - padding: 15px; - box-sizing: border-box; .card-i{ - padding-bottom: 15px; - margin-bottom: 15px; - border-bottom: 1px solid #f0f0f0; + width: calc(100% - 30px); + background: #fff; + border-radius: 16px; + padding: 15px; + margin: 0 auto 15px; position: relative; display: flex; align-items: flex-start; - justify-content: space-between; box-sizing: border-box; + box-shadow: 4px 4px 12px rgba(150,150,150,.05); + &:last-of-type{ margin-bottom: 0; - padding-bottom: 0; - border-bottom: none; } .card-i-l{ - width: 70%; - view{ - width: 100%; - font-size: 32rpx; - margin-bottom: 10rpx; - overflow: hidden; - text-overflow: ellipsis; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - } + width: 75%; + &>view{ + width: 100%; + font-size: 32rpx; + font-family: "PingFang SC"; + font-weight: 800; + margin-bottom: 10rpx; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + } } .card-i-r{ width: 25%; -- Gitblit v1.9.2