123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- #include "clObjectiveScore.h"
- #include "ui_clObjectiveScore.h"
- #include "CAppInfo.h"
- #include <QListWidgetItem>
- #include <QHBoxLayout>
- #include <QLabel>
- #include <QGraphicsDropShadowEffect>
- #include "logproc.h"
- #include "awMsgBox.h"
- clObjectiveScore::clObjectiveScore(int nRow, QString sExamStudentId, QWidget *parent) :
- QWidget(parent),
- ui(new Ui::clObjectiveScore), m_sExamStudentId(sExamStudentId), m_nRow(nRow)
- {
- ui->setupUi(this);
- setStyleSheet(g_appInfoPtr->m_sQssStr);
- qRegisterMetaType<CQueryObjectiveScoreList>("CQueryObjectiveScoreList");
- connect(g_httpBllPtr.get(), &CHttpBll::sgnQueryObjectiveScoreList, this, &clObjectiveScore::onQueryObjectiveScoreList);
- CHttpRequestPackage hrp;
- hrp.sUri = "/api/ecs_oe_admin/client/exam/process/queryObjectiveScoreList";
- hrp.nRequestType = RequestType::rtQueryObjectiveScoreList;
- hrp.eParamType = HttpParamType::hptUrl;
- hrp.sCommonStr = sExamStudentId;
- hrp.sParamList.push_back(QString("examStudentId,%1").arg(m_sExamStudentId));
- g_httpBllPtr->post(hrp);
- }
- clObjectiveScore::~clObjectiveScore()
- {
- awMsgBox::clear(this);
- delete ui;
- }
- void clObjectiveScore::setUI(const int nLeft, const int nTop, const int nWidth, const int nHeight)
- {
- setGeometry(nLeft, nTop, nWidth, nHeight);
- ui->widget_objevtiveScore->setGeometry(g_appInfoPtr->m_fRate*5, g_appInfoPtr->m_fRate*5, width()-g_appInfoPtr->m_fRate*10, height()-g_appInfoPtr->m_fRate*10);
- ui->lw_objectiveScore->setGeometry(g_appInfoPtr->m_fRate*20, g_appInfoPtr->m_fRate*10,
- ui->widget_objevtiveScore->width() - g_appInfoPtr->m_fRate*20,
- ui->widget_objevtiveScore->height() - g_appInfoPtr->m_fRate*10*2);
- /*
- QListWidgetItem *pItem = new QListWidgetItem;
- QSize size = pItem->sizeHint();
- size.setHeight(g_appInfoPtr->m_fRate*46);
- pItem->setSizeHint(size);
- ui->lw_objectiveScore->addItem(pItem);
- QWidget *w = new QWidget;
- w->setStyleSheet(QString("QWidget{background:rgba(19, 187, 138, 1); border-radius:%1px}").arg((int)(g_appInfoPtr->m_fRate*10)));
- QHBoxLayout *l = new QHBoxLayout;
- QString sLabelStyle = QString(R"(QLabel{
- font-size:%1px;
- font-family:"Microsoft YaHei";
- font-weight:400;
- color:rgba(255,255,255,1);})").arg((int)(g_appInfoPtr->m_fRate*12));
- QLabel *label_times = new QLabel;
- label_times->setText(QString::fromLocal8Bit("次数"));
- label_times->setStyleSheet(sLabelStyle);
- label_times->adjustSize();
- QLabel *label_startTime = new QLabel;
- label_startTime->setText(QString::fromLocal8Bit("开始时间"));
- label_startTime->setStyleSheet(sLabelStyle);
- label_startTime->adjustSize();
- QLabel *label_handinPaperTime = new QLabel;
- label_handinPaperTime->setText(QString::fromLocal8Bit("交卷时间"));
- label_handinPaperTime->setStyleSheet(sLabelStyle);
- label_handinPaperTime->adjustSize();
- QLabel *label_score = new QLabel;
- label_score->setText(QString::fromLocal8Bit("客观分"));
- label_score->setStyleSheet(sLabelStyle);
- label_score->adjustSize();
- l->addSpacing(g_appInfoPtr->m_fRate*20);
- l->addWidget(label_times);
- l->addStretch();
- l->addWidget(label_startTime);
- l->addStretch();
- l->addWidget(label_handinPaperTime);
- l->addStretch();
- l->addWidget(label_score);
- l->addSpacing(g_appInfoPtr->m_fRate*20);
- w->setLayout(l);
- ui->lw_objectiveScore->setItemWidget(pItem, w);
- */
- QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect;
- effect->setOffset(g_appInfoPtr->m_fRate*4,g_appInfoPtr->m_fRate*4);
- effect->setColor(QColor(0,0,0,30));
- effect->setBlurRadius(g_appInfoPtr->m_fRate*16);
- ui->widget_objevtiveScore->setGraphicsEffect(effect);
- }
- void clObjectiveScore::onQueryObjectiveScoreList(CQueryObjectiveScoreList queryObjectiveScoreList)
- {
- if (queryObjectiveScoreList.nCode == 200)
- {
- if(m_sExamStudentId == queryObjectiveScoreList.sExamStudentId)
- {
- ui->lw_objectiveScore->clear();
- QListWidgetItem *pItem = new QListWidgetItem;
- QSize size = pItem->sizeHint();
- size.setHeight(g_appInfoPtr->m_fRate * 46);
- pItem->setSizeHint(size);
- ui->lw_objectiveScore->addItem(pItem);
- QWidget *w = new QWidget;
- w->setStyleSheet(QString("QWidget{background:rgba(19, 187, 138, 1); border-radius:%1px}").arg((int)(g_appInfoPtr->m_fRate * 10)));
- QHBoxLayout *l = new QHBoxLayout;
- QString sLabelStyle = QString(R"(QLabel{
- font-size:%1px;
- font-family:"Microsoft YaHei";
- font-weight:400;
- color:rgba(255,255,255,1);})").arg((int)(g_appInfoPtr->m_fRate * 12));
- QLabel *label_times = new QLabel;
- label_times->setText(QString::fromLocal8Bit("次数"));
- label_times->setStyleSheet(sLabelStyle);
- label_times->adjustSize();
- QLabel *label_startTime = new QLabel;
- label_startTime->setText(QString::fromLocal8Bit("开始时间"));
- label_startTime->setStyleSheet(sLabelStyle);
- label_startTime->adjustSize();
- QLabel *label_handinPaperTime = new QLabel;
- label_handinPaperTime->setText(QString::fromLocal8Bit("交卷时间"));
- label_handinPaperTime->setStyleSheet(sLabelStyle);
- label_handinPaperTime->adjustSize();
- QLabel *label_score = new QLabel;
- label_score->setText(QString::fromLocal8Bit("客观分"));
- label_score->setStyleSheet(sLabelStyle);
- label_score->adjustSize();
- l->addSpacing(g_appInfoPtr->m_fRate * 20);
- l->addWidget(label_times);
- l->addStretch();
- l->addWidget(label_startTime);
- l->addStretch();
- l->addWidget(label_handinPaperTime);
- l->addStretch();
- l->addWidget(label_score);
- l->addSpacing(g_appInfoPtr->m_fRate * 20);
- w->setLayout(l);
- ui->lw_objectiveScore->setItemWidget(pItem, w);
- int nSzie = queryObjectiveScoreList.vObjectiveScore.size();
- for (int i = nSzie - 1; i >= 0; --i)
- {
- if(i == nSzie - 11)
- {
- break;
- }
- CObjectiveScore os = queryObjectiveScoreList.vObjectiveScore[i];
- QListWidgetItem *pItem = new QListWidgetItem;
- QSize size = pItem->sizeHint();
- size.setHeight(g_appInfoPtr->m_fRate * 46);
- pItem->setSizeHint(size);
- ui->lw_objectiveScore->addItem(pItem);
- QWidget *w = new QWidget;
- w->setStyleSheet(QString("QWidget{background:rgba(255, 255, 255, 1); border-radius:%1px}").arg((int)(g_appInfoPtr->m_fRate * 10)));
- QHBoxLayout *l = new QHBoxLayout;
- QString sLabelStyle = QString(R"(QLabel{
- font-size:%1px;
- font-family:"Microsoft YaHei";
- font-weight:400;
- color:rgba(51,51,51,1);})").arg((int)(g_appInfoPtr->m_fRate * 12));
- QString sLabelScoreStyle = QString(R"(QLabel{
- font-size:%1px;
- font-family:"Microsoft YaHei";
- font-weight:500;
- color:rgba(51,51,51,1);})").arg((int)(g_appInfoPtr->m_fRate * 12));
- QLabel *label_times = new QLabel;
- label_times->setText(QString::number(os.nExamOrder));
- label_times->setStyleSheet(sLabelStyle);
- label_times->adjustSize();
- QLabel *label_startTime = new QLabel;
- label_startTime->setText(os.sStartTime);
- label_startTime->setStyleSheet(sLabelStyle);
- label_startTime->adjustSize();
- QLabel *label_handinPaperTime = new QLabel;
- label_handinPaperTime->setText(os.sEndTime);
- label_handinPaperTime->setStyleSheet(sLabelStyle);
- label_handinPaperTime->adjustSize();
- if (label_handinPaperTime->width() < label_startTime->width())
- {
- label_handinPaperTime->setFixedWidth(label_startTime->width());
- }
- QLabel *label_score = new QLabel;
- QString sScoreText = QString::number(os.fObjectiveScore);
- if (os.bIsAuditing)
- {
- sScoreText = QString::fromLocal8Bit("审核中");
- }
- if (os.bIsIllegality)
- {
- sScoreText = QString::fromLocal8Bit("违纪");
- }
- label_score->setText(sScoreText);
- label_score->setStyleSheet(sLabelScoreStyle);
- label_score->adjustSize();
- l->addSpacing(g_appInfoPtr->m_fRate * 20);
- l->addWidget(label_times);
- l->addStretch();
- l->addWidget(label_startTime);
- l->addStretch();
- l->addWidget(label_handinPaperTime);
- l->addStretch();
- l->addWidget(label_score);
- l->addSpacing(g_appInfoPtr->m_fRate * 20);
- w->setLayout(l);
- ui->lw_objectiveScore->setItemWidget(pItem, w);
- }
- nSzie = nSzie > 10 ? 10 : nSzie;
- int nHeight = g_appInfoPtr->m_fRate * 46*(nSzie+1) + g_appInfoPtr->m_fRate * (10 + 5) + g_appInfoPtr->m_fRate * (20 + 5);
- emit objectiveScoreHeight(m_nRow, nHeight);
- }
- }
- else
- {
- if(queryObjectiveScoreList.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("获取客观题成绩失败"), (QWidget*)(this->parent()), MSG_ICON_TYPE::mit_error);
- }
- else
- {
- ShowMsg(queryObjectiveScoreList.sMessage, (QWidget*)(this->parent()), MSG_ICON_TYPE::mit_error);
- }
- }
- }
|