assessment.vue 5.4 KB
<template>
    <view class="content">
        <u-navbar
            back-icon-color="#FFFFFF"
            :background="background"
            title-color="#fff"
            :border-bottom="false"
        ></u-navbar>
        <view class="title">考试规则</view>
        <view class="test">
            <view class="slogan">
                这是一场严肃的考试,请认真查看 规则,预祝您顺利通过考试!
            </view>
            <view class="text">
                <text class="left">考试科目:</text
                ><text style="color: #007aff">{{ desc.title }}</text>
            </view>
            <view class="text">
                <text class="left">合格条件:</text><text>{{ desc.score }}</text>
            </view>
            <view class="text">
                <text class="left">考试时间:</text><text>{{ desc.time }}</text>
            </view>
            <view class="text">
                <text class="left">题目来源:</text><text>系统随机{{ desc.number }}</text>
            </view>
            <button @click="getUserExamId()">开始考试</button>
        </view>
    </view>
</template>

<script>
let condition = {
    "dev": {
        "id-2": {
            "score": "60分",
            "time": "30分钟",
            "number": "20",
            "title": "服务规范"
        },
        "id-3": {
            "score": "30分",
            "time": "15分钟",
            "number": "10",
            "title": "服务规范"
        },
        "id-4": {
            "score": "15分",
            "time": "6分钟",
            "number": "4",
            "title": "交付规范"
        }
    },
    "test": {
        "id-2": {
            "score": "60分",
            "time": "30分钟",
            "number": "20",
            "title": "服务规范"
        },
        "id-3": {
            "score": "30分",
            "time": "15分钟",
            "number": "10",
            "title": "服务规范"
        },
        "id-4": {
            "score": "15分",
            "time": "6分钟",
            "number": "4",
            "title": "交付规范"
        }
    },
    "prod": {
        "id-2": {
            "score": "60分",
            "time": "30分钟",
            "number": "20",
            "title": "服务规范"
        },
        "id-3": {
            "score": "30分",
            "time": "15分钟",
            "number": "10",
            "title": "服务规范"
        },
        "id-4": {
            "score": "15分",
            "time": "6分钟",
            "number": "4",
            "title": "交付规范"
        }
    }
};
let env = process.uniEnv.node_env;
let desc = condition[env];

export default {
    data() {
        return {
            desc: null,
            examId: null,
            exam: null,
            userExamId: null,
        };
    },
    onLoad(param) {
        this.examId = param.examId
        this.desc = desc["id-" + this.examId]
        // this.getUserExamInfo();
    },
    methods: {
        //申请考试获取userExamId
        getUserExamId: function () {
            let examId = this.examId;
            wx.navigateTo({
                url: "/pages/learn/answer?examId=" + examId,
            });
        },
        getUserExamInfo() {
            uni.request({
              url:
                  process.uniEnv.systemUrl.apiUrl +
                  "/wxh-worker-rest/rest/exam/serviceRule/" +
                  this.vuex_token +
                  "?examId=" +
                  this.examId,
              method: "POST",
              header: {
                  "Content-Type": "application/x-www-from-urlencoded",
              },

              success: (res) => {
                  console.log("标识符1", res.data);
                  uni.hideLoading();
                  if (res.data.code == 200) {
                      if (res.data.data.userExamId) {
                          this.userExamId = res.data.data.userExamId;
                          console.log("这个是个标识符", this.userExamId);
                      }
                  }
              },
            });
            setTimeout(() => {
              wx.navigateTo({
                  url: "/pages/learn/answer?userExamId=" + this.userExamId,
              });
            }, 1000);  
        },
    },
};
</script>

<style>
.content {
    width: 750rpx;
    height: 100vh;
    overflow: auto;
    background-color: #f4f5f7;
    background-image: linear-gradient(to top, #f4f5f7 0%, #2272ff 50%);
    background-size: 750rpx 600rpx;
    background-repeat: no-repeat;
}

.title {
    padding: 30rpx 30rpx 46rpx;
    line-height: 40rpx;
    font-size: 40rpx;
    color: #fff;
}

.test {
    margin: 0 30rpx;
    overflow: hidden;
    border-radius: 12rpx;
    padding-bottom: 60rpx;
    background-image: url(../../static/photo/examination.png);
    background-repeat: no-repeat;
    background-size: 66%;
    background-color: #fff;
    background-position: right bottom;
    min-height: 800rpx;
}
.slogan {
    font-size: 40rpx;
    font-weight: bold;
    color: #333333;
    line-height: 20px;
    padding: 50rpx 58rpx 46rpx 30rpx;
}

.left {
    margin-right: 8rpx;
    margin-left: 30rpx;
    color: #666666;
    font-size: 28rpx;
}

.text {
    margin: 30rpx 0;
}

button {
    width: 600rpx;
    height: 104rpx;
    background: #2272ff;
    font-size: 32rpx;
    font-weight: 600;
    color: #ffffff;
    margin-top: 237rpx;
    border-radius: 26px;
    line-height: 104rpx;
}
</style>