From b941ca4d159d7af138bc0a2fa7e04b1e9fdd61d0 Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期三, 21 八月 2024 09:49:49 +0800 Subject: [PATCH] 提交 --- pages/tabBar/count/count.vue | 295 ++++++++++++++++++++++++++++++++++------------------------ 1 files changed, 172 insertions(+), 123 deletions(-) diff --git a/pages/tabBar/count/count.vue b/pages/tabBar/count/count.vue index 51a5d33..56fb158 100644 --- a/pages/tabBar/count/count.vue +++ b/pages/tabBar/count/count.vue @@ -8,34 +8,52 @@ <view style="display: flex; flex-direction: column;"> <view class="navBar"> <!-- <u-icon style=" margin-left: -25px;" name="arrow-left" color="black" size="17" @click="goBack" />--> - <view class="barText">我的成绩</view> + <view class="barText">我的</view> </view> </view> </view> <view class="m-p-15"> - <view class="card-list"> - <scroll-view v-if="examList && examList.length>0" scroll-y="true" class="scroll-Y" @scrolltoupper="upper" @scrolltolower="lower" lower-threshold="150" @scroll="scrollView" style="height:350px"> - <view class="paper-card" v-for="(item,index) in examList" :key="index" @click="toDetail(item,2)"> - <view class="paper-card-l"> - <view class="paper-card-t">{{item.examPaper.name}}</view> - <view style="color: #999;margin-bottom: 15px;font-size: 12px">{{item.examPaper.code}}</view> - <view style="display: flex;align-items: center"> - <u-tag style="margin-right: 20rpx" :text="item.examPaper.categoryName" size="mini"></u-tag> - <u-tag :text="item.createName" plain plainFill size="mini"></u-tag> - </view> - </view> - <view class="paper-card-r"> - <view :class="item.passed == 0?'red':'green'"> - <view>{{item.score}}</view> - <view class="divide"></view> - <view>{{item.passed == 0?'不合格':'合格'}}</view> - </view> - </view> - </view> - </scroll-view> - <u-empty v-else text="暂无已完成的考试记录" mode="list"></u-empty> + <view class="userInfo"> + <view class="info-l"> + <image src="../../../static/companyLogo.png" mode="widthFix"></image> +<!-- <view class="info-icons">--> +<!-- <u-icon v-if="user.sex==0" name="man" color="#0f7ff9" bold size="24"></u-icon>--> +<!-- <u-icon v-else-if="user.sex==1" name="woman" color="#ff69bf" bold size="24"></u-icon>--> +<!-- <u-icon v-else name="question" color="#ff69bf" bold size="24"></u-icon>--> +<!-- </view>--> + </view> + + <view class="info-r"> + <view class="info-n"> +<!-- 用户:--> + <span>{{username}}</span> + + </view> +<!-- <view class="info-id">--> +<!-- ID:<span>{{user.idNo}}</span>--> +<!-- </view>--> + </view> </view> - <view> + <view class="card-list"> + <view class="paper-card"> + <view class="menu-i" @click="toHazmat"> + <view class="menu-l"> + <u-icon name="warning" color="#0f7ff9" size="32"></u-icon> + <view><span style="color: #ed6464">危化品</span>操作记录</view> + </view> + <u-icon name="arrow-right" color="#ccc" size="20"></u-icon> + </view> + <view class="menu-i" @click="toProduct"> + <view class="menu-l"> + <u-icon name="bag" color="#0f7ff9" size="32"></u-icon> + <view><span style="color: #5fb734">成品</span>操作记录</view> + </view> + <u-icon name="arrow-right" color="#ccc" size="20"></u-icon> + </view> + </view> +<!-- <u-empty v-else text="暂无已完成的考试记录" mode="list"></u-empty>--> + </view> + <view class="loginBtn"> <u-button @click="loginOut" type="primary" text="退出登录" style="width: 80%" shape="circle"></u-button> </view> </view> @@ -45,7 +63,7 @@ <script> import tabBar from '../tabBarIndex.vue' - import {getExamList, loginOut} from "../../../api"; + import {getExamList, getUserInfo, loginOut} from "../../../api"; import {getCleanRecord} from "../../../api/wearhouse"; export default { components:{ @@ -55,6 +73,7 @@ return { page: 'pages/tabBar/count/count', statusBarHeight: '', + username: '', examParams: { pageNum: 1, pageSize: 10, @@ -65,27 +84,27 @@ } }, + created(){ + uni.hideTabBar() + }, onLoad() { this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight']; + this.username = uni.getStorageSync('name') // uni.hideTabBar(); - this.getExamList() + // this.getUserInfo() }, + methods: { goBack() { uni.switchTab({ url:'/pages/tabBar/firstPage/firstPage' }); }, - getExamList(){ - getExamList(this.examParams).then(res => { + + getUserInfo(){ + getUserInfo(uni.getStorageSync('uid')).then(res => { if(res.code == 200) { - let list = res.data.list?res.data.list: []; - if (res.pageNum != 1) { - this.examList = this.examList.concat(list) - } else { - this.examList = res.data.list - } - this.totalPage = res.data.totalPage + this.user = res.data }else{ uni.$u.toast(res.message) } @@ -96,6 +115,19 @@ uni.setStorageSync("prevPage", '/pages/tabBar/count/count'); uni.navigateTo({ url: `/pages/tabBar/firstPage/exam?bank=` + encodeURIComponent(JSON.stringify(item)) + `&type=` + encodeURIComponent(JSON.stringify(type)) + }) + }, + toHazmat(){ + uni.setStorageSync("prevPage", '/pages/tabBar/count/count'); + uni.navigateTo({ + url: '/pages/tabBar/count/countDetail' + }) + }, + + toProduct(){ + uni.setStorageSync("prevPage", '/pages/tabBar/count/count'); + uni.navigateTo({ + url: '/pages/tabBar/count/productDetail' }) }, @@ -109,7 +141,7 @@ if(res.code == 200){ uni.showToast({ title: '账户已退出', - duration: 1000 + duration: 800 }) setTimeout(()=>{ uni.clearStorageSync(); @@ -117,7 +149,7 @@ uni.navigateTo({ url: '/pages/index/index' }) - },1000) + },800) } }) } else if (res.cancel) { @@ -127,22 +159,11 @@ }) }, - upper(e) { - // console.log(e) - }, - lower(e) { - //并且让页码+1,调用获取数据的方法获取第二页数据 - this.examParams.pageNum++ - //此处调用自己获取数据列表的方法 - if (this.examParams.pageNum > this.totalPage){ - uni.$u.toast('已加载全部数据') - return - } - this.getExamList() - }, - scrollView(e) { - // console.log(e) - }, + getPhoneNumber(phone) { + const firstThree = phone?phone.slice(0, 3):'' + const lastFour = phone?phone.slice(-4):'' + return `${firstThree}****${lastFour}` + } } } @@ -154,6 +175,9 @@ flex-direction: column; width: 100%; height: 100%; +} +.u-icon{ + margin: 0 !important; } .fix{ position: sticky; @@ -182,88 +206,113 @@ .statusBar{ background-color:lightgrey; } + +.myImg{ + width: 100%; + height: 100% +} + .m-p-15{ width: 100%; + padding-top: 50rpx; + background: url("../../../static/my-bg.jpg") no-repeat top; + background-size: 100% auto; - .card-list{ - width: 100%; - height: calc(100vh - 220px); - margin: 20px 0; + .userInfo{ + display: flex; + align-items: center; + width: calc(100% - 60px); + margin: 20rpx auto; - .paper-card{ - width: calc(100% - 30px); - background: #fff; - border-radius: 20px; - padding: 15px; - margin: 0 auto 15px; - //position: relative; - box-sizing: border-box; - box-shadow: 0 3px 8px rgba(150,150,150,.1); - display: flex; - align-items: center; - justify-content: space-between; - - &:last-of-type{ - margin-bottom: 0; + .info-l{ + width: 150rpx; + height: 150rpx; + border-radius: 50%; + position: relative; + margin-right: 20px; + image{ + width: 150rpx; + height: 150rpx; + border-radius: 50%; } - - //.isPassed{ - // position: absolute; - // right: 15px; - // top: 15px; - //} - - .paper-card-l{ - width: 75%; - - .paper-card-t{ - font-size: 32rpx; - margin-bottom: 10rpx; - font-family: "PingFang SC"; - font-weight: 800; - overflow: hidden; - text-overflow: ellipsis; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - } + .info-icons{ + width: 48rpx; + height: 48rpx; + border-radius: 90%; + position: absolute; + bottom: 10rpx; + right: 0; + background: #fff; + display: flex; + align-items: center; + justify-content: center; + box-shadow: 0 2px 4px rgba(0,0,0,.1); } + } - .paper-card-r{ - width: 25%; - &>view{ - width: 140rpx; - height: 140rpx; - border-radius: 50%; - color: #fff; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - font-size: 20rpx; - line-height: 1; + .info-r{ + color: #fff; + .info-n{ + display: flex; + align-items: center; + font-size: 36rpx; + font-weight: bold; + margin-bottom: 10px; - view:first-of-type{ - font-size: 44rpx; - font-weight: 600; - } - - .divide{ - width: 60%; - height: 1rpx; - background: #fff; - margin: 10rpx 0; - } - } - - .green{ - background: #5fb734; - } - .red{ - background: #ed6464 + span{ + margin-right: 10px; } } } } + + .card-list{ + width: 100%; + margin: 20px 0; + + .paper-card{ + width: calc(100% - 40px); + margin: 0 auto 15px; + display: flex; + align-items: center; + justify-content: space-between; + + .menu-i{ + width: calc(50% - 5px); + background: rgba(255,255,255,1); + border-radius: 12px; + display: flex; + align-items: center; + box-shadow: 0 3px 8px rgba(150,150,150,.1); + justify-content: space-between; + padding: 18px 15px; + box-sizing: border-box; + cursor: pointer; + + .menu-l{ + display: flex; + align-items: center; + font-size: 22rpx; + color: #999; + view{ + margin-left: 6px; + display: flex; + flex-direction: column; + align-items: flex-start; + span{ + font-size: 32rpx; + font-weight: bold; + color: #333; + } + } + } + } + } + } +} +.loginBtn{ + width: 100%; + position: fixed; + bottom: 90px; } </style> \ No newline at end of file -- Gitblit v1.9.2