添加证书

This commit is contained in:
@fawn-nine
2024-09-14 16:06:35 +08:00
parent d3097edd2c
commit 5ee3ec4398
15 changed files with 407 additions and 133 deletions

View File

@@ -2,8 +2,8 @@
<view>
<public-module></public-module>
<z-nav-bar title="班级详情"></z-nav-bar>
<!-- <text class="small_btn retake border_radius_10" @click="goTest()">再考一次</text> -->
<text class="" @click="showSubmit">提交证件资料</text>
<text class="small_btn retake border_radius_10" @click="goTest()">再考一次</text>
<!-- <text class="" @click="showSubmit">提交证件资料</text> -->
<view class="mainContent" v-if="thisClass.id">
<view :class="['classStatus',
thisClass.state == '0' ? 'daikai' :'',
@@ -53,11 +53,11 @@
<!-- v-if="thisClass.state == '3'" -->
<view class="optionsBox">
<!-- v-show="thisClass.state == '2'" -->
<view class="chengji" style="text-align: center;">
<view class="chengji zong" style="text-align: center;">
<view style="margin-top: 20rpx;">总成绩
<text class="scoreNumber greenScore">{{performanceScore.userScore}}</text>
<view class="">
<view class="">
<view class="" style="margin: 20rpx 0;">
<text class="c999">{{performanceScore.examScore}}分考试分 <uni-icons type="eye"
size="20" color="#999" @click="showPaperList = true"></uni-icons></text>
<text class="c999">{{performanceScore.usualScore}}分平时表现分</text>
@@ -70,12 +70,16 @@
<text class="blueScore" v-else-if="performanceScore.userScore >= 60 && performanceScore.userScore < 70"> B </text>
<text class="small_btn border_radius_10 zhengshu" @click="showSubmit">{{certificate && certificate.id ? '查看证书' : '生成证书'}}</text>
</view>
<!-- <view style="margin-top: 20rpx; text-align: center;">很遗憾您的成绩未达标</view> -->
<view class="" style="margin-top: 20rpx; text-align: center;"
v-if="performanceScore.userScore < 60 && newCLass && newCLass.id">
<text class="small_btn chongxiu border_radius_10"
@click="onPageJump('/pages/miniClass/classInfo',newCLass.id)">加入新班级重修</text>
</view>
<template v-if="performanceScore.userScore < 60">
<view class="flex_box flex_center align-items_box">
<text style="margin-top: 20rpx; text-align: center;">很遗憾您的成绩未达标</text>
<view class="" style="margin-top: 20rpx; text-align: center;"
v-if="newCLass && newCLass.id">
<text class="small_btn chongxiu border_radius_10"
@click="onPageJump('/pages/miniClass/classInfo',newCLass.id)">加入新班级重修</text>
</view>
</view>
</template>
</view>
</view>
</view>
@@ -127,7 +131,7 @@
</view>
</view>
<view class="pingfenBox"
v-if="thisClass.state == '1' || thisClass.state == '3' || thisClass.state == '2'">
v-if="thisClass.state != '0' && tijiaoTitleList.length > 0">
<view class="scoreTitle">
<view class="titles flex_box">
<text>表现分</text><uni-icons type="help" size="18" color="#fff"
@@ -431,11 +435,36 @@
</u-popup>
<!-- <addCerInfo v-if="showSubmitInfoBlank" :submitInfo="submitInfo" @close="closeManager" ></addCerInfo> -->
<u-popup key="5" :show="showSubmitInfoBlank" :round="10" @close="closeManager">
<view class="guanli">
<h3>信息展示</h3>
<view class="guanli userinfoPup">
<view class="" style="text-align: center; margin-bottom: 40rpx;">
<h3>信息确认</h3>
<text style="color: #666;">请确认以下证书信息证书一经生成后不可更改</text>
</view>
<view class="tips border_radius_10">
{{submitInfo.name}}-{{submitInfo.photo}}
<!-- {{submitInfo.name}}-{{submitInfo.photo}} -->
<view class="flex_box align-items_box item">
<text class="mr20rpx">证书姓名</text>
<text class="mr20rpx">
{{submitInfo.name && submitInfo.name != '' && submitInfo.name != null ? submitInfo.name : '未设置'}}
</text>
<text class="small_btn border_radius_10"
v-if="!submitInfo.name || submitInfo.name != '' || submitInfo.name != null"
@click="onPageJump('/pages/mine/userInfo/persData')" style="display: block; height: 30px;">
{{submitInfo.name && submitInfo.name != '' && submitInfo.name != null ? '去修改' : '去设置'}}
</text>
</view>
<view class="flex_box align-items_box item">
<text class="mr20rpx">证书照片</text>
<image @click="preveImg(submitInfo.photo)" class="mr20rpx" v-if="submitInfo.photo && submitInfo.photo != '' && submitInfo.photo != null"
:src="submitInfo.photo" mode="widthFix" style="width:100rpx; height:140rpx;"></image>
<text class="mr20rpx" v-else>未上传</text>
<text class="small_btn border_radius_10" v-if="!submitInfo.photo || submitInfo.photo != '' || submitInfo.photo != null"
@click="onPageJump('/pages/mine/userInfo/persData')" style="display: block; height: 30px;">{{submitInfo.photo && submitInfo.photo != '' && submitInfo.photo != null ? '去修改' : '去上传'}}</text>
</text>
</view>
</view>
<view class="btn_box_certificate"><button @click="createCertificate">立即生成证书</button></view>
</view>
</u-popup>
<!-- <z-navigation></z-navigation> -->
@@ -609,7 +638,8 @@
this.pPage = 0
this.taskList = []
this.getList()
})
})
// uni.$on('refreshUserAnswerList',() => {
// console.log('开始刷新用户提交列表');
// this.pPage = 0
@@ -658,16 +688,18 @@
console.log('正在进行中的试卷信息', historyPaper);
this.ingPaper = historyPaper
// console.log('对比----------------', historyPaper.classId, this.classId);
if (historyPaper && historyPaper != null && historyPaper.classId == this.classId) {
var planEndTimeDate = new Date(historyPaper.planEndTime)
paperEndTime = planEndTimeDate.getTime(); // 结束的时间戳
if (historyPaper && historyPaper != null && historyPaper.relationId == this.classId) {
// var planEndTimeDate = new Date(historyPaper.planEndTime)
// paperEndTime = planEndTimeDate.getTime(); // 结束的时间戳
paperEndTime = historyPaper.planEndTime
console.log('+++++++++',paperEndTime);
this.examId = historyPaper.id
} else {
this.examId = undefined
paperEndTime = 0
}
severNowTime = await this.getServerTime()
// console.log('//////////////', paperEndTime, severNowTime);
console.log('//////////////', paperEndTime, severNowTime);
if (severNowTime > -1 && paperEndTime - severNowTime > 0) {
var secondTimeDif = paperEndTime - severNowTime
this.timeDif.hour = parseInt((secondTimeDif % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
@@ -681,6 +713,14 @@
}
}
if(this.thisClass.state == '2'){
var userObj = await this.getUserData()
if(userObj){
this.submitInfo.name = userObj.name
this.submitInfo.photo = userObj.photo
// this.showSubmitInfoBlank = true
}
}
},
components: {
sutdentScoreList,
@@ -768,22 +808,17 @@
if(this.certificate && this.certificate.id){
// 已生成
uni.navigateTo({
url:'去个人中心'
url:'/pages/certificate/certificate'
})
}else{ // 未生成
var userObj = await this.getUserData()
if(userObj){
this.submitInfo.name = userObj.name
this.submitInfo.photo = userObj.photo
this.showSubmitInfoBlank = true
}
}else{ // 未生成
this.showSubmitInfoBlank = true
}
},
async getUserData() {
let that = this;
var Ss = undefined
var Ss = undefined
// 获取个人信息
if (this.userInfo.id != undefined) {
await this.$http
@@ -865,7 +900,7 @@
})
.then((res) => {
if (res.code == 0) {
console.log('获取试卷列表', res);
// console.log('获取试卷列表', res);
this.paperList = res.examPaper
if (this.paperList.length > 0) {
var _list = [...this.paperList]
@@ -991,6 +1026,75 @@
});
},
// 生成证书
createCertificate(){
if(this.submitInfo.name && this.submitInfo.name != null && this.submitInfo.name != ''
&& this.submitInfo.photo && this.submitInfo.photo != null && this.submitInfo.photo != ''){
}else{
uni.showModal({
title:'提示',
content:"真实姓名或证书照片未设置,请设置完成后再来生成证书吧",
cancelText:'稍后设置',
confirmText:'立即设置',
success: (res) => {
if (res.confirm) {
uni.navigateTo({
url:'/pages/mine/userInfo/persData'
})
}
}
})
return
}
var type = undefined
if(this.performanceScore.userScore >= 60 && this.performanceScore.userScore < 70){
type = 'B'
}else if(this.performanceScore.userScore >= 70){
type = 'A'
}else{
uni.showToast({
title:'您的成绩未达到证书水平,请继续努力'
})
return
}
var data = {
"type": type, //证书类型A a证 B b证 ZK自考
"relationId": this.classId //小班id、课程id
}
// console.log('证书提交数据',data,this.performanceScore.userScore);
$http.request({
url: "common/class/generateCertificateClass",
method: "POST",
data,
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(async (res) => {
if (res.code == 0) {
console.log('证书返回值', res);
uni.showToast({
title: '生成成功',
icon: 'none'
})
setTimeout(()=>{
this.closeManager()
this.getScore()
},300)
} else {
uni.showToast({
title: res.errMsg,
icon: 'none'
})
}
}).catch(e => {
uni.showToast({
title: e.errMsg,
icon: 'none'
})
});
},
// 查询平时表现分+ 最终成绩 + 可加入的新班级 + 证书信息
async getScore() {
$http.request({
@@ -1013,11 +1117,13 @@
}else{
// >= 60
if(this.thisClass.state == '2' ){
var certificate = await this.getCertificateInfo()
if(certificate && certificate.id){
this.certificate = certificate
var certificate = await this.getCertificateInfo()
if(certificate && certificate.length > 0 && certificate[0].id){
this.certificate = certificate[0]
}
console.log('this.certificate',certificate);
}
}
} else {
uni.showToast({
@@ -1035,7 +1141,7 @@
// 查询证书获得情况
async getCertificateInfo(){
var _obj = undefined
$http.request({
await $http.request({
url: "common/class/getUserCertificateByClassId",
method: "POST",
data: {
@@ -1046,7 +1152,7 @@
'Content-Type': 'application/json'
},
})
.then((res) => {
.then( (res) => {
if (res.code == 0) {
// this.newCLass = res.result
console.log('证书数据', res);
@@ -1100,7 +1206,7 @@
// 继续考试
continueTest(id) {
uni.navigateTo({
url: `/pages/miniClass/continueTest?id=${id}`
url: `/pages/miniClass/continueTest?id=${id}&classId=${this.classId}`
})
},
radioChange1(e) {
@@ -1448,6 +1554,14 @@
taskEdit(item) {
console.log('taskEdit'.item);
},
// 图片预览
preveImg(url){
console.log('dianjile fangda tu');
uni.previewImage({
urls: [url],
current: 0
});
},
// 退出班级 // 踢出班级
outClass(userId) {
let that = this
@@ -1530,7 +1644,7 @@
},
})
.then(async res => {
// console.log('班级信息', res);
console.log('班级信息', res);
this.refresh = false
if (res.code == 0) {
// res = classData // 测试数据
@@ -1740,8 +1854,9 @@
margin-bottom: 20rpx;
}
.zhengshu {
.zhengshu { margin-left: 20rpx;
color: #ffaa7f;
font-size: 28rpx;
border: 1px solid #ffaa7f
}
@@ -1765,6 +1880,7 @@
}
.scoreNumber {
// display: block; margin: 20rpx 0;
font-size: 60rpx;
}
@@ -1815,6 +1931,11 @@
margin-top: 20rpx;
border-top: 1px solid #eee;
}
.chengji.zong{
margin-top: 0;
padding-top: 0;
border-top: none;
}
.manBtnBox {
justify-content: center;
@@ -2292,9 +2413,29 @@
}
.optionsBox {}
.btn_box_certificate {
margin-top: 70rpx;
padding-bottom: 20rpx;
button {
font-size: 32rpx;
@include theme('btn_bg') color: #fff;
height: 80rpx;
line-height: 80rpx;
border-radius: 50rpx;
}
}
.retake {
border: 1px solid #55aa00;
color: #55aa7f;
}
.mr20rpx{
margin-right: 20rpx;
}
.userinfoPup{
.tips{
// .item{justify-content: space-around;}
}
.small_btn{color: #55aaff; border: #55aaff 1px solid ;}
}
</style>