123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- #include "awExamScore.h"
- #include "ui_awExamScore.h"
- #include "CAppInfo.h"
- #include "awMsgBox.h"
- awExamScore::awExamScore(QWidget *parent) :
- QWidget(parent),
- ui(new Ui::awExamScore)
- {
- ui->setupUi(this);
- setStyleSheet(g_appInfoPtr->m_sQssStr);
- qRegisterMetaType<CGetExamProperty>("CGetExamProperty");
- connect(g_httpBllPtr.get(), &CHttpBll::sgnGetExamProperty, this, &awExamScore::onGetExamProperty);
- CHttpRequestPackage hrp;
- hrp.sUri = QString("/api/ecs_exam_work/exam/getExamPropertyFromCacheByStudentSession/%1/%2")
- .arg(g_appInfoPtr->m_oExamInfo.nExamId).arg("SNAPSHOT_INTERVAL,PRACTICE_TYPE,FREEZE_TIME");
- hrp.nRequestType = RequestType::rtGetExamProperty;
- hrp.sCommonStr = "AFTER_EXAM_REMARK,IS_OBJ_SCORE_VIEW,SHOW_CHEATING_REMARK,CHEATING_REMARK";
- g_httpBllPtr->get(hrp);
- }
- awExamScore::~awExamScore()
- {
- delete ui;
- }
- void awExamScore::setUI(const int nLeft, const int nTop, const int nWidth, const int nHeight)
- {
- setGeometry(nLeft, nTop, nWidth, nHeight);
- ui->widget_awes_BG->setGeometry(0, 0, nWidth, nHeight);
- ui->label_awes_title->adjustSize();
- ui->label_awes_title->setGeometry((ui->widget_awes_BG->width() - ui->label_awes_title->width())/2, g_appInfoPtr->m_fRate*58,
- ui->label_awes_title->width(), ui->label_awes_title->height());
- ui->label_awes_ptoto->setGeometry((ui->widget_awes_BG->width() - g_appInfoPtr->m_fRate*90)/2,
- ui->label_awes_title->y() + ui->label_awes_title->height() + g_appInfoPtr->m_fRate*20,
- g_appInfoPtr->m_fRate*90, g_appInfoPtr->m_fRate*120);
- QString sFileName = g_appInfoPtr->m_sStudentPhotoPath.right(g_appInfoPtr->m_sStudentPhotoPath.length() - g_appInfoPtr->m_sStudentPhotoPath.lastIndexOf("/") - 1);
- sFileName = g_appInfoPtr->m_sCacheFileDir + sFileName;
- ui->label_awes_ptoto->setPixmap(QPixmap(sFileName).scaled(ui->label_awes_ptoto->width(), ui->label_awes_ptoto->height(),
- Qt::IgnoreAspectRatio));
- ui->label_awes_result->adjustSize();
- ui->label_awes_result->setGeometry((ui->widget_awes_BG->width() - ui->label_awes_result->width())/2, ui->label_awes_ptoto->y() + ui->label_awes_ptoto->height() + g_appInfoPtr->m_fRate*20,
- ui->label_awes_result->width(), ui->label_awes_result->height());
- ui->txtb_awes_postNotice->setGeometry(g_appInfoPtr->m_fRate*40, ui->label_awes_result->y() + ui->label_awes_result->height() + g_appInfoPtr->m_fRate*40,
- ui->widget_awes_BG->width() - g_appInfoPtr->m_fRate*40*2, g_appInfoPtr->m_fRate*164);
- ui->txtb_awes_breachNotice->setVisible(false);
- ui->txtb_awes_breachNotice->setGeometry(ui->txtb_awes_postNotice->x() + ui->txtb_awes_postNotice->width() + g_appInfoPtr->m_fRate*20,
- ui->txtb_awes_postNotice->y(), ui->txtb_awes_postNotice->width(), ui->txtb_awes_postNotice->height());
- ui->btn_awes_goback->setGeometry((ui->widget_awes_BG->width() - g_appInfoPtr->m_fRate*200)/2, ui->txtb_awes_postNotice->y() + ui->txtb_awes_postNotice->height() + g_appInfoPtr->m_fRate*30,
- g_appInfoPtr->m_fRate*200, g_appInfoPtr->m_fRate*40);
- }
- void awExamScore::onGetExamProperty(CGetExamProperty getExamProperty)
- {
- if (getExamProperty.nCode == 200)
- {
- if (getExamProperty.sType == "AFTER_EXAM_REMARK,IS_OBJ_SCORE_VIEW,SHOW_CHEATING_REMARK,CHEATING_REMARK")
- {
- if (getExamProperty.bShowCheatingRemark)
- {
- ui->txtb_awes_breachNotice->setVisible(true);
- ui->txtb_awes_postNotice->setGeometry(g_appInfoPtr->m_fRate * 40, ui->label_awes_result->y() + ui->label_awes_result->height() + g_appInfoPtr->m_fRate * 40,
- (ui->widget_awes_BG->width() - g_appInfoPtr->m_fRate * 40 * 2 - g_appInfoPtr->m_fRate*20)/2, g_appInfoPtr->m_fRate * 164);
- ui->txtb_awes_breachNotice->setGeometry(ui->txtb_awes_postNotice->x() + ui->txtb_awes_postNotice->width() + g_appInfoPtr->m_fRate * 20,
- ui->txtb_awes_postNotice->y(), ui->txtb_awes_postNotice->width(), ui->txtb_awes_postNotice->height());
- ui->txtb_awes_breachNotice->insertHtml(getExamProperty.sCheatingRemark);
- }
- ui->txtb_awes_postNotice->insertHtml(getExamProperty.sAfterExamRemark);
- if (getExamProperty.bIsObjScoreView)
- {
- //获取客观分
- ui->label_awes_result->setText(QString::fromLocal8Bit("考试结果计算中..."));
- CHttpRequestPackage hrp;
- hrp.sUri = QString("/api/ecs_oe_student/client/exam/process/getEndExamInfo");
- hrp.sParamList.push_back(QString("examRecordDataId,%1").arg(g_appInfoPtr->m_oExamInfo.nExamRecordDataId));
- hrp.nRequestType = RequestType::rtGetEndExamInfo;
- hrp.eParamType = HttpParamType::hptUrl;
- g_httpBllPtr->post(hrp);
- }
- else
- {
- //显示交卷成功
- ui->label_awes_result->setText(QString::fromLocal8Bit("交卷完成"));
- }
- }
- }
- else
- {
- if(getExamProperty.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("获取考试信息失败"), g_appInfoPtr->m_pAnsBgWidget);
- }
- else
- {
- ShowMsg(getExamProperty.sMessage, g_appInfoPtr->m_pAnsBgWidget);
- }
- }
- }
- void awExamScore::onGetEndExamInfo(CGetEndExamInfo getEndExamInfo)
- {
- if (getEndExamInfo.nCode == 200)
- {
- ui->label_awes_result->setText(QString::fromLocal8Bit("客观题得分:%1").arg(getEndExamInfo.fObjectiveScore));
- }
- else
- {
- if(getEndExamInfo.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("获取考试信息失败"), g_appInfoPtr->m_pAnsBgWidget);
- }
- else
- {
- ShowMsg(getEndExamInfo.sMessage, g_appInfoPtr->m_pAnsBgWidget);
- }
- }
- }
- void awExamScore::on_btn_awes_goback_clicked()
- {
- emit goHomePage();
- }
|