awExamScore.cpp 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #include "awExamScore.h"
  2. #include "ui_awExamScore.h"
  3. #include "CAppInfo.h"
  4. #include "awMsgBox.h"
  5. awExamScore::awExamScore(QWidget *parent) :
  6. QWidget(parent),
  7. ui(new Ui::awExamScore)
  8. {
  9. ui->setupUi(this);
  10. setStyleSheet(g_appInfoPtr->m_sQssStr);
  11. qRegisterMetaType<CGetExamProperty>("CGetExamProperty");
  12. connect(g_httpBllPtr.get(), &CHttpBll::sgnGetExamProperty, this, &awExamScore::onGetExamProperty);
  13. CHttpRequestPackage hrp;
  14. hrp.sUri = QString("/api/ecs_exam_work/exam/getExamPropertyFromCacheByStudentSession/%1/%2")
  15. .arg(g_appInfoPtr->m_oExamInfo.nExamId).arg("SNAPSHOT_INTERVAL,PRACTICE_TYPE,FREEZE_TIME");
  16. hrp.nRequestType = RequestType::rtGetExamProperty;
  17. hrp.sCommonStr = "AFTER_EXAM_REMARK,IS_OBJ_SCORE_VIEW,SHOW_CHEATING_REMARK,CHEATING_REMARK";
  18. g_httpBllPtr->get(hrp);
  19. }
  20. awExamScore::~awExamScore()
  21. {
  22. delete ui;
  23. }
  24. void awExamScore::setUI(const int nLeft, const int nTop, const int nWidth, const int nHeight)
  25. {
  26. setGeometry(nLeft, nTop, nWidth, nHeight);
  27. ui->widget_awes_BG->setGeometry(0, 0, nWidth, nHeight);
  28. ui->label_awes_title->adjustSize();
  29. ui->label_awes_title->setGeometry((ui->widget_awes_BG->width() - ui->label_awes_title->width())/2, g_appInfoPtr->m_fRate*58,
  30. ui->label_awes_title->width(), ui->label_awes_title->height());
  31. ui->label_awes_ptoto->setGeometry((ui->widget_awes_BG->width() - g_appInfoPtr->m_fRate*90)/2,
  32. ui->label_awes_title->y() + ui->label_awes_title->height() + g_appInfoPtr->m_fRate*20,
  33. g_appInfoPtr->m_fRate*90, g_appInfoPtr->m_fRate*120);
  34. QString sFileName = g_appInfoPtr->m_sStudentPhotoPath.right(g_appInfoPtr->m_sStudentPhotoPath.length() - g_appInfoPtr->m_sStudentPhotoPath.lastIndexOf("/") - 1);
  35. sFileName = g_appInfoPtr->m_sCacheFileDir + sFileName;
  36. ui->label_awes_ptoto->setPixmap(QPixmap(sFileName).scaled(ui->label_awes_ptoto->width(), ui->label_awes_ptoto->height(),
  37. Qt::IgnoreAspectRatio));
  38. ui->label_awes_result->adjustSize();
  39. 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,
  40. ui->label_awes_result->width(), ui->label_awes_result->height());
  41. 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,
  42. ui->widget_awes_BG->width() - g_appInfoPtr->m_fRate*40*2, g_appInfoPtr->m_fRate*164);
  43. ui->txtb_awes_breachNotice->setVisible(false);
  44. ui->txtb_awes_breachNotice->setGeometry(ui->txtb_awes_postNotice->x() + ui->txtb_awes_postNotice->width() + g_appInfoPtr->m_fRate*20,
  45. ui->txtb_awes_postNotice->y(), ui->txtb_awes_postNotice->width(), ui->txtb_awes_postNotice->height());
  46. 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,
  47. g_appInfoPtr->m_fRate*200, g_appInfoPtr->m_fRate*40);
  48. }
  49. void awExamScore::onGetExamProperty(CGetExamProperty getExamProperty)
  50. {
  51. if (getExamProperty.nCode == 200)
  52. {
  53. if (getExamProperty.sType == "AFTER_EXAM_REMARK,IS_OBJ_SCORE_VIEW,SHOW_CHEATING_REMARK,CHEATING_REMARK")
  54. {
  55. if (getExamProperty.bShowCheatingRemark)
  56. {
  57. ui->txtb_awes_breachNotice->setVisible(true);
  58. 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,
  59. (ui->widget_awes_BG->width() - g_appInfoPtr->m_fRate * 40 * 2 - g_appInfoPtr->m_fRate*20)/2, g_appInfoPtr->m_fRate * 164);
  60. ui->txtb_awes_breachNotice->setGeometry(ui->txtb_awes_postNotice->x() + ui->txtb_awes_postNotice->width() + g_appInfoPtr->m_fRate * 20,
  61. ui->txtb_awes_postNotice->y(), ui->txtb_awes_postNotice->width(), ui->txtb_awes_postNotice->height());
  62. ui->txtb_awes_breachNotice->insertHtml(getExamProperty.sCheatingRemark);
  63. }
  64. ui->txtb_awes_postNotice->insertHtml(getExamProperty.sAfterExamRemark);
  65. if (getExamProperty.bIsObjScoreView)
  66. {
  67. //获取客观分
  68. ui->label_awes_result->setText(QString::fromLocal8Bit("考试结果计算中..."));
  69. CHttpRequestPackage hrp;
  70. hrp.sUri = QString("/api/ecs_oe_student/client/exam/process/getEndExamInfo");
  71. hrp.sParamList.push_back(QString("examRecordDataId,%1").arg(g_appInfoPtr->m_oExamInfo.nExamRecordDataId));
  72. hrp.nRequestType = RequestType::rtGetEndExamInfo;
  73. hrp.eParamType = HttpParamType::hptUrl;
  74. g_httpBllPtr->post(hrp);
  75. }
  76. else
  77. {
  78. //显示交卷成功
  79. ui->label_awes_result->setText(QString::fromLocal8Bit("交卷完成"));
  80. }
  81. }
  82. }
  83. else
  84. {
  85. if(getExamProperty.sMessage.isEmpty())
  86. {
  87. ShowMsg(QString::fromLocal8Bit("获取考试信息失败"), g_appInfoPtr->m_pAnsBgWidget);
  88. }
  89. else
  90. {
  91. ShowMsg(getExamProperty.sMessage, g_appInfoPtr->m_pAnsBgWidget);
  92. }
  93. }
  94. }
  95. void awExamScore::onGetEndExamInfo(CGetEndExamInfo getEndExamInfo)
  96. {
  97. if (getEndExamInfo.nCode == 200)
  98. {
  99. ui->label_awes_result->setText(QString::fromLocal8Bit("客观题得分:%1").arg(getEndExamInfo.fObjectiveScore));
  100. }
  101. else
  102. {
  103. if(getEndExamInfo.sMessage.isEmpty())
  104. {
  105. ShowMsg(QString::fromLocal8Bit("获取考试信息失败"), g_appInfoPtr->m_pAnsBgWidget);
  106. }
  107. else
  108. {
  109. ShowMsg(getEndExamInfo.sMessage, g_appInfoPtr->m_pAnsBgWidget);
  110. }
  111. }
  112. }
  113. void awExamScore::on_btn_awes_goback_clicked()
  114. {
  115. emit goHomePage();
  116. }