马宇豪
2024-08-21 23db8ee6063226480f964ed1de3ece9310e221a2
pages/tabBar/count/countDetail.vue
@@ -8,32 +8,39 @@
      <view style="display: flex; flex-direction: column;">
        <view class="navBar">
          <u-icon name="arrow-left" color="black" size="17" style="margin-left: 8px;" @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:100%">
            <view class="paper-card" v-for="(item,index) in examList" :key="index" @click="toDetail(item,2)">
            <view class="paper-card" v-for="(item,index) in examList" :key="index">
              <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 class="dot"></view>
                <view class="line"></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 class="paper-card-box">
                <view class="paper-card-r">
                  <view class="paper-card-t"><u-icon name="clock-fill" color="#2979ff" size="18" style="margin-right: 4px"></u-icon>{{item.updateTime}}</view>
                  <view class="paper-card-c">
                    <span style="margin-right: 4px">对</span>
                    <span style="font-weight: bold" v-if="item.hazmatBasic">{{item.hazmatBasic.companyName?item.hazmatBasic.companyName + '的':''}}{{item.hazmatBasic.name}}({{item.hazmatBasic.productSn}})</span>
                    <span style="font-weight: bold" v-if="item.productBasic">{{item.productBasic.companyName?item.productBasic.companyName + '的':''}}{{item.productBasic.name}}({{item.productBasic.productSn}})</span>
                    进行
                    <span :class="item.num>=0?'green':'red'" style="font-weight: bold;margin: 0 4px">{{item.state==0?'入库 ':item.state==1?'取用 ':item.state==2?'归还 ':item.state==3?'标签作废 ':item.state==4?'用尽登记 ':item.state==5?'销售 ':'-- '}}</span>
                  </view>
                  <view v-if="item.hazmatBasic" :class="item.num>=0?'green':'red'" style="font-size: 28rpx">
                    <span v-if="item.num  > 0">+</span>{{item.num + item.hazmatBasic.unit}}
                  </view>
                  <view v-if="item.productBasic" :class="item.num>=0?'green':'red'" style="font-size: 28rpx">
                    <span v-if="item.num  > 0">+</span>{{item.num + item.productBasic.unit}}
                  </view>
                </view>
              </view>
            </view>
          </scroll-view>
          <u-empty v-else text="暂无已完成的考试记录" mode="list"></u-empty>
          <u-empty v-else text="暂无记录" mode="list"></u-empty>
      </view>
<!--      <view>-->
<!--        <u-button @click="loginOut" type="primary" text="退出登录" style="width: 80%" shape="circle"></u-button>-->
@@ -45,7 +52,7 @@
<script>
   import tabBar from '../tabBarIndex.vue'
  import {getExamList, loginOut} from "../../../api";
  import {getHazmatFlowByUser,loginOut} from "../../../api";
  import {getCleanRecord} from "../../../api/wearhouse";
   export default {
      components:{
@@ -58,7 +65,6 @@
        examParams: {
          pageNum: 1,
          pageSize: 10,
          state: 2
        },
        examList: [],
        totalPage: 0
@@ -69,7 +75,7 @@
      console.log('跳转完成')
         this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight'];
         // uni.hideTabBar();
      this.getExamList()
      this.getList()
      },
      methods: {
         goBack() {
@@ -84,8 +90,8 @@
          })
        }
         },
      getExamList(){
        getExamList(this.examParams).then(res => {
      getList(){
        getHazmatFlowByUser(this.examParams).then(res => {
          if(res.code == 200) {
            let list = res.data.list?res.data.list: [];
            if (res.data.pageNum != 1) {
@@ -96,41 +102,6 @@
            this.totalPage = res.data.totalPage
          }else{
            uni.$u.toast(res.message)
          }
        })
      },
      toDetail(item,type){
        uni.setStorageSync("prevPage", '/pages/tabBar/count/count');
        uni.navigateTo({
          url: `/pages/tabBar/firstPage/exam?bank=` + encodeURIComponent(JSON.stringify(item)) + `&type=` + encodeURIComponent(JSON.stringify(type))
        })
      },
      loginOut(){
        uni.showModal({
          title: '提示',
          content: '是否确认退出该账号?',
          success: async function (res) {
            if (res.confirm) {
              loginOut().then(res=>{
                if(res.code == 200){
                  uni.showToast({
                    title: '账户已退出',
                    duration: 1000
                  })
                  setTimeout(()=>{
                    uni.clearStorageSync();
                    uni.clearStorage();
                    uni.navigateTo({
                      url: '/pages/index/index'
                    })
                  },1000)
                }
              })
            } else if (res.cancel) {
              console.log('用户点击取消');
            }
          }
        })
      },
@@ -146,7 +117,7 @@
          uni.$u.toast('已加载全部数据')
          return
        }
        this.getExamList()
        this.getList()
      },
      scrollView(e) {
        // console.log(e)
@@ -205,64 +176,92 @@
    .paper-card{
      width: calc(100% - 30px);
      background: #fff;
      border-radius: 20px;
      padding: 15px;
      margin: 0 auto 15px;
      box-sizing: border-box;
      box-shadow: 0 3px 8px rgba(150,150,150,.1);
      margin: 0 auto;
      display: flex;
      align-items: center;
      justify-content: space-between;
      .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;
        width: 5%;
        position: relative;
        .dot{
          width: 32rpx;
          height: 32rpx;
          border-radius: 50%;
          background: #5fb734;
          position: absolute;
          left: 50%;
          top: 28rpx;
          transform: translateX(-16rpx);
          z-index: 9;
          box-shadow: 0 3px 8px rgba(95,183,52,.4);
          border: 1px solid #fff;
        }
        .line{
          position: absolute;
          left: 50%;
          top: 0;
          width: 1px;
          height: 100%;
          border-left: 1px dashed #ccc;
        }
      }
      .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;
          view:first-of-type{
            font-size: 44rpx;
            font-weight: 600;
      &:first-of-type{
        .paper-card-l{
          .line{
            position: absolute;
            left: 50%;
            top: 44rpx;
            width: 1px;
            height: calc(100% - 44rpx);
            border-left: 1px dashed #ccc;
          }
          .divide{
            width: 60%;
            height: 1rpx;
            background: #fff;
        }
      }
      &:last-of-type{
        .paper-card-l{
          .line{
            position: absolute;
            left: 50%;
            top: 0;
            width: 1px;
            height: 56rpx;
            border-left: 1px dashed #ccc;
          }
        }
      }
      .paper-card-box{
        width: calc(95% - 15px);
        padding-bottom: 15px;
        .paper-card-r{
          width: 100%;
          background: #fff;
          border-radius: 20px;
          padding: 15px;
          box-sizing: border-box;
          box-shadow: 0 3px 8px rgba(150,150,150,.1);
          .paper-card-t{
            font-size: 32rpx;
            font-family: "PingFang SC";
            font-weight: 800;
            display: flex;
          }
          .paper-card-c{
            font-size: 28rpx;
            margin: 10rpx 0;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
          }
        }
        .green{
          background: #5fb734;
        }
        .red{
          background: #ed6464
          .green{
            margin-bottom: 5px;
            color: #5fb734;
          }
          .red{
            margin-bottom: 5px;
            color: #ed6464
          }
        }
      }
    }