添加考试和证书查询

This commit is contained in:
shijing 2024-05-30 17:36:28 +08:00
parent 3a38185a81
commit 0084b973b0
8 changed files with 519 additions and 73 deletions

View File

@ -1,7 +1,6 @@
// 如果没有通过拦截器配置域名的话可以在这里写上完整的URL(加上域名部分)
let hotSearchUrl = '/ebapi/store_api/hot_search';
let indexUrl = '/ebapi/public_api/index';
// 此处第二个参数vm就是我们在页面使用的this你可以通过vm获取vuex等操作更多内容详见uView对拦截器的介绍部分
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
const install = (Vue, vm) => {
@ -11,27 +10,17 @@ const install = (Vue, vm) => {
});
// 此处使用了传入的params参数一切自定义即可
let getUserInfo = (params = {}) => vm.$u.get('/system/user/info/', params);//获取用户信息
let getCode = (params = {}) => vm.$u.post('/system/sendmsg/', params); //获取邮箱验证码
let codeLogin = (params = {}) => vm.$u.post('/token2/', params); //邮箱验证码登录
let login = (params = {}) => vm.$u.post('/token/', params); //账户密码登录
// 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下
let wxmplogin = (params = {}) => vm.$u.post('/wxmplogin/', params); //微信登录
let bindmp = (params = {}) => vm.$u.post('/system/user/bindwxmp/', params); //微信绑定
let unbindmp = (params = {}) => vm.$u.post('/system/user/unbindwxmp/', params); //微信绑定
let getMyInspectTaskList = (params = {}) => vm.$u.get('/quality/subinspecttask/self/', params);
let getSubinspectTask = (id, params)=> vm.$u.get(`/quality/subinspecttask/${id}/`, params);
//获取子任务涉及的单位
let getSubtaskDepts = (id, params)=> vm.$u.get(`/quality/subinspecttask/${id}/depts/`, params);
//获取子任务单位的详细信息
let getSubtaskDept = (id, params)=> vm.$u.get(`/quality/inspectdept/${id}/`, params);
let getInspectRecords = (params)=> vm.$u.get('/quality/inspectrecord/', params);
@ -44,8 +33,6 @@ const install = (Vue, vm) => {
let getVideos = (params={})=>vm.$u.get('/vod/video/', params);//点播视频
let getDickey = (params={})=>vm.$u.get('/system/dict/', params);//查询字典
let putMyVideoView =(id)=>vm.$u.put(`/vod/video/${id}/myview/`);//更新本人观看信息
//考试有关
let getExamList = (params={})=>vm.$u.get('/exam/exam/', params);//考试列表
let startExam = (id)=>vm.$u.post(`/exam/exam/${id}/start/`);//开始考试
@ -54,6 +41,7 @@ const install = (Vue, vm) => {
let examRecordDetail = (id,params={})=>vm.$u.get(`/exam/examrecord/${id}/`,params);//我的考试记录
let paperDetail = (id,params={})=>vm.$u.get(`/exam/paper/${id}/`,params);//测试
let questionList = (params={})=>vm.$u.get(`/exam/question/`,params);//题目
let certificateList = (params={})=>vm.$u.get(`/edu/certificate/`,params);//证书列表
vm.$u.api = {getUserInfo,
getCode,
@ -83,7 +71,9 @@ const install = (Vue, vm) => {
examRecord,
paperDetail,
questionList,
examRecordDetail
examRecordDetail,
certificateList
};
}

View File

@ -137,33 +137,33 @@
}
}
,{
"path" : "pages/exam/test",
"style" :
{
"navigationBarTitleText": "练习",
"enablePullDownRefresh": false
}
// ,{
// "path" : "pages/exam/test",
// "style" :
// {
// "navigationBarTitleText": "练习",
// "enablePullDownRefresh": false
// }
}
,{
"path" : "pages/exam/question",
"style" :
{
"navigationBarTitleText": "专题练习",
"enablePullDownRefresh": false
}
// }
// ,{
// "path" : "pages/exam/question",
// "style" :
// {
// "navigationBarTitleText": "专题练习",
// "enablePullDownRefresh": false
// }
}
,{
"path" : "pages/exam/testDetail",
"style" :
{
"navigationBarTitleText": "练习题目",
"enablePullDownRefresh": false
}
// }
// ,{
// "path" : "pages/exam/testDetail",
// "style" :
// {
// "navigationBarTitleText": "练习题目",
// "enablePullDownRefresh": false
// }
}
// }
,{
"path" : "pages/exam/exam",
"style" :
@ -186,7 +186,7 @@
"path" : "pages/exam/main",
"style" :
{
"navigationBarTitleText": "答题中",
"navigationBarTitleText": "考试中",
"enablePullDownRefresh": false
}
@ -195,7 +195,7 @@
"path" : "pages/exam/record",
"style" :
{
"navigationBarTitleText": "答题记录",
"navigationBarTitleText": "考试记录",
"enablePullDownRefresh": false
}
@ -204,7 +204,7 @@
"path" : "pages/exam/result",
"style" :
{
"navigationBarTitleText": "答题结束",
"navigationBarTitleText": "考试结束",
"enablePullDownRefresh": false
}
@ -212,7 +212,15 @@
"path" : "pages/exam/detail",
"style" :
{
"navigationBarTitleText": "答题详情",
"navigationBarTitleText": "考试详情",
"enablePullDownRefresh": false
}
},{
"path" : "pages/certificate/index",
"style" :
{
"navigationBarTitleText": "证书查询",
"enablePullDownRefresh": false
}
@ -239,14 +247,14 @@
"pagePath": "pages/exam/index",
"iconPath": "static/common/dati.png",
"selectedIconPath": "static/common/datic.png",
"text": "答题"
},
{
"pagePath": "pages/vod/video",
"iconPath": "static/common/play.png",
"selectedIconPath": "static/common/playc.png",
"text": "点播"
"text": "考试"
},
// {
// "pagePath": "pages/vod/video",
// "iconPath": "static/common/play.png",
// "selectedIconPath": "static/common/playc.png",
// "text": "点播"
// },
{
"pagePath": "pages/my/my",
"iconPath": "static/common/me.png",

View File

@ -0,0 +1,25 @@
<template>
<view>
<web-view src="https://testsearch.ctc.ac.cn/index_zs.html"></web-view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
page{
height: 100%;
background-color: #ededed;
}
</style>
<style>
</style>

View File

@ -0,0 +1,302 @@
<template>
<view>
<!-- <view class="typeSelect">
<view class="typeWrap">
<view @click="typeChange(0)">证书号</view>
<view @click="typeChange(1)">姓名</view>
</view>
</view>
<view v-if="type==0">
<view class="row">
<text class="label"><text class="redStar">*</text>证书号</text>
<input class="searchInput" type="text" id="number" v-model="form.number">
</view>
<view class="searchBtn" @click="searchClick(0)">查询</view>
</view>
<view v-else>
<view class="row">
<text class="label"><text class="redStar">*</text>姓名</text>
<input class="searchInput" type="text" id="name" v-model="form.name">
</view>
<view class="row">
<text class="label"><text class="redStar">*</text>单位</text>
<input class="searchInput" type="text" id="deptName" v-model="form.deptName">
</view>
<view class="searchBtn" @click="searchClick(1)">查询</view>
</view>
<view v-if="showImg">
<img class="imgs" :src="imgSrc">
</view>
<view class="lists" v-if="dataList.length>0">
<view v-for="item in dataList" class="listItem" @click="showImage(item)">
<view v-if="item.证书方案=='202309'">
<view>姓名{{item.姓名}}</view>
<view>资格
<text v-if="item.是否内审员">内审员</text>
<text v-if="item.是否内审员&&(item.是否授权签字人||item.是否质量负责人||item.是否最高管理者)"></text>
<text v-if="item.是否授权签字人">授权签字人</text>
<text v-if="item.是否内审员&&(item.是否质量负责人||item.是否最高管理者)"></text>
<text v-if="item.是否质量负责人">质量负责人</text>
<text v-if="item.是否内审员&&item.是否最高管理者"></text>
<text v-if="item.是否最高管理者">最高管理者</text>
</view>
<view>证书编号{{item.证书编号}}</view>
<view>所属单位{{item.所属单位}}{{item.单位名称}}</view>
</view>
<view v-if="item.证书方案=='202312'">
<view>姓名{{item.姓名}}</view>
<view>单位名称{{item.单位名称}}</view>
<view>证书编号{{item.证书编号}}</view>
<view>培训日期{{item.培训日期}}</view>
<view>培训结束日期{{item.培训结束日期}}</view>
<view>发证日期{{item.发证日期}}</view>
</view>
</view>
</view>
<view v-else>
<view>{{warningTxtx}}</view>
</view>
-->
<view class="searWrap">
<input class="infoInput" placeholder="填写证书编号/姓名" v-model="search">
</input>
<view class="searchBtn" @click="searchCandidates">查询</view>
</view>
<view class="listWrap">
<view v-if="candidates.length>0">
<!-- <view> -->
<view class="listTitle">证书列表</view>
<view >
<view>
<view>
姓名:姓名</view>
<view>
<view> 证书号:<text style="color:#438af4">XJ8937264</text></view>
</view>
<view>
<view>发证日期:2024-05-26</view>
</view>
</view>
<view>
<view style="color:green">通过考核</view>
</view>
</view>
<view v-for="item in candidates" v-bind:key="item.id">
<view>
<view>
姓名:{{item.consumer_name}}</view>
<view>
<view style="color:darkblue"> 证书号:{{item.number}}</view>
</view>
<view>
<view>发证日期:{{item.issue_date}}</view>
</view>
</view>
<view>
<view style="color:green">通过考核</view>
</view>
</view>
</view>
<!-- <view v-else style="text-align:center">暂无证书信息</view> -->
</view>
</view>
</template>
<script>
export default {
data() {
return {
search:'',
candidates:[{
consumer_name:'shijing',
number:'XJ8937264',
issue_date:'2024-05-26'
}],
query: {
page: 1,
limit: 10
},
type:0,
form: {
number: '',
name: '',
deptName: ''
},
warningTxtx:'请输入信息进行查询',
imgSrc:'',
showImg:false,
dataList:[{
证书方案:'202309',
姓名:'shijing',
是否内审员:true,
是否授权签字人:true,
是否质量负责人:true,
是否最高管理者:true,
证书编号:"DXCTC20240530",
所属单位:'zhogncun',
单位名称:'zhogncun',
}],
showErr:false,
errMsg:''
}
},
methods: {
typeChange(index){
let that = this;
that.dataList = [];
this.type = index;
that.showImg = false;
that.imgSrc = '';
},
searchClick(type){
let that = this;
that.dataList = [];
that.showImg = false;
that.imgSrc = '';
if(that.type==0){
if(that.form.number!==''){
this.$u.api.certificateList({证书编号:that.form.number,page:0}).then(res => {
debugger;
console.log(res.data.data)
if(res.data.data.length>0){
that.dataList = res.data.data;
}else{
that.warningTxtx='暂未查询到您的相关证书!'
}
})
}else{
that.errMsg = '请输入证书编号';
that.showErr = true;
setTimeout(()=>{
that.showErr = false;
},1500)
}
}else{
if(that.form.name!==''){
if(that.form.deptName!==''){
this.$u.api.certificateList({姓名:that.form.name,单位名称:that.form.deptName,page:0}).then(res => {
if(res.data.data.length>0){
that.dataList = res.data.data;
}else{
this.$u.api.certificateList({姓名:that.form.name,所属单位:that.form.deptName,page:0}).then(res => {
if(res.data.data.length>0){
that.dataList = res.data.data;
}else{
that.warningTxtx='暂未查询到您的相关证书!'
}
})
}
})
}else{
that.errMsg = '请输入所属单位';
that.showErr = true;
setTimeout(()=>{
that.showErr = false;
},1500)
}
}else{
that.errMsg = '请输入姓名';
that.showErr = true;
setTimeout(()=>{
that.showErr = false;
},1500)
}
}
},
showImage(data){
let that = this;
let timer = new Date().getTime();
if(data.证书地址!==null){
that.imgSrc = 'https://testsearch.ctc.ac.cn'+data.证书地址+'?'+timer;
that.showImg = true;
}else{
// axios.get(`https://testsearch.ctc.ac.cn/api/edu/certificate/${data.id}/`).then(res=>{
// if(res.data){
// let data1 = res.data.data;
// that.imgSrc = 'https://testsearch.ctc.ac.cn'+data1.证书地址+'?'+timer;
// that.showImg = true;
// }else{
// that.warningTxtx='暂未查询到您的相关证书!'
// }
// })
}
},
searchCandidates() {
if(this.search!==null&&this.search!==''){
console.log(this.search)
uni.showLoading({
title:"正在获取证书",
})
var data = {search:this.search};
this.$u.api.certificateList(data).then(res=>{
uni.hideLoading()
this.candidates = res
}).catch(e=>{
uni.hideLoading()
})
}else{
uni.showToast({
title:'请填写正确的证书编号或身份证号',
icon:'none'
})
return
}
},
}
}
</script>
<style>
page{
height: 100%;
background-color: #ededed;
}
</style>
<style scoped>
.searWrap{
display: flex;
/* margin-top: 30rpx; */
padding: 20rpx 0;
background: #ffffff;
}
.searchBtn{
/* flex: 2; */
width: 150rpx;
height: 100rpx;
line-height: 100rpx;
text-align: center;
color: #ffffff;
border-radius: 40rpx;
margin-right: 20rpx;
background-color:#438af4 ;
}
.infoInput{
flex: 4;
height: 100rpx;
line-height: 100rpx;
padding: 0 20rpx;
box-sizing: border-box;
border: 1rpx solid #dddddd;
border-radius: 40rpx;
margin: 0 20rpx;
}
.listWrap{
padding: 20rpx;
margin-top: 20rpx;
box-sizing: border-box;
background: #ffffff;
}
.listTitle{
height: 70rpx;
padding-left: 30rpx;
line-height: 70rpx;
font-size: 36rpx;
}
</style>

View File

@ -1,32 +1,33 @@
<template>
<view>
<uni-list>
<uni-list-item v-for="item in list" :key="item.id" @click="goDetail(item.id)" :clickable="true" link>
<uni-list-item v-for="item in list" :key="item.id" @click="goDetail(item.id)" :clickable="true" link style="padding: 10upx;">
<!-- 自定义 body -->
<template slot="body" style="display: block;">
<template slot="body" style="display: block;width: 100%;">
<view class="infoHead" style="">
<view>
<!-- <text v-if="item.type=='自助模考'">模拟练习</text> -->
<text style="font-weight: bold;color:orange">{{item.type}}</text>
<text style="font-weight: bold;">{{item.exam_name}}</text>
<text v-if="item.name.indexOf('(补)') != -1">()</text>
</view>
<view style="color:gray;font-size: 26rpx;">
<span>耗时:
<span style="color:darkblue;font-weight: bold;">{{item.took_format}}</span>
</span>
-
<text>提交时间:{{item.create_time}}</text>
<span style="font-size: 26upx;">总分{{item.total_score}}</span>
</view>
<view style="color:gray;font-size: 26rpx;">
<span>总分:{{item.total_score}}</span>
-
<span>得分:
<span style="color:green;font-weight: bold;">{{item.score}}</span>
<view class="infoLine">
<span>耗时
<span style="color:#e47d25;">{{item.took_format}}</span>
</span>
</view>
<view class="infoLine">
<text>提交时间{{item.create_time}}</text>
</view>
<view class="infoLine">
<span>本次得分
<span class='scoreClass'>{{item.score}}</span>
</span>
</view>
</template>
</uni-list-item>
</uni-list>
<view style="color:gray;text-align: center;margin-top:20upx">{{loadingText}}</view>
<view class="loadingText">{{loadingText}}</view>
</view>
</template>
@ -48,11 +49,11 @@
that.$u.api.examRecord(that.listQuery).then(res => {
uni.stopPullDownRefresh()
uni.setNavigationBarTitle({
title: res.data.count + '答题记录'
title: res.data.count + '考试记录'
})
if (that.listQuery.page == 1) {
if (res.data.results.length == 0) {
that.loadingText = '暂无答题记录'
that.loadingText = '暂无考试记录'
} else {
that.loadingText = ''
that.list = res.data.results
@ -70,7 +71,7 @@
},
goDetail(id) {
uni.showLoading({
title:"正在获取答题详情",
title:"正在获取考试详情",
})
this.$u.api.examRecordDetail(id).then(res=>{
uni.hideLoading()
@ -112,4 +113,26 @@
background-color: $u-bg-color;
}
.infoHead{
display: flex;
justify-content: space-between;
height: 64upx;
line-height: 60upx;
}
.infoLine{
color:gray;
font-size: 28upx;
height: 40upx;
line-height: 40upx;
}
.scoreClass{
color:#2581e4;
font-weight: bold;
font-size: 34upx;
}
.loadingText{
color:gray;
text-align: center;
margin-top:20upx
}
</style>

View File

@ -4,13 +4,13 @@
</view> -->
<view style="background-color: #2581e4;">
<u-image :src="imageURL" mode="widthFix"></u-image>
<view style="background-color: #2581e4;font-weight: bold;font-size: 30rpx;color:white;padding-left:8rpx">欢迎您:{{vuex_user.name}}</view>
<view class="welcome">欢迎您{{vuex_user.name}}</view>
</view>
<!-- <u-swiper @change="change" :height="250" :list="swiper_list" :title="swtitle" :effect3d="effect3d"
:indicator-pos="indicatorPos" :mode="mode" :interval="3000" @click="click"></u-swiper> -->
<view style="margin-bottom: 12rpx;">
<view style="margin: 12rpx;">
<u-grid :col="3" :border="false">
<u-grid-item v-for="(item, index) in grids" v-bind:key="index" @click="clickGrid(item)">
<u-icon :name="item.icon" color="#2b85e4" size="80"></u-icon>
@ -88,6 +88,21 @@
name: '手册/资料',
icon: 'file-text',
path: '/pages/document/index',
},
{
name: '考试',
icon: 'file-text',
path: '/pages/exam/exam',
},
{
name: '考试记录',
icon: 'file-text',
path: '/pages/exam/record',
},
{
name: '证书查询',
icon: 'file-text',
path: '/pages/certificate/index',
}
],
headstyle: {
@ -161,6 +176,15 @@
</style>
<style lang="scss" scoped>
.welcome{
background-color: #2581e4;
// font-weight: bold;
font-size: 24rpx;
color:white;
padding-left:8rpx;
height: 50rpx;
line-height: 46rpx;
}
.u-body-item-title {
font-size: 32rpx;
color: #333;

View File

@ -115,6 +115,17 @@
this.$u.vuex('vuex_token', res.data.access)
this.$u.api.getUserInfo().then(res => {
this.$u.vuex('vuex_user', res.data)
if(res.data.wxmp_openid){}else{
uni.login({
provider: 'weixin',
success: (loginRes)=>{
this.$u.api.bindmp({code:loginRes.code}).then(res=>{
// this.$u.toast('绑定成功');
this.$u.vuex('vuex_user.wxmp_openid', res.data.wxmp_openid)
}).catch(e=>{})
}
});
}
// 修改资源请求地址
this.$u.vuex('vuex_user.avatar', this.vuex_user.avatar +
'?token=' + this.vuex_token)

View File

@ -16,6 +16,16 @@
<view style="margin-top: 16rpx;">
<u-button @click="submit" type="warning" >登录</u-button>
</view>
<view class="alternative">
<navigator url="login" class="password" open-type="navigate">验证码登录</navigator>
</view>
<u-verification-code seconds="30" ref="uCode" @change="codeChange"></u-verification-code>
<view style="text-align: center;">
<view class="icon">
<u-icon size="70" name="weixin-fill" color="rgb(83,194,64)" @click="mpLogin"></u-icon>
</view>
微信登录
</view>
</view>
</view>
</template>
@ -81,6 +91,20 @@ export default {
this.$u.vuex('vuex_token', res.data.access)
this.$u.api.getUserInfo().then(res=>{
this.$u.vuex('vuex_user', res.data)
if(res.data.wxmp_openid){}else{
uni.login({
provider: 'weixin',
success: (loginRes)=>{
this.$u.api.bindmp({code:loginRes.code}).then(res=>{
// this.$u.toast('绑定成功');
this.$u.vuex('vuex_user.wxmp_openid', res.data.wxmp_openid)
}).catch(e=>{})
}
});
}
// 修改资源请求地址
this.$u.vuex('vuex_user.avatar', res.data.avatar +
'?token=' + this.vuex_token)
@ -99,6 +123,45 @@ export default {
console.log('验证失败');
}
});
},
codeChange(text) {
this.codeTips = text;
},
mpLogin() {
uni.showLoading({
title: '微信登录中...',
mask: true
})
uni.login({
provider: 'weixin',
success: (loginRes) => {
this.$u.api.wxmplogin({
code: loginRes.code
}).then(res => {
this.$u.vuex('vuex_token', res.data.access)
this.$u.api.getUserInfo().then(res => {
uni.hideLoading()
uni.showToast({
title: "登录成功",
icon: "none"
})
uni.reLaunch({
url: "/pages/home/home"
})
this.$u.vuex('vuex_user', res.data)
// 修改资源请求地址
this.$u.vuex('vuex_user.avatar', this.vuex_user.avatar +
'?token=' + this.vuex_token)
})
}).catch(e => {
uni.hideLoading()
uni.showToast({
title: "暂未绑定微信!",
icon: "none"
})
})
}
});
}
}
};