From 637da3ece986e6750804e38938a15fa577116977 Mon Sep 17 00:00:00 2001
From: liuyg <liuyg@qq.com>
Date: Mon, 07 Mar 2022 15:09:52 +0800
Subject: [PATCH] 冲突
---
components/dyw-answer/answer.vue | 672 +++++-------
pages/business/business - 副本.vue | 30
components/dyw-answer/answer - 副本 (2).vue | 999 ++++++++++++++++++
pages.json | 4
pages/business/business.vue | 41
pages/exam/examTextPage.vue | 190 +-
App.vue | 4
common/api/examFunc.js | 63
store/state.js | 2
/dev/null | 199 ---
pages/registerUser/registerUser.vue | 74
pages/exam/examResultPage.vue | 130 ++
pages/exam/startexam.vue | 80 -
pages/grabOrders/grabOrdersMain/business.vue | 596 +++++-----
store/actions.js | 183 +-
15 files changed, 2,060 insertions(+), 1,207 deletions(-)
diff --git a/App.vue b/App.vue
index c42ed80..7aca46e 100644
--- a/App.vue
+++ b/App.vue
@@ -143,6 +143,10 @@
width: 100%;
height: 100%;
}
+
+ .uGridSelected {
+ background: #f4f4f4 !important;
+ }
/*每个页面公共css */
</style>
diff --git a/common/api/exam.js b/common/api/exam.js
deleted file mode 100644
index ce29663..0000000
--- a/common/api/exam.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * @Author: Morpheus
- * @Date: 2021-05-09 15:17:44
- * @Last Modified by: Morpheus
- * @Last Modified time: 2021-12-24 11:26:04
- */
-// 校区
-import request from '@/common/axios'
-
-export const enterExam = (params) => {
- return request({
- url: '/simulateExamRecord/beginExam',
- method: 'POST',
- data: params
- })
-}
\ No newline at end of file
diff --git a/common/api/examFunc.js b/common/api/examFunc.js
index c0de7bd..292075c 100644
--- a/common/api/examFunc.js
+++ b/common/api/examFunc.js
@@ -10,53 +10,40 @@
let questionList = []
let queTypeArr = []
-
+
quesModules.forEach((item, index) => {
-
+
+
+
let quesType = item.choicesType
-
- queTypeArr.push(quesType)
-
- item.template = item.choicesType
-
+
+ // 是否答题了
+ item.selectedFlag = false
+ // 答题的结果
item.tempAnswer = ""
-
+ // 题目是否做对
+ item.correctOrError = false
+
+ queTypeArr.push(quesType)
+
+ if (item.choicesType == 1 || item.choicesType == 3) {
+ item.dualChooseArr = []
+ }
+
+
item.options = item.examSubjectOptions
-
- item.options.forEach(it => {
- it.newOptLetter = it.optionName
- it.optContent = it.optionContent
- it.optLetter = it.newOptLetter
- })
-
+
+ if (item.choicesType == 0 || item.choicesType == 1 || item.choicesType == 3) {
+ item.options.reverse()
+ }
+
+
questionList.push(item)
-
+
})
store.state.queTypeArr = unique(queTypeArr)
store.state.questionList = questionList
-}
-
-export const topicOptions = (options) => {
-
- var questionList = store.state.questionList
-
- questionList.forEach((item, index) => {
-
- })
-
- store.state.questionList = questionList
-
- // for (let j = 0; j < quesModules[i].examSubjectOptions.length; j++) {
- // // 解决theoryExamAnswer可能为null的问题,把它赋值为字符串
- // quesModules[i].examSubjectOptions[j].tempAnswer = "" //暂存每题的答案
- // quesModules[i].examSubjectOptions[j].template = quesModules[i].choicesType //防止template初始值是null
- // quesModules[i].examSubjectOptions[j].recordId = store.state.examDetail
- // .id //搬移recordId的位置
- // quesModules[i].examSubjectOptions[j].blankArr = [] //新建blankArr属性,临时保存填空题答案
- // quesModules[i].examSubjectOptions[j].dualChooseArr = [] //新建blankArr属性,临时保存填空题答案
- // questionList.push(quesModules[i].examSubjectOptions[j])
- // }
}
diff --git a/common/axios.js b/common/axios.js
deleted file mode 100644
index a12765d..0000000
--- a/common/axios.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * 全站http配置
- *
- * axios参数说明
- * isSerialize是否开启form表单提交
- * isToken是否需要token
- */
-import axios from "axios";
-
-const service = axios.create({
- baseURL: "http://192.168.0.198:81", //正常接口
- timeout: 600000, // request timeout
-});
-
-// 返回其他状态码
-service.defaults.validateStatus = function (status) {
- return status >= 200 && status <= 500;
-};
-
-// 跨域请求,允许保存cookie
-service.defaults.withCredentials = true;
-
-// http request拦截
-service.interceptors.request.use(
- (config) => {
- return config;
- },
- (error) => {
- return Promise.reject(error);
- }
-);
-
-// http response 拦截
-service.interceptors.response.use(
- (res) => {
- return res;
- },
- (error) => {
- return Promise.reject(new Error(error));
- }
-);
-
-export default service;
diff --git "a/components/dyw-answer/answer - \345\211\257\346\234\254 \0502\051.vue" "b/components/dyw-answer/answer - \345\211\257\346\234\254 \0502\051.vue"
new file mode 100644
index 0000000..2b60937
--- /dev/null
+++ "b/components/dyw-answer/answer - \345\211\257\346\234\254 \0502\051.vue"
@@ -0,0 +1,999 @@
+<template>
+ <!-- 此组件用于显示整套试卷·
+ 试卷类型包含
+ exam 理论考试
+ paper 模拟考试 知识点练习 -->
+ <view>
+ <!-- 大标题 -->
+ <view class="header" id="header">
+ <!-- <span class="header-button" @click='leave' v-if='!isReviewed && examType=='know' '>暂离</span> -->
+ <span v-if="examType=='exam'"> {{examDetail.exam.name}}</span>
+ <span v-if="(examType=='paper' )|| (examType=='know') || (examType=='course')">
+ {{examDetail.paper.name}}</span>
+ <span class="header-button" @click='handleSubmit(1)' v-if='!isReviewed'>交卷</span>
+ <!-- <span class="scoreText" v-else>得分:{{examDetail.score}}</span> -->
+ </view>
+ <!-- 小标题栏 -->
+ <view id="subHeader">
+ <view class="sub-header" v-if='questionList.length > 0'>
+ <u-tag class="typeTag" :text="answerStatusName" mode="dark" shape="circle" />
+ <view v-if="examDetail.exam.examTime<=0">不限时</view>
+ <u-count-down v-if="(!isReviewed)&&(examType=='exam')&& (examDetail.exam.examTime>0)"
+ :timestamp="examDetail.exam.examTime / 1000" :show-days="false" @end="end" @change="change">
+ </u-count-down>
+ <clock v-if="(!isReviewed)&&(examType=='paper' || (examType=='course'))" ref="myClock"
+ :timeOrigin="parseInt(examDetail.time)">
+ </clock>
+ <span v-if="examType=='exam'">第
+ {{currentIndex+1}}/{{examDetail.exam.totalQuestion}} 题</span>
+ <span v-if="(examType=='paper' )|| (examType=='know')">第
+ {{currentIndex+1}}/{{examDetail.totalQuestion}} 题</span>
+ </view>
+ </view>
+
+ <!-- 答题区域 -->
+ <swiper class="content" :duration='duration' :current=currentIndex @change='handleSwiperChanged'
+ v-if='questionList.length > 0' :style="{'height':swiperHeight}">
+ <template v-for='item in questionList'>
+ <swiper-item class="content-item">
+ <scroll-view scroll-y :style="{'height':swiperHeight}">
+ <!-- 显示题目的题干 -->
+ <view class="content-title">
+ <rich-text :nodes="item.subjectName"></rich-text>
+ </view>
+ <!-- 以下显示选项 -->
+ <!-- type == 0 单选题 -->
+ <view class="content-solutions" v-if='item.template == 0'>
+ <template v-for='subItem in item.options'>
+ <view
+ :class="[isReviewed && subItem.optAnswer == 1 ? 'right': '',isReviewed && (item.wrongArr.indexOf(subItem.optLetter) >-1) ? 'wrong': '']"
+ class="content-solutions-item" @click='chooseSolution(item,subItem)'>
+ <view v-if="(!isReviewed) && (examType=='exam') "
+ class="content-solutions-item-single">
+ {{subItem.newOptLetter}}
+ </view>
+ <view v-else class="content-solutions-item-single">{{subItem.optLetter}}</view>
+ <!-- 此处注意optLetter与newOptLetter的区别,newOptLetter是ABCD顺序的,而optLetter乱序的,两者无直接关系 -->
+ <view
+ :class="item.tempAnswer == subItem.optLetter? 'content-solutions-item-select' : ''"
+ class="content-solutions-item-content">{{subItem.optContent}}</view>
+ </view>
+ </template>
+ </view>
+
+ <!-- type == 1 多选题 -->
+ <view class="content-solutions" v-if='item.template == 1'>
+ <template v-for='subItem in item.options'>
+ <view
+ :class="[isReviewed && subItem.optAnswer == 1 ? 'right': '',isReviewed && (item.wrongArr.indexOf(subItem.optLetter) >-1) ? 'wrong': '']"
+ class="content-solutions-item" @click='chooseMutiSolution(item,subItem)'>
+ <view v-if="(!isReviewed) && (examType=='exam') "
+ class="content-solutions-item-single">
+ {{subItem.newOptLetter}}
+ </view>
+ <view v-else class="content-solutions-item-single">{{subItem.optLetter}}</view>
+ <!-- TODO 是否被选中的条件判断不对 -->
+ <view
+ :class="item.tempAnswer.indexOf(subItem.optLetter) >-1 ? 'content-solutions-item-select' : ''"
+ class="content-solutions-item-content">{{subItem.optContent}}
+ </view>
+ </view>
+ </template>
+ </view>
+
+ <!-- type == 2 判断题 -->
+ <view class="content-solutions" v-if='item.template == 2'>
+ <template v-for='subItem in item.options'>
+ <view class="content-solutions-judge">
+ <view v-for="(judgeItem,judgeIndex) in judgeArr"
+ :class="[item.tempAnswer == judgeItem.value? 'content-solutions-item-select' : '',isReviewed && (item.rightAnswer==judgeItem.name) ? 'right': '',isReviewed && (item.wrongArr ==judgeItem.value) ? 'wrong': '']"
+ class="content-solutions-judge-item"
+ @click='judgeSolution(item,judgeItem.value)'>{{judgeItem.name}}</view>
+ </view>
+ </template>
+ </view>
+
+ <!-- type == 4 填空题 -->
+ <view class="content-solutions" v-if='item.template == 4'>
+ <template v-if="!isReviewed">
+ <view class="content-solutions-item" v-for='(subItem,subIndex) in item.options'
+ :keys="subIndex"
+ :class="[isReviewed && item.answerStatus!=4 &&(item.blankString != item.rightAnswer)? 'wrong':'']">
+ <view class="content-solutions-item-single">{{subIndex+1}}</view>
+ <input :disabled="isReviewed" type="text" class="content-solutions-blank"
+ v-model="item.blankArr[subIndex]" placeholder="请在此处输入答案" />
+ </view>
+ </template>
+ <template v-else>
+ <view class="content-solutions-item">
+ <view class="content-solutions-item-single"></view>
+ <!-- TODOvalue的绑定值不对 :value="item.blankArr[subIndex].replace(/"\;/g, '')" -->
+ <input :disabled="isReviewed" :value="(item.blankArr).join(',')" type="text"
+ class="content-solutions-blank" />
+ </view>
+ </template>
+ </view>
+ <!-- type == 5 简答题 -->
+ <view class="content-solutions" v-if='item.template == 5'>
+ <textarea v-if="!isReviewed" @input="textInput" :disabled="isReviewed" placeholder="请输入您的答案"
+ auto-height />
+ <textarea v-else :disabled="isReviewed" :value="item.tempAnswer.replace(/"\;/g, '')"
+ auto-height />
+ </view>
+
+ <view class="explain" v-if='isReviewed'>
+ <u-tag v-show="item.answerStatus==1" text="未答" type="error" />
+ <u-tag v-show="item.answerStatus==2" text="正确" type="success" />
+ <u-tag v-show="item.answerStatus==3" text="错误" type="error" />
+ <u-tag v-show="item.answerStatus==4" text="未评分" type="warning" />
+ <u-tag v-show="item.answerStatus==5" text="已评分" type="warning" />
+ <u-tag v-show="item.answerStatus==6" text="已答" type="warning" />
+ <view class="explain-title">正确答案:</view>
+ <!-- <span class="text">{{item.rightAnswer}}</span> -->
+ <u-parse :html="item.rightAnswer"></u-parse>
+ <view class="explain-title">试题解析:</view>
+ <!-- <view class="explain-content">{{item.queAnalysis | analysisFilter }}</view> -->
+ <u-parse :html="item.queAnalysis?item.queAnalysis:'暂无'"></u-parse>
+ <view class="noteArea">
+ <view class="noteAreaTitle">
+ <view class="explain-title">我的笔记:</view>
+ <view v-if="eidtOrFinishValue=='编辑笔记'" class="funcGroup" @click="editBtnFunc(item)">
+ <u-icon class="funcBtn" name="edit-pen"></u-icon>
+ <span>编辑笔记</span>
+ </view>
+ <view v-else class="funcGroup" @click="finishBtnFunc(item)">
+ <u-icon class="funcBtn" name="edit-pen"></u-icon>
+ <span>完成</span>
+ </view>
+ </view>
+ <!-- 只有回答过的题目才能编辑笔记!!! -->
+ <text-editor :noteId="item.id" :textContent="item.theoryExamAnswer.queNote"
+ :isreadOnly="isreadOnly" @editorInput='updateEditorText'>
+ </text-editor>
+ </view>
+ </view>
+ </scroll-view>
+ </swiper-item>
+ </template>
+ </swiper>
+
+ <!-- 底部栏 -->
+ <view class="footer" id="footer">
+ <view class="footer-back" @click='handleChangeCurrentSwiper(-1)'>上一题</view>
+ <view class="footer-card" @click="showQuestion = !showQuestion">答题卡</view>
+ <view class="footer-right" @click='handleChangeCurrentSwiper(1)'>下一题</view>
+ </view>
+
+ <!-- 答题卡弹出层 -->
+ <modal v-model="showQuestion">
+ <view class='question-modal' :style="{'height': modalHeight}">
+ <view class="question-modal-header" id="questionHeader">
+ 答题卡
+ </view>
+ <scroll-view scroll-y class="question-modal-body" :style="{'height': modalContentHeight}">
+ <template v-for="(subItem,subIndex) in queTypeArr">
+ <view class="queTypeName" v-show="queTypeStore[subIndex]>=0">{{subItem.name}}</view>
+ <!-- <u-tag :text="subItem.name" v-show="queTypeStore[subIndex]>0" mode="dark" /> -->
+ <view class="queTypeArea">
+
+ <template v-for="(item, index) in questionList">
+ <view v-show="item.template == subItem.value">
+
+ <!-- 1.复习状态且回答正确 -->
+ <!-- <view v-if='item.tempAnswer && item.answer==item.tempAnswer && isReviewed' -->
+ <view v-if='isReviewed && item.answerStatus == "2"'
+ class="question-modal-body-item question-modal-body-item-right"
+ @click="handleJumpSwiper(index)">{{index + 1 }}</view>
+ <!-- 2.复习状态且回答错误 -->
+ <view
+ v-else-if='isReviewed && (item.answerStatus == "1" ||item.answerStatus == "3" )'
+ class="question-modal-body-item question-modal-body-item-failed"
+ @click="handleJumpSwiper(index)">{{index + 1 }}</view>
+ <!-- 3.复习状态且简答题未评分或者已评分 -->
+ <view
+ v-else-if='isReviewed && (item.answerStatus == "4" ||item.answerStatus == "5")'
+ class="question-modal-body-item question-modal-body-item-unScored"
+ @click="handleJumpSwiper(index)">{{index + 1 }}</view>
+ <!-- 3.非复习状态且已经作答 -->
+ <view v-else-if='!isReviewed && item.tempAnswer && item.tempAnswer.length != 0'
+ class="question-modal-body-item question-modal-body-item-select"
+ @click="handleJumpSwiper(index)">{{index + 1 }}</view>
+ <!-- 4.非复习状态且未作答 -->
+ <view v-else class="question-modal-body-item question-modal-body-item-unselect"
+ @click="handleJumpSwiper(index)">
+ {{index + 1 }}
+ </view>
+ <!-- <u-line color="red" border-style="info"></u-line> -->
+ </view>
+ </template>
+ </view>
+ </template>
+ </scroll-view>
+ <view class="question-modal-foot" id="questionHeader">
+ <view v-if="!isReviewed" class="ansBlock">
+ <view class="blockItem">
+ <view class="block-ansed"></view>
+ <view class="">已答</view>
+ </view>
+ <view class="blockItem">
+ <view class="block-unansed"></view>
+ <view class="">未答</view>
+ </view>
+ </view>
+
+ <view v-else class="ansBlock">
+ <view class="blockItem">
+ <view class="block-right"></view>
+ <view class="">答对</view>
+ </view>
+ <view class="blockItem">
+ <view class="block-wrong"></view>
+ <view class="">答错</view>
+ </view>
+ <view class="blockItem">
+ <view class="block-unScored"></view>
+ <view class="">未评分</view>
+ </view>
+ </view>
+ </view>
+ </view>
+ </modal>
+ <u-toast ref="uToast" />
+ </view>
+</template>
+
+<script>
+ import Modal from './modal.vue'
+ import clock from '@/components/clock/clock.vue';
+ export default {
+ data() {
+ return {
+ isreadOnly: true,
+ quesModules: [],
+ areaText: ``, //保存简答题答案
+ judgeArr: [{
+ name: '正确',
+ value: '1'
+ },
+ {
+ name: '错误',
+ value: '0'
+ }
+ ],
+ queTypeArr: [{
+ name: '单选题',
+ value: '0',
+ be: false,
+ },
+ {
+ name: '多选题',
+ value: '1',
+ be: false,
+ },
+ {
+ name: '判断题',
+ value: '2',
+ be: false,
+ },
+ {
+ name: '填空题',
+ value: '4',
+ be: false,
+ },
+ {
+ name: '简答题',
+ value: '5',
+ be: false,
+ }
+ ],
+ currentIndex: 0,
+ swiperHeight: '667px',
+ modalHeight: '500px',
+ modalContentHeight: '400px',
+ showQuestion: false,
+ articleEditorValue: '',
+ eidtOrFinishValue: '编辑笔记',
+ // eidtOrFinish: true,
+ editorText: '',
+ editor: 'editor',
+ }
+ },
+ filters: {
+ // 判断答案状态
+ analysisFilter(item) {
+ if (item == null) {
+ return "暂无解析"
+ } else {
+ return item
+ }
+ }
+ },
+ watch: {
+ // 监听currentIndex的变化,改变则提交答案 相同
+ currentIndex(newVal, oldVal) {
+ let that = this
+ if (!this.isReviewed) {
+ // 对各题型的答案进行处理
+ switch (that.questionList[oldVal].template) {
+ case 0:
+ // 选择题
+ break;
+ case 1:
+ // 多选题
+ // that.questionList[that.currentIndex].tempAnswer = that.questionList[that.currentIndex]
+ // .dualChooseArr.join(',')
+ break;
+ case 2:
+ // 判断题
+ break;
+ case 4:
+ // 填空题
+ that.questionList[oldVal].tempAnswer = that.questionList[oldVal].blankArr.join(
+ '||~||') // 数组拼接为字符串
+ break;
+ case 5:
+ that.questionList[oldVal].tempAnswer = JSON.stringify(that.areaText)
+ // console.log('000:',that.questionList[oldVal].tempAnswer);
+ break;
+ default:
+ }
+
+ // if (this.examType == 'exam') {
+ // // 保存答案
+ // var answerObj = {
+ // examRecordId: this.questionList[oldVal].recordId,
+ // paperQueId: this.questionList[oldVal].id,
+ // answer: this.questionList[oldVal].tempAnswer,
+ // template: this.questionList[oldVal].template
+ // }
+
+ // // 进行答题的api请求
+ // console.log('answerObj:', oldVal, answerObj);
+ // this.$api.answerExam(answerObj)
+ // .then(res => {
+ // console.log(res);
+ // })
+ // } else if (this.examType == 'paper' || this.examType == 'know') {
+ // var answerObj = {
+ // exerciseId: this.examDetail.exerciseId,
+ // paperQueId: this.questionList[oldVal].id,
+ // answer: this.questionList[oldVal].tempAnswer,
+ // template: this.questionList[oldVal].template
+ // }
+
+ // // 进行答题的api请求
+ // console.log('answerObj:', oldVal, answerObj);
+ // this.$api.answerPaper(answerObj)
+ // .then(res => {
+ // console.log(res);
+ // })
+ // } else {
+ // return
+ // }
+ // immediate: true,
+ }
+ }
+ },
+ computed: {
+ // swiperHeight(){
+ // uni.getSystemInfo({
+ // success(res) {
+ // console.log(res);
+ // return res.windowHeight+'px'
+ // }
+ // })
+ // },
+ examDetail() {
+ return this.$store.state.examDetail
+ },
+ questionList() {
+ console.log(this.$store.state.questionList, 77777)
+ return this.$store.state.questionList
+ },
+ queTypeStore() {
+ return this.$store.state.queTypeArr
+ },
+ max() {
+ return this.questionList.length - 1
+ },
+ answerStatusName() {
+ console.log(this.questionList[this.currentIndex].template, 63636636366)
+ switch (this.questionList[this.currentIndex].template) {
+ case 0:
+ return '单选题'
+ break;
+ case 1:
+ return '多选题'
+ break;
+ case 2:
+ return '判断题'
+ break;
+ case 4:
+ return '填空题'
+ break;
+ case 5:
+ return '简答题'
+ break;
+ default:
+ return '考试题'
+ }
+ }
+ },
+ props: {
+ isReviewed: {
+ type: Boolean,
+ default: false
+ },
+ examType: {
+ type: String,
+ default: "exam"
+ },
+ duration: {
+ type: [String, Number],
+ default: 300
+ },
+ },
+ mounted() {
+ var that = this
+ this.setAnswerHeight()
+ if ((!this.isReviewed) && ((this.examType == 'paper') || (this.examType == 'course'))) {
+ this.$refs.myClock.start();
+ }
+ },
+ components: {
+ Modal,
+ clock
+ },
+ methods: {
+ /*设置题目的高度*/
+ setAnswerHeight() {
+ let that = this
+ let tempHeight = 0
+ uni.getSystemInfo({
+ //获取手机屏幕高度信息,让swiper的高度和手机屏幕一样高
+ success: function(res) {
+ console.log(res, '010101010')
+ tempHeight = res.windowHeight;
+ that.modalHeight = res.windowHeight - uni.upx2px(200) + 'px';
+ that.modalContentHeight = res.windowHeight - uni.upx2px(380) + 'px';
+ uni.createSelectorQuery().in(that).select("#header").fields({
+ size: true,
+ scrollOffset: true
+ }, (data) => {
+ console.log('data', data);
+ tempHeight -= data.height;
+ uni.createSelectorQuery().in(that).select("#subHeader").fields({
+ size: true,
+ scrollOffset: true
+ }, (data) => {
+ tempHeight -= data.height;
+ uni.createSelectorQuery().in(that).select("#footer").fields({
+ size: true,
+ scrollOffset: true
+ }, (data) => {
+ tempHeight -= data.height;
+ that.swiperHeight = tempHeight + 'px';
+ }).exec();
+ }).exec();
+ }).exec();
+ }
+ });
+ },
+ /* 跳转指定题目 */
+ handleJumpSwiper(index) {
+ this.currentIndex = index
+ this.showQuestion = false
+ },
+ change(timestamp) {
+ // var that = this
+ if (timestamp == 30) {
+ this.$refs.uToast.show({
+ title: '考试只剩余30s,请注意时间',
+ type: 'warning',
+ duration: 2000,
+ position: 'top'
+ })
+ }
+ // this.$forceUpdate()
+ },
+ end() {
+ this.$refs.uToast.show({
+ title: '考试时间结束,已自动交卷',
+ type: 'warning'
+ })
+ setTimeout(() => {
+ this.handleSubmit(0)
+ }, 2000)
+ },
+ textInput(e) {
+ this.areaText = e.detail.value
+ // console.log(e.detail.value)
+ },
+ /* 滑动题目 */
+ handleSwiperChanged(event) {
+ this.currentIndex = event.detail.current
+ },
+ /* 调用上一页,下一页 */
+ handleChangeCurrentSwiper(operation) {
+ let max = this.questionList.length - 1
+ let min = 0
+ // 进行翻页
+ if ((this.currentIndex > min && operation < 0) || (this.currentIndex < max && operation > 0)) {
+ this.currentIndex += operation
+ // console.log(this.currentIndex)
+ }
+ },
+ /* 选择答案(单选)*/
+ chooseSolution(item, subItem) {
+ if (!this.isReviewed) {
+ // tempAnswer为学生答案
+ item.tempAnswer = subItem.optLetter
+ // 强制刷新更新视图
+ this.$forceUpdate()
+ // this.questionList[this.currentIndex].tempAnswer = subItem.optLetter
+ if (this.currentIndex < this.max) {
+ setTimeout(() => {
+ this.currentIndex += 1
+ }, 300)
+ }
+ // this.onAnswerChange(item)
+ }
+ },
+ /* 选择答案(多选)*/
+ chooseMutiSolution(item, subItem) {
+ console.log(item, 123)
+ if (!this.isReviewed) {
+ let answerIndex = item.dualChooseArr.indexOf(subItem.optLetter)
+ if (answerIndex > -1) {
+ // 该选项已经在数组中了
+ item.dualChooseArr.splice(answerIndex, 1)
+ } else {
+ // 该选项不在数组中
+ item.dualChooseArr.push(subItem.optLetter)
+ }
+ item.tempAnswer = item.dualChooseArr.join(',')
+ // this.onAnswerChange(answerIndex)
+ // 强制刷新更新视图
+ this.$forceUpdate()
+ }
+ },
+ /* 判断题答案 */
+ judgeSolution(item, value) {
+ if (!this.isReviewed) {
+ // tempAnswer为学生答案
+ item.tempAnswer = value
+ // 强制刷新更新视图
+ this.$forceUpdate()
+ if (this.currentIndex < this.max) {
+ setTimeout(() => {
+ this.currentIndex += 1
+ }, 300)
+ }
+ // this.onAnswerChange(item)
+ }
+ },
+
+ /* 题目答案变化 */
+ onAnswerChange(item) {
+ let result = JSON.parse(JSON.stringify(item))
+ this.$emit('onChange', item)
+ },
+ /* 交卷 相同 */
+ handleSubmit(submitORimeEnd) {
+ /*submitORimeEnd == 1,submit
+ submitORimeEnd == 0,stimeEnd*/
+ if (this.currentIndex == 0) {
+ this.currentIndex++
+ } else {
+ this.currentIndex = 0
+ }
+ if (submitORimeEnd) {
+ // this.$emit('submit', this.questionList)
+ this.$emit('submit')
+ } else {
+ this.$emit('timeEnd')
+ }
+ },
+
+ // 点击编辑笔记
+ editBtnFunc(item) {
+ if (item.theoryExamAnswer.id == undefined) {
+ this.$refs.uToast.show({
+ title: '未作答的题目不可编辑笔记!',
+ type: 'error',
+ // url: '/pages/user/index'
+ })
+ return
+ }
+ this.isreadOnly = !this.isreadOnly
+ this.eidtOrFinishValue = '完成'
+ },
+ // 完成编辑
+ finishBtnFunc(item) {
+ var that = this
+ this.isreadOnly = !this.isreadOnly
+ this.eidtOrFinishValue = '编辑笔记'
+ console.log('保存笔记内容', item, that.editorText);
+ this.$api.examNote(item.theoryExamAnswer.id, that.editorText)
+ .then(res => {
+ console.log('更新笔记成功', res)
+ })
+ },
+ updateEditorText(text) {
+ // 从子组件获取输入框输入内容
+ this.editorText = text
+ },
+ }
+ }
+</script>
+
+<style lang="scss">
+ page {
+ background-color: #FFFFFF;
+ }
+
+ #header,
+ #subHeader {
+ height: 100rpx;
+ }
+
+ .header {
+ width: 750rpx;
+ // position: fixed;
+ margin-top: 30rpx;
+ position: relative;
+ text-align: center;
+ line-height: 100rpx;
+ font-size: 36rpx;
+ font-weight: 600;
+ color: #103289;
+ letter-spacing: 10rpx;
+ background-color: #FFFFFF;
+
+ &-button {
+ width: 80rpx;
+ height: 40rpx;
+ line-height: 40rpx;
+ position: absolute;
+ top: 20rpx;
+ right: 40rpx;
+ padding: 10rpx 20rpx;
+ border-radius: 15rpx;
+ letter-spacing: 2rpx;
+ font-weight: 500;
+ color: #FFFFFF;
+ background-color: #103289;
+ }
+
+ .scoreText {
+ color: #00b060;
+ font-size: 35rpx;
+ }
+ }
+
+ .sub-header {
+ width: 750rpx;
+ // position: fixed;
+ // margin-top: 130rpx;
+ padding: 30rpx 20rpx;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ color: #000;
+ font-size: 33rpx;
+ font-weight: bold;
+ background-color: #FFFFFF;
+ }
+
+ .content {
+ // margin-top: 130rpx;
+ letter-spacing: 3rpx;
+
+ .typeTag {
+ margin-right: 20rpx;
+ }
+
+ &-item-explain {
+ padding-bottom: 20rpx;
+ font-size: 30rpx;
+ color: #8799a3;
+ letter-spacing: 5rpx;
+ border-top: 1px solid rgba(0, 0, 0, 0.1);
+
+ &-result {
+ padding: 20rpx 0;
+
+ span {
+ padding-left: 20rpx;
+ color: #39b54a;
+ }
+ }
+
+ &-content {
+ padding: 20rpx 0;
+ }
+ }
+
+ &-item {
+ padding: 0 20rpx;
+ box-sizing: border-box;
+ }
+
+ &-title {
+ margin-bottom: 30rpx;
+ font-size: 32rpx;
+ line-height: 55rpx;
+ color: #000
+ }
+
+ &-solutions {
+ width: 100%;
+ padding-bottom: 20rpx;
+
+ &-item {
+ margin: 40rpx 0;
+ border: 5rpx solid #103289;
+ border-radius: 20rpx;
+ display: flex;
+ align-items: center;
+ font-size: 30rpx;
+ background-color: #103289;
+
+ &-check-content {
+ padding: 35rpx 20rpx;
+ width: 100%;
+ border-radius: 15rpx;
+ color: #103289;
+ background-color: #FFFFFF;
+ }
+
+ &-single {
+ width: 80rpx;
+ text-align: center;
+ color: #FFFFFF;
+ }
+
+ &-content {
+ padding: 35rpx 20rpx;
+ width: 630rpx;
+ border-top-right-radius: 15rpx;
+ border-bottom-right-radius: 15rpx;
+ color: #000;
+ background-color: #FFFFFF;
+ }
+
+ &-select {
+ color: #FFFFFF;
+ background-color: #103289;
+ }
+ }
+
+ &-judge {
+ display: flex;
+ justify-content: space-around;
+ background-color: #FFFFFF;
+ padding: 20rpx;
+ text-align: center;
+ font-size: 30rpx;
+
+ .content-solutions-judge-item {
+ border: 5rpx solid #103289;
+ border-radius: 60rpx;
+ width: 300rpx;
+ padding: 35rpx 20rpx; // 控制单元格的高度
+ }
+
+ .content-solutions-judge-select {
+ color: #FFFFFF;
+ background-color: #103289;
+ }
+
+ }
+
+ &-blank {
+ // border: 5rpx solid #103289;
+ height: 60rpx;
+ width: 90%;
+ // border-radius: 20rpx;
+ background-color: #FFFFFF;
+ padding: 20rpx;
+ }
+
+ &-fillItem {
+ border: 5rpx solid #103289;
+ border-radius: 20rpx;
+ background-color: #FFFFFF;
+ padding: 20rpx;
+ }
+ }
+
+ .explain {
+ border-top: solid #999999 1px;
+ padding-top: 10rpx;
+ font-size: 28rpx;
+ color: #666666;
+
+ .explainResult {
+ color: #103289;
+ }
+
+ .explain-title {
+ font-weight: bold;
+ }
+
+ .noteArea {
+ border-top: 2rpx solid #103289;
+ padding-top: 10rpx;
+
+ // background-color: #0077AA;
+ .noteAreaTitle {
+ display: flex;
+ justify-content: space-between;
+ }
+ }
+ }
+ }
+
+ .footer {
+ width: 750rpx;
+ height: 100rpx;
+ padding: 30rpx 20rpx;
+ position: fixed;
+ bottom: 0;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ font-size: 30rpx;
+ box-sizing: border-box;
+ color: #4c8af3;
+ box-shadow: 0 0 5px 1px #eee;
+ background-color: #FFFFFF;
+
+ &-card {
+ padding: 10rpx 20rpx;
+ border: 1px solid #103289;
+ border-radius: 15rpx;
+ color: #FFFFFF;
+ background-color: #103289;
+ }
+ }
+
+ .question-modal {
+ width: 700rpx;
+ padding: 40rpx;
+ background-color: #FFFFFF;
+
+ &-header {
+ height: 80rpx;
+ line-height: 80rpx;
+ text-align: center;
+ font-size: 35rpx;
+ color: #333333;
+ border-bottom: 1rpx solid #F0F0F0;
+ }
+
+ &-body {
+
+ // margin-bottom: 100rpx;
+ .queTypeName {
+ font-size: 32rpx;
+ font-weight: bold;
+
+ }
+
+ .queTypeArea {
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ margin-bottom: 20rpx;
+
+ .question-modal-body-item {
+ width: 80rpx;
+ height: 80rpx;
+ margin: 10rpx 22rpx;
+ line-height: 80rpx;
+ font-size: 35rpx;
+ text-align: center;
+ border-radius: 50%;
+ color: #ffffff;
+ // background-color: #0077AA;
+ }
+ }
+
+ &-item-unselect {
+ // color: #FFFFFF;
+ background-color: #bbbbbb;
+ }
+
+ &-item-select {
+ // color: #FFFFFF;
+ background-color: #103289;
+ }
+
+ &-item-failed {
+ color: #FFFFFF;
+ background-color: #982121;
+ }
+
+ &-item-right {
+ color: #FFFFFF;
+ background-color: #39b54a;
+ }
+
+ &-item-unScored {
+ color: #FFFFFF;
+ background-color: #ff9f73;
+ }
+ }
+
+ .question-modal-foot {
+ height: 100rpx;
+ border-top: 1rpx solid #F0F0F0;
+ // position: fixed;
+ // margin-bottom: 0rpx;
+ margin-top: -60rpx;
+
+ .ansBlock {
+ display: flex;
+ justify-content: center;
+
+ // align-items: center;
+ .blockItem {
+ display: flex;
+ align-items: center;
+ margin: 20rpx;
+ }
+
+ .block-ansed {
+ width: 80rpx;
+ height: 80rpx;
+ border-radius: 50%;
+ background: #103289;
+ margin: 0 10rpx;
+ }
+
+ .block-unansed {
+ width: 80rpx;
+ height: 80rpx;
+ border-radius: 50%;
+ // border: solid #ffffff 1px;
+ background: #bbbbbb;
+ margin: 0 10rpx;
+ }
+
+ .block-right {
+ width: 80rpx;
+ height: 80rpx;
+ border-radius: 50%;
+ background: #39b54a;
+ margin: 0 10rpx;
+ }
+
+ .block-wrong {
+ width: 80rpx;
+ height: 80rpx;
+ border-radius: 50%;
+ background: #982121;
+ margin: 0 10rpx;
+ }
+
+ .block-unScored {
+ width: 80rpx;
+ height: 80rpx;
+ border-radius: 50%;
+ background: #ff9f73;
+ margin: 0 10rpx;
+ }
+ }
+
+ }
+ }
+
+ .right {
+ border: 8rpx solid #39b54a;
+ }
+
+ .wrong {
+ border: 8rpx solid #d81717;
+ }
+</style>
diff --git a/components/dyw-answer/answer.vue b/components/dyw-answer/answer.vue
index 9ea969b..6e42e28 100644
--- a/components/dyw-answer/answer.vue
+++ b/components/dyw-answer/answer.vue
@@ -3,36 +3,31 @@
试卷类型包含
exam 理论考试
paper 模拟考试 知识点练习 -->
- <view>
+ <view class="container">
<!-- 大标题 -->
- <view class="header" id="header">
- <!-- <span class="header-button" @click='leave' v-if='!isReviewed && examType=='know' '>暂离</span> -->
- <span v-if="examType=='exam'"> {{examDetail.exam.name}}</span>
- <span v-if="(examType=='paper' )|| (examType=='know') || (examType=='course')">
- {{examDetail.paper.name}}</span>
- <span class="header-button" @click='handleSubmit(1)' v-if='!isReviewed'>交卷</span>
- <!-- <span class="scoreText" v-else>得分:{{examDetail.score}}</span> -->
- </view>
+ <u-navbar class="header" id="header" height="44" back-icon-color="#fff" title="模拟考试" title-color="#fff"
+ :background="{background: '#103289'}" :custom-back="exitExam">
+ <u-button class="slot-wrap-right" type="primary" size="mini" @click="handleSubmit(1)">交卷
+ </u-button>
+ </u-navbar>
+
<!-- 小标题栏 -->
- <view id="subHeader">
+ <view id="subHeader" :style="{'margin-top': subHeaderTop}">
<view class="sub-header" v-if='questionList.length > 0'>
<u-tag class="typeTag" :text="answerStatusName" mode="dark" shape="circle" />
<view v-if="examDetail.exam.examTime<=0">不限时</view>
- <u-count-down v-if="(!isReviewed)&&(examType=='exam')&& (examDetail.exam.examTime>0)"
- :timestamp="examDetail.exam.examTime / 1000" :show-days="false" @end="end" @change="change">
+
+ <u-count-down v-if="examDetail.exam.examTime" :timestamp="examDetail.exam.examTime / 1000"
+ :show-days="false" @end="end" @change="change">
</u-count-down>
- <clock v-if="(!isReviewed)&&(examType=='paper' || (examType=='course'))" ref="myClock"
- :timeOrigin="parseInt(examDetail.time)">
- </clock>
- <span v-if="examType=='exam'">第
+
+ <span>第
{{currentIndex+1}}/{{examDetail.exam.totalQuestion}} 题</span>
- <span v-if="(examType=='paper' )|| (examType=='know')">第
- {{currentIndex+1}}/{{examDetail.totalQuestion}} 题</span>
</view>
</view>
<!-- 答题区域 -->
- <swiper class="content" :duration='duration' :current=currentIndex @change='handleSwiperChanged'
+ <swiper class="content" :duration='duration' :current='currentIndex' @change='handleSwiperChanged'
v-if='questionList.length > 0' :style="{'height':swiperHeight}">
<template v-for='item in questionList'>
<swiper-item class="content-item">
@@ -43,115 +38,98 @@
</view>
<!-- 以下显示选项 -->
<!-- type == 0 单选题 -->
- <view class="content-solutions" v-if='item.template == 0'>
+ <view class="content-solutions" v-if='item.choicesType == 0'>
<template v-for='subItem in item.options'>
- <view
- :class="[isReviewed && subItem.optAnswer == 1 ? 'right': '',isReviewed && (item.wrongArr.indexOf(subItem.optLetter) >-1) ? 'wrong': '']"
- class="content-solutions-item" @click='chooseSolution(item,subItem)'>
- <view v-if="(!isReviewed) && (examType=='exam') "
- class="content-solutions-item-single">
- {{subItem.newOptLetter}}
+ <view class="content-solutions-item"
+ @click="!item.selectedFlag && chooseSolution(item,subItem)">
+ <view class="content-solutions-item-single">
+ {{subItem.optionName}}
</view>
- <view v-else class="content-solutions-item-single">{{subItem.optLetter}}</view>
- <!-- 此处注意optLetter与newOptLetter的区别,newOptLetter是ABCD顺序的,而optLetter乱序的,两者无直接关系 -->
+
<view
- :class="item.tempAnswer == subItem.optLetter? 'content-solutions-item-select' : ''"
- class="content-solutions-item-content">{{subItem.optContent}}</view>
+ :class="item.tempAnswer == subItem.optionName? 'content-solutions-item-select' : ''"
+ class="content-solutions-item-content">{{subItem.optionContent}}</view>
</view>
</template>
</view>
<!-- type == 1 多选题 -->
- <view class="content-solutions" v-if='item.template == 1'>
+ <view class="content-solutions" v-if='item.choicesType == 1'>
<template v-for='subItem in item.options'>
- <view
- :class="[isReviewed && subItem.optAnswer == 1 ? 'right': '',isReviewed && (item.wrongArr.indexOf(subItem.optLetter) >-1) ? 'wrong': '']"
- class="content-solutions-item" @click='chooseMutiSolution(item,subItem)'>
- <view v-if="(!isReviewed) && (examType=='exam') "
- class="content-solutions-item-single">
- {{subItem.newOptLetter}}
+ <view class="content-solutions-item"
+ @click='!item.selectedFlag && chooseMutiSolution(item,subItem)'>
+ <view class="content-solutions-item-single">
+ {{subItem.optionName}}
</view>
- <view v-else class="content-solutions-item-single">{{subItem.optLetter}}</view>
- <!-- TODO 是否被选中的条件判断不对 -->
+
<view
- :class="item.tempAnswer.indexOf(subItem.optLetter) >-1 ? 'content-solutions-item-select' : ''"
- class="content-solutions-item-content">{{subItem.optContent}}
- </view>
+ :class="item.tempAnswer.indexOf(subItem.optionName) > -1 ? 'content-solutions-item-select' : ''"
+ class="content-solutions-item-content">{{subItem.optionContent}}</view>
</view>
</template>
+ <u-button v-show="!item.selectedFlag" type="primary" shape="circle"
+ :custom-style="{backgroundColor: '#103289'}" @click="confirm(item)">确认答案
+ </u-button>
</view>
<!-- type == 2 判断题 -->
- <view class="content-solutions" v-if='item.template == 2'>
- <template v-for='subItem in item.options'>
+ <view class="content-solutions" v-if='item.choicesType == 2'>
+ <template v-for="(judgeItem,judgeIndex) in judgeArr">
<view class="content-solutions-judge">
- <view v-for="(judgeItem,judgeIndex) in judgeArr"
- :class="[item.tempAnswer == judgeItem.value? 'content-solutions-item-select' : '',isReviewed && (item.rightAnswer==judgeItem.name) ? 'right': '',isReviewed && (item.wrongArr ==judgeItem.value) ? 'wrong': '']"
+ <view
+ :class="[item.tempAnswer == judgeItem.name? 'content-solutions-item-select' : '']"
class="content-solutions-judge-item"
- @click='judgeSolution(item,judgeItem.value)'>{{judgeItem.name}}</view>
+ @click="!item.selectedFlag && judgeSolution(item, judgeItem.name)">
+ {{judgeItem.name}}
+ </view>
</view>
</template>
</view>
- <!-- type == 4 填空题 -->
- <view class="content-solutions" v-if='item.template == 4'>
- <template v-if="!isReviewed">
- <view class="content-solutions-item" v-for='(subItem,subIndex) in item.options'
- :keys="subIndex"
- :class="[isReviewed && item.answerStatus!=4 &&(item.blankString != item.rightAnswer)? 'wrong':'']">
- <view class="content-solutions-item-single">{{subIndex+1}}</view>
- <input :disabled="isReviewed" type="text" class="content-solutions-blank"
- v-model="item.blankArr[subIndex]" placeholder="请在此处输入答案" />
+ <!-- type == 3 实操题 -->
+ <view class="content-solutions" v-if='item.choicesType == 3'>
+ <view style="color: #103289;">
+ 您选择的顺序为:<text style="text-decoration: underline;">{{item.tempAnswer}}</text>
+ </view>
+ <template v-for='subItem in item.options'>
+ <view class="content-solutions-item"
+ @click='!item.selectedFlag && chooseMutiSolution(item,subItem)'>
+ <view class="content-solutions-item-single">
+ {{subItem.optionName}}
+ </view>
+
+ <view
+ :class="item.tempAnswer.indexOf(subItem.optionName) > -1 ? 'content-solutions-item-select' : ''"
+ class="content-solutions-item-content">{{subItem.optionContent}}</view>
</view>
</template>
- <template v-else>
- <view class="content-solutions-item">
- <view class="content-solutions-item-single"></view>
- <!-- TODOvalue的绑定值不对 :value="item.blankArr[subIndex].replace(/"\;/g, '')" -->
- <input :disabled="isReviewed" :value="(item.blankArr).join(',')" type="text"
- class="content-solutions-blank" />
- </view>
- </template>
- </view>
- <!-- type == 5 简答题 -->
- <view class="content-solutions" v-if='item.template == 5'>
- <textarea v-if="!isReviewed" @input="textInput" :disabled="isReviewed" placeholder="请输入您的答案"
- auto-height />
- <textarea v-else :disabled="isReviewed" :value="item.tempAnswer.replace(/"\;/g, '')"
- auto-height />
+ <u-button v-show="!item.selectedFlag" type="primary" shape="circle"
+ :custom-style="{backgroundColor: '#103289'}" @click="pictureConfirm(item)">确认答案
+ </u-button>
</view>
- <view class="explain" v-if='isReviewed'>
- <u-tag v-show="item.answerStatus==1" text="未答" type="error" />
- <u-tag v-show="item.answerStatus==2" text="正确" type="success" />
- <u-tag v-show="item.answerStatus==3" text="错误" type="error" />
- <u-tag v-show="item.answerStatus==4" text="未评分" type="warning" />
- <u-tag v-show="item.answerStatus==5" text="已评分" type="warning" />
- <u-tag v-show="item.answerStatus==6" text="已答" type="warning" />
- <view class="explain-title">正确答案:</view>
- <!-- <span class="text">{{item.rightAnswer}}</span> -->
- <u-parse :html="item.rightAnswer"></u-parse>
- <view class="explain-title">试题解析:</view>
- <!-- <view class="explain-content">{{item.queAnalysis | analysisFilter }}</view> -->
- <u-parse :html="item.queAnalysis?item.queAnalysis:'暂无'"></u-parse>
- <view class="noteArea">
- <view class="noteAreaTitle">
- <view class="explain-title">我的笔记:</view>
- <view v-if="eidtOrFinishValue=='编辑笔记'" class="funcGroup" @click="editBtnFunc(item)">
- <u-icon class="funcBtn" name="edit-pen"></u-icon>
- <span>编辑笔记</span>
+ <view class="explain" v-if="item.selectedFlag">
+ <view>
+ <view style="display: flex; justify-content: flex-start; align-items: center;">
+
+ <u-tag style="margin: 0 20rpx;" v-show="item.correctOrError" text="正确"
+ type="success" />
+ <u-tag style="margin: 0 20rpx;" v-show="!item.correctOrError" text="错误"
+ type="error" />
+
+ <view>
+ 答案
+ <text style="margin: 0 20rpx;">{{item.answer}}</text>
</view>
- <view v-else class="funcGroup" @click="finishBtnFunc(item)">
- <u-icon class="funcBtn" name="edit-pen"></u-icon>
- <span>完成</span>
+ <view>
+ 您选择
+ <text style="margin: 0 20rpx;">{{item.tempAnswer}}</text>
</view>
+
</view>
- <!-- 只有回答过的题目才能编辑笔记!!! -->
- <text-editor :noteId="item.id" :textContent="item.theoryExamAnswer.queNote"
- :isreadOnly="isreadOnly" @editorInput='updateEditorText'>
- </text-editor>
</view>
</view>
+
</scroll-view>
</swiper-item>
</template>
@@ -164,6 +142,7 @@
<view class="footer-right" @click='handleChangeCurrentSwiper(1)'>下一题</view>
</view>
+
<!-- 答题卡弹出层 -->
<modal v-model="showQuestion">
<view class='question-modal' :style="{'height': modalHeight}">
@@ -175,53 +154,30 @@
<view class="queTypeName" v-show="queTypeStore[subIndex]>=0">{{subItem.name}}</view>
<!-- <u-tag :text="subItem.name" v-show="queTypeStore[subIndex]>0" mode="dark" /> -->
<view class="queTypeArea">
-
<template v-for="(item, index) in questionList">
- <view v-show="item.template == subItem.value">
-
- <!-- 1.复习状态且回答正确 -->
- <!-- <view v-if='item.tempAnswer && item.answer==item.tempAnswer && isReviewed' -->
- <view v-if='isReviewed && item.answerStatus == "2"'
- class="question-modal-body-item question-modal-body-item-right"
- @click="handleJumpSwiper(index)">{{index + 1 }}</view>
- <!-- 2.复习状态且回答错误 -->
- <view
- v-else-if='isReviewed && (item.answerStatus == "1" ||item.answerStatus == "3" )'
- class="question-modal-body-item question-modal-body-item-failed"
- @click="handleJumpSwiper(index)">{{index + 1 }}</view>
- <!-- 3.复习状态且简答题未评分或者已评分 -->
- <view
- v-else-if='isReviewed && (item.answerStatus == "4" ||item.answerStatus == "5")'
- class="question-modal-body-item question-modal-body-item-unScored"
- @click="handleJumpSwiper(index)">{{index + 1 }}</view>
- <!-- 3.非复习状态且已经作答 -->
- <view v-else-if='!isReviewed && item.tempAnswer && item.tempAnswer.length != 0'
- class="question-modal-body-item question-modal-body-item-select"
- @click="handleJumpSwiper(index)">{{index + 1 }}</view>
- <!-- 4.非复习状态且未作答 -->
- <view v-else class="question-modal-body-item question-modal-body-item-unselect"
+ <view v-show="item.choicesType == subItem.value">
+ <!-- 未作答 -->
+ <view v-if="!item.selectedFlag"
+ class="question-modal-body-item question-modal-body-item-unselect"
@click="handleJumpSwiper(index)">
{{index + 1 }}
</view>
- <!-- <u-line color="red" border-style="info"></u-line> -->
+ <!-- 回答正确 -->
+ <view v-else-if='item.selectedFlag && item.tempAnswer == item.answer'
+ class="question-modal-body-item question-modal-body-item-right"
+ @click="handleJumpSwiper(index)">{{index + 1 }}</view>
+ <!-- 回答错误 -->
+ <view v-else-if='item.selectedFlag && item.tempAnswer != item.answer'
+ class="question-modal-body-item question-modal-body-item-failed"
+ @click="handleJumpSwiper(index)">{{index + 1 }}</view>
</view>
</template>
</view>
</template>
</scroll-view>
<view class="question-modal-foot" id="questionHeader">
- <view v-if="!isReviewed" class="ansBlock">
- <view class="blockItem">
- <view class="block-ansed"></view>
- <view class="">已答</view>
- </view>
- <view class="blockItem">
- <view class="block-unansed"></view>
- <view class="">未答</view>
- </view>
- </view>
- <view v-else class="ansBlock">
+ <view class="ansBlock">
<view class="blockItem">
<view class="block-right"></view>
<view class="">答对</view>
@@ -231,10 +187,11 @@
<view class="">答错</view>
</view>
<view class="blockItem">
- <view class="block-unScored"></view>
- <view class="">未评分</view>
+ <view class="block-unansed"></view>
+ <view class="">未答</view>
</view>
</view>
+
</view>
</view>
</modal>
@@ -248,9 +205,9 @@
export default {
data() {
return {
+ subHeaderTop: 0,
isreadOnly: true,
quesModules: [],
- areaText: ``, //保存简答题答案
judgeArr: [{
name: '正确',
value: '1'
@@ -276,8 +233,8 @@
be: false,
},
{
- name: '填空题',
- value: '4',
+ name: '实操题',
+ value: '3',
be: false,
},
{
@@ -309,14 +266,14 @@
}
},
watch: {
+
// 监听currentIndex的变化,改变则提交答案 相同
currentIndex(newVal, oldVal) {
let that = this
- if (!this.isReviewed) {
- // 对各题型的答案进行处理
- switch (that.questionList[oldVal].template) {
+ // 对各题型的答案进行处理
+ if (that.questionList[oldVal].selectedFlag) {
+ switch (that.questionList[oldVal].choicesType) {
case 0:
- // 选择题
break;
case 1:
// 多选题
@@ -326,51 +283,12 @@
case 2:
// 判断题
break;
- case 4:
- // 填空题
- that.questionList[oldVal].tempAnswer = that.questionList[oldVal].blankArr.join(
- '||~||') // 数组拼接为字符串
+ case 3:
+ // 实操题
break;
- case 5:
- that.questionList[oldVal].tempAnswer = JSON.stringify(that.areaText)
- // console.log('000:',that.questionList[oldVal].tempAnswer);
- break;
+
default:
}
-
- if (this.examType == 'exam') {
- // 保存答案
- var answerObj = {
- examRecordId: this.questionList[oldVal].recordId,
- paperQueId: this.questionList[oldVal].id,
- answer: this.questionList[oldVal].tempAnswer,
- template: this.questionList[oldVal].template
- }
-
- // 进行答题的api请求
- console.log('answerObj:', oldVal, answerObj);
- this.$api.answerExam(answerObj)
- .then(res => {
- console.log(res);
- })
- } else if (this.examType == 'paper' || this.examType == 'know') {
- var answerObj = {
- exerciseId: this.examDetail.exerciseId,
- paperQueId: this.questionList[oldVal].id,
- answer: this.questionList[oldVal].tempAnswer,
- template: this.questionList[oldVal].template
- }
-
- // 进行答题的api请求
- console.log('answerObj:', oldVal, answerObj);
- this.$api.answerPaper(answerObj)
- .then(res => {
- console.log(res);
- })
- } else {
- return
- }
- // immediate: true,
}
}
},
@@ -378,7 +296,6 @@
// swiperHeight(){
// uni.getSystemInfo({
// success(res) {
- // console.log(res);
// return res.windowHeight+'px'
// }
// })
@@ -387,7 +304,6 @@
return this.$store.state.examDetail
},
questionList() {
- console.log(this.$store.state.questionList, 77777)
return this.$store.state.questionList
},
queTypeStore() {
@@ -397,8 +313,7 @@
return this.questionList.length - 1
},
answerStatusName() {
- console.log(this.questionList[this.currentIndex].template, 63636636366)
- switch (this.questionList[this.currentIndex].template) {
+ switch (this.questionList[this.currentIndex].choicesType) {
case 0:
return '单选题'
break;
@@ -408,8 +323,8 @@
case 2:
return '判断题'
break;
- case 4:
- return '填空题'
+ case 3:
+ return '实操题'
break;
case 5:
return '简答题'
@@ -420,14 +335,6 @@
}
},
props: {
- isReviewed: {
- type: Boolean,
- default: false
- },
- examType: {
- type: String,
- default: "exam"
- },
duration: {
type: [String, Number],
default: 300
@@ -436,15 +343,18 @@
mounted() {
var that = this
this.setAnswerHeight()
- if ((!this.isReviewed) && ((this.examType == 'paper') || (this.examType == 'course'))) {
- this.$refs.myClock.start();
- }
+
},
components: {
Modal,
clock
},
methods: {
+ exitExam() {
+ uni.redirectTo({
+ url: '/pages/exam/startexam'
+ });
+ },
/*设置题目的高度*/
setAnswerHeight() {
let that = this
@@ -452,15 +362,17 @@
uni.getSystemInfo({
//获取手机屏幕高度信息,让swiper的高度和手机屏幕一样高
success: function(res) {
- console.log(res, '010101010')
- tempHeight = res.windowHeight;
+ tempHeight = res.windowHeight - res.statusBarHeight;
+
+ that.subHeaderTop = res.statusBarHeight + 'px'
+
that.modalHeight = res.windowHeight - uni.upx2px(200) + 'px';
- that.modalContentHeight = res.windowHeight - uni.upx2px(380) + 'px';
+
+ that.modalContentHeight = res.windowHeight - uni.upx2px(360) + 'px';
uni.createSelectorQuery().in(that).select("#header").fields({
size: true,
scrollOffset: true
}, (data) => {
- console.log('data', data);
tempHeight -= data.height;
uni.createSelectorQuery().in(that).select("#subHeader").fields({
size: true,
@@ -505,10 +417,6 @@
this.handleSubmit(0)
}, 2000)
},
- textInput(e) {
- this.areaText = e.detail.value
- // console.log(e.detail.value)
- },
/* 滑动题目 */
handleSwiperChanged(event) {
this.currentIndex = event.detail.current
@@ -520,62 +428,125 @@
// 进行翻页
if ((this.currentIndex > min && operation < 0) || (this.currentIndex < max && operation > 0)) {
this.currentIndex += operation
- // console.log(this.currentIndex)
}
},
/* 选择答案(单选)*/
chooseSolution(item, subItem) {
- if (!this.isReviewed) {
- // tempAnswer为学生答案
- item.tempAnswer = subItem.optLetter
- // 强制刷新更新视图
- this.$forceUpdate()
- // this.questionList[this.currentIndex].tempAnswer = subItem.optLetter
- if (this.currentIndex < this.max) {
- setTimeout(() => {
- this.currentIndex += 1
- }, 300)
- }
- // this.onAnswerChange(item)
+ // tempAnswer为学生答案
+ item.tempAnswer = subItem.optionName
+ item.selectedFlag = true
+ if (item.tempAnswer == item.answer) item.correctOrError = true
+ // 强制刷新更新视图
+ this.$forceUpdate()
+ if (this.currentIndex < this.max) {
+ setTimeout(() => {
+ this.currentIndex += 1
+ }, 300)
}
},
/* 选择答案(多选)*/
chooseMutiSolution(item, subItem) {
- if (!this.isReviewed) {
- let answerIndex = item.dualChooseArr.indexOf(subItem.optLetter)
- if (answerIndex > -1) {
- // 该选项已经在数组中了
- item.dualChooseArr.splice(answerIndex, 1)
- } else {
- // 该选项不在数组中
- item.dualChooseArr.push(subItem.optLetter)
- }
- item.tempAnswer = item.dualChooseArr.join(',')
- // this.onAnswerChange(answerIndex)
- // 强制刷新更新视图
- this.$forceUpdate()
+ let answerIndex = item.dualChooseArr.indexOf(subItem.optionName)
+ if (answerIndex > -1) {
+ // 该选项已经在数组中了
+ item.dualChooseArr.splice(answerIndex, 1)
+ } else {
+ // 该选项不在数组中
+ item.dualChooseArr.push(subItem.optionName)
+ }
+ item.tempAnswer = item.dualChooseArr.join(',')
+ // 强制刷新更新视图
+
+ },
+ // 多选题中的答案确认
+ confirm(item) {
+ if (item.tempAnswer == "")
+ return this.$refs.uToast.show({
+ title: '答案不能为空,请选择',
+ type: 'warning',
+ duration: 2000
+ })
+
+
+
+ let one = item.answer.split(',')
+ let two = item.tempAnswer.split(',')
+ let flag = true
+ if (one.length == two.length) {
+ one.forEach((item) => {
+ if (two.indexOf(item) == -1) {
+ flag = false
+ return
+ }
+ })
+ } else {
+ flag = false
+ }
+
+
+ item.selectedFlag = true
+
+ if (flag != false) item.correctOrError = true
+
+ this.$forceUpdate()
+
+ if (this.currentIndex < this.max) {
+ setTimeout(() => {
+ this.currentIndex += 1
+ }, 300)
+ }
+ },
+ // 实操题中的答案确认
+ pictureConfirm(item) {
+ if (item.tempAnswer == "") {
+ this.$refs.uToast.show({
+ title: '答案不能为空,请选择',
+ type: 'warning',
+ duration: 2000
+ })
+
+ return
+ }
+
+ let one = item.answer.split(',')
+ let two = item.tempAnswer.split(',')
+ let flag = true
+ if (one.length == two.length) {
+ one.forEach((item, index) => {
+ if (item != two[index]) {
+ flag = false
+ return
+ }
+ })
+ } else {
+ flag = false
+ }
+
+ item.selectedFlag = true
+
+ if (flag != false) item.correctOrError = true
+
+ this.$forceUpdate()
+
+ if (this.currentIndex < this.max) {
+ setTimeout(() => {
+ this.currentIndex += 1
+ }, 300)
}
},
/* 判断题答案 */
judgeSolution(item, value) {
- if (!this.isReviewed) {
- // tempAnswer为学生答案
- item.tempAnswer = value
- // 强制刷新更新视图
- this.$forceUpdate()
- if (this.currentIndex < this.max) {
- setTimeout(() => {
- this.currentIndex += 1
- }, 300)
- }
- // this.onAnswerChange(item)
+ // tempAnswer为学生答案
+ item.tempAnswer = value
+ item.selectedFlag = true
+ if (item.tempAnswer == item.answer) item.correctOrError = true
+ // 强制刷新更新视图
+ this.$forceUpdate()
+ if (this.currentIndex < this.max) {
+ setTimeout(() => {
+ this.currentIndex += 1
+ }, 300)
}
- },
-
- /* 题目答案变化 */
- onAnswerChange(item) {
- let result = JSON.parse(JSON.stringify(item))
- this.$emit('onChange', item)
},
/* 交卷 相同 */
handleSubmit(submitORimeEnd) {
@@ -592,97 +563,83 @@
} else {
this.$emit('timeEnd')
}
- },
-
- // 点击编辑笔记
- editBtnFunc(item) {
- if (item.theoryExamAnswer.id == undefined) {
- this.$refs.uToast.show({
- title: '未作答的题目不可编辑笔记!',
- type: 'error',
- // url: '/pages/user/index'
- })
- return
- }
- this.isreadOnly = !this.isreadOnly
- this.eidtOrFinishValue = '完成'
- },
- // 完成编辑
- finishBtnFunc(item) {
- var that = this
- this.isreadOnly = !this.isreadOnly
- this.eidtOrFinishValue = '编辑笔记'
- console.log('保存笔记内容', item, that.editorText);
- this.$api.examNote(item.theoryExamAnswer.id, that.editorText)
- .then(res => {
- console.log('更新笔记成功', res)
- })
- },
- updateEditorText(text) {
- // 从子组件获取输入框输入内容
- this.editorText = text
- },
+ }
}
}
</script>
<style lang="scss">
+ .slot-wrap-right {
+ position: absolute;
+ top: 0;
+ left: auto;
+ right: 10px;
+ bottom: 0;
+ margin: auto;
+ color: #fff;
+ letter-spacing: 4rpx;
+ /* 如果您想让slot内容占满整个导航栏的宽度 */
+ /* flex: 1; */
+ /* 如果您想让slot内容与导航栏左右有空隙 */
+ /* padding: 0 30rpx; */
+ }
+
page {
background-color: #FFFFFF;
}
#header,
#subHeader {
- height: 100rpx;
+ width: 100%;
+ height: 88rpx;
+ line-height: 88rpx;
}
.header {
- width: 750rpx;
- // position: fixed;
- margin-top: 30rpx;
position: relative;
text-align: center;
- line-height: 100rpx;
- font-size: 36rpx;
- font-weight: 600;
- color: #103289;
- letter-spacing: 10rpx;
- background-color: #FFFFFF;
-
- &-button {
- width: 80rpx;
- height: 40rpx;
- line-height: 40rpx;
- position: absolute;
- top: 20rpx;
- right: 40rpx;
- padding: 10rpx 20rpx;
- border-radius: 15rpx;
- letter-spacing: 2rpx;
- font-weight: 500;
- color: #FFFFFF;
- background-color: #103289;
- }
-
- .scoreText {
- color: #00b060;
- font-size: 35rpx;
- }
+ letter-spacing: 2rpx;
}
.sub-header {
- width: 750rpx;
+
// position: fixed;
// margin-top: 130rpx;
- padding: 30rpx 20rpx;
+ padding: 0 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
color: #000;
- font-size: 33rpx;
+ font-size: 32rpx;
font-weight: bold;
background-color: #FFFFFF;
+ box-shadow: 0 0 5px 1px #eee;
}
+
+ .footer {
+ width: 100%;
+ height: 88rpx;
+ padding: 30rpx 20rpx;
+ position: fixed;
+ bottom: 0;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ font-size: 30rpx;
+ box-sizing: border-box;
+ color: #4c8af3;
+ box-shadow: 0 0 5px 1px #eee;
+ background-color: #FFFFFF;
+
+ &-card {
+ padding: 10rpx 20rpx;
+ border: 1px solid #103289;
+ border-radius: 15rpx;
+ color: #FFFFFF;
+ background-color: #103289;
+ }
+ }
+
.content {
// margin-top: 130rpx;
@@ -808,58 +765,17 @@
.explain {
border-top: solid #999999 1px;
- padding-top: 10rpx;
+ padding: 10rpx;
font-size: 28rpx;
color: #666666;
-
- .explainResult {
- color: #103289;
- }
-
- .explain-title {
- font-weight: bold;
- }
-
- .noteArea {
- border-top: 2rpx solid #103289;
- padding-top: 10rpx;
-
- // background-color: #0077AA;
- .noteAreaTitle {
- display: flex;
- justify-content: space-between;
- }
- }
}
+
}
- .footer {
- width: 750rpx;
- height: 100rpx;
- padding: 30rpx 20rpx;
- position: fixed;
- bottom: 0;
- display: flex;
- align-items: center;
- justify-content: space-between;
- font-size: 30rpx;
- box-sizing: border-box;
- color: #4c8af3;
- box-shadow: 0 0 5px 1px #eee;
- background-color: #FFFFFF;
-
- &-card {
- padding: 10rpx 20rpx;
- border: 1px solid #103289;
- border-radius: 15rpx;
- color: #FFFFFF;
- background-color: #103289;
- }
- }
.question-modal {
width: 700rpx;
- padding: 40rpx;
+ padding: 0 40rpx;
background-color: #FFFFFF;
&-header {
@@ -926,11 +842,10 @@
}
.question-modal-foot {
- height: 100rpx;
+ height: 40rpx;
border-top: 1rpx solid #F0F0F0;
// position: fixed;
// margin-bottom: 0rpx;
- margin-top: -60rpx;
.ansBlock {
display: flex;
@@ -943,46 +858,31 @@
margin: 20rpx;
}
- .block-ansed {
- width: 80rpx;
- height: 80rpx;
- border-radius: 50%;
- background: #103289;
- margin: 0 10rpx;
- }
-
- .block-unansed {
- width: 80rpx;
- height: 80rpx;
- border-radius: 50%;
- // border: solid #ffffff 1px;
- background: #bbbbbb;
- margin: 0 10rpx;
- }
-
.block-right {
- width: 80rpx;
- height: 80rpx;
+ width: 40rpx;
+ height: 40rpx;
border-radius: 50%;
background: #39b54a;
margin: 0 10rpx;
}
.block-wrong {
- width: 80rpx;
- height: 80rpx;
+ width: 40rpx;
+ height: 40rpx;
border-radius: 50%;
background: #982121;
margin: 0 10rpx;
}
- .block-unScored {
- width: 80rpx;
- height: 80rpx;
+ .block-unansed {
+ width: 40rpx;
+ height: 40rpx;
border-radius: 50%;
- background: #ff9f73;
+ // border: solid #ffffff 1px;
+ background: #bbbbbb;
margin: 0 10rpx;
}
+
}
}
diff --git a/pages.json b/pages.json
index 5a8874d..14ad3b7 100644
--- a/pages.json
+++ b/pages.json
@@ -648,8 +648,8 @@
}
},
{
- "path": "pages/exam/examReviewPage",
- "name": "examReviewPage",
+ "path": "pages/exam/examResultPage",
+ "name": "examResultPage",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "",
diff --git "a/pages/business/business - \345\211\257\346\234\254.vue" "b/pages/business/business - \345\211\257\346\234\254.vue"
new file mode 100644
index 0000000..3b48f0a
--- /dev/null
+++ "b/pages/business/business - \345\211\257\346\234\254.vue"
@@ -0,0 +1,30 @@
+<template>
+ <view class="container">
+ <u-empty text="功能研发中" mode="favor" margin-top="400"></u-empty>
+ <!-- 底部导航条 -->
+ <u-tabbar :list="tabbar" :mid-button="false"></u-tabbar>
+ </view>
+</template>
+
+<script>
+ export default {
+ data() {
+ return {
+ tabbar: this.$store.state.tabbar,
+ };
+ },
+ onLoad() {
+
+ },
+ mounted() {
+
+ },
+ methods: {
+
+ }
+ };
+</script>
+
+<style lang="scss">
+
+</style>
diff --git a/pages/business/business.vue b/pages/business/business.vue
index 3b48f0a..0bbce2e 100644
--- a/pages/business/business.vue
+++ b/pages/business/business.vue
@@ -1,30 +1,29 @@
<template>
- <view class="container">
- <u-empty text="功能研发中" mode="favor" margin-top="400"></u-empty>
- <!-- 底部导航条 -->
- <u-tabbar :list="tabbar" :mid-button="false"></u-tabbar>
- </view>
+ <view class="container">
+ <u-empty text="功能研发中" mode="favor" margin-top="400"></u-empty>
+ <!-- 底部导航条 -->
+ <u-tabbar :list="tabbar" :mid-button="false"></u-tabbar>
+ </view>
</template>
<script>
- export default {
- data() {
- return {
- tabbar: this.$store.state.tabbar,
- };
- },
- onLoad() {
+export default {
+ data () {
+ return {
+ tabbar: this.$store.state.tabbar,
+ }
+ },
+ onLoad () {
- },
- mounted() {
-
- },
- methods: {
-
- }
- };
+ },
+ mounted () {
+
+ },
+ methods: {
+
+ }
+};
</script>
<style lang="scss">
-
</style>
diff --git a/pages/exam/examResultPage.vue b/pages/exam/examResultPage.vue
new file mode 100644
index 0000000..846bdb9
--- /dev/null
+++ b/pages/exam/examResultPage.vue
@@ -0,0 +1,130 @@
+<template>
+ <view class="content">
+
+ <u-navbar height="44" back-icon-color="#fff" title="考试结果" :is-back="false" title-color="#fff"
+ :background="{background: '#103289'}">
+ </u-navbar>
+
+ <view class="finishText">
+ <view class="box">
+ <text class="title">考试名称:</text>
+ <text class="val">模拟考试</text>
+ </view>
+ <view class="box">
+ <text class="title">总题数:</text>
+ <text class="val">{{totalQueNum}}题</text>
+ </view>
+ <view class="box">
+ <text class="title">总分数:</text>
+ <text class="val">{{totalScore}}分</text>
+ </view>
+ <view class="box">
+ <text class="title">答对:</text>
+ <text class="val">{{rightQueNum}}题</text>
+ </view>
+ <view class="box">
+ <text class="title">答错:</text>
+ <text class="val">{{wrongQueNum}}题</text>
+ </view>
+ <view class="box">
+ <text class="title">未答:</text>
+ <text class="val">{{noneQueNum}}题</text>
+ </view>
+ <view class="box">
+ <text class="title">得分:</text>
+ <text class="val">{{score}}分</text>
+ </view>
+ </view>
+
+ <view class="btnArea">
+ <u-button class="btnClass" type="primary" :ripple="true" shape="circle" @click="backToHome">返回首页
+ </u-button>
+ </view>
+
+ </view>
+</template>
+
+<script>
+ export default {
+ props: {},
+ data() {
+ return {
+ totalQueNum: '',
+ totalScore: '',
+ rightQueNum: '',
+ wrongQueNum: '',
+ noneQueNum: '',
+ score: '',
+ }
+ },
+ methods: {
+ backToHome() {
+ uni.switchTab({
+ url: '/pages/home/home',
+ })
+ }
+ },
+ computed: {
+
+ },
+ onLoad(options) {
+ this.totalQueNum = options.totalQueNum
+ this.totalScore = options.totalScore
+ this.rightQueNum = options.rightQueNum
+ this.wrongQueNum = options.wrongQueNum
+ this.noneQueNum = options.noneQueNum
+ this.score = options.score
+ }
+
+ }
+</script>
+
+<style lang="scss" scoped>
+ .finishText {
+ // margin: 100rpx 200rpx;
+ margin: 50rpx 10%;
+ padding: 5%;
+ width: 80%;
+ font-size: 32rpx;
+ display: flex;
+ flex-direction: column;
+ background: #f8f8f8;
+ box-shadow: 0 0 20px 2px #dddddd;
+ border-radius: 5px;
+ letter-spacing: 0.2rpx;
+
+ text {
+ color: #103289;
+ font-weight: bold;
+ }
+
+ .box {
+ flex: 1;
+ display: flex;
+
+ .title {
+ flex: 1;
+ text-align-last: justify;
+ }
+
+ .val {
+ flex: 1;
+ }
+ }
+ }
+
+ .btnArea {
+ display: flex;
+ margin-top: 50rpx;
+
+ .btnClass {
+ width: 300rpx;
+ }
+ }
+
+ .infoArea {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ }
+</style>
diff --git a/pages/exam/examReviewPage.vue b/pages/exam/examReviewPage.vue
deleted file mode 100644
index b85b304..0000000
--- a/pages/exam/examReviewPage.vue
+++ /dev/null
@@ -1,199 +0,0 @@
-<template>
- <view>
- <nav-bar-sub></nav-bar-sub>
- <!-- 用于提示是否确认退出考试 -->
- <!-- <u-modal v-model="show" :content="content" :show-cancel-button="true" @confirm="handleConfirm"></u-modal> -->
- <!-- 渲染题目 -->
- <Answer :isReviewed='isReview' examType="exam" @submit='handleCommit' @timeEnd='handleConfirm'
- @onChange='onChange'></Answer>
- </view>
-
-</template>
-
-<script>
- import Answer from '@/components/dyw-answer/answer.vue';
- export default {
- data() {
- return {
- // show: false,
- // content: '是否确认交卷',
- isReview: true,
- confirmSubmitContent: '',
- questionList: [],
- examType: '', //考试类型
- }
- },
- onLoad(option) {
- var that = this
- this.$api.checkGrade(option.recordId)
- .then(res => {
- console.log(res.values);
- that.$store.state.examDetail = res.values
- var quesModules = res.values.modules
- // 提取出所有的题目
- for (let i = 0; i < quesModules.length; i++) {
- for (let j = 0; j < quesModules[i].questions.length; j++) {
- // 解决theoryExamAnswer可能为null的问题,把它赋值为字符串
- if (quesModules[i].questions[j].theoryExamAnswer == null) {
- quesModules[i].questions[j].unAnswered = true //标记此题未答
- }
- quesModules[i].questions[j].template = quesModules[i].template //防止template初始值是null
- quesModules[i].questions[j].tempAnswer = ''
- quesModules[i].questions[j].rightAnswer = ''
- // quesModules[i].questions[j].recordId = that.$store.state.examDetail.recordId //搬移recordId的位置
- // 遍历选项得出正确答案和用户答案
- if (quesModules[i].questions[j].template == 1 || quesModules[i].questions[j].template ==
- 2) {
- // 单选题与多选题
- if (quesModules[i].questions[j].unAnswered) {
- quesModules[i].questions[j].theoryExamAnswer = {
- optAnswer: "未作答"
- }
- }
-
- // 用户答案
- quesModules[i].questions[j].tempAnswer = quesModules[i].questions[j]
- .theoryExamAnswer.optAnswer
-
- // 赋值选择题正确答案
- for (let k = 0; k < quesModules[i].questions[j].options.length; k++) {
- // 获取选择题的正确答案
- if (quesModules[i].questions[j].options[k].optAnswer == 1) {
- if (quesModules[i].questions[j].rightAnswer == '') {
- quesModules[i].questions[j].rightAnswer = quesModules[i].questions[j]
- .options[k].optLetter
- } else {
- quesModules[i].questions[j].rightAnswer += ',' + quesModules[i]
- .questions[j].options[k].optLetter
- }
- }
- }
-
- // 判断题目错选了哪一项
- var rightArr = quesModules[i].questions[j].rightAnswer.split(',')
- var userArr = quesModules[i].questions[j].tempAnswer.split(',')
- quesModules[i].questions[j].wrongArr = [] // 保存选中的错误的选项
-
- for (var item of userArr) {
- // 用户的该答案不在正确答案数组在
- if (rightArr.indexOf(item) < 0) {
- quesModules[i].questions[j].wrongArr.push(item)
- }
- }
-
- } else if (quesModules[i].questions[j].template == 3) {
- // 3.判断题
- quesModules[i].questions[j].wrongArr = ''
- if (quesModules[i].questions[j].unAnswered) {
- quesModules[i].questions[j].theoryExamAnswer = {
- optAnswer: "未作答"
- }
- }
- // 题目已经作答 获取用户判断题答案 0错误 1正确
- quesModules[i].questions[j].tempAnswer = quesModules[i].questions[j]
- .theoryExamAnswer.optAnswer
-
- // 为判断题的答案赋值
- if (quesModules[i].questions[j].options[0].optAnswer == 0) {
- quesModules[i].questions[j].rightAnswer = "错误"
- } else {
- quesModules[i].questions[j].rightAnswer = "正确"
- }
-
- // 判断题目错选了哪一项
- if (quesModules[i].questions[j].tempAnswer != quesModules[i].questions[j].options[0]
- .optAnswer) {
- quesModules[i].questions[j].wrongArr = quesModules[i].questions[j].tempAnswer
- }
-
- } else if (quesModules[i].questions[j].template == 4) {
- // 4.填空题
- if (!quesModules[i].questions[j].unAnswered) {
- // 题目已经作答 获取用户填空题答案
- quesModules[i].questions[j].blankArr = quesModules[i].questions[j]
- .theoryExamAnswer
- .shortAnswer.split("||~||")
- quesModules[i].questions[j].blankString = quesModules[i].questions[j].blankArr.join(',')
- } else {
- // 题目未作答
- quesModules[i].questions[j].blankArr = [] //新建blankArr属性,临时保存填空题答案
- quesModules[i].questions[j].blankString = '' //新建blankArr属性,临时保存填空题答案
- quesModules[i].questions[j].theoryExamAnswer = {}
- for (let m = 0; m < quesModules[i].questions[j].options.length; m++) {
- quesModules[i].questions[j].theoryExamAnswer.shortAnswer += "暂未作答||~||"
- }
- }
-
- // 为填空题附上正确答案
- for (let k = 0; k < quesModules[i].questions[j].options.length; k++) {
- // 把null赋值为空字符串
- if (quesModules[i].questions[j].rightAnswer == '') {
- quesModules[i].questions[j].rightAnswer = quesModules[i].questions[j]
- .options[
- k].optContent
- } else {
- quesModules[i].questions[j].rightAnswer += ',' + quesModules[i].questions[
- j]
- .options[k].optContent
- }
- }
- } else {
- // 5.简答题
- if (!quesModules[i].questions[j].unAnswered) {
- // 题目已经作答 获取用户的简答题答案
- quesModules[i].questions[j].tempAnswer = quesModules[i].questions[j]
- .theoryExamAnswer
- .shortAnswer
- } else {
- quesModules[i].questions[j].theoryExamAnswer = {}
- quesModules[i].questions[j].theoryExamAnswer.shortAnswer = "暂未作答"
- }
-
- // 正确答案
- quesModules[i].questions[j].rightAnswer = quesModules[i].questions[j].queAnswer
- }
- that.questionList.push(quesModules[i].questions[j])
- }
- }
- that.$store.state.questionList = that.questionList
- console.log('questionList:', that.questionList);
- })
- console.log('考题列表:', this.questionList);
- },
- components: {
- Answer
- },
- methods: {
- /* 提交答案 显示再次确认*/
- handleCommit(questionList) {
- // 显示是否确认交卷
- this.show = true;
- },
-
- // 已确认进行答案提交
- handleConfirm() {
- // uni.setStorageSync('questionList', questionList)
- // 进行交卷的api请求
- this.$api.commitExam(this.$store.state.examDetail.exam.id, this.$store.state.examDetail.recordId)
- .then(res => {
- console.log('交卷:', res);
- })
-
- uni.redirectTo({
- url: '/pages/exam/examResultPage',
- })
- },
- /* 题目答案变化
- */
- onChange(answer) {
- console.log(answer)
- }
- }
- }
-</script>
-
-<style lang="scss">
- page {
- background-color: #FFFFFF;
- }
-</style>
diff --git a/pages/exam/examTextPage.vue b/pages/exam/examTextPage.vue
index a21fcf4..7f10b2f 100644
--- a/pages/exam/examTextPage.vue
+++ b/pages/exam/examTextPage.vue
@@ -5,8 +5,7 @@
<u-modal v-model="show" :content="content" :show-cancel-button="true" @confirm="handleConfirm"></u-modal>
<!-- 渲染题目 -->
- <Answer :isReviewed='isReview' :examType="examType" @submit='handleCommit' @timeEnd='handleConfirm'
- @onChange='onChange'></Answer>
+ <Answer @submit='handleCommit' @timeEnd='handleConfirm' @onChange='onChange'></Answer>
<u-toast ref="uToast" />
</view>
@@ -14,99 +13,51 @@
<script>
import Answer from '@/components/dyw-answer/answer.vue';
- import {
- enterExam
- } from '@/common/api/exam'
+
import {
ModifyQuesList
} from '@/common/api/examFunc'
+
export default {
data() {
return {
show: false,
content: '是否确认交卷',
- isReview: false,
questionList: [],
- examType: 'exam', //考试类型
}
},
onLoad(option) {
+ this.$store.state.questionList = []
- this.examType = option.examType
-
var that = this
- if (option.examType == 'exam') {
- // 理论考试
- enterExam({
- idCardNo: option.id
- }).then(res => {
+ console.log(this.$store.state.UserData)
+ // 理论考试
+ uni.request({
+ url: "http://223.82.109.183:2080/api/simulateExamRecord/beginExam",
+ method: 'POST',
+ data: {
+ idCardNo: this.$store.state.UserData.cardid
+ },
+ success: (res) => {
var examObj = res.data.data.simulateExamRecord
examObj.exam = {
- name: '测试考试',
+ name: '模拟考试',
examScore: 100,
examTime: res.data.data.simulateExamRecord.answerTime,
checkFace: 1,
...option
}
-
-
examObj.exam.totalQuestion = res.data.data.examSubjectInfo.length
examObj.totalQuestion = res.data.data.examSubjectInfo.length
that.$store.state.examDetail = examObj
+ that.$store.state.paperDetail = res.data.data.simulateExamRecord
// 提取出所有的题目
ModifyQuesList(res.data.data.examSubjectInfo)
- })
- } else if (option.examType == 'paper') {
- // 模拟考试
- this.$api.paperStart(option.paperId)
- .then(res => {
- console.log('paperStart:', res);
- that.$store.state.examDetail = res.values
- console.log('paper examDetail:', res.values);
- var quesModules = res.values.modules
- that.$api.ModifyQuesList(quesModules)
- console.log(that.$store.state.pracDetail);
- console.log(that.$store.state.pracQuesList);
- })
- } else if (option.examType == 'know') {
- // 知识点练习
- const knowSearch = JSON.parse(decodeURIComponent(option.knowSearch));
- console.log(knowSearch);
- this.$api.startKnow(knowSearch)
- .then(res => {
- if (res.status == 1) {
- // 获取知识点失败
- this.$refs.uToast.show({
- title: res.message,
- type: 'error',
- // icon: false,
- url: '/pages/exam/pracIndexKnow'
- })
- } else {
- console.log('开始知识点练习的请求结果:', res);
- that.$store.state.examDetail = res.values
- var quesModules = res.values.modules
- that.$api.ModifyQuesList(quesModules)
- console.log(that.$store.state.pracDetail);
- console.log(that.$store.state.pracQuesList);
- }
- })
- } else if (option.examType == 'course') {
- this.$api.startTheory(that.$store.state.access_token, option.paperId)
- .then(res => {
- that.$store.state.examDetail = res.values
- var quesModules = res.values.modules
- that.$api.ModifyQuesList(quesModules)
- })
- } else {
- console.log("考试类型错误,请输入正确的类型");
- // return false
- }
-
- console.log('考题列表:', this.questionList);
+ }
+ });
},
components: {
Answer
@@ -120,53 +71,76 @@
// 已确认进行答案提交
handleConfirm() {
- // 进行交卷的api请求
let that = this
- if (this.examType == 'exam') {
- this.$api.commitExam(this.$store.state.examDetail.exam.id, this.$store.state.examDetail.recordId)
- .then(res => {
- console.log('交卷:', res);
- that.$u.route('/pages/exam/examResultPage', {
- recordId: that.$store.state.examDetail.recordId,
- examType: 'exam'
- })
- })
- } else if ((this.examType == 'paper') || (this.examType == 'know')) {
- this.$api.commitPaper(this.$store.state.examDetail.exerciseId)
- .then(res => {
- console.log('交卷:', res);
- that.$u.route('/pages/exam/examResultPage', {
- exerciseId: that.$store.state.examDetail.exerciseId,
- examType: 'paper',
- })
- })
- } else if (this.examType == 'store') {
- this.$api.commitExam(this.$store.state.examDetail.exam.id, this.$store.state.examDetail.recordId)
- .then(res => {
- console.log('交卷:', res);
- that.$u.route('/pages/exam/examResultPage', {
- recordId: that.$store.state.examDetail.recordId,
- examType: 'exam'
- })
- })
- } else if (this.examType == 'course') {
- this.$api.commitCourse(this.$store.state.access_token, this.$store.state.examDetail.exerciseId)
- .then(res => {
- console.log('交卷:', res);
- that.$u.route('/pages/exam/examResultPage', {
- exerciseId: that.$store.state.examDetail.exerciseId,
- examType: 'course',
- })
- })
- } else {
- console.log("提交的考试类型出错");
+ let totalQueNum = 0
+ let totalScore = 0
+ let rightQueNum = 0
+ let wrongQueNum = 0
+ let noneQueNum = 0
+ let score = 0
+
+ let sendData = {
+ simulateExamId: this.$store.state.paperDetail.id,
+ examResultVOS: []
}
+
+ this.$store.state.questionList.forEach(item => {
+ if (item.selectedFlag == true) {
+
+ let obj = {
+ subjectChoicesId: item.id,
+ value: item.tempAnswer,
+ grade: item.score
+ }
+
+ if (item.correctOrError == false) {
+ obj.grade = 0
+ wrongQueNum += 1
+ } else {
+ rightQueNum += 1
+ score += item.score
+ }
+
+ sendData.examResultVOS.push(obj)
+
+ } else {
+ noneQueNum += 1
+ }
+ totalQueNum += 1
+ totalScore += item.score
+ })
+
+ if (noneQueNum == totalQueNum)
+ return this.$refs.uToast.show({
+ title: '请答题后再交卷',
+ type: 'warning',
+ duration: 2000
+ })
+
+ // 进行交卷的api请求
+ that.$u.route('/pages/exam/examResultPage', {
+ recordId: that.$store.state.examDetail.recordId,
+ totalQueNum: totalQueNum,
+ totalScore: totalScore,
+ rightQueNum: rightQueNum,
+ wrongQueNum: wrongQueNum,
+ noneQueNum: noneQueNum,
+ score: score
+ })
+
+
+ uni.request({
+ url: "http://223.82.109.183:2080/api/simulateExamRecord/saveSimulateExam",
+ method: 'POST',
+ data: sendData,
+ success: (res) => {
+
+ }
+ });
},
/* 题目答案变化
*/
- onChange(answer) {
- console.log(answer)
- }
+ onChange(answer) {}
}
}
</script>
diff --git a/pages/exam/startexam.vue b/pages/exam/startexam.vue
index 2f669b1..e14aa94 100644
--- a/pages/exam/startexam.vue
+++ b/pages/exam/startexam.vue
@@ -13,17 +13,14 @@
<view class="tipsArea">
<ul>
<li>1、答题时要注意“剩余时间”提示,当剩余时间为0时,系统将自动交卷。</li>
- <li>2、答题完成后,点击“我要交卷”按钮进行交卷,否则考试无效。</li>
- <li>3、如果你准备好了,就点击“进入考场”吧,预祝取得好的成绩。</li>
+ <li>2、答题完成后,点击“交卷”按钮进行交卷,否则考试无效。</li>
+ <li>3、答题时需注意模拟考试不能修改答案。</li>
+ <li>4、如果你准备好了,就点击“进入考场”吧,预祝取得好的成绩。</li>
</ul>
</view>
<view class="btnArea">
- <!-- checkFace==1 不需要人脸识别,checkFace==2 需要人脸识别 -->
- <u-button v-if="needCheckFace==2 && !passFace " class="btnClass" type="primary" :ripple="true"
- shape="circle" @click="checkFace">开始人脸识别</u-button>
- <u-button v-if="needCheckFace==1 || passFace" class="btnClass" type="success" :ripple="true" shape="circle"
- @click="enterExam">进入考试</u-button>
- <u-button class="btnClass" type="error" :ripple="true" shape="circle" @click="exitExam">退出考试</u-button>
+ <u-button class="btnClass" type="success" shape="circle" @click="enterExam">进入考试</u-button>
+ <u-button class="btnClass" type="error" shape="circle" @click="exitExam">退出考试</u-button>
</view>
<u-toast ref="uToast" />
</view>
@@ -33,25 +30,14 @@
export default {
data() {
return {
- examItem: {},
- examNote: `
- 1、答题时要注意“剩余时间”提示,当剩余时间为0时,系统将自动交卷。
- 2、答题完成后,点击“我要交卷”按钮进行交卷,否则考试无效。
- 3、如果你准备好了,就点击“进入考场”吧,预祝取得好的成绩。`,
- passFace: false,
-
+ examItem: {}
}
},
methods: {
enterExam() {
- // 进入考试
- // uni.navigateTo({
- // url: '/pages/exam/examTextPage'
- // })
- this.$u.route('/pages/exam/examTextPage', {
- id: this.examItem.id,
- examType: 'exam',
+ uni.navigateTo({
+ url: '/pages/exam/examTextPage'
})
},
@@ -60,59 +46,28 @@
uni.navigateBack({
delta: 1
})
- },
- checkFace() {
- var that = this
- this.$api.uploadImg2('face')
- .then(res => {
- console.log('faceRes', res)
- if (res.data.indexOf('操作成功') >= 0) {
- this.passFace = true
- }
- })
- },
- },
- computed: {
- needCheckFace: function() {
- // checkFace==1 不需要人脸识别,checkFace==2 需要人脸识别
- // H5 平台不需要检测人脸
- // #ifdef H5
- return 1
- // #endif
-
- // #ifdef APP-PLUS || MP-WEIXIN
- return this.examItem.checkFace
- // #endif
}
},
+ computed: {},
onLoad(options) {
// 页面跳转 传递对象 传对象
options = {
- id: '360198198812130014',
- name: '测试考试',
+ name: '保安员模拟考试',
examScore: 100,
- examTime: 90,
+ examTime: 60,
checkFace: 1
}
this.examItem = options
- console.log("考试信息:", this.examItem);
-
}
}
</script>
<style lang="scss">
- page {
- font-size: 31rpx;
-
- ul li {
- list-style: none;
- }
- }
-
.tipsArea {
padding: 0 40rpx;
margin-left: -30rpx;
+ line-height: 64rpx;
+
}
.subTitle {
@@ -124,19 +79,12 @@
}
.examContent {
- line-height: 50rpx;
+ line-height: 56rpx;
margin-left: 180rpx;
text {
font-weight: bold;
}
- }
-
- ol {
- // padding: 80rpx;
- // background-color: #0077AA;
- margin: 0 30rpx;
- line-height: 50rpx;
}
.btnArea {
diff --git a/pages/grabOrders/grabOrdersMain/business.vue b/pages/grabOrders/grabOrdersMain/business.vue
index cb89a3a..dcdc9fe 100644
--- a/pages/grabOrders/grabOrdersMain/business.vue
+++ b/pages/grabOrders/grabOrdersMain/business.vue
@@ -1,299 +1,343 @@
<template>
- <view class="container">
- <view class="head">
- <u-navbar :is-fixed="false" :border-bottom="false" :is-back="true" back-icon-name="arrow-leftward"
- back-icon-color="#fff" back-icon-size="35" :background="{ background: '#103289' }" title="我参与"
- title-color="#fff"></u-navbar>
- <view class="head-bg"></view>
- <!-- 我的订阅 start -->
- <view class="card sub">
- <view class="title"></view>
- <view class="list">
- <u-grid :col="3" :border="false">
- <u-grid-item bg-color="transparent" v-for="(item, index) in dataOne" :key="index">
- <navigator hover-class="none" class="nav-item" @click="goOnePage(item.url,index)">
- <image :src="item.img" mode="widthFix" class="nav-item-img"></image>
- <u-badge :count="item.cout" :offset="[20, 20]"></u-badge>
- <view class="nav-item-name">{{item.title}}</view>
- </navigator>
- </u-grid-item>
- </u-grid>
- </view>
- </view>
- <!-- 我的订阅 end -->
+ <view class="container">
+ <view class="head">
+ <u-navbar
+ :is-fixed="false"
+ :border-bottom="false"
+ :is-back="true"
+ back-icon-name="arrow-leftward"
+ back-icon-color="#fff"
+ back-icon-size="35"
+ :background="{ background: '#103289' }"
+ title="我参与"
+ title-color="#fff"
+ ></u-navbar>
+ <view class="head-bg"></view>
+ <!-- 我的订阅 start -->
+ <view class="card sub">
+ <view class="title"></view>
+ <view class="list">
+ <u-grid :col="3" :border="false">
+ <u-grid-item
+ bg-color="transparent"
+ :class="{ uGridSelected: itemSelectFlag && index == 3 }"
+ v-for="(item, index) in dataOne"
+ :key="index"
+ >
+ <navigator
+ hover-class="none"
+ class="nav-item"
+ @click="goOnePage(item.url, index)"
+ >
+ <image
+ :src="item.img"
+ mode="widthFix"
+ class="nav-item-img"
+ ></image>
+ <u-badge :count="item.cout" :offset="[20, 20]"></u-badge>
+ <view class="nav-item-name">{{ item.title }}</view>
+ </navigator>
+ </u-grid-item>
+ </u-grid>
+ </view>
+ </view>
+ <!-- 我的订阅 end -->
- <view class="card wrap" v-if="bashow">
- <view class="title">保安管理</view>
- <view class="list">
- <u-grid :col="4" :border="false">
- <u-grid-item bg-color="transparent" v-for="(item, index) in dataTwo" :key="index">
- <navigator hover-class="none" url="" class="nav-item" @click="goTwoPage(item.url,index)">
- <image :src="item.img" mode="widthFix" class="nav-item-img"></image>
- <view class="nav-item-name">{{item.title}}</view>
- </navigator>
- </u-grid-item>
- </u-grid>
- </view>
- </view>
-
- </view>
- <u-toast ref="uToast" />
- <!-- 底部导航条 -->
- <!-- <u-tabbar :list="tabbar" :mid-button="false"></u-tabbar> -->
- </view>
+ <view class="card wrap" v-if="bashow">
+ <view class="title">保安管理</view>
+ <view class="list">
+ <u-grid :col="4" :border="false">
+ <u-grid-item
+ bg-color="transparent"
+ v-for="(item, index) in dataTwo"
+ :key="index"
+ >
+ <navigator
+ hover-class="none"
+ url=""
+ class="nav-item"
+ @click="goTwoPage(item.url, index)"
+ >
+ <image
+ :src="item.img"
+ mode="widthFix"
+ class="nav-item-img"
+ ></image>
+ <view class="nav-item-name">{{ item.title }}</view>
+ </navigator>
+ </u-grid-item>
+ </u-grid>
+ </view>
+ </view>
+ </view>
+ <u-toast ref="uToast" />
+ <!-- 底部导航条 -->
+ <!-- <u-tabbar :list="tabbar" :mid-button="false"></u-tabbar> -->
+ </view>
</template>
<script>
- export default {
- data() {
- return {
- tabbar: this.$store.state.tabbar,
- bashow: false,
- dataOne: [{
- title: '参与治安防范巡查',
- img: '/static/workbench/task2.png',
- url: '../grabOrdersZAXC/grabOrders?detailData=0',
- cout: 0
- }, {
- title: '参与治安防范宣传',
- img: '/static/workbench/task1.png',
- url: '../grabOrdersZAYWXC/grabOrders?detailData=0',
- cout: 0
- }, {
- title: '参与治安防范培训',
- img: '/static/workbench/task3.png',
- url: '../grabOrdersZAFFPX/grabOrders?detailData=0',
- cout: 0
- }, {
- title: '保安管理',
- img: '/static/workbench/task4.png',
- url: '',
- cout: 0
- }],
- dataTwo: [{
- title: '电子证件',
- img: '/static/workbench/task9.png',
- url: ''
- }, {
- title: '模拟考试',
- img: '/static/workbench/task5.png',
- url: ''
- }
- // ,{
- // title:'模拟考试',
- // img:'../../static/workbench/exam.png',
- // url:'/pages/exam/startexam'
- // }
- ]
- };
- },
- onShow() {
- this.getNum();
- },
- onLoad() {
+export default {
+ data() {
+ return {
+ tabbar: this.$store.state.tabbar,
+ bashow: false,
+ itemSelectFlag: false,
+ dataOne: [
+ {
+ title: "参与治安防范巡查",
+ img: "/static/workbench/task2.png",
+ url: "../grabOrdersZAXC/grabOrders?detailData=0",
+ cout: 0,
+ },
+ {
+ title: "参与治安防范宣传",
+ img: "/static/workbench/task1.png",
+ url: "../grabOrdersZAYWXC/grabOrders?detailData=0",
+ cout: 0,
+ },
+ {
+ title: "参与治安防范培训",
+ img: "/static/workbench/task3.png",
+ url: "../grabOrdersZAFFPX/grabOrders?detailData=0",
+ cout: 0,
+ },
+ {
+ title: "保安管理",
+ img: "/static/workbench/task4.png",
+ url: "",
+ cout: 0,
+ },
+ ],
+ dataTwo: [
+ {
+ title: "电子证件",
+ img: "/static/workbench/task9.png",
+ url: "",
+ },
+ // ,{
+ // title:'模拟考试',
+ // img:'../../static/workbench/exam.png',
+ // url:'/pages/exam/startexam'
+ // }
+ ],
+ };
+ },
+ onShow() {
+ this.getNum();
+ },
+ onLoad() {
+ if (this.$store.state.billFlag == true) {
+ this.dataTwo.push({
+ title: "模拟考试",
+ img: "/static/workbench/task5.png",
+ url: "/pages/exam/startexam",
+ });
+ }
+ },
+ onBackPress(e) {
+ console.log("监听返回按钮事件2", e);
+ uni.switchTab({
+ url: "/pages/home/home",
+ });
+ // 此处一定姚要return为true,否则页面不会返回到指定路径
+ return true;
+ },
+ mounted() {
+ // if (this.$store.state.UserData.stype != "1") {
+ // this.$refs.uToast.show({
+ // title: '功能暂未开放',
+ // type: 'warning',
+ // });
+ // }
+ },
+ methods: {
+ //获取资讯信息
+ getNum() {
+ var that = this;
+ uni.request({
+ url: this.$store.state.piAPI + "/taskqd/selectNum",
+ method: "GET",
+ data: {
+ serid: that.$store.state.UserData.user_id,
+ jurisdiction: that.$store.state.UserData.jurisdiction,
+ workjurisdiction: that.$store.state.UserData.workjurisdiction,
+ },
+ success: (res) => {
+ var data = res.data.data;
+ this.dataOne[0].cout = Number(data.xcha);
+ this.dataOne[1].cout = Number(data.xchuan);
+ this.dataOne[2].cout = Number(data.px);
+ },
+ });
+ },
+ //页面跳转
+ goOnePage(url, index) {
+ if (index == "3") {
+ this.bashow = !this.bashow;
- },
- onBackPress(e) {
- console.log("监听返回按钮事件2", e);
- uni.switchTab({
- url: "/pages/home/home"
- })
- // 此处一定姚要return为true,否则页面不会返回到指定路径
- return true;
- },
- mounted() {
- // if (this.$store.state.UserData.stype != "1") {
- // this.$refs.uToast.show({
- // title: '功能暂未开放',
- // type: 'warning',
- // });
- // }
- },
- methods: {
- //获取资讯信息
- getNum() {
- var that = this;
- uni.request({
- url: this.$store.state.piAPI + '/taskqd/selectNum',
- method: 'GET',
- data: {
- serid: that.$store.state.UserData.user_id,
- jurisdiction: that.$store.state.UserData.jurisdiction,
- workjurisdiction: that.$store.state.UserData.workjurisdiction,
- },
- success: (res) => {
- var data = res.data.data;
- this.dataOne[0].cout = Number(data.xcha);
- this.dataOne[1].cout = Number(data.xchuan);
- this.dataOne[2].cout = Number(data.px);
- }
- });
- },
- //页面跳转
- goOnePage(url, index) {
- if (index == "3") {
- this.bashow = !this.bashow;
- }
- uni.navigateTo({
- url: url
- })
- },
- //获取用户信息
- getUser() {
- var that = this;
- uni.request({
- url: that.$store.state.BaopiAPI + '/blade-user/detail',
- method: 'GET',
- data: {
- cardid: that.$store.state.UserData.cardid,
- isDeleted: 0,
- status: 1,
- },
- success: (res) => {
- if (res.statusCode == "200") {
- var urls = "http://223.82.109.183:2080/securityInfo.html?securityNumber=" + res
- .data.data.securitynumber;
- uni.navigateTo({
- url: '../../voting/information?url=' + urls
- });
- } else {
- this.$refs.uToast.show({
- title: '暂无证件信息',
- type: 'warning',
- });
- }
- }
- });
- },
- goTwoPage(url, index) {
- if (index == "1") {
- this.$refs.uToast.show({
- title: '功能研发中',
- type: 'warning',
- });
- return;
- } else {
- this.getUser();
- }
- },
- }
- };
+ this.itemSelectFlag = !this.itemSelectFlag;
+ }
+ uni.navigateTo({
+ url: url,
+ });
+ },
+ //获取用户信息
+ getUser() {
+ var that = this;
+ uni.request({
+ url: that.$store.state.BaopiAPI + "/blade-user/detail",
+ method: "GET",
+ data: {
+ cardid: that.$store.state.UserData.cardid,
+ isDeleted: 0,
+ status: 1,
+ },
+ success: (res) => {
+ if (res.statusCode == "200") {
+ var urls =
+ "http://223.82.109.183:2080/securityInfo.html?securityNumber=" +
+ res.data.data.securitynumber;
+ uni.navigateTo({
+ url: "../../voting/information?url=" + urls,
+ });
+ } else {
+ this.$refs.uToast.show({
+ title: "暂无证件信息",
+ type: "warning",
+ });
+ }
+ },
+ });
+ },
+ goTwoPage(url, index) {
+ if (index == "1") {
+ uni.navigateTo({
+ url,
+ });
+ return;
+ } else {
+ this.getUser();
+ }
+ },
+ },
+};
</script>
<style lang="scss">
- .container {
- background-color: #f7f7f7;
- min-height: 100vh;
- overflow: hidden;
- }
+.container {
+ background-color: #f7f7f7;
+ min-height: 100vh;
+ overflow: hidden;
+}
- .head {
- position: relative;
- top: 0;
- left: 0;
- z-index: 1;
- }
+.head {
+ position: relative;
+ top: 0;
+ left: 0;
+ z-index: 1;
+}
- .head-bg {
- position: absolute;
- left: 0px;
- top: 0px;
- z-index: -1;
- width: 750rpx;
- height: 270rpx;
- background: #103289;
- }
+.head-bg {
+ position: absolute;
+ left: 0px;
+ top: 0px;
+ z-index: -1;
+ width: 750rpx;
+ height: 270rpx;
+ background: #103289;
+}
- .card {
- margin: 30rpx;
- background: #ffffff;
- border-radius: 20rpx;
- margin-top: 36rpx;
- }
+.card {
+ margin: 30rpx;
+ background: #ffffff;
+ border-radius: 20rpx;
+ margin-top: 36rpx;
+}
- .sub {
- .title {
- padding-top: 36rpx;
- display: flex;
- justify-content: center;
- align-items: center;
+.sub {
+ .title {
+ padding-top: 36rpx;
+ display: flex;
+ justify-content: center;
+ align-items: center;
- font-size: 30rpx;
- font-family: Source Han Sans CN;
- font-weight: 500;
- color: #000000;
+ font-size: 30rpx;
+ font-family: Source Han Sans CN;
+ font-weight: 500;
+ color: #000000;
- &::before {
- content: '';
- display: block;
- width: 135rpx;
- height: 1rpx;
- background: #e4e7ed;
- margin: 0 17rpx;
- }
+ &::before {
+ content: "";
+ display: block;
+ width: 135rpx;
+ height: 1rpx;
+ background: #e4e7ed;
+ margin: 0 17rpx;
+ }
- // &::after {
- // content: '';
- // display: block;
- // width: 135rpx;
- // height: 1rpx;
- // background: #e4e7ed;
- // margin: 0 17rpx;
- // }
- }
- }
+ // &::after {
+ // content: '';
+ // display: block;
+ // width: 135rpx;
+ // height: 1rpx;
+ // background: #e4e7ed;
+ // margin: 0 17rpx;
+ // }
+ }
+}
- .list {
- display: flex;
- flex-wrap: wrap;
- padding: 0 0 30rpx;
+.list {
+ display: flex;
+ flex-wrap: wrap;
+ padding: 0 0 30rpx;
- .nav-item {
- width: 100%;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- align-items: center;
- font-size: 30rpx;
- font-family: Source Han Sans CN;
- font-weight: 400;
- color: #131313;
- line-height: 48rpx;
+ .nav-item {
+ width: 100%;
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+ align-items: center;
+ font-size: 30rpx;
+ font-family: Source Han Sans CN;
+ font-weight: 400;
+ color: #131313;
+ line-height: 48rpx;
- &-img {
- width: 64rpx;
- height: 64rpx;
- margin-bottom: 20rpx;
- }
+ &-img {
+ width: 64rpx;
+ height: 64rpx;
+ margin-bottom: 20rpx;
+ }
- &-name {
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #585b61;
- opacity: 0.77;
- }
- }
- }
+ &-name {
+ font-size: 26rpx;
+ font-family: PingFang SC;
+ font-weight: 400;
+ color: #585b61;
+ opacity: 0.77;
+ }
+ }
+}
- .wrap {
- .title {
- padding: 36rpx 16rpx;
- display: flex;
- align-items: center;
- font-size: 32rpx;
- font-family: Source Han Sans CN;
- font-weight: 500;
- color: #000000;
+.wrap {
+ .title {
+ padding: 36rpx 16rpx;
+ display: flex;
+ align-items: center;
+ font-size: 32rpx;
+ font-family: Source Han Sans CN;
+ font-weight: 500;
+ color: #000000;
- &::before {
- content: "";
- display: block;
- width: 5rpx;
- height: 36rpx;
- margin-right: 10rpx;
- background: #103289;
- }
- }
- }
+ &::before {
+ content: "";
+ display: block;
+ width: 5rpx;
+ height: 36rpx;
+ margin-right: 10rpx;
+ background: #103289;
+ }
+ }
+}
</style>
diff --git a/pages/registerUser/registerUser.vue b/pages/registerUser/registerUser.vue
index 3fed9b6..90909d2 100644
--- a/pages/registerUser/registerUser.vue
+++ b/pages/registerUser/registerUser.vue
@@ -84,23 +84,25 @@
var identity =
/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/;
- if (value.length <= 11) {
- if (phone.test(value)) {
- this.form.phone = value;
- return true
- } else {
- return callback(new Error('手机号格式不正确'));
- }
+ // if (value.length <= 11) {
+ // if (phone.test(value)) {
+ // this.form.phone = value;
+ // return true
+ // } else {
+ // return callback(new Error('手机号格式不正确'));
+ // }
+ // }
+
+ if (identity.test(value)) {
+ this.form.carId = value;
+ return true
+ } else {
+ return callback(new Error('身份证号格式不正确'));
}
- if (value.length > 11) {
- if (identity.test(value)) {
- this.form.carId = value;
- return true
- } else {
- return callback(new Error('身份证号格式不正确'));
- }
- }
+ // if (value.length > 11) {
+
+ // }
};
@@ -145,7 +147,7 @@
img: 'man-add-fill',
froms: 'user',
requireds: true,
- placeholder: '请输入身份证号或手机号'
+ placeholder: '请输入身份证号'
},
{
title: '密码',
@@ -257,14 +259,14 @@
trigger: ['change', 'blur'],
}],
jobUnit: [{
- required: true,
+ required: false,
message: '请输入单位名称',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}],
address: [{
- required: false,
- message: '请输入居住地',
+ required: true,
+ message: '请选择居住地',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}],
@@ -275,14 +277,14 @@
trigger: ['change', 'blur'],
}],
signals: [{
- required: true,
+ required: false,
message: '请输入警号',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}],
xq: [{
- required: true,
- message: '请选择辖区',
+ required: false,
+ message: '请选择工作地点',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}],
@@ -384,6 +386,26 @@
return
}
var that = this;
+
+ //判断是否必填警号和工作地点
+ if(that.form.role == "民警"){
+ that.rules.signals[0].required = true;
+ }
+
+ if(that.jobValue == "有"){
+ that.rules.jobUnit[0].required = true;
+ that.rules.xq[0].required = true;
+ }
+
+ that.$refs.uForm.validate(valid => {
+ if (valid) {
+ that.registerEvent()
+ }else{
+ return
+ }
+ });
+
+
uni.request({
url: that.$store.state.piAPI + '/zc/inspect',
method: 'GET',
@@ -403,8 +425,6 @@
}
- that.registerEvent()
-
// that.$refs.uForm.validate(valid => {
// if (valid) {
// var d = that.form;
@@ -422,8 +442,9 @@
},
registerEvent() {
- var d = this.form;
- var url = this.$store.state.piAPI + '/zc/inster',
+ var that = this;
+ var d = that.form;
+ var url = that.$store.state.piAPI + '/zc/inster',
data = {
// deptid: ,
password: d.pass,
@@ -464,6 +485,7 @@
}
});
+
},
depl() {
diff --git a/store/actions.js b/store/actions.js
index 47c7c4c..34509af 100644
--- a/store/actions.js
+++ b/store/actions.js
@@ -3,95 +3,108 @@
import websocket from "./websocket.js"
import positions from "./positions.js"
+
+
const actions = {
- loging(store, data) {
- var user = [{
- name: '1',
- password: '111111'
- },
- {
- name: '2',
- password: '222222'
- },
- {
- name: '3',
- password: '333333'
- },
- ],
- pasw = md5(data.pass),
- url = this.state.piAPI + '/blade-auth/oauth/token?tenantId=000000&username=' + data.name +
- ' &password=' + pasw + '&grant_type=password&scope=all&type=account';
- // url ='http://192.168.0.109:82/blade-auth/oauth/token';
- // url ='http://192.168.0.109:82/blade-auth/oauth/token?tenantId=000000&username=admin&password=93369e86dc5fa854a0eaf75558c4039d&grant_type=password';
- // url ='http://web.byisf.com/api/blade-auth/oauth/token?tenantId=000000&username=admin&password=93369e86dc5fa854a0eaf75558c4039d&grant_type=password&scope=all';
- // console.log(url);
- wx.request({ //uniapp 自带axios
- url: url, //仅为示例,并非真实接口地址。
- // data: d,
- // data: {
- // tenantId: '000000',
- // username: data.name,
- // password: pasw,
- // grant_type: 'password',
- // scope: 'all',
- // type: "account"
- // },
- header: {
- // "Content-Type":"",
- "Authorization": "Basic c2FiZXI6c2FiZXJfc2VjcmV0",
- "Tenant-Id": "000000"
+ loging (store, data) {
+ var user = [{
+ name: '1',
+ password: '111111'
+ },
+ {
+ name: '2',
+ password: '222222'
+ },
+ {
+ name: '3',
+ password: '333333'
+ },
+ ],
+ pasw = md5(data.pass),
+ url = this.state.piAPI + '/blade-auth/oauth/token?tenantId=000000&username=' + data.name +
+ ' &password=' + pasw + '&grant_type=password&scope=all&type=account'
+ // url ='http://192.168.0.109:82/blade-auth/oauth/token';
+ // url ='http://192.168.0.109:82/blade-auth/oauth/token?tenantId=000000&username=admin&password=93369e86dc5fa854a0eaf75558c4039d&grant_type=password';
+ // url ='http://web.byisf.com/api/blade-auth/oauth/token?tenantId=000000&username=admin&password=93369e86dc5fa854a0eaf75558c4039d&grant_type=password&scope=all';
+ // console.log(url);
+ wx.request({ //uniapp 自带axios
+ url: url, //仅为示例,并非真实接口地址。
+ // data: d,
+ // data: {
+ // tenantId: '000000',
+ // username: data.name,
+ // password: pasw,
+ // grant_type: 'password',
+ // scope: 'all',
+ // type: "account"
+ // },
+ header: {
+ // "Content-Type":"",
+ "Authorization": "Basic c2FiZXI6c2FiZXJfc2VjcmV0",
+ "Tenant-Id": "000000"
- // "Cookie": "JSESSIONID=maOJY05vT2jj4nHwsQGSPgWWVFH1mY-TGWOLYCSh"
- },
- method: "post",
- // // dataType: 'JSON',
- success: (res) => {
- if (res.statusCode == 200) {
- if (res.data.error_code == "400") {
- uni.hideNavigationBarLoading();
- uni.showToast({
- title: '密码错误,请重试',
- icon: 'none',
- duration: 2000
- });
- return;
- }
- store.commit('getUserData', res.data)
- // console.log(res.data,123542);
- data.isit = true;
- data.userName = res.data.nick_name; //警袁姓名
- data.userID = res.data.user_id; //警袁id
- data.avatar = res.data.avatar; //头像
- data.accounts = data.name;
- data.pass = data.pass;
- // data.userPhon = res.user_id;
- store.commit('login', data);
+ // "Cookie": "JSESSIONID=maOJY05vT2jj4nHwsQGSPgWWVFH1mY-TGWOLYCSh"
+ },
+ method: "post",
+ // // dataType: 'JSON',
+ success: (res) => {
+ if (res.statusCode == 200) {
+ if (res.data.error_code == "400") {
+ uni.hideNavigationBarLoading()
+ uni.showToast({
+ title: '密码错误,请重试',
+ icon: 'none',
+ duration: 2000
+ })
+ return
+ }
+ store.commit('getUserData', res.data)
+ // console.log(res.data,123542);
+ data.isit = true
+ data.userName = res.data.nick_name //警袁姓名
+ data.userID = res.data.user_id //警袁id
+ data.avatar = res.data.avatar //头像
+ data.accounts = data.name
+ data.pass = data.pass
+ // data.userPhon = res.user_id;
+ store.commit('login', data)
- }
- },
- fail: (res) => {
- console.log('失去连接 请稍等');
- // console.log(res);
- }
- });
- // var time = setTimeout(() => { //模拟请求时间
- // var ud = user,
- // isit = false;
- // for (var key in ud) {
- // if (ud[key].name == data.name && ud[key].password == data.pass) {
- // isit = true;
- // break;
- // } else {
- // isit = false;
- // }
- // }
- // data.isit = isit;
- // store.commit('login', data);
- // }, 2000)
+ wx.request({
+ url: "http://223.82.109.183:2080/api/userVip/getUserVipInfo?idCardNo=" + res
+ .data.cardid,
+ method: 'get',
+ success: (result) => {
+ if (JSON.stringify(result.data.data) != '{}') {
+ store.state.billFlag = true
+ }
+ }
+ })
- },
- ...websocket.actions,
- ...positions.actions
+ }
+ },
+ fail: (res) => {
+ console.log('失去连接 请稍等')
+ // console.log(res);
+ }
+ })
+ // var time = setTimeout(() => { //模拟请求时间
+ // var ud = user,
+ // isit = false;
+ // for (var key in ud) {
+ // if (ud[key].name == data.name && ud[key].password == data.pass) {
+ // isit = true;
+ // break;
+ // } else {
+ // isit = false;
+ // }
+ // }
+ // data.isit = isit;
+ // store.commit('login', data);
+ // }, 2000)
+
+ },
+ ...websocket.actions,
+ ...positions.actions
}
export default actions
diff --git a/store/state.js b/store/state.js
index db93dc9..8f3ea88 100644
--- a/store/state.js
+++ b/store/state.js
@@ -4,6 +4,8 @@
const state = {
examDetail: {}, // 考试详情
questionList: [], // 考试考题列表
+ paperDetail: {},
+ billFlag: false,
queTypeArr:[0,0,0,0,0],
loging: false,
message: {
--
Gitblit v1.9.3