Files
dvcp_v2_wechat_app/src/project/qujing/AppLegalLearning/components/GeneralLawExam.vue

375 lines
9.9 KiB
Vue
Raw Normal View History

2023-01-30 14:57:39 +08:00
<template>
2023-01-31 09:49:26 +08:00
<div class="GeneralLawExam">
2023-01-30 14:57:39 +08:00
<div class="search_box">
2023-02-13 16:13:27 +08:00
<u-search placeholder="请输入需要搜索的考试" bg-color="#FFF" v-model="title"
2023-02-17 09:54:49 +08:00
:show-action="false" @search="getList" @clear="title='',getList()"></u-search>
2023-01-30 14:57:39 +08:00
</div>
2023-02-17 14:38:07 +08:00
<p class="all_test">全部考试</p>
2023-02-14 08:55:54 +08:00
<div class="card_list" v-if="testList.length">
2023-02-22 08:37:34 +08:00
<scroll-view :style="{height: height + 'px'}" scroll-y>
2023-02-17 10:21:50 +08:00
<div class="card" v-for="item in testList" :key="item.id">
<div class="card_top">
2023-03-23 18:01:00 +08:00
<div class="card_title" :class="item.myRecord ? 'min-wid' : '' ">{{ item.examinationName }}</div>
2023-02-17 10:21:50 +08:00
<div class="card_count">
<span class="col_blue">{{ item.allSubjectNumber }}</span>
</div>
<div class="card_statistics">
<span>{{ item.passNumber }}</span>人通过/<span>{{ item.examinationNumber }}</span>人参与
</div>
<div class="result" v-if="item.myRecord">
2023-03-22 10:54:20 +08:00
<img class="result-img" v-show="item.myRecord.assessmentType == 0" src="https://cdn.cunwuyun.cn/qujing/xuefuwuche.png" alt="">
<img class="result-img" v-show="item.myRecord.assessmentType == 1" src="https://cdn.cunwuyun.cn/qujing/caigaobadou.png" alt="">
<img class="result-img" v-show="item.myRecord.assessmentType == 2" src="https://cdn.cunwuyun.cn/qujing/hege.png" alt="">
<img class="result-img" v-show="item.myRecord.assessmentType == 3" src="https://cdn.cunwuyun.cn/qujing/buhege.png" alt="">
2023-02-17 10:21:50 +08:00
</div>
<div class="grade" :class="{'error':item.myRecord.assessmentType == 3}">{{ item.myRecord.score }}</div>
2023-03-22 17:53:49 +08:00
<div class="tips" v-if="item.examinationType" :class="item.examinationType == 0? 'auth': ''">{{ item.examinationType==0? '学习测试':'考试认证' }}</div>
2023-01-30 14:57:39 +08:00
</div>
2023-03-23 17:56:03 +08:00
<div class="card_bottom" :class="item.myRecord?'col_gray':'col_blue'" @click="handleToTest(item)">{{ item.myRecord? '重新考试':'参加考试'}}</div>
2023-01-30 14:57:39 +08:00
</div>
2023-02-17 09:54:49 +08:00
</scroll-view>
2023-01-30 14:57:39 +08:00
</div>
2023-02-14 08:55:54 +08:00
<AiEmpty :description="`暂无数据`" class="emptyWrap" v-else/>
2023-02-17 09:54:49 +08:00
2023-02-02 12:00:35 +08:00
<u-popup v-model="showAuth" mode="bottom" border-radius="32">
<div class="auth_box">
<div class="auth_title">居民信息认证</div>
<div class="auth_form">
2023-02-13 14:14:51 +08:00
<div class="form_name"><span class="red">*</span>姓名</div>
2023-03-15 15:38:43 +08:00
<input class="input" type="text" placeholder="请输入姓名" v-model="form.name"/>
2023-02-13 14:14:51 +08:00
<div class="form_name"><span class="red">*</span>身份证号</div>
2023-03-15 15:38:43 +08:00
<input class="input" type="idcard" placeholder="请输入18位身份证号" v-model="form.idNumber"/>
2023-02-13 14:14:51 +08:00
<div class="form_name"><span class="red">*</span>地区</div>
2023-02-13 16:13:27 +08:00
<AiAreaPicker class="ai-area" v-model="form.areaId" :areaId="$areaId" :fullName.sync="form.areaName">
2023-02-07 13:57:49 +08:00
<div class="ai-area__wrapper">
2023-02-17 14:17:21 +08:00
<div>
<span v-if="form.areaName">{{ form.areaName }}</span>
<i v-else style="color: #999">请选择</i>
</div>
2023-02-07 13:57:49 +08:00
<u-icon name="arrow-right" color="#ddd"/>
</div>
</AiAreaPicker>
2023-02-02 12:00:35 +08:00
</div>
<div class="auth_btn">
2023-02-07 13:57:49 +08:00
<div class="cancel" @click="showAuth = false,form = {}">取消</div>
<div class="submit" @click="comfirm">确定</div>
2023-02-01 18:02:38 +08:00
</div>
</div>
</u-popup>
2023-01-30 14:57:39 +08:00
</div>
</template>
<script>
2023-02-13 14:14:51 +08:00
import { mapState } from "vuex"
2023-01-30 14:57:39 +08:00
export default {
2023-02-17 14:12:38 +08:00
props: {
height: Number,
},
2023-01-30 14:57:39 +08:00
data() {
return {
2023-02-17 14:18:13 +08:00
showAuth: false,
2023-02-13 16:13:27 +08:00
title: '',
2023-01-30 14:57:39 +08:00
current: 1,
2023-02-07 13:57:49 +08:00
form: {
name: '',
idNumber: '',
areaId: '',
areaName: '',
2023-02-13 14:14:51 +08:00
},
flag: false,
2023-02-13 16:13:27 +08:00
current: 1,
testList: [],
2023-02-20 15:11:36 +08:00
testId: '',
2023-03-22 10:54:20 +08:00
studyDuration: '',
2023-01-30 14:57:39 +08:00
}
},
2023-02-13 14:14:51 +08:00
computed: {
...mapState(['user'])
2023-01-30 14:57:39 +08:00
},
methods: {
getList() {
2023-02-13 16:13:27 +08:00
this.$instance.post(`/app/appexaminationinfo/listForXCX`, null, {
params: {
current: this.current,
2023-02-22 08:37:34 +08:00
size: 3000,
2023-02-13 16:13:27 +08:00
title: this.title
}
}).then(res=> {
if(res?.data) {
2023-02-22 08:37:34 +08:00
this.testList = res.data.records
2023-03-23 11:23:55 +08:00
this.getStudyDuration()
2023-02-13 16:13:27 +08:00
}
})
2023-01-30 17:09:15 +08:00
},
2023-02-16 08:54:41 +08:00
getUserInfo() {
this.$instance.post(`/app/appwechatuserqujing/check`).then(res=> {
if(res?.data) {
this.$store.commit('setUser', res.data)
}
})
},
2023-03-23 11:23:55 +08:00
handleToTest({id, examinationDuration: time, examinationType }) {
2023-03-23 09:15:22 +08:00
if(examinationType == 1) {
2023-03-23 15:49:57 +08:00
if(this.studyDuration < time) {
2023-03-23 11:23:55 +08:00
return uni.showModal({
2023-03-23 09:15:22 +08:00
title: '考试说明',
content: `「考试认证」类考试,需要在线课堂中学习普法知识满足${time}分钟才能参加,考试通过并审核后可获取知法明理证书。`,
confirmText: '去学习',
confirmColor: '#2D7DFF',
success: (res)=> {
if (res.confirm) {
2023-03-23 11:23:55 +08:00
uni.$emit('update', { inx: 0 })
2023-03-23 09:15:22 +08:00
} else if (res.cancel) {
// 停留
}
}
});
}
}
2023-02-15 17:43:08 +08:00
if(!this.user.areaId) {
this.showAuth = true;
2023-02-20 15:11:36 +08:00
this.testId = id;
2023-02-15 17:43:08 +08:00
} else {
2023-02-14 14:06:46 +08:00
this.$emit('toTest',id)
2023-02-15 17:43:08 +08:00
}
2023-02-07 13:57:49 +08:00
},
2023-03-22 10:54:20 +08:00
// 查看累计时长
getStudyDuration() {
this.$instance.post(`/app/appwechatuserqujing/queryStudyDuration`).then(res => {
if (res?.data) {
this.studyDuration = res.data.studyDuration
}
})
},
2023-02-07 13:57:49 +08:00
comfirm() {
2023-02-13 14:14:51 +08:00
if(this.flag) return
if(!this.form.name) {
return this.$u.toast('请输入姓名')
}
if(!this.form.idNumber) {
return this.$u.toast('请输入身份证号')
}
2023-02-17 11:07:32 +08:00
if (!this.$idCardNoUtil.checkIdCardNo(this.form.idNumber)) {
return this.$u.toast('请输入正确的身份证号码')
}
2023-02-07 14:08:23 +08:00
2023-02-13 14:14:51 +08:00
if(!this.form.areaId) {
return this.$u.toast('请选择地区')
}
this.flag = true
this.$instance.post(`/app/appwechatuserqujing/idNumberAttestation`, this.form).then(res=> {
if(res?.code == 0) {
this.flag = false
2023-02-20 15:11:36 +08:00
this.showAuth = false
this.$u.toast("认证成功");
2023-02-13 14:14:51 +08:00
setTimeout(()=> {
2023-02-20 15:11:36 +08:00
this.$emit('toTest',this.testId)
2023-02-13 14:14:51 +08:00
}, 500)
2023-02-20 11:47:03 +08:00
} else {
this.flag = false
this.showAuth = false
this.$u.toast('认证失败')
2023-02-13 14:14:51 +08:00
}
}).catch((err)=> {
this.flag = false
this.showAuth = false
this.$u.toast(err.msg)
})
2023-02-21 11:46:59 +08:00
},
2023-01-30 14:57:39 +08:00
},
}
</script>
<style lang="scss" socped>
2023-01-31 09:49:26 +08:00
.GeneralLawExam {
2023-01-30 14:57:39 +08:00
.search_box {
margin: 24px 0;
padding: 0 32px;
box-sizing: border-box;
}
.all_test {
font-size: 28px;
color: #333333;
font-weight: 600;
padding: 0 32px;
box-sizing: border-box;
}
.card_list {
padding: 8px 32px;
box-sizing: border-box;
.card {
margin-top: 24px;
.card_top,
.card_bottom {
padding: 24px;
box-sizing: border-box;
background: #FCFCFC;
}
.card_top {
position: relative;
border-radius: 16px 16px 0 0;
2023-03-23 13:39:14 +08:00
padding: 38px;
box-sizing: border-box;
2023-03-23 17:56:03 +08:00
2023-01-30 14:57:39 +08:00
.card_title {
font-weight: 500;
2023-01-31 16:19:20 +08:00
font-size: 36px;
2023-01-30 14:57:39 +08:00
color: #333333;
2023-01-31 16:19:20 +08:00
overflow: hidden;
2023-01-30 14:57:39 +08:00
text-overflow:ellipsis;
display: -webkit-box;
2023-01-31 16:19:20 +08:00
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
2023-03-23 18:01:00 +08:00
}
.min-wid {
2023-03-23 17:56:03 +08:00
width: 438px;
2023-01-30 14:57:39 +08:00
}
.card_count,
.card_statistics {
font-weight: 400;
font-size: 26px;
color: #999999;
margin-top: 16px;
}
.result {
position: absolute;
right: 0;
2023-03-23 13:45:00 +08:00
top: 33px;
2023-03-15 15:38:43 +08:00
.result-img {
2023-01-30 14:57:39 +08:00
width: 200px;
height: 200px;
}
}
.grade {
position: absolute;
right: 75px;
2023-03-23 13:45:00 +08:00
top: 92px;
2023-01-30 14:57:39 +08:00
font-weight: 500;
font-size: 40px;
color: #0FC484;
}
2023-02-16 08:54:41 +08:00
.error {
color: #E23C3C;
}
2023-03-22 16:32:50 +08:00
.tips {
position: absolute;
top: 0;
right: 0;
width: 116px;
height: 38px;
2023-03-24 13:02:29 +08:00
line-height: 38px;
2023-03-22 16:32:50 +08:00
background: #FF772D;
border-radius: 0 16px 0 16px;
color: #FFF;
2023-03-24 13:02:29 +08:00
font-size: 24px;
text-align: center;
2023-03-22 16:32:50 +08:00
}
2023-03-22 17:53:49 +08:00
.auth {
background: #8F5AFF;
}
2023-01-30 14:57:39 +08:00
}
.card_bottom {
border-top: 1px solid #EEEEEE;
border-radius: 0 0 16px 16px;
text-align: center;
}
.col_blue {
color: #2D7DFF;
}
2023-03-23 17:56:03 +08:00
.col_gray {
color: #687DA6;
}
2023-01-30 14:57:39 +08:00
}
}
2023-02-02 12:00:35 +08:00
.auth_box {
padding: 32px;
box-sizing: border-box;
.auth_title {
font-weight: 600;
font-size: 34px;
color: #333333;
text-align: center;
}
.auth_form {
margin-top: 30px;
.form_name {
font-weight: 500;
font-size: 28px;
color: #333333;
margin-bottom: 16px;
2023-02-13 14:14:51 +08:00
.red {
color: #FF4466;
}
2023-02-02 12:00:35 +08:00
}
2023-03-15 15:38:43 +08:00
.input {
2023-02-02 12:00:35 +08:00
height: 96px;
background: #F4F5FA;
border-radius: 16px;
margin-bottom: 32px;
padding-left: 24px;
}
2023-02-17 14:17:21 +08:00
2023-02-07 13:57:49 +08:00
.ai-area .ai-area__wrapper {
display: flex;
2023-02-17 14:17:21 +08:00
justify-content: space-between;
align-items: center;
2023-02-07 13:57:49 +08:00
background: #F4F5FA;
border-radius: 16px;
margin-bottom: 32px;
padding: 24px;
box-sizing: border-box;
}
2023-02-02 12:00:35 +08:00
}
.auth_btn {
display: flex;
justify-content: space-between;
height: 100px;
padding: 10px 0;
box-sizing: border-box;
.cancel {
background: #F2F2F2;
color: #2D7DFF;
}
.submit {
background: #2D7DFF;
color: #FFF;
}
.cancel,
.submit {
width: 48%;
height: 80px;
line-height: 80px;
text-align: center;
border-radius: 16px;
}
}
}
2023-01-30 14:57:39 +08:00
}
</style>