clOnlineExam.cpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. #include "clOnlineExam.h"
  2. #include "ui_clOnlineExam.h"
  3. #include "CAppInfo.h"
  4. #include "logproc.h"
  5. #include <QScrollBar>
  6. #include "awMsgBox.h"
  7. clOnlineExam::clOnlineExam(QWidget *parent) :
  8. QWidget(parent),
  9. ui(new Ui::clOnlineExam)
  10. {
  11. ui->setupUi(this);
  12. setStyleSheet(g_appInfoPtr->m_sQssStr);
  13. qRegisterMetaType<CQueryExamList>("CQueryExamList");
  14. connect(g_httpBllPtr.get(), &CHttpBll::sgnQueryExamList, this, &clOnlineExam::onQueryExamList);
  15. qRegisterMetaType<CQueryExamEndList>("CQueryExamEndList");
  16. connect(g_httpBllPtr.get(), &CHttpBll::sgnQueryExamEndList, this, &clOnlineExam::onQueryExamEndList);
  17. m_pObjectiveScoreTimer = std::make_shared<QTimer>();
  18. m_pObjectiveScoreTimer->setInterval(200);
  19. connect(m_pObjectiveScoreTimer.get(), &QTimer::timeout, this, [&]() {
  20. m_pObjectiveScoreTimer->stop();
  21. if (m_pObjectiveScore != nullptr)
  22. {
  23. m_pObjectiveScore.reset();
  24. }
  25. });
  26. m_pRefreshTimer = std::make_shared<QTimer>();
  27. m_pRefreshTimer->setInterval(1000);
  28. connect(m_pRefreshTimer.get(), &QTimer::timeout, this, [&]() {
  29. --m_nRefreshSeconds;
  30. ui->btn_refresh->setText(QString::fromLocal8Bit("倒计时%1s").arg(m_nRefreshSeconds));
  31. if(m_nRefreshSeconds <= 0)
  32. {
  33. m_pRefreshTimer->stop();
  34. ui->btn_refresh->setEnabled(true);
  35. ui->btn_refresh->setText(QString::fromLocal8Bit("刷新"));
  36. }
  37. });
  38. }
  39. clOnlineExam::~clOnlineExam()
  40. {
  41. delete ui;
  42. }
  43. void clOnlineExam::setUI(const int nWidth, const int nHeight)
  44. {
  45. setGeometry(0, 0, nWidth, nHeight);
  46. // ui->tabw_onlineExam->setGeometry(0, 0, nWidth, nHeight);
  47. // ui->tabw_onlineExam->setTabText(0, QString::fromLocal8Bit("待考列表"));
  48. // ui->tabw_onlineExam->setTabText(1, QString::fromLocal8Bit("已完成考试"));
  49. ui->tabw_onlineExam->setCurrentIndex(0);
  50. ui->btn_examList->setFixedSize(QSize(g_appInfoPtr->m_fRate*86, g_appInfoPtr->m_fRate*30));
  51. ui->btn_endExamList->setFixedSize(QSize(g_appInfoPtr->m_fRate*100, g_appInfoPtr->m_fRate*30));
  52. ui->btn_refresh->setFixedSize(QSize(g_appInfoPtr->m_fRate*86, g_appInfoPtr->m_fRate*30));
  53. ui->btn_examList->setStyleSheet(QString(R"(QPushButton{
  54. outline:none;
  55. border-radius:%1px;
  56. border:0px solid rgba(255,255,255,1);
  57. background:rgba(19, 187, 138, 1);
  58. font-size:%2px;
  59. font-family:"Microsoft YaHei";
  60. font-weight:500;
  61. color:rgba(255,255,255,1);
  62. })").arg((int)(g_appInfoPtr->m_fRate*15))
  63. .arg((int)(g_appInfoPtr->m_fRate*12)));
  64. ui->btn_endExamList->setStyleSheet(QString(R"(QPushButton{
  65. outline:none;
  66. border-radius:%1px;
  67. border:0px solid rgba(255,255,255,1);
  68. background:rgba(239, 240, 245, 1);
  69. font-size:%2px;
  70. font-family:"Microsoft YaHei";
  71. font-weight:500;
  72. color:rgba(153, 153, 153, 1);
  73. })").arg((int)(g_appInfoPtr->m_fRate*15))
  74. .arg((int)(g_appInfoPtr->m_fRate*12)));
  75. ui->vlayout_el->setContentsMargins(g_appInfoPtr->m_fRate*30, 0, g_appInfoPtr->m_fRate*30, 0);
  76. ui->vlayout_fel->setContentsMargins(g_appInfoPtr->m_fRate*30, 0, g_appInfoPtr->m_fRate*30, 0);
  77. ui->tablewt_examList->setEditTriggers(QAbstractItemView::NoEditTriggers);
  78. //整行选中的方式
  79. ui->tablewt_examList->setSelectionBehavior(QAbstractItemView::SelectRows);
  80. //设置为只能选中一行
  81. ui->tablewt_examList->setSelectionMode(QAbstractItemView::SingleSelection);
  82. //隐藏列表头
  83. ui->tablewt_examList->verticalHeader()->setVisible(false);
  84. //隐藏边框
  85. ui->tablewt_examList->setShowGrid(false);
  86. //表头不高亮显示
  87. ui->tablewt_examList->horizontalHeader()->setHighlightSections(false);
  88. //设置行数
  89. ui->tablewt_examList->setRowCount(10);
  90. //设置列数
  91. ui->tablewt_examList->setColumnCount(7);
  92. ui->tablewt_examList->setHorizontalScrollMode(QTableWidget::ScrollPerPixel);
  93. ui->tablewt_examList->horizontalScrollBar()->setSingleStep(g_appInfoPtr->m_fRate*5);
  94. QStringList sHeadStr;
  95. sHeadStr << QString::fromLocal8Bit("课程") <<
  96. QString::fromLocal8Bit("层次") <<
  97. QString::fromLocal8Bit("专业") <<
  98. QString::fromLocal8Bit("考试进入时间") <<
  99. QString::fromLocal8Bit("考试时间周期") <<
  100. QString::fromLocal8Bit("剩余考试次数") <<
  101. QString::fromLocal8Bit("操作");
  102. ui->tablewt_examList->setHorizontalHeaderLabels(sHeadStr);
  103. ui->tablewt_examList->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
  104. ui->tablewt_examList->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
  105. ui->tablewt_examList->verticalHeader()->setDefaultSectionSize(g_appInfoPtr->m_fRate*48);
  106. ui->tablewt_examList->setColumnWidth(0, g_appInfoPtr->m_fRate*116);
  107. ui->tablewt_examList->setColumnWidth(1, g_appInfoPtr->m_fRate*56);
  108. ui->tablewt_examList->setColumnWidth(2, g_appInfoPtr->m_fRate*104);
  109. ui->tablewt_examList->setColumnWidth(3, g_appInfoPtr->m_fRate*277);
  110. ui->tablewt_examList->setColumnWidth(4, g_appInfoPtr->m_fRate*305);
  111. ui->tablewt_examList->setColumnWidth(5, g_appInfoPtr->m_fRate*102);
  112. ui->tablewt_examList->setColumnWidth(6, g_appInfoPtr->m_fRate*146);
  113. ui->tablewt_examList->horizontalHeader()->setStretchLastSection(true);
  114. ui->tablew_finishExamList->setEditTriggers(QAbstractItemView::NoEditTriggers);
  115. //整行选中的方式
  116. ui->tablew_finishExamList->setSelectionBehavior(QAbstractItemView::SelectRows);
  117. //设置为只能选中一行
  118. ui->tablew_finishExamList->setSelectionMode(QAbstractItemView::SingleSelection);
  119. //隐藏列表头
  120. ui->tablew_finishExamList->verticalHeader()->setVisible(false);
  121. //隐藏边框
  122. ui->tablew_finishExamList->setShowGrid(false);
  123. //表头不高亮显示
  124. ui->tablew_finishExamList->horizontalHeader()->setHighlightSections(false);
  125. //设置行数
  126. ui->tablew_finishExamList->setRowCount(10);
  127. //设置列数
  128. ui->tablew_finishExamList->setColumnCount(7);
  129. ui->tablew_finishExamList->setHorizontalScrollMode(QTableWidget::ScrollPerPixel);
  130. ui->tablew_finishExamList->horizontalScrollBar()->setSingleStep(g_appInfoPtr->m_fRate*5);
  131. ui->tablew_finishExamList->setHorizontalHeaderLabels(sHeadStr);
  132. ui->tablew_finishExamList->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
  133. ui->tablew_finishExamList->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
  134. ui->tablew_finishExamList->verticalHeader()->setDefaultSectionSize(g_appInfoPtr->m_fRate*48);
  135. ui->tablew_finishExamList->setColumnWidth(0, g_appInfoPtr->m_fRate*116);
  136. ui->tablew_finishExamList->setColumnWidth(1, g_appInfoPtr->m_fRate*56);
  137. ui->tablew_finishExamList->setColumnWidth(2, g_appInfoPtr->m_fRate*104);
  138. ui->tablew_finishExamList->setColumnWidth(3, g_appInfoPtr->m_fRate*277);
  139. ui->tablew_finishExamList->setColumnWidth(4, g_appInfoPtr->m_fRate*305);
  140. ui->tablew_finishExamList->setColumnWidth(5, g_appInfoPtr->m_fRate*102);
  141. ui->tablew_finishExamList->setColumnWidth(6, g_appInfoPtr->m_fRate*146);
  142. ui->tablew_finishExamList->horizontalHeader()->setStretchLastSection(true);
  143. }
  144. void clOnlineExam::showEvent(QShowEvent *)
  145. {
  146. refreshExam();
  147. }
  148. void clOnlineExam::refreshExam()
  149. {
  150. CHttpRequestPackage hrp;
  151. hrp.sUri = "/api/ecs_oe_admin/client/exam/process/queryExamList";
  152. hrp.nRequestType = RequestType::rtQueryExamList;
  153. g_httpBllPtr->post(hrp);
  154. CHttpRequestPackage hrp1;
  155. hrp1.sUri = "/api/ecs_oe_admin/client/exam/process/queryExamEndList";
  156. hrp1.nRequestType = RequestType::rtQueryExamEndList;
  157. g_httpBllPtr->post(hrp1);
  158. }
  159. void clOnlineExam::onQueryExamList(CQueryExamList queryExamList)
  160. {
  161. if (queryExamList.nCode == 200)
  162. {
  163. qDebug() << "onQueryExamList";
  164. int nSize = queryExamList.vOnlieExamList.size();
  165. ui->tablewt_examList->setRowCount(nSize);
  166. for (int i = 0; i < nSize; ++i)
  167. {
  168. CExamCourseInfo eci = queryExamList.vOnlieExamList[i];
  169. ui->tablewt_examList->setItem(i, 0, new QTableWidgetItem(eci.sCourseName));
  170. ui->tablewt_examList->setItem(i, 1, new QTableWidgetItem(eci.sCourseLevel));
  171. ui->tablewt_examList->setItem(i, 2, new QTableWidgetItem(eci.sSpecialtyName));
  172. ui->tablewt_examList->setItem(i, 3, new QTableWidgetItem(QString::fromLocal8Bit("%1 ~ %2").arg(eci.sStartTime).arg(eci.sEndTime)));
  173. QString sWeekCycle = CWeekTransform::getWeekCycles(eci.vExamCycleWeek);
  174. QString sTimeRange = eci.sExamCycleTimeRange.join(QString::fromLocal8Bit(","));
  175. QDateTime dtCurrent = QDateTime::fromMSecsSinceEpoch(g_appInfoPtr->serverMTime());
  176. QDateTime dtStartTime = QDateTime::fromString(eci.sStartTime, "yyyy-MM-dd hh:mm:ss");
  177. QDateTime dtEndTime = QDateTime::fromString(eci.sEndTime, "yyyy-MM-dd hh:mm:ss");
  178. bool bIsInExamTime = dtCurrent > dtStartTime && dtCurrent < dtEndTime;
  179. QString sWeek = dtCurrent.toString("ddd");
  180. bool bIsInWeek = sWeekCycle.size() == 0 || sWeekCycle.indexOf(sWeek) >= 0;
  181. QTime tCurrent = QDateTime::fromMSecsSinceEpoch(g_appInfoPtr->serverMTime()).time();
  182. bool bIsInTimeRange = eci.sExamCycleTimeRange.size() == 0 || CWeekTransform::isInTimeRange(tCurrent, eci.sExamCycleTimeRange);
  183. ui->tablewt_examList->setItem(i, 4, new QTableWidgetItem(QString::fromLocal8Bit("%1 %2").arg(sWeekCycle).arg(sTimeRange)));
  184. ui->tablewt_examList->setItem(i, 5, new QTableWidgetItem(QString::number(eci.nAllowExamCount)));
  185. clOperation *clo = new clOperation(i, ui->tablewt_examList);
  186. clo->setUI(ui->tablewt_examList->columnWidth(6), ui->tablewt_examList->rowHeight(i), CL_OPERATION_TYPE::cot_online_exam);
  187. clo->setBtn1Enable(bIsInWeek && bIsInTimeRange && bIsInExamTime && eci.nAllowExamCount>0);
  188. clo->setBtn2Enable(eci.bIsObjScoreView);
  189. ui->tablewt_examList->setCellWidget(i, 6, clo);
  190. connect(clo, &clOperation::enterExam, this, [&](CL_OPERATION_TYPE cot, int nRow){
  191. if (cot == CL_OPERATION_TYPE::cot_online_exam )
  192. {
  193. QString sWeekCycle = CWeekTransform::getWeekCycles(m_vOnlieExamList[nRow].vExamCycleWeek);
  194. QString sTimeRange = m_vOnlieExamList[nRow].sExamCycleTimeRange.join(QString::fromLocal8Bit(","));
  195. QDateTime dtCurrent = QDateTime::fromMSecsSinceEpoch(g_appInfoPtr->serverMTime());
  196. QDateTime dtStartTime = QDateTime::fromString(m_vOnlieExamList[nRow].sStartTime, "yyyy-MM-dd hh:mm:ss");
  197. QDateTime dtEndTime = QDateTime::fromString(m_vOnlieExamList[nRow].sEndTime, "yyyy-MM-dd hh:mm:ss");
  198. bool bIsInExamTime = dtCurrent > dtStartTime && dtCurrent < dtEndTime;
  199. QString sWeek = dtCurrent.toString("ddd");
  200. bool bIsInWeek = sWeekCycle.size() == 0 || sWeekCycle.indexOf(sWeek) >= 0;
  201. QTime tCurrent = QDateTime::fromMSecsSinceEpoch(g_appInfoPtr->serverMTime()).time();
  202. bool bIsInTimeRange = m_vOnlieExamList[nRow].sExamCycleTimeRange.size() == 0 || CWeekTransform::isInTimeRange(tCurrent, m_vOnlieExamList[nRow].sExamCycleTimeRange);
  203. if(bIsInWeek && bIsInTimeRange && bIsInExamTime && m_vOnlieExamList[nRow].nAllowExamCount > 0)
  204. {
  205. emit enterExam(cot, m_vOnlieExamList[nRow].nExamId, m_vOnlieExamList[nRow].nExamStudentId,
  206. m_vOnlieExamList[nRow].sCourseCode, m_vOnlieExamList[nRow].sCourseName);
  207. }
  208. }
  209. });
  210. connect(clo, &clOperation::showObjectiveScore, this, [&](CL_OPERATION_TYPE cot, int nRow) {
  211. if (cot == CL_OPERATION_TYPE::cot_online_exam )
  212. {
  213. m_pObjectiveScoreTimer->stop();
  214. if (m_pObjectiveScore != nullptr &&
  215. m_pObjectiveScore->getRow() != nRow)
  216. {
  217. m_pObjectiveScore.reset();
  218. }
  219. if (m_pObjectiveScore == nullptr)
  220. {
  221. m_pObjectiveScore = std::make_shared<clObjectiveScore>(nRow, QString::number(m_vOnlieExamList[nRow].nExamStudentId), this);
  222. connect(m_pObjectiveScore.get(), &clObjectiveScore::objectiveScoreHeight, this, [&](int nRow, int nHeight) {
  223. int ntableTop = ui->tabw_onlineExam->y() + g_appInfoPtr->m_fRate*70;
  224. int nTop = ntableTop + (nRow + 2)* ui->tablewt_examList->verticalHeader()->defaultSectionSize() - nHeight / 2;
  225. if (nHeight > ui->tabw_onlineExam->height())
  226. {
  227. nHeight = ui->tabw_onlineExam->height();
  228. }
  229. if (nTop < ui->tabw_onlineExam->y())
  230. {
  231. nTop = ui->tabw_onlineExam->y();
  232. }
  233. else if ((nTop + nHeight) > (ntableTop + ui->tablewt_examList->height()))
  234. {
  235. nTop = ntableTop + ui->tablewt_examList->height() - nHeight;
  236. }
  237. m_pObjectiveScore->setUI(ui->tablewt_examList->x() + ui->tablewt_examList->width() - ui->tablewt_examList->columnWidth(6) - g_appInfoPtr->m_fRate * 530,
  238. nTop, g_appInfoPtr->m_fRate * 530, nHeight);
  239. m_pObjectiveScore->show();
  240. });
  241. }
  242. }
  243. });
  244. connect(clo, &clOperation::hideObjectiveScore, this, [&](CL_OPERATION_TYPE cot, int nRow) {
  245. if (cot == CL_OPERATION_TYPE::cot_online_exam)
  246. {
  247. m_pObjectiveScoreTimer->start();
  248. }
  249. });
  250. }
  251. m_vOnlieExamList.swap(queryExamList.vOnlieExamList);
  252. }
  253. else
  254. {
  255. if(queryExamList.sMessage.isEmpty())
  256. {
  257. ShowMsg(QString::fromLocal8Bit("获取在线考试信息失败"), (QWidget*)(this->parent()), MSG_ICON_TYPE::mit_error);
  258. }
  259. else
  260. {
  261. ShowMsg(queryExamList.sMessage, (QWidget*)(this->parent()), MSG_ICON_TYPE::mit_error);
  262. }
  263. }
  264. }
  265. void clOnlineExam::onQueryExamEndList(CQueryExamEndList queryExamEndList)
  266. {
  267. if (queryExamEndList.nCode == 200)
  268. {
  269. int nSize = queryExamEndList.vOnlieEndExamList.size();
  270. ui->tablew_finishExamList->setRowCount(nSize);
  271. for (int i = 0; i < nSize; ++i)
  272. {
  273. CExamCourseInfo eci = queryExamEndList.vOnlieEndExamList[i];
  274. ui->tablew_finishExamList->setItem(i, 0, new QTableWidgetItem(eci.sCourseName));
  275. ui->tablew_finishExamList->setItem(i, 1, new QTableWidgetItem(eci.sCourseLevel));
  276. ui->tablew_finishExamList->setItem(i, 2, new QTableWidgetItem(eci.sSpecialtyName));
  277. ui->tablew_finishExamList->setItem(i, 3, new QTableWidgetItem(QString::fromLocal8Bit("%1 ~ %2").arg(eci.sStartTime).arg(eci.sEndTime)));
  278. QString sWeekCycle = CWeekTransform::getWeekCycles(eci.vExamCycleWeek);
  279. QString sTimeRange = eci.sExamCycleTimeRange.join(",");
  280. ui->tablew_finishExamList->setItem(i, 4, new QTableWidgetItem(QString::fromLocal8Bit("%1 %2").arg(sWeekCycle).arg(sTimeRange)));
  281. ui->tablew_finishExamList->setItem(i, 5, new QTableWidgetItem(QString::number(eci.nAllowExamCount)));
  282. clOperation *clo = new clOperation(i, ui->tablew_finishExamList);
  283. clo->setUI(ui->tablew_finishExamList->columnWidth(6), ui->tablew_finishExamList->rowHeight(i), CL_OPERATION_TYPE::cot_online_finish_exam);
  284. clo->setBtn1Enable(eci.bIsObjScoreView);
  285. ui->tablew_finishExamList->setCellWidget(i, 6, clo);
  286. connect(clo, &clOperation::showObjectiveScore, this, [&](CL_OPERATION_TYPE cot, int nRow) {
  287. if (cot == CL_OPERATION_TYPE::cot_online_finish_exam )
  288. {
  289. m_pObjectiveScoreTimer->stop();
  290. if (m_pObjectiveScore != nullptr &&
  291. m_pObjectiveScore->getRow() != nRow)
  292. {
  293. m_pObjectiveScore.reset();
  294. }
  295. if (m_pObjectiveScore == nullptr)
  296. {
  297. m_pObjectiveScore = std::make_shared<clObjectiveScore>(nRow, QString::number(m_vOnlieEndExamList[nRow].nExamStudentId), this);
  298. connect(m_pObjectiveScore.get(), &clObjectiveScore::objectiveScoreHeight, this, [&](int nRow, int nHeight) {
  299. int ntableTop = ui->tablew_finishExamList->y() + g_appInfoPtr->m_fRate*70;
  300. int nTop = ntableTop + (nRow + 2)* ui->tablew_finishExamList->verticalHeader()->defaultSectionSize() - nHeight / 2;
  301. if (nHeight > ui->tabw_onlineExam->height())
  302. {
  303. nHeight = ui->tabw_onlineExam->height();
  304. }
  305. if (nTop < ui->tablew_finishExamList->y())
  306. {
  307. nTop = ui->tablew_finishExamList->y();
  308. }
  309. else if ((nTop + nHeight) > (ntableTop + ui->tablew_finishExamList->height()))
  310. {
  311. nTop = ntableTop + ui->tablew_finishExamList->height() - nHeight;
  312. }
  313. m_pObjectiveScore->setUI(ui->tablew_finishExamList->x() + ui->tablew_finishExamList->width() - ui->tablew_finishExamList->columnWidth(6) - g_appInfoPtr->m_fRate * 530,
  314. nTop, g_appInfoPtr->m_fRate * 530, nHeight);
  315. m_pObjectiveScore->show();
  316. });
  317. }
  318. }
  319. });
  320. connect(clo, &clOperation::hideObjectiveScore, this, [&](CL_OPERATION_TYPE cot, int nRow) {
  321. if (cot == CL_OPERATION_TYPE::cot_online_finish_exam)
  322. {
  323. m_pObjectiveScoreTimer->start();
  324. }
  325. });
  326. }
  327. m_vOnlieEndExamList.swap(queryExamEndList.vOnlieEndExamList);
  328. }
  329. else
  330. {
  331. if(queryExamEndList.sMessage.isEmpty())
  332. {
  333. ShowMsg(QString::fromLocal8Bit("获取在线考试信息失败"), (QWidget*)(this->parent()), MSG_ICON_TYPE::mit_error);
  334. }
  335. else
  336. {
  337. ShowMsg(queryExamEndList.sMessage, (QWidget*)(this->parent()), MSG_ICON_TYPE::mit_error);
  338. }
  339. }
  340. }
  341. void clOnlineExam::on_btn_examList_clicked()
  342. {
  343. ui->tabw_onlineExam->setCurrentIndex(0);
  344. ui->btn_examList->setStyleSheet(QString(R"(QPushButton{
  345. outline:none;
  346. border-radius:%1px;
  347. border:0px solid rgba(255,255,255,1);
  348. background:rgba(19, 187, 138, 1);
  349. font-size:%2px;
  350. font-family:"Microsoft YaHei";
  351. font-weight:500;
  352. color:rgba(255,255,255,1);
  353. })").arg((int)(g_appInfoPtr->m_fRate*15))
  354. .arg((int)(g_appInfoPtr->m_fRate*12)));
  355. ui->btn_endExamList->setStyleSheet(QString(R"(QPushButton{
  356. outline:none;
  357. border-radius:%1px;
  358. border:0px solid rgba(255,255,255,1);
  359. background:rgba(239, 240, 245, 1);
  360. font-size:%2px;
  361. font-family:"Microsoft YaHei";
  362. font-weight:500;
  363. color:rgba(153, 153, 153, 1);
  364. })").arg((int)(g_appInfoPtr->m_fRate*15))
  365. .arg((int)(g_appInfoPtr->m_fRate*12)));
  366. }
  367. void clOnlineExam::on_btn_endExamList_clicked()
  368. {
  369. ui->tabw_onlineExam->setCurrentIndex(1);
  370. ui->btn_endExamList->setStyleSheet(QString(R"(QPushButton{
  371. outline:none;
  372. border-radius:%1px;
  373. border:0px solid rgba(255,255,255,1);
  374. background:rgba(19, 187, 138, 1);
  375. font-size:%2px;
  376. font-family:"Microsoft YaHei";
  377. font-weight:500;
  378. color:rgba(255,255,255,1);
  379. })").arg((int)(g_appInfoPtr->m_fRate*15))
  380. .arg((int)(g_appInfoPtr->m_fRate*12)));
  381. ui->btn_examList->setStyleSheet(QString(R"(QPushButton{
  382. outline:none;
  383. border-radius:%1px;
  384. border:0px solid rgba(255,255,255,1);
  385. background:rgba(239, 240, 245, 1);
  386. font-size:%2px;
  387. font-family:"Microsoft YaHei";
  388. font-weight:500;
  389. color:rgba(153, 153, 153, 1);
  390. })").arg((int)(g_appInfoPtr->m_fRate*15))
  391. .arg((int)(g_appInfoPtr->m_fRate*12)));
  392. }
  393. void clOnlineExam::on_btn_refresh_clicked()
  394. {
  395. ui->btn_refresh->setEnabled(false);
  396. refreshExam();
  397. m_pRefreshTimer->start();
  398. m_nRefreshSeconds = 20;
  399. ui->btn_refresh->setText(QString::fromLocal8Bit("倒计时%1s").arg(m_nRefreshSeconds));
  400. }