Merge branch 'dev-yjl' into 'shenzhen-dev'

安全教育模块-扫码考试页面开发

See merge request !121
This commit is contained in:
袁晶琳 2023-03-16 10:07:58 +08:00
commit bcf285cd36
9 changed files with 703 additions and 15 deletions

View File

@ -1,4 +1,4 @@
// var COMPANY = ''; //通用
var COMPANY = ''; //通用
// var COMPANY='zhongjian'; //中建,和沃尔对接的插件版用这个企业
// var COMPANY='hezhan'; //合展-宿迁
// var COMPANY='nanchang'; //南昌地铁、衢州
@ -7,7 +7,7 @@
// var COMPANY='shenbai'; //沈白高铁
// COMPANY = 'henan' // 河南春笋
// COMPANY = 'xingxuan'
COMPANY = 'hengtong'//瑞士恒通
// COMPANY = 'hengtong'//瑞士恒通
@ -20,7 +20,7 @@ var PROJECT = {
}
var PROJECT_TYPE = PROJECT.online_zjsj
var PROJECT_TYPE = PROJECT.local_test
var headerShow = true; // 是否显示头部
var tabsShow = true; // 是否显示tabs

BIN
src/assets/images/aqjy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -61,4 +61,15 @@ export const getselectHiddenDangerRectifyRecordListApi = data => post('xmgl/hidd
export const addHiddenDangerRectifyRecordApi = data => post('xmgl/hiddenDangerRectifyRecord/add', data);
//隐患考核列表
export const getSelectEnterpriseScoreList = data => post('xmgl/hiddenDangerInspectRecord/selectEnterpriseScoreList', data);
export const getSelectEnterpriseScoreList = data => post('xmgl/hiddenDangerInspectRecord/selectEnterpriseScoreList', data);
//验证身份证
export const getAnswerWorkerInfoList = data => post('xmgl/safeEducationQuestionAnswer/getAnswerWorkerInfo', data);
//获取课程详细数据
export const getSelectSafeEducationQuestionInfoList = data => post('xmgl/safeEducationQuestion/selectSafeEducationQuestionInfo', data);
//考试成功
export const addSafeEducationQuestionAnswer = data => post('xmgl/safeEducationQuestionAnswer/add', data);

View File

@ -1277,8 +1277,26 @@ const routes2 = [
component: resolve => require(['@/views/projectFront/informatioBroadcast/broadcast.vue'], resolve)
},
]
],
},
//扫二维码路由
{
path: '/authentication',
name: '安全教育_考试',
component: () => import('@/views/projectFront/examination/authentication.vue')
},
{
path: '/test',
name: '安全教育_考试提示',
component: () => import('@/views/projectFront/examination/test.vue')
},
{
path: '/videoLearning',
name: '安全教育_考试视频',
component: () => import('@/views/projectFront/examination/videoLearning.vue')
},
//企业后台
{
path: '/page',

View File

@ -0,0 +1,107 @@
<template>
<div>
<div class="fullHeight">
<!-- <image src="/static/onlineTest_bg.png" class="onlineTest_bg"></image> -->
<div class="centerBox">
<img src="@/assets/images/aqjy.png" class="aqjyImg" />
<div class="inputContent">
<input
class="inputBox"
type="text"
v-model="idCard"
placeholder="请输入身份证号码"
/>
<div class="confirmBtn" @click="verifyFn">开始培训</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { getAnswerWorkerInfoList } from '@/assets/js/api/safeManage.js'
export default {
data() {
return {
idCard: '',
projectSn: '',
eduId: ''
}
},
created(options) {
this.projectSn = this.$store.state.projectSn
this.eduId = '1636008037212958721'
},
methods: {
verifyFn() {
if (this.idCard == '') {
this.$message.error('请输入身份证号码')
return
}
getAnswerWorkerInfoList({
idCard: this.idCard,
projectSn: this.projectSn
}).then((result) => {
if (result.result) {
this.$message.success('验证成功!')
setTimeout(() => {
this.$router.push({
path: '/videoLearning',
query: {
eduId: this.eduId,
workerId: result.result.id
}
})
}, 1000)
}
})
}
}
}
</script>
<style scoped>
.onlineTest_bg {
width: 100%;
height: 100%;
}
.centerBox {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.aqjyImg {
width: 120px;
height: 100px;
margin-bottom: 30px;
}
.inputContent {
/* position: fixed;
bottom: 10%;
left: 0; */
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.inputBox {
background-color: white;
border-radius: 4px;
padding: 10px 10px;
width: 200px;
font-size: 15px;
display: inline-block;
margin-right: 10px;
border: 1px solid rgba(63, 83, 110, 0.5);
}
.confirmBtn {
background-color: #4181fe;
color: white;
font-size: 15px;
padding: 10px 20px;
border-radius: 4px;
width: 60px;
}
</style>

View File

@ -0,0 +1,80 @@
<template>
<div>
<div class="dialogBox" v-show="dialogVisible">
<div class="mask" @click="hideFn"></div>
<div class="dialogContent">
<!-- <div class="dialogTitle">
<slot name="title"></slot>
<text @click="hideFn" style="float: right;">X</text>
</div> -->
<!-- <div class="dialogInner"> -->
<slot name="content"></slot>
<!-- </div> -->
</div>
</div>
</div>
</template>
<script>
export default {
props: {
canClickMask: {
type: Boolean,
default: true
}
},
data() {
return {
dialogVisible: false
}
},
mounted() {},
methods: {
showFn() {
this.dialogVisible = true
},
hideFn() {
if (this.canClickMask) {
this.dialogVisible = false
}
},
hideFn2() {
this.dialogVisible = false
}
}
}
</script>
<style lang="scss" scoped>
.dialogBox {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 999;
}
.mask {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.4);
}
.dialogTitle {
padding: 15px;
}
.dialogContent {
width: calc(100% - 90px);
position: fixed;
left: 45px;
top: 50%;
transform: translateY(-50%);
background-color: white;
border-radius: 4px;
}
.dialogInner {
padding: 0 15px;
}
</style>

View File

@ -0,0 +1,344 @@
<template>
<div class="fullHeight">
<div class="headers">
<div class="headerName">考试</div>
</div>
<div class="pageContent">
<div class="tips">交卷之前离开当前页面会导致本次考试作废</div>
<div
class="blockBox"
v-for="(item, index) in courseDetail.questionList"
:key="index"
>
<div class="testTilte">
{{ index + 1 }}{{ item.questionName }}{{ item.questionScore }}
</div>
<el-checkbox-group
class="optionsBox"
v-if="item.questionType == 2"
v-model="radioList"
@change="
(e) => {
changeChecked(e, item.questionId, index)
}
"
>
<el-checkbox
v-for="(data, index) in item.optionList"
:label="data.optionId"
:key="index"
>{{ indexList[index] }}{{ data.optionName }}</el-checkbox
>
</el-checkbox-group>
<!-- <label
class="optionItem"
v-for="(data, index2) in item.optionList"
:key="index2"
>
<checkbox class="checkbox" :value="data.optionId + ''" /><text
class="desc"
>{{ indexList[index2] }}{{ data.optionName }}</text
>
</label> -->
<el-radio-group class="optionsBox" v-model="radio" v-else>
<!-- <label
class="optionItem"
v-for="(data, index2) in item.optionList"
:key="index2"
>
<radio
class="checkbox"
:value="data.optionId + ''"
:checked="data.optionId === item.optionId"
/><text class="desc"
>{{ indexList[index2] }}{{ data.optionName }}</text
>
</label> -->
<el-radio
@change="
(e) => {
changeChecked(e, item.questionId, index)
}
"
v-for="(data, index2) in item.optionList"
:key="index2"
:label="data.optionId"
>{{ indexList[index2] }}{{ data.optionName }}</el-radio
>
</el-radio-group>
</div>
<button type="primary" class="btn submitBtn big" @click="submitData()">
交卷
</button>
</div>
<dialogs ref="dialogs">
<!-- <template v-slot:title>
{{isAdd?'添加':'编辑'}}
</template> -->
<template v-slot:content>
<div class="formBox2">
<form @submit="submitData">
<div class="uni-form-item">
<div class="uni-form-label">
<text class="star">*</text>身份证号码
</div>
<div class="uni-form-input">
<input
class="uni-input"
placeholder-class="cl"
name="idCard"
v-model="idCard"
placeholder="请输入"
/>
</div>
</div>
<button form-type="submit" type="primary" class="btn submitBtn">
提交
</button>
</form>
</div>
</template>
</dialogs>
<div class="testResultBox" v-if="showResult">
<image
v-if="isQualified == 1"
src="/static/Pass.png"
class="resultImg"
></image>
<image v-else src="/static/noPass.png" class="resultImg"></image>
<div class="score">{{ score }}</div>
</div>
</div>
</template>
<script>
import dialogs from '@/views/projectFront/examination/dialog.vue'
import {
getSelectSafeEducationQuestionInfoList,
addSafeEducationQuestionAnswer
} from '@/assets/js/api/safeManage.js'
export default {
components: { dialogs },
data() {
return {
radio: 3,
radioList: [],
indexList: [
'A',
'B',
'C',
'D',
'E',
'F',
'G',
'H',
'I',
'J',
'K',
'L',
'N',
'M',
'O',
'P',
'Q',
'R',
'S',
'T',
'U',
'V',
'W',
'X',
'Y',
'Z'
],
courseDetail: {
eduAddr: '',
eduClasshour: '',
eduContent: '',
eduCourseName: '',
eduPhoto: '',
eduTeacher: '',
eduTime: '',
eduType: '',
eduVideo: '',
passScore: '',
projectSn: '',
questionList: [],
totalScore: '',
videoType: 1
},
eduId: '',
selectList: [],
idCard: '',
workerId: '',
score: 0,
showResult: false,
isQualified: 1 //12
}
},
created(options) {
console.log('获取课程详细数据1516', this.$route.query)
this.eduId = this.$route.query.eduId
this.workerId = this.$route.query.workerId
this.getDetailData()
},
beforeDestroy() {
// console.log('onUnload')
// uni.showModal({
// title:'',
// content:'',
// success(res) {
// if(res.confirm){
// console.log('')
// }else{
// console.log('')
// }
// }
// })
},
methods: {
changeChecked(e, questionId, index) {
console.log(e, questionId)
var arr = e
//
for (var i = 0; i < this.selectList.length; i++) {
if (this.selectList[i].questionId == questionId) {
this.selectList.splice(i--, 1)
}
}
//
if (Array.isArray(arr)) {
for (var i = 0; i < arr.length; i++) {
this.selectList.push({
questionId: questionId,
optionId: arr[i]
})
}
} else {
this.selectList.push({
questionId: questionId,
optionId: arr
})
this.courseDetail.questionList[index].optionId = arr
}
console.log(this.selectList)
},
//
getDetailData() {
var that = this
getSelectSafeEducationQuestionInfoList({ eduId: this.eduId }).then(
(result) => {
if (result.result) {
that.courseDetail = result.result.safeEducation
}
}
)
},
inputIdCard() {
this.$refs.dialogs.showFn()
},
submitData() {
// if(this.idCard==''){
// uni.showToast({
// title:''
// })
// return
// }
var json = {
eduId: this.eduId,
workerId: this.workerId,
// idCard:this.idCard,
list: this.selectList
}
addSafeEducationQuestionAnswer(json).then((result) => {
if (result.result) {
this.$message.success('考试成功!')
this.showResult = true
this.isQualified = result.result.isQualified
this.score = result.result.score
}
})
}
}
}
</script>
<style scoped>
.tips {
font-size: 14px;
color: red;
margin: 10px 0;
text-align: center;
}
.blockBox {
box-shadow: 0 4px 24px 0px rgba(212, 220, 236, 0.69);
border-radius: 8px;
margin: 15px;
padding: 15px;
position: relative;
}
.optionItem {
/* padding-left: 20px; */
margin-top: 10px;
font-size: 14px;
display: block;
}
.desc {
margin-left: 5px;
}
.checkbox {
transform: scale(0.8);
}
.submitBtn {
/* margin: 15px 20px; */
/* position: fixed;
bottom: 20px;
left: 20px; */
width: calc(100% - 40px);
margin: 20px;
height: 44px;
border-radius: 20px;
background: #4181fe;
color: #fff;
border: none;
font-size: 20px;
}
.testResultBox {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
z-index: 99999;
}
.resultImg {
width: 100%;
height: 100%;
}
.score {
position: fixed;
left: 50%;
top: 55%;
font-size: 70px;
width: 200px;
height: 200px;
border-radius: 50%;
border: 8px solid #fdcb05;
color: #fdcb05;
text-align: center;
line-height: 200px;
transform: translate(-50%, -50%);
}
.headers {
border-bottom: 1px solid #f3f3f3;
height: 50px;
color: #3d4490;
font-size: 18px;
text-align: center;
line-height: 50px;
}
</style>

View File

@ -0,0 +1,130 @@
<template>
<div>
<div class="fullHeight">
<div class="headers">
<div class="headerName">课程学习</div>
</div>
<video
:src="$store.state.FILEURL + courseDetail.eduVideo"
controls
class="videoBox"
></video>
<div class="courseTitle">
{{ courseDetail.eduCourseName }}
</div>
<div class="desc">
课程类型{{ educateTypeList[courseDetail.eduType - 1] }}
</div>
<div class="desc">试卷总分{{ courseDetail.totalScore }}</div>
<div class="desc">及格分数{{ courseDetail.passScore }}</div>
<div class="desc">创建时间{{ courseDetail.addTime }}</div>
<button
type="primary"
class="btn submitBtn big"
@click="gotoTest"
v-if="courseDetail.questionList.length > 0"
>
开始考试
</button>
</div>
</div>
</template>
<script>
import { getSelectSafeEducationQuestionInfoList } from '@/assets/js/api/safeManage.js'
export default {
data() {
return {
courseDetail: {
eduAddr: '',
eduClasshour: '',
eduContent: '',
eduCourseName: '',
eduPhoto: '',
eduTeacher: '',
eduTime: '',
eduType: 1,
eduVideo: '',
passScore: '',
projectSn: '',
questionList: [],
totalScore: '',
addTime: ''
},
educateTypeList: [
'入场三级教育',
'定期安全教育',
'安全技术交底',
'VR安全教育'
],
eduId: '',
workerId: ''
}
},
created(options) {
console.log('获取课程详细数据1516', this.$route.query)
this.eduId = this.$route.query.eduId
this.workerId = this.$route.query.workerId
this.getDetailData()
},
methods: {
gotoTest() {
this.$router.push({
path: '/test',
query: {
eduId: this.eduId,
workerId: this.workerId
}
})
},
//
getDetailData() {
var that = this
console.log('获取课程详细数据1515')
getSelectSafeEducationQuestionInfoList({ eduId: this.eduId }).then(
(result) => {
if (result.result) {
that.courseDetail = result.result.safeEducation
}
}
)
}
}
}
</script>
<style scoped>
.videoBox {
width: 100%;
height: 300px;
margin: 10px 0;
}
.courseTitle {
padding: 0 15px;
}
.desc {
font-size: 12px;
opacity: 0.6;
padding: 5px 0 0 15px;
}
.submitBtn {
/* margin: 15px 20px; */
position: fixed;
bottom: 20px;
/* left: 20px; */
width: calc(100% - 0px);
background: #4181fe;
height: 44px;
border: none;
color: #fff;
}
.headers {
border-bottom: 1px solid #f3f3f3;
height: 50px;
color: #3d4490;
font-size: 18px;
text-align: center;
line-height: 50px;
}
</style>

View File

@ -640,18 +640,16 @@ export default {
createQRcode(index) {
console.log('扫码进来了吗====1', index)
if (this.$route.path.indexOf('/project/') != -1) {
console.log('扫码进来了吗====2')
let url = ''
if (process.env.NODE_ENV == 'development') {
url = 'http://182.90.224.147:18170/'
} else {
url = window.location.origin + '/'
}
// let url = ''
// if (process.env.NODE_ENV == 'development') {
// url = 'http://182.90.224.147:18170/'
// } else {
let url = window.location.origin
// }
console.log(
'扫码进来了吗====3 :' +
(url +
'#/pages/projectEnd/safetyEducation/authentication?eduId=' +
'#/authentication?eduId=' +
this.eduId +
'&projectSn=' +
this.$store.state.projectSn)
@ -667,7 +665,7 @@ export default {
height: height, //
text:
url +
'#/pages/projectEnd/safetyEducation/authentication?eduId=' +
'/authentication?eduId=' +
this.eduId +
'&projectSn=' +
this.$store.state.projectSn, //