|
|
|
@ -3,7 +3,8 @@
|
|
|
|
|
<ch-nav-bar title="考试详情" :height="66"></ch-nav-bar>
|
|
|
|
|
<uni-list>
|
|
|
|
|
<uni-list-item :showArrow="false" title="考试名称" :rightText="exam.examname" />
|
|
|
|
|
<uni-list-item :showArrow="false" title="提交状态" :rightText="status" />
|
|
|
|
|
<uni-list-item :showArrow="false" title="考试状态" :rightText="status" />
|
|
|
|
|
<uni-list-item :showArrow="false" title="提交状态" :rightText="studentStatus" />
|
|
|
|
|
<uni-list-item :showArrow="false" title="得分" :rightText="exam.studentscore + ''" />
|
|
|
|
|
<uni-list-item :showArrow="false" title="考试图片" />
|
|
|
|
|
<!-- <uni-file-picker
|
|
|
|
@ -27,7 +28,7 @@
|
|
|
|
|
:url="uploadUrl">
|
|
|
|
|
</ch-image-uploader>
|
|
|
|
|
</uni-list>
|
|
|
|
|
<button class="submit-btn" type="primary" :loading="uploading" :disabled="isDisable" @click="submitExam">提交图片</button>
|
|
|
|
|
<button class="submit-btn" type="primary" :loading="uploading" :disabled="isDisable" @click="submitExam" v-if="status === '进行中'">提 交</button>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
@ -59,8 +60,7 @@ const data = reactive({
|
|
|
|
|
const { exam, img, imgStyle , files, examId, uploading } = toRefs(data);
|
|
|
|
|
|
|
|
|
|
const isDisable = computed(() => {
|
|
|
|
|
console.log('files', files.value)
|
|
|
|
|
!files.value.length || uploading.value
|
|
|
|
|
return !files.value.length || uploading.value
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const status = computed(() => {
|
|
|
|
@ -69,6 +69,12 @@ const status = computed(() => {
|
|
|
|
|
return exam.value.status == 1 ? '进行中' : '已结束'
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const studentStatus = computed(() => {
|
|
|
|
|
if (!exam.value.studentstatus) return ''
|
|
|
|
|
|
|
|
|
|
return exam.value.studentstatus == 1 ? '已提交' : '未提交'
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const uploadUrl = computed(() => {
|
|
|
|
|
return `${config.baseUrl}/api/user.ashx?act=subexaminfo&studentid=${userId}&examid=${examId.value}`
|
|
|
|
|
})
|
|
|
|
@ -86,24 +92,52 @@ onMounted(() => {
|
|
|
|
|
// examid: 1,
|
|
|
|
|
// studentid: 1
|
|
|
|
|
// }
|
|
|
|
|
getExamInfo(params, { loading: true }).then(info => {
|
|
|
|
|
exam.value = info;
|
|
|
|
|
if (!info.studentimg) return;
|
|
|
|
|
files.value = [{
|
|
|
|
|
name: 'studentimg',
|
|
|
|
|
extname: 'image/png',
|
|
|
|
|
path: `${info.studentimg}`
|
|
|
|
|
}]
|
|
|
|
|
})
|
|
|
|
|
getInfo(params, true)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 提交图片
|
|
|
|
|
function submitExam () {
|
|
|
|
|
uploading.value = true;
|
|
|
|
|
console.log(imgUploader)
|
|
|
|
|
imgUploader.value.upload()
|
|
|
|
|
.then(() => {
|
|
|
|
|
console.log('上传成功')
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '提交成功',
|
|
|
|
|
icon: 'success'
|
|
|
|
|
})
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
getInfo({
|
|
|
|
|
examid: examId.value,
|
|
|
|
|
studentid: userId
|
|
|
|
|
})
|
|
|
|
|
}, 1000)
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '提交失败',
|
|
|
|
|
icon: 'error'
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
uploading.value = false;
|
|
|
|
|
uploading.value = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getInfo (params, loading = false) {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
getExamInfo(params, { loading }).then(info => {
|
|
|
|
|
exam.value = info;
|
|
|
|
|
if (!info.studentimg) return;
|
|
|
|
|
files.value = [{
|
|
|
|
|
name: 'studentimg',
|
|
|
|
|
extname: 'image/png',
|
|
|
|
|
path: `${info.studentimg}`
|
|
|
|
|
}]
|
|
|
|
|
resolve(info)
|
|
|
|
|
})
|
|
|
|
|
.catch(error => {
|
|
|
|
|
reject(error)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|