courseList.cpp 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111
  1. #include "courseList.h"
  2. #include "ui_courseList.h"
  3. #include "awMsgBox.h"
  4. #include <QDesktopWidget>
  5. #include <QMouseEvent>
  6. #include "CAppInfo.h"
  7. #include "CSqlite3DBProc.h"
  8. courseList::courseList(QWidget *parent) :
  9. QWidget(parent),
  10. ui(new Ui::courseList)
  11. {
  12. ui->setupUi(this);
  13. setWindowFlags(Qt::FramelessWindowHint);
  14. setStyleSheet(g_appInfoPtr->m_sQssStr);
  15. qRegisterMetaType<CGetStudentInfoBySession>("CGetStudentInfoBySession");
  16. connect(g_httpBllPtr.get(), &CHttpBll::sgnGetStudentInfoBySession, this, &courseList::onGetStudentInfoBySession);
  17. qRegisterMetaType<CSpecialtyNameList>("CSpecialtyNameList");
  18. connect(g_httpBllPtr.get(), &CHttpBll::sgnSpecialtyNameList, this, &courseList::onSpecialtyNameList);
  19. qRegisterMetaType<CCheckExamInProgress>("CCheckExamInProgress");
  20. connect(g_httpBllPtr.get(), &CHttpBll::sgnCheckExamInProgress, this, &courseList::onCheckExamInProgress);
  21. qRegisterMetaType<CGetStudentClientMenu>("CGetStudentClientMenu");
  22. connect(g_httpBllPtr.get(), &CHttpBll::sgnGetStudentClientMenu, this, &courseList::onGetStudentClientMenu);
  23. qRegisterMetaType<CGetUserNoticeList>("CGetUserNoticeList");
  24. connect(g_httpBllPtr.get(), &CHttpBll::sgnGetUserNoticeList, this, &courseList::onGetUserNoticeList);
  25. qRegisterMetaType<CDownLoadFileInfo>("CDownLoadFileInfo");
  26. connect(g_httpBllPtr.get(), &CHttpBll::sgnDownLoadFile, this, &courseList::onDownLoadFile);
  27. qRegisterMetaType<CAppDownLoadUrl>("CAppDownLoadUrl");
  28. connect(g_httpBllPtr.get(), &CHttpBll::sgnAppDownLoadUrl, this, &courseList::onAppDownLoadUrl);
  29. qRegisterMetaType<CStartExamLimit>("CStartExamLimit");
  30. connect(g_httpBllPtr.get(), &CHttpBll::sgnStartExamLimit, this, &courseList::onStartExamLimit);
  31. qRegisterMetaType<CIpLimit>("CIpLimit");
  32. connect(g_httpBllPtr.get(), &CHttpBll::sgnIpLimit, this, &courseList::onIpLimit);
  33. qRegisterMetaType<CGetExamProperty>("CGetExamProperty");
  34. connect(g_httpBllPtr.get(), &CHttpBll::sgnGetExamProperty, this, &courseList::onGetExamProperty);
  35. qRegisterMetaType<CFaceCheckEnabled>("CFaceCheckEnabled");
  36. connect(g_httpBllPtr.get(), &CHttpBll::sgnFaceCheckEnabled, this, &courseList::onFaceCheckEnabled);
  37. qRegisterMetaType<CLivenessEnabled>("CLivenessEnabled");
  38. connect(g_httpBllPtr.get(), &CHttpBll::sgnLivenessEnabled, this, &courseList::onLivenessEnabled);
  39. sqlite3_stmt *stmt;
  40. QString sSql = QString("select agreement from t_agreement where student_id=%1")
  41. .arg(g_appInfoPtr->m_nStudentId);
  42. if (!g_sysDBProcPtr->QuerySql(sSql.toStdString(), &stmt))
  43. {
  44. ShowMsg(QString::fromLocal8Bit("加载隐私协议信息失败!"), this);
  45. }
  46. bool bAgreement = false;
  47. int nField = 0;
  48. g_sysDBProcPtr->BeginGetFields(stmt);
  49. if (!g_sysDBProcPtr->Eof())
  50. {
  51. if (g_sysDBProcPtr->GetFields(0, nField, stmt) == 1)
  52. {
  53. bAgreement = true;
  54. }
  55. }
  56. g_sysDBProcPtr->EndGetFields(stmt);
  57. if (!bAgreement)
  58. {
  59. if (m_pPrivacyWidget == nullptr)
  60. {
  61. m_pPrivacyWidget = std::make_shared<privacyWidget>(this);
  62. connect(m_pPrivacyWidget.get(), &privacyWidget::agreement, this, [&]() {
  63. m_pPrivacyWidget.reset();
  64. getStudentInfoBySession();
  65. });
  66. connect(m_pPrivacyWidget.get(), &privacyWidget::disAgreement, this, [&]() {
  67. on_btn_exit_clicked();
  68. });
  69. }
  70. m_pPrivacyWidget->show();
  71. }
  72. else
  73. {
  74. getStudentInfoBySession();
  75. }
  76. initUI();
  77. m_pMobileLogin = nullptr;
  78. m_pStudentInfo = nullptr;
  79. m_pMobileLoginBtnTimer = std::make_shared<QTimer>();
  80. m_pMobileLoginBtnTimer->setInterval(500);
  81. connect(m_pMobileLoginBtnTimer.get(), &QTimer::timeout, this, &courseList::hideMobileLoginBtn);
  82. m_pStudentInfoBtnTimer = std::make_shared<QTimer>();
  83. m_pStudentInfoBtnTimer->setInterval(500);
  84. connect(m_pStudentInfoBtnTimer.get(), &QTimer::timeout, this, &courseList::hideStudentInfoBtn);
  85. m_pRefreshTimer = std::make_shared<QTimer>();
  86. m_pRefreshTimer->setInterval(1000*60*3);
  87. connect(m_pRefreshTimer.get(), &QTimer::timeout, this, []() {
  88. CHttpRequestPackage hrp;
  89. hrp.sUri = "/api/ecs_core/rolePrivilege/getStudentClientMenu";
  90. hrp.nRequestType = RequestType::rtGetStudentClientMenu;
  91. hrp.sParamList.push_back(QString::fromLocal8Bit("rootOrgId,%1").arg(g_appInfoPtr->m_sRootOrgId));
  92. g_httpBllPtr->get(hrp);
  93. CHttpRequestPackage hrp1;
  94. hrp1.sUri = "/api/ecs_core/student/online_signal/" + QString::number(g_appInfoPtr->m_nStudentId);
  95. hrp1.nRequestType = RequestType::rtOnlineSignal;
  96. g_httpBllPtr->get(hrp1);
  97. });
  98. ui->btn_mobileLogin->installEventFilter(this);
  99. ui->btn_studentInfo->installEventFilter(this);
  100. }
  101. courseList::~courseList()
  102. {
  103. delete ui;
  104. }
  105. void courseList::initUI()
  106. {
  107. QDesktopWidget *dekwiget = QApplication::desktop();
  108. setGeometry(0, 0, dekwiget->width(), dekwiget->height());
  109. ui->widget_cl_BG->setGeometry(0, 0, dekwiget->width(), dekwiget->height());
  110. ui->widget_menu->setGeometry(0, 0, g_appInfoPtr->m_fRate*96, height());
  111. ui->widget_top->setGeometry(ui->widget_menu->width(), 0, width() - ui->widget_menu->width(), g_appInfoPtr->m_fRate*56);
  112. ui->widget_bottom->setGeometry(ui->widget_top->x(), height() - g_appInfoPtr->m_fRate*38, ui->widget_top->width(), g_appInfoPtr->m_fRate*38);
  113. ui->stw_courseList->setGeometry(ui->widget_top->x(), ui->widget_top->y() + ui->widget_top->height(),
  114. ui->widget_top->width(), height() - ui->widget_top->height() - ui->widget_bottom->height());
  115. /*
  116. clOnlineExam *cloe = new clOnlineExam;
  117. cloe->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
  118. ui->stw_courseList->addWidget(cloe);
  119. clOnlineHomework *clow = new clOnlineHomework;
  120. clow->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
  121. ui->stw_courseList->addWidget(clow);
  122. clOnlinePractice *clop = new clOnlinePractice;
  123. clop->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
  124. ui->stw_courseList->addWidget(clop);
  125. clOfflineExam *cloffe = new clOfflineExam;
  126. cloffe->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
  127. ui->stw_courseList->addWidget(cloffe);
  128. clNoticeList *clnl = new clNoticeList;
  129. clnl->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
  130. ui->stw_courseList->addWidget(clnl);
  131. clEditPassword *clep = new clEditPassword;
  132. clep->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
  133. ui->stw_courseList->addWidget(clep);
  134. ui->stw_courseList->setCurrentIndex(0);
  135. */
  136. ui->label_cl_org_icon->setGeometry(g_appInfoPtr->m_fRate*30, g_appInfoPtr->m_fRate*30, g_appInfoPtr->m_fRate*36, g_appInfoPtr->m_fRate*36);
  137. ui->btn_onlineExam->setGeometry(g_appInfoPtr->m_fRate*20, g_appInfoPtr->m_fRate*103, g_appInfoPtr->m_fRate*56, g_appInfoPtr->m_fRate*66);
  138. ui->btn_onlineHomework->setGeometry(ui->btn_onlineExam->x(), ui->btn_onlineExam->y() + ui->btn_onlineExam->height() + g_appInfoPtr->m_fRate*17,
  139. ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
  140. ui->btn_onlinePractice->setGeometry(ui->btn_onlineExam->x(), ui->btn_onlineHomework->y() + ui->btn_onlineHomework->height() + g_appInfoPtr->m_fRate*17,
  141. ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
  142. ui->btn_offlineExam->setGeometry(ui->btn_onlineExam->x(), ui->btn_onlinePractice->y() + ui->btn_onlinePractice->height() + g_appInfoPtr->m_fRate*17,
  143. ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
  144. ui->btn_notice->setGeometry(ui->btn_onlineExam->x(), ui->btn_offlineExam->y() + ui->btn_offlineExam->height() + g_appInfoPtr->m_fRate*17,
  145. ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
  146. ui->btn_noticeNum->setGeometry(ui->btn_notice->x() + ui->btn_notice->width() - g_appInfoPtr->m_fRate*16, ui->btn_notice->y(),
  147. g_appInfoPtr->m_fRate*16, g_appInfoPtr->m_fRate*16);
  148. ui->btn_noticeNum->setVisible(false);
  149. ui->btn_editPassword->setGeometry(ui->btn_onlineExam->x(), ui->btn_notice->y() + ui->btn_notice->height() + g_appInfoPtr->m_fRate*17,
  150. ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
  151. ui->label_currentPlaceIcon->setGeometry(g_appInfoPtr->m_fRate*30, (ui->widget_top->height() - g_appInfoPtr->m_fRate*10)/2,
  152. g_appInfoPtr->m_fRate*10, g_appInfoPtr->m_fRate*10);
  153. ui->label_currrentPlace->adjustSize();
  154. ui->label_currrentPlace->setGeometry(ui->label_currentPlaceIcon->x() + ui->label_currentPlaceIcon->width() + g_appInfoPtr->m_fRate*10,
  155. (ui->widget_top->height() - ui->label_currrentPlace->height())/2, g_appInfoPtr->m_fRate*400, ui->label_currrentPlace->height());
  156. ui->btn_cl_close->setGeometry(ui->widget_top->width() - g_appInfoPtr->m_fRate*10 - g_appInfoPtr->m_fRate*24, g_appInfoPtr->m_fRate*16,
  157. g_appInfoPtr->m_fRate*24, g_appInfoPtr->m_fRate*24);
  158. ui->btn_minisize->setGeometry(ui->btn_cl_close->x() - g_appInfoPtr->m_fRate*6 - ui->btn_cl_close->width(), ui->btn_cl_close->y(),
  159. ui->btn_cl_close->width(), ui->btn_cl_close->height());
  160. ui->label_VLine->setGeometry(ui->btn_minisize->x() - g_appInfoPtr->m_fRate*21, ui->btn_cl_close->y(),
  161. g_appInfoPtr->m_fRate*1, g_appInfoPtr->m_fRate*24);
  162. ui->btn_exit->setGeometry(ui->label_VLine->x() - g_appInfoPtr->m_fRate*(20+24), ui->btn_cl_close->y(),
  163. ui->btn_cl_close->width(), ui->btn_cl_close->height());
  164. ui->btn_studentInfo->setGeometry(ui->btn_exit->x() - g_appInfoPtr->m_fRate*(10+90), ui->btn_cl_close->y(),
  165. g_appInfoPtr->m_fRate*90, g_appInfoPtr->m_fRate*24);
  166. ui->btn_studentInfo->setIconSize(QSize(g_appInfoPtr->m_fRate*8, g_appInfoPtr->m_fRate*8));
  167. ui->btn_studentInfo->setIcon(QIcon(":/images/icon-student-info.png"));
  168. ui->label_arrow->setGeometry(ui->btn_studentInfo->x() + (ui->btn_studentInfo->width() - g_appInfoPtr->m_fRate*12)/2,
  169. ui->btn_studentInfo->y() + ui->btn_studentInfo->height(),
  170. g_appInfoPtr->m_fRate*12, g_appInfoPtr->m_fRate*3);
  171. ui->label_arrow->setVisible(false);
  172. ui->btn_mobileLogin->setGeometry(ui->btn_studentInfo->x() - g_appInfoPtr->m_fRate*(10+167), ui->btn_cl_close->y(),
  173. g_appInfoPtr->m_fRate*167, g_appInfoPtr->m_fRate*24);
  174. ui->btn_mobileLogin->setIconSize(QSize(g_appInfoPtr->m_fRate*8, g_appInfoPtr->m_fRate*8));
  175. ui->btn_mobileLogin->setIcon(QIcon(":/images/icon-mobile-login.png"));
  176. ui->label_cl_company->adjustSize();
  177. ui->label_cl_company->setGeometry(g_appInfoPtr->m_fRate*30, (ui->widget_bottom->height() - ui->label_cl_company->height())/2,
  178. ui->label_cl_company->width(), ui->label_cl_company->height());
  179. ui->label_cl_version->adjustSize();
  180. ui->label_cl_version->setGeometry(ui->widget_bottom->width() - g_appInfoPtr->m_fRate*30 - ui->label_cl_version->width(),
  181. ui->label_cl_company->y(), ui->label_cl_version->width(), ui->label_cl_version->height());
  182. ui->label_serverTime->adjustSize();
  183. ui->label_serverTime->setGeometry(ui->label_cl_version->x() - g_appInfoPtr->m_fRate*20 - ui->label_serverTime->width(), ui->label_cl_company->y(),
  184. ui->label_serverTime->width(), ui->label_serverTime->height());
  185. setCheck(COURSE_MENU_BTN_TYPE::cmbt_online_exam);
  186. }
  187. void courseList::menuBtnRePosistion()
  188. {
  189. int nTop = g_appInfoPtr->m_fRate * 103;
  190. if(ui->btn_onlineExam->isVisible())
  191. {
  192. ui->btn_onlineExam->setGeometry(g_appInfoPtr->m_fRate * 20, nTop, g_appInfoPtr->m_fRate * 56, g_appInfoPtr->m_fRate * 66);
  193. nTop = nTop + ui->btn_onlineExam->height() + g_appInfoPtr->m_fRate * 17;
  194. }
  195. if(ui->btn_onlineHomework->isVisible())
  196. {
  197. ui->btn_onlineHomework->setGeometry(ui->btn_onlineExam->x(), nTop,
  198. ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
  199. nTop = nTop + ui->btn_onlineExam->height() + g_appInfoPtr->m_fRate * 17;
  200. }
  201. if (ui->btn_onlinePractice->isVisible())
  202. {
  203. ui->btn_onlinePractice->setGeometry(ui->btn_onlineExam->x(), nTop,
  204. ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
  205. nTop = nTop + ui->btn_onlineExam->height() + g_appInfoPtr->m_fRate * 17;
  206. }
  207. if (ui->btn_offlineExam->isVisible())
  208. {
  209. ui->btn_offlineExam->setGeometry(ui->btn_onlineExam->x(), nTop,
  210. ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
  211. nTop = nTop + ui->btn_onlineExam->height() + g_appInfoPtr->m_fRate * 17;
  212. }
  213. if (ui->btn_notice->isVisible())
  214. {
  215. ui->btn_notice->setGeometry(ui->btn_onlineExam->x(), nTop,
  216. ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
  217. ui->btn_noticeNum->setGeometry(ui->btn_notice->x() + ui->btn_notice->width() - g_appInfoPtr->m_fRate * 16, ui->btn_notice->y(),
  218. g_appInfoPtr->m_fRate * 16, g_appInfoPtr->m_fRate * 16);
  219. nTop = nTop + ui->btn_onlineExam->height() + g_appInfoPtr->m_fRate * 17;
  220. }
  221. if (ui->btn_editPassword->isVisible())
  222. {
  223. ui->btn_editPassword->setGeometry(ui->btn_onlineExam->x(), ui->btn_notice->y() + ui->btn_notice->height() + g_appInfoPtr->m_fRate * 17,
  224. ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
  225. }
  226. }
  227. void courseList::on_btn_minisize_clicked()
  228. {
  229. emit minisize();
  230. }
  231. void courseList::on_btn_cl_close_clicked()
  232. {
  233. close();
  234. logout();
  235. }
  236. void courseList::setCheck(COURSE_MENU_BTN_TYPE cmbt)
  237. {
  238. QString sNormalSheet = QString(R"(outline:none;
  239. font-size:%1px;
  240. font-family:"Microsoft YaHei";
  241. font-weight:400;
  242. color:rgba(255,255,255,0.4);
  243. background:rgba(255,255,255,0);
  244. border-radius:%2;)").arg((int)(g_appInfoPtr->m_fRate*12)).arg(g_appInfoPtr->m_fRate*12);
  245. QString sCheckSheet = QString(R"(QPushButton
  246. {
  247. outline:none;
  248. font-size:%1px;
  249. font-family:"Microsoft YaHei";
  250. font-weight:400;
  251. color:rgba(255,255,255,1);
  252. border-radius:%2px;
  253. background:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(16, 195, 182, 1), stop:1 rgba(39, 217, 146, 1));
  254. })").arg((int)(g_appInfoPtr->m_fRate*12)).arg(g_appInfoPtr->m_fRate*12);
  255. ui->btn_onlineExam->setStyleSheet(sNormalSheet);
  256. ui->btn_onlineHomework->setStyleSheet(sNormalSheet);
  257. ui->btn_onlinePractice->setStyleSheet(sNormalSheet);
  258. ui->btn_offlineExam->setStyleSheet(sNormalSheet);
  259. ui->btn_notice->setStyleSheet(sNormalSheet);
  260. ui->btn_editPassword->setStyleSheet(sNormalSheet);
  261. if (m_pOnlineExam != nullptr)
  262. {
  263. m_pOnlineExam->hide();
  264. }
  265. if (m_pOnlineHomework != nullptr)
  266. {
  267. m_pOnlineHomework->hide();
  268. }
  269. if (m_pOnlinePractice != nullptr)
  270. {
  271. m_pOnlinePractice->hide();
  272. }
  273. if (m_pOfflineExam != nullptr)
  274. {
  275. m_pOfflineExam->hide();
  276. }
  277. if (m_pNoticeList != nullptr)
  278. {
  279. m_pNoticeList->hide();
  280. }
  281. if (m_pEditPassword != nullptr)
  282. {
  283. m_pEditPassword->hide();
  284. }
  285. QString sCurrentPlace = "";
  286. if (cmbt == COURSE_MENU_BTN_TYPE::cmbt_online_exam)
  287. {
  288. if (m_pOnlineExam == nullptr)
  289. {
  290. m_pOnlineExam = std::make_shared<clOnlineExam>(ui->stw_courseList);
  291. m_pOnlineExam->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
  292. connect(m_pOnlineExam.get(), &clOnlineExam::enterExam, this, &courseList::onEnterExam);
  293. }
  294. m_pOnlineExam->show();
  295. ui->btn_onlineExam->setStyleSheet(sCheckSheet);
  296. sCurrentPlace = QString::fromLocal8Bit("当前所在位置:在线考试");
  297. }
  298. else if(cmbt == COURSE_MENU_BTN_TYPE::cmbt_online_homework)
  299. {
  300. if (m_pOnlineHomework == nullptr)
  301. {
  302. m_pOnlineHomework = std::make_shared<clOnlineHomework>(ui->stw_courseList);
  303. m_pOnlineHomework->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
  304. connect(m_pOnlineHomework.get(), &clOnlineHomework::enterExam, this, &courseList::onEnterExam);
  305. }
  306. m_pOnlineHomework->show();
  307. ui->btn_onlineHomework->setStyleSheet(sCheckSheet);
  308. sCurrentPlace = QString::fromLocal8Bit("当前所在位置:在线作业");
  309. }
  310. else if(cmbt == COURSE_MENU_BTN_TYPE::cmbt_online_practice)
  311. {
  312. if (m_pOnlinePractice == nullptr)
  313. {
  314. m_pOnlinePractice = std::make_shared<clOnlinePractice>(ui->stw_courseList);
  315. m_pOnlinePractice->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
  316. connect(m_pOnlinePractice.get(), &clOnlinePractice::enterExam, this, &courseList::onEnterExam);
  317. }
  318. m_pOnlinePractice->show();
  319. ui->btn_onlinePractice->setStyleSheet(sCheckSheet);
  320. sCurrentPlace = QString::fromLocal8Bit("当前所在位置:在线练习");
  321. }
  322. else if(cmbt == COURSE_MENU_BTN_TYPE::cmbt_offline_exam)
  323. {
  324. if (m_pOfflineExam == nullptr)
  325. {
  326. m_pOfflineExam = std::make_shared<clOfflineExam>(ui->stw_courseList);
  327. m_pOfflineExam->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
  328. }
  329. m_pOfflineExam->show();
  330. ui->btn_offlineExam->setStyleSheet(sCheckSheet);
  331. sCurrentPlace = QString::fromLocal8Bit("当前所在位置:离线考试");
  332. }
  333. else if(cmbt == COURSE_MENU_BTN_TYPE::cmbt_notice)
  334. {
  335. if (m_pNoticeList == nullptr)
  336. {
  337. m_pNoticeList = std::make_shared<clNoticeList>(ui->stw_courseList);
  338. m_pNoticeList->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
  339. }
  340. m_pNoticeList->show();
  341. ui->btn_notice->setStyleSheet(sCheckSheet);
  342. sCurrentPlace = QString::fromLocal8Bit("当前所在位置:公告通知");
  343. }
  344. else if(cmbt == COURSE_MENU_BTN_TYPE::cmbt_edit_password)
  345. {
  346. if (m_pEditPassword == nullptr)
  347. {
  348. m_pEditPassword = std::make_shared<clEditPassword>(ui->stw_courseList);
  349. m_pEditPassword->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
  350. }
  351. m_pEditPassword->show();
  352. ui->btn_editPassword->setStyleSheet(sCheckSheet);
  353. sCurrentPlace = QString::fromLocal8Bit("当前所在位置:修改密码");
  354. }
  355. ui->label_currrentPlace->setText(sCurrentPlace);
  356. }
  357. void courseList::onEnterExam(CL_OPERATION_TYPE cot, __int64 nExamId, __int64 nExamStudentId)
  358. {
  359. if(cot == CL_OPERATION_TYPE::cot_online_exam)
  360. {
  361. g_appInfoPtr->m_oExamInfo.sExamType = EXAM_TYPES::ONLINE;
  362. }
  363. g_appInfoPtr->m_oExamInfo.nExamId = nExamId;
  364. g_appInfoPtr->m_oExamInfo.nExamStudentId = nExamStudentId;
  365. //开考限流
  366. CHttpRequestPackage hrp;
  367. hrp.sUri = QString("https://tcc.qmth.com.cn/rate_limit/prod/startExam/%1").arg(100);
  368. hrp.nRequestType = RequestType::rtStartExamLimit;
  369. g_httpBllPtr->getUrl(hrp);
  370. }
  371. void courseList::onStartExamLimit(CStartExamLimit startExamLimit)
  372. {
  373. if (startExamLimit.nCode == 200)
  374. {
  375. if (startExamLimit.bPass)
  376. {
  377. CHttpRequestPackage hrp;
  378. hrp.sUri = QString("/api/ecs_exam_work/exam/ipLimit/%1").arg(g_appInfoPtr->m_oExamInfo.nExamId);
  379. hrp.nRequestType = RequestType::rtIpLimit;
  380. g_httpBllPtr->get(hrp);
  381. }
  382. else
  383. {
  384. //重试
  385. }
  386. }
  387. else
  388. {
  389. ShowMsg(QString::fromLocal8Bit("开考失败"), this);
  390. }
  391. }
  392. void courseList::onIpLimit(CIpLimit ipLimit)
  393. {
  394. if (ipLimit.nCode == 200)
  395. {
  396. if (!ipLimit.bLimited)
  397. {
  398. //断点
  399. CHttpRequestPackage hrp;
  400. hrp.sUri = "/api/ecs_oe_student/client/exam/process/checkExamInProgress";
  401. hrp.nRequestType = RequestType::rtCheckExamInProgress;
  402. hrp.sCommonStr = EXAM_INPROGRESS_ENTER_TYPE::EIET_ENTER_EXAM;
  403. g_httpBllPtr->post(hrp);
  404. }
  405. else
  406. {
  407. ShowMsg(QString::fromLocal8Bit("当前ip限制参加考试"), this);
  408. }
  409. }
  410. else
  411. {
  412. ShowMsg(QString::fromLocal8Bit("开考失败"), this);
  413. }
  414. }
  415. void courseList::onGetExamProperty(CGetExamProperty getExamProperty)
  416. {
  417. if (getExamProperty.nCode == 200)
  418. {
  419. if (getExamProperty.sType == "CHECK_ENVIRONMENT,IS_FACE_CHECK,SNAPSHOT_INTERVAL,WARN_THRESHOLD,FACE_VERIFY_START_MINUTE,FACE_VERIFY_END_MINUTE,IS_STRANGER_ENABLE")
  420. {
  421. g_appInfoPtr->m_oExamInfo.bIsFaceCheck = getExamProperty.bIsFaceCheck;
  422. g_appInfoPtr->m_oExamInfo.nWarnThreshold = getExamProperty.nWarnThreshold;
  423. g_appInfoPtr->m_oExamInfo.nSnapshotInterval = getExamProperty.nSnapshotInterval;
  424. g_appInfoPtr->m_oExamInfo.nFaceVerifyStartMinute = getExamProperty.nFaceVerifyStartMinute;
  425. g_appInfoPtr->m_oExamInfo.nFaceVerifyEndMinute = getExamProperty.nFaceVerifyEndMinute;
  426. g_appInfoPtr->m_oExamInfo.bIsStrangerEnable = getExamProperty.bIsStrangerEnable;
  427. if (getExamProperty.bCheckEnvironment && !g_appInfoPtr->m_oExamInfo.bIsExamInProgress)
  428. {
  429. if(m_pWhetherEnvTest == nullptr)
  430. {
  431. m_pWhetherEnvTest = std::make_shared<etWhetherEnvTest>(this);
  432. connect(m_pWhetherEnvTest.get(), &etWhetherEnvTest::envTest, this, [&](){
  433. m_pWhetherEnvTest.reset();
  434. //环境检测
  435. if (m_pEnvironmentalTest == nullptr)
  436. {
  437. m_pEnvironmentalTest = std::make_shared<environmentalTest>(this);
  438. connect(m_pEnvironmentalTest.get(), &environmentalTest::enterExam, this, [&](){
  439. m_pEnvironmentalTest.reset();
  440. //人脸识别
  441. CHttpRequestPackage hrp;
  442. hrp.sUri = QString("/api/ecs_exam_work/exam/faceCheckEnabled/%1")
  443. .arg(g_appInfoPtr->m_oExamInfo.nExamId);
  444. hrp.nRequestType = RequestType::rtFaceCheckEnabled;
  445. g_httpBllPtr->get(hrp);
  446. });
  447. }
  448. m_pEnvironmentalTest->show();
  449. });
  450. connect(m_pWhetherEnvTest.get(), &etWhetherEnvTest::skipEnvTest, this, [&](){
  451. m_pWhetherEnvTest.reset();
  452. //人脸识别
  453. CHttpRequestPackage hrp;
  454. hrp.sUri = QString("/api/ecs_exam_work/exam/faceCheckEnabled/%1")
  455. .arg(g_appInfoPtr->m_oExamInfo.nExamId);
  456. hrp.nRequestType = RequestType::rtFaceCheckEnabled;
  457. g_httpBllPtr->get(hrp);
  458. });
  459. }
  460. m_pWhetherEnvTest->show();
  461. }
  462. else
  463. {
  464. //人脸识别
  465. CHttpRequestPackage hrp;
  466. hrp.sUri = QString("/api/ecs_exam_work/exam/faceCheckEnabled/%1")
  467. .arg(g_appInfoPtr->m_oExamInfo.nExamId);
  468. hrp.nRequestType = RequestType::rtFaceCheckEnabled;
  469. g_httpBllPtr->get(hrp);
  470. }
  471. }
  472. }
  473. else
  474. {
  475. if(getExamProperty.sMessage.isEmpty())
  476. {
  477. ShowMsg(QString::fromLocal8Bit("获取考试信息失败"), this);
  478. }
  479. else
  480. {
  481. ShowMsg(getExamProperty.sMessage, this);
  482. }
  483. }
  484. }
  485. void courseList::onFaceCheckEnabled(CFaceCheckEnabled faceCheckEnabled)
  486. {
  487. if (faceCheckEnabled.nCode == 200)
  488. {
  489. //人脸检测
  490. g_appInfoPtr->m_oExamInfo.bFaceCheck = faceCheckEnabled.bEnabled;
  491. if (faceCheckEnabled.bEnabled && !g_appInfoPtr->m_oExamInfo.bIsExamInProgress)
  492. {
  493. if (m_pFaceCompare == nullptr)
  494. {
  495. m_pFaceCompare = std::make_shared<faceCompare>(this);
  496. connect(m_pFaceCompare.get(), &faceCompare::exitFaceCompare, this, [&]() {
  497. m_pFaceCompare.reset();
  498. });
  499. connect(m_pFaceCompare.get(), &faceCompare::faceComparePass, this, [&]() {
  500. m_pFaceCompare.reset();
  501. //活体检测
  502. CHttpRequestPackage hrp;
  503. hrp.sUri = QString("/api/ecs_exam_work/exam/identificationOfLivingEnabled/%1")
  504. .arg(g_appInfoPtr->m_oExamInfo.nExamId);
  505. hrp.nRequestType = RequestType::rtLivenessEnabled;
  506. g_httpBllPtr->get(hrp);
  507. });
  508. }
  509. m_pFaceCompare->show();
  510. }
  511. else
  512. {
  513. //活体检测
  514. CHttpRequestPackage hrp;
  515. hrp.sUri = QString("/api/ecs_exam_work/exam/identificationOfLivingEnabled/%1")
  516. .arg(g_appInfoPtr->m_oExamInfo.nExamId);
  517. hrp.nRequestType = RequestType::rtLivenessEnabled;
  518. g_httpBllPtr->get(hrp);
  519. }
  520. }
  521. else
  522. {
  523. if(faceCheckEnabled.sMessage.isEmpty())
  524. {
  525. ShowMsg(QString::fromLocal8Bit("获取人脸识别信息失败"), this);
  526. }
  527. else
  528. {
  529. ShowMsg(faceCheckEnabled.sMessage, this);
  530. }
  531. }
  532. }
  533. void courseList::onLivenessEnabled(CLivenessEnabled livenessEnabled)
  534. {
  535. if (livenessEnabled.nCode == 200)
  536. {
  537. g_appInfoPtr->m_oExamInfo.bLivenessCheck = livenessEnabled.bEnabled;
  538. //进入待考
  539. enterWaitExam();
  540. }
  541. else
  542. {
  543. if(livenessEnabled.sMessage.isEmpty())
  544. {
  545. ShowMsg(QString::fromLocal8Bit("获取活体信息失败"), this);
  546. }
  547. else
  548. {
  549. ShowMsg(livenessEnabled.sMessage, this);
  550. }
  551. }
  552. }
  553. void courseList::enterWaitExam()
  554. {
  555. //进入待考
  556. if (m_pBackground == nullptr)
  557. {
  558. if (g_appInfoPtr->m_oExamInfo.bIsExamInProgress)
  559. {
  560. m_pBackground = std::make_shared<awBackground>(AW_WIDGET_TYPE::awwt_answerWidget, this);
  561. m_pResumeExam.reset();
  562. }
  563. else
  564. {
  565. m_pBackground = std::make_shared<awBackground>(AW_WIDGET_TYPE::awwt_waitExam, this);
  566. }
  567. connect(m_pBackground.get(), &awBackground::closeWidget, this, [&](){
  568. m_pBackground.reset();
  569. });
  570. connect(m_pBackground.get(), &awBackground::showPracticeInfo, this, [&](){
  571. m_pBackground.reset();
  572. CPracticeRecord pr;
  573. pr.nId = g_appInfoPtr->m_oExamInfo.nExamRecordDataId;
  574. pr.sCourseCode = g_appInfoPtr->m_oExamInfo.sCourseCode;
  575. pr.sCourseName = g_appInfoPtr->m_oExamInfo.sCourseName;
  576. if(m_pClopReport == nullptr)
  577. {
  578. m_pClopReport = std::make_shared<clopReport>(pr, true, ui->stw_courseList);
  579. connect(m_pClopReport.get(), &clopReport::goback, this, [&](){
  580. m_pClopReport.reset();
  581. });
  582. m_pClopReport->setUI(0, 0, ui->stw_courseList->width(), ui->stw_courseList->height());
  583. }
  584. m_pClopReport->show();
  585. });
  586. }
  587. m_pBackground->show();
  588. }
  589. void courseList::on_btn_onlineExam_clicked()
  590. {
  591. ui->stw_courseList->setCurrentIndex(0);
  592. setCheck(COURSE_MENU_BTN_TYPE::cmbt_online_exam);
  593. }
  594. void courseList::on_btn_onlineHomework_clicked()
  595. {
  596. ui->stw_courseList->setCurrentIndex(1);
  597. setCheck(COURSE_MENU_BTN_TYPE::cmbt_online_homework);
  598. }
  599. void courseList::on_btn_onlinePractice_clicked()
  600. {
  601. ui->stw_courseList->setCurrentIndex(2);
  602. setCheck(COURSE_MENU_BTN_TYPE::cmbt_online_practice);
  603. }
  604. void courseList::on_btn_offlineExam_clicked()
  605. {
  606. ui->stw_courseList->setCurrentIndex(3);
  607. setCheck(COURSE_MENU_BTN_TYPE::cmbt_offline_exam);
  608. }
  609. void courseList::on_btn_notice_clicked()
  610. {
  611. ui->stw_courseList->setCurrentIndex(4);
  612. setCheck(COURSE_MENU_BTN_TYPE::cmbt_notice);
  613. }
  614. void courseList::on_btn_editPassword_clicked()
  615. {
  616. ui->stw_courseList->setCurrentIndex(5);
  617. setCheck(COURSE_MENU_BTN_TYPE::cmbt_edit_password);
  618. }
  619. void courseList::on_btn_exit_clicked()
  620. {
  621. close();
  622. logout();
  623. }
  624. void courseList::logout()
  625. {
  626. CHttpRequestPackage hrp;
  627. hrp.sUri = "/api/ecs_core/auth/logout";
  628. hrp.nRequestType = RequestType::rtLogout;
  629. g_httpBllPtr->get(hrp);
  630. }
  631. bool courseList::eventFilter(QObject *obj, QEvent *ev)
  632. {
  633. if(ev->type() == QEvent::Enter)
  634. {
  635. if(obj == ui->btn_mobileLogin)
  636. {
  637. m_pMobileLoginBtnTimer->stop();
  638. if(m_pStudentInfo != nullptr)
  639. {
  640. m_pStudentInfo.reset();
  641. m_pStudentInfo = nullptr;
  642. }
  643. if(m_pMobileLogin == nullptr)
  644. {
  645. m_pMobileLogin = std::make_shared<clMobileLogin>(this);
  646. m_pMobileLogin->setUI(g_appInfoPtr->m_fRate*838, g_appInfoPtr->m_fRate*53, g_appInfoPtr->m_fRate*240, g_appInfoPtr->m_fRate*290);
  647. m_pMobileLogin->show();
  648. m_pMobileLogin->installEventFilter(this);
  649. }
  650. ui->btn_mobileLogin->setIcon(QIcon(":/images/icon-mobile-login-hover.png"));
  651. }
  652. else if(obj == ui->btn_studentInfo)
  653. {
  654. m_pStudentInfoBtnTimer->stop();
  655. if(m_pMobileLogin != nullptr)
  656. {
  657. m_pMobileLogin.reset();
  658. m_pMobileLogin = nullptr;
  659. }
  660. if(m_pStudentInfo == nullptr)
  661. {
  662. m_pStudentInfo = std::make_shared<clStudentInfo>(this);
  663. connect(m_pStudentInfo.get(), &clStudentInfo::sgnStudentLogout, this, [&]() {
  664. on_btn_exit_clicked();
  665. });
  666. connect(m_pStudentInfo.get(), &clStudentInfo::sgnStudentEditPassword, this, [&]() {
  667. if (m_pStudentInfo != nullptr)
  668. {
  669. m_pStudentInfo.reset();
  670. }
  671. on_btn_editPassword_clicked();
  672. });
  673. m_pStudentInfo->setUI(g_appInfoPtr->m_fRate*838, g_appInfoPtr->m_fRate*53, g_appInfoPtr->m_fRate*330, g_appInfoPtr->m_fRate*240);
  674. m_pStudentInfo->show();
  675. m_pStudentInfo->installEventFilter(this);
  676. }
  677. ui->btn_studentInfo->setIcon(QIcon(":/images/icon-student-info-hover.png"));
  678. }
  679. else if(obj == m_pMobileLogin.get())
  680. {
  681. m_pMobileLoginBtnTimer->stop();
  682. }
  683. else if(obj == m_pStudentInfo.get())
  684. {
  685. m_pStudentInfoBtnTimer->stop();
  686. }
  687. }
  688. else if(ev->type() == QEvent::Leave)
  689. {
  690. if(obj == ui->btn_mobileLogin || obj == m_pMobileLogin.get())
  691. {
  692. ui->btn_mobileLogin->setIcon(QIcon(":/images/icon-mobile-login.png"));
  693. m_pMobileLoginBtnTimer->start();
  694. }
  695. if(obj == ui->btn_studentInfo || obj == m_pStudentInfo.get())
  696. {
  697. ui->btn_studentInfo->setIcon(QIcon(":/images/icon-student-info.png"));
  698. m_pStudentInfoBtnTimer->start();
  699. }
  700. }
  701. return QWidget::eventFilter(obj, ev);
  702. }
  703. void courseList::hideStudentInfoBtn()
  704. {
  705. if(m_pStudentInfo != nullptr)
  706. {
  707. m_pStudentInfo.reset();
  708. }
  709. }
  710. void courseList::hideMobileLoginBtn()
  711. {
  712. if(m_pMobileLogin != nullptr)
  713. {
  714. m_pMobileLogin.reset();
  715. }
  716. }
  717. void courseList::getStudentInfoBySession()
  718. {
  719. CHttpRequestPackage hrp;
  720. hrp.sUri = "/api/ecs_core/student/getStudentInfoBySession";
  721. hrp.nRequestType = RequestType::rtGetStudentInfoBySession;
  722. g_httpBllPtr->get(hrp);
  723. }
  724. void courseList::onGetStudentInfoBySession(CGetStudentInfoBySession getStudentInfoBySession)
  725. {
  726. if (getStudentInfoBySession.nCode == 200)
  727. {
  728. g_appInfoPtr->m_nStudentId = getStudentInfoBySession.nId;
  729. g_appInfoPtr->m_sStudentName = getStudentInfoBySession.sName;
  730. g_appInfoPtr->m_nOrgId = getStudentInfoBySession.nOrgId;
  731. g_appInfoPtr->m_sOrgCode = getStudentInfoBySession.sOrgCode;
  732. g_appInfoPtr->m_sOrgName = getStudentInfoBySession.sOrgName;
  733. g_appInfoPtr->m_sStudentCode = getStudentInfoBySession.sStudentCode;
  734. g_appInfoPtr->m_sStudentIdentityNumber = getStudentInfoBySession.sIdentityNumber;
  735. g_appInfoPtr->m_sStudentPhotoPath = getStudentInfoBySession.sPhotoPath;
  736. g_appInfoPtr->m_bStudentEnable = getStudentInfoBySession.bEnable;
  737. ui->btn_studentInfo->setText(g_appInfoPtr->m_sStudentName);
  738. ui->btn_studentInfo->setVisible(g_appInfoPtr->m_bStudentEnable);
  739. ui->btn_mobileLogin->setVisible(g_appInfoPtr->m_bShowStudentClientAppQrcode);
  740. CHttpRequestPackage hrp;
  741. hrp.sUri = "/api/ecs_exam_work/exam_student/specialtyNameList";
  742. hrp.nRequestType = RequestType::rtSpecialtyNameList;
  743. g_httpBllPtr->get(hrp);
  744. if (!g_appInfoPtr->m_sStudentPhotoPath.isEmpty())
  745. {
  746. QString sFileName = g_appInfoPtr->m_sStudentPhotoPath.right(g_appInfoPtr->m_sStudentPhotoPath.length() - g_appInfoPtr->m_sStudentPhotoPath.lastIndexOf("/") - 1);
  747. sFileName = g_appInfoPtr->m_sCacheFileDir + sFileName;
  748. CHttpRequestPackage hrp;
  749. hrp.sUri = g_appInfoPtr->m_sStudentPhotoPath;
  750. hrp.sCommonStr = sFileName;
  751. hrp.nRequestType = RequestType::rtDownLoadFile;
  752. g_httpBllPtr->downLoad(hrp);
  753. }
  754. if (g_appInfoPtr->m_bShowStudentClientAppQrcode)
  755. {
  756. CHttpRequestPackage hrp;
  757. hrp.sUri = "/api/ecs_core/systemProperty/APP_DOWNLOAD_URL";
  758. hrp.nRequestType = RequestType::rtAppDownLoadUrl;
  759. g_httpBllPtr->get(hrp);
  760. }
  761. }
  762. else
  763. {
  764. if(getStudentInfoBySession.sMessage.isEmpty())
  765. {
  766. ShowMsg(QString::fromLocal8Bit("获取考生信息失败"), this);
  767. }
  768. else
  769. {
  770. ShowMsg(getStudentInfoBySession.sMessage, this);
  771. }
  772. }
  773. }
  774. void courseList::onAppDownLoadUrl(CAppDownLoadUrl appDownLoadUrl)
  775. {
  776. if (appDownLoadUrl.nCode == 200)
  777. {
  778. g_appInfoPtr->m_sAppDownLoadUrl = appDownLoadUrl.sUrl;
  779. }
  780. else
  781. {
  782. if(appDownLoadUrl.sMessage.isEmpty())
  783. {
  784. ShowMsg(QString::fromLocal8Bit("获取APP下载地址失败"), this);
  785. }
  786. else
  787. {
  788. ShowMsg(appDownLoadUrl.sMessage, this);
  789. }
  790. }
  791. }
  792. void courseList::onDownLoadFile(CDownLoadFileInfo downLoadFileInfo)
  793. {
  794. QString sFileName = g_appInfoPtr->m_sStudentPhotoPath.right(g_appInfoPtr->m_sStudentPhotoPath.length() - g_appInfoPtr->m_sStudentPhotoPath.lastIndexOf("/") - 1);
  795. sFileName = g_appInfoPtr->m_sCacheFileDir + sFileName;
  796. if (downLoadFileInfo.sFileName == sFileName)
  797. {
  798. if (downLoadFileInfo.nCode == 200)
  799. {
  800. }
  801. else
  802. {
  803. if(downLoadFileInfo.sMessage.isEmpty())
  804. {
  805. ShowMsg(QString::fromLocal8Bit("下载失败"), this);
  806. }
  807. else
  808. {
  809. ShowMsg(downLoadFileInfo.sMessage, this);
  810. }
  811. }
  812. }
  813. }
  814. void courseList::onSpecialtyNameList(CSpecialtyNameList specialtyNameList)
  815. {
  816. if (specialtyNameList.nCode == 200)
  817. {
  818. g_appInfoPtr->m_sSpecialtyName = specialtyNameList.sSpecialtyName;
  819. CHttpRequestPackage hrp;
  820. hrp.sUri = "/api/ecs_oe_student/client/exam/process/checkExamInProgress";
  821. hrp.nRequestType = RequestType::rtCheckExamInProgress;
  822. hrp.sCommonStr = EXAM_INPROGRESS_ENTER_TYPE::EIET_COURSE_LIST;
  823. g_httpBllPtr->post(hrp);
  824. }
  825. else
  826. {
  827. if(specialtyNameList.sMessage.isEmpty())
  828. {
  829. ShowMsg(QString::fromLocal8Bit("获取专业信息失败"), this);
  830. }
  831. else
  832. {
  833. ShowMsg(specialtyNameList.sMessage, this);
  834. }
  835. }
  836. }
  837. void courseList::onCheckExamInProgress(CCheckExamInProgress checkExamInProgress)
  838. {
  839. if (checkExamInProgress.nCode == 200)
  840. {
  841. if (checkExamInProgress.bHasExamInProgress)
  842. {
  843. if (checkExamInProgress.bIsExceed)
  844. {
  845. //超过断点时长交卷
  846. }
  847. else
  848. {
  849. //进入断点
  850. g_appInfoPtr->m_oExamInfo.nExamId = checkExamInProgress.nExamId;
  851. g_appInfoPtr->m_oExamInfo.nExamRecordDataId = checkExamInProgress.nExamRecordDataId;
  852. g_appInfoPtr->m_oExamInfo.sExamType = checkExamInProgress.sExamType;
  853. g_appInfoPtr->m_oExamInfo.bIsExamInProgress = true;
  854. if (m_pResumeExam == nullptr)
  855. {
  856. m_pResumeExam = std::make_shared<awResumeExam>(this);
  857. }
  858. m_pResumeExam->show();
  859. //环境监测
  860. CHttpRequestPackage hrp;
  861. hrp.sUri = QString("/api/ecs_exam_work/exam/getExamPropertyFromCacheByStudentSession/%1/%2")
  862. .arg(g_appInfoPtr->m_oExamInfo.nExamId).arg("CHECK_ENVIRONMENT,IS_FACE_CHECK,SNAPSHOT_INTERVAL,WARN_THRESHOLD,FACE_VERIFY_START_MINUTE,FACE_VERIFY_END_MINUTE,IS_STRANGER_ENABLE");
  863. hrp.nRequestType = RequestType::rtGetExamProperty;
  864. hrp.sCommonStr = "CHECK_ENVIRONMENT,IS_FACE_CHECK,SNAPSHOT_INTERVAL,WARN_THRESHOLD,FACE_VERIFY_START_MINUTE,FACE_VERIFY_END_MINUTE,IS_STRANGER_ENABLE";
  865. g_httpBllPtr->get(hrp);
  866. }
  867. }
  868. else
  869. {
  870. if (checkExamInProgress.sEnterType == EXAM_INPROGRESS_ENTER_TYPE::EIET_COURSE_LIST)
  871. {
  872. CHttpRequestPackage hrp;
  873. hrp.sUri = "/api/ecs_core/rolePrivilege/getStudentClientMenu";
  874. hrp.nRequestType = RequestType::rtGetStudentClientMenu;
  875. hrp.sParamList.push_back(QString::fromLocal8Bit("rootOrgId,%1").arg(g_appInfoPtr->m_sRootOrgId));
  876. g_httpBllPtr->get(hrp);
  877. if (m_pWelcomeWidget == nullptr)
  878. {
  879. m_pWelcomeWidget = std::make_shared<welcomeWidget>(g_appInfoPtr->m_sStudentName, g_appInfoPtr->m_sStudentCode, g_appInfoPtr->m_sSpecialtyName, this);
  880. connect(m_pWelcomeWidget.get(), &welcomeWidget::exitWelcomeWidget, this, [&]() {
  881. m_pWelcomeWidget.reset();
  882. });
  883. }
  884. m_pWelcomeWidget->show();
  885. }
  886. else
  887. {
  888. //环境监测
  889. CHttpRequestPackage hrp;
  890. hrp.sUri = QString("/api/ecs_exam_work/exam/getExamPropertyFromCacheByStudentSession/%1/%2")
  891. .arg(g_appInfoPtr->m_oExamInfo.nExamId).arg("CHECK_ENVIRONMENT,IS_FACE_CHECK,SNAPSHOT_INTERVAL,WARN_THRESHOLD,FACE_VERIFY_START_MINUTE,FACE_VERIFY_END_MINUTE,IS_STRANGER_ENABLE");
  892. hrp.nRequestType = RequestType::rtGetExamProperty;
  893. hrp.sCommonStr = "CHECK_ENVIRONMENT,IS_FACE_CHECK,SNAPSHOT_INTERVAL,WARN_THRESHOLD,FACE_VERIFY_START_MINUTE,FACE_VERIFY_END_MINUTE,IS_STRANGER_ENABLE";
  894. g_httpBllPtr->get(hrp);
  895. }
  896. }
  897. }
  898. else
  899. {
  900. if(checkExamInProgress.sMessage.isEmpty())
  901. {
  902. ShowMsg(QString::fromLocal8Bit("获取断点信息失败"), this);
  903. }
  904. else
  905. {
  906. ShowMsg(checkExamInProgress.sMessage, this);
  907. }
  908. }
  909. }
  910. void courseList::onGetStudentClientMenu(CGetStudentClientMenu getStudentClientMenu)
  911. {
  912. if (getStudentClientMenu.nCode == 200)
  913. {
  914. ui->btn_onlineExam->setVisible(false);
  915. ui->btn_onlineHomework->setVisible(false);
  916. ui->btn_onlinePractice->setVisible(false);
  917. ui->btn_offlineExam->setVisible(false);
  918. ui->btn_notice->setVisible(false);
  919. ui->btn_editPassword->setVisible(false);
  920. for (CStudentClientMenu scm : getStudentClientMenu.vMenus)
  921. {
  922. if (scm.sCode == "stu_online_exam_0")
  923. {
  924. ui->btn_onlineExam->setVisible(true);
  925. }
  926. else if (scm.sCode == "stu_online_homework_0")
  927. {
  928. ui->btn_onlineHomework->setVisible(true);
  929. }
  930. else if (scm.sCode == "stu_online_practice_0")
  931. {
  932. ui->btn_onlinePractice->setVisible(true);
  933. }
  934. else if (scm.sCode == "stu_offline_exam_0")
  935. {
  936. ui->btn_offlineExam->setVisible(true);
  937. }
  938. else if (scm.sCode == "stu_notice_0")
  939. {
  940. ui->btn_notice->setVisible(true);
  941. CHttpRequestPackage hrp;
  942. hrp.sUri = "/api/ecs_exam_work/notice/getUserNoticeList";
  943. hrp.nRequestType = RequestType::rtGetUserNoticeList;
  944. g_httpBllPtr->get(hrp);
  945. }
  946. else if (scm.sCode == "stu_modify_pwd_0")
  947. {
  948. ui->btn_editPassword->setVisible(true);
  949. }
  950. }
  951. menuBtnRePosistion();
  952. }
  953. else
  954. {
  955. if(getStudentClientMenu.sMessage.isEmpty())
  956. {
  957. ShowMsg(QString::fromLocal8Bit("获取菜单失败"), this);
  958. }
  959. else
  960. {
  961. ShowMsg(getStudentClientMenu.sMessage, this);
  962. }
  963. }
  964. }
  965. void courseList::onGetUserNoticeList(CGetUserNoticeList getUserNoticeList)
  966. {
  967. if (getUserNoticeList.nCode == 200)
  968. {
  969. if (m_pNoticeList == nullptr)
  970. {
  971. m_pNoticeList = std::make_shared<clNoticeList>(ui->stw_courseList);
  972. m_pNoticeList->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
  973. }
  974. m_pNoticeList->setNotice(getUserNoticeList.vNoticeList);
  975. if (m_pNoticePopWidget == nullptr)
  976. {
  977. m_pNoticePopWidget = std::make_shared<clNoticePopWidget>(this);
  978. m_pNoticePopWidget->setUI(g_appInfoPtr->m_fRate * 960, g_appInfoPtr->m_fRate * 558, g_appInfoPtr->m_fRate * 310, g_appInfoPtr->m_fRate * 200);
  979. }
  980. for (CNoticeInfo ni : getUserNoticeList.vNoticeList)
  981. {
  982. if (!ni.bHasRead)
  983. {
  984. m_pNoticePopWidget->addNotice(ni);
  985. }
  986. }
  987. if(m_pNoticePopWidget->noticeCount() > 0)
  988. {
  989. ui->btn_noticeNum->setVisible(true);
  990. ui->btn_noticeNum->setText(QString::number(m_pNoticePopWidget->noticeCount()));
  991. m_pNoticePopWidget->show();
  992. }
  993. }
  994. else
  995. {
  996. if(getUserNoticeList.sMessage.isEmpty())
  997. {
  998. ShowMsg(QString::fromLocal8Bit("获取通知信息失败"), this);
  999. }
  1000. else
  1001. {
  1002. ShowMsg(getUserNoticeList.sMessage, this);
  1003. }
  1004. }
  1005. }