123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401 |
- #include "courseList.h"
- #include "ui_courseList.h"
- #include "awMsgBox.h"
- #include <QDesktopWidget>
- #include <QMouseEvent>
- #include "CAppInfo.h"
- #include "CSqlite3DBProc.h"
- courseList::courseList(QWidget *parent) :
- QWidget(parent),
- ui(new Ui::courseList)
- {
- ui->setupUi(this);
- setWindowFlags(Qt::FramelessWindowHint);
- setStyleSheet(g_appInfoPtr->m_sQssStr);
- qRegisterMetaType<CGetStudentInfoBySession>("CGetStudentInfoBySession");
- connect(g_httpBllPtr.get(), &CHttpBll::sgnGetStudentInfoBySession, this, &courseList::onGetStudentInfoBySession);
- qRegisterMetaType<CSpecialtyNameList>("CSpecialtyNameList");
- connect(g_httpBllPtr.get(), &CHttpBll::sgnSpecialtyNameList, this, &courseList::onSpecialtyNameList);
- qRegisterMetaType<CCheckExamInProgress>("CCheckExamInProgress");
- connect(g_httpBllPtr.get(), &CHttpBll::sgnCheckExamInProgress, this, &courseList::onCheckExamInProgress);
- qRegisterMetaType<CGetStudentClientMenu>("CGetStudentClientMenu");
- connect(g_httpBllPtr.get(), &CHttpBll::sgnGetStudentClientMenu, this, &courseList::onGetStudentClientMenu);
- qRegisterMetaType<CGetUserNoticeList>("CGetUserNoticeList");
- connect(g_httpBllPtr.get(), &CHttpBll::sgnGetUserNoticeList, this, &courseList::onGetUserNoticeList);
- qRegisterMetaType<CDownLoadFileInfo>("CDownLoadFileInfo");
- connect(g_httpBllPtr.get(), &CHttpBll::sgnDownLoadFile, this, &courseList::onDownLoadFile);
- qRegisterMetaType<CAppDownLoadUrl>("CAppDownLoadUrl");
- connect(g_httpBllPtr.get(), &CHttpBll::sgnAppDownLoadUrl, this, &courseList::onAppDownLoadUrl);
- qRegisterMetaType<CStartExamLimit>("CStartExamLimit");
- connect(g_httpBllPtr.get(), &CHttpBll::sgnStartExamLimit, this, &courseList::onStartExamLimit);
- qRegisterMetaType<CIpLimit>("CIpLimit");
- connect(g_httpBllPtr.get(), &CHttpBll::sgnIpLimit, this, &courseList::onIpLimit);
- qRegisterMetaType<CGetExamProperty>("CGetExamProperty");
- connect(g_httpBllPtr.get(), &CHttpBll::sgnGetExamProperty, this, &courseList::onGetExamProperty);
- qRegisterMetaType<CFaceCheckEnabled>("CFaceCheckEnabled");
- connect(g_httpBllPtr.get(), &CHttpBll::sgnFaceCheckEnabled, this, &courseList::onFaceCheckEnabled);
- qRegisterMetaType<CLivenessEnabled>("CLivenessEnabled");
- connect(g_httpBllPtr.get(), &CHttpBll::sgnLivenessEnabled, this, &courseList::onLivenessEnabled);
- qRegisterMetaType<CEndExam>("CEndExam");
- connect(g_httpBllPtr.get(), &CHttpBll::sgnEndExam, this, &courseList::onEndExam);
- qRegisterMetaType<CGetOrgPropertiesByGroupWithoutCache>("CGetOrgPropertiesByGroupWithoutCache");
- connect(g_httpBllPtr.get(), &CHttpBll::sgnGetOrgPropertiesByGroupWithoutCache, this, &courseList::onGetOrgPropertiesByGroupWithoutCache);
- sqlite3_stmt *stmt;
- QString sSql = QString("select agreement from t_agreement where student_id=%1")
- .arg(g_appInfoPtr->m_nStudentId);
- if (!g_sysDBProcPtr->QuerySql(sSql.toStdString(), &stmt))
- {
- ShowMsg(QString::fromLocal8Bit("加载隐私协议信息失败!"), this, MSG_ICON_TYPE::mit_error);
- }
- bool bAgreement = false;
- int nField = 0;
- g_sysDBProcPtr->BeginGetFields(stmt);
- if (!g_sysDBProcPtr->Eof())
- {
- if (g_sysDBProcPtr->GetFields(0, nField, stmt) == 1)
- {
- bAgreement = true;
- }
- }
- g_sysDBProcPtr->EndGetFields(stmt);
- if (!bAgreement)
- {
- if (m_pPrivacyWidget == nullptr)
- {
- m_pPrivacyWidget = std::make_shared<privacyWidget>(this);
- connect(m_pPrivacyWidget.get(), &privacyWidget::agreement, this, [&]() {
- m_pPrivacyWidget.reset();
- getStudentInfoBySession();
- });
- connect(m_pPrivacyWidget.get(), &privacyWidget::disAgreement, this, [&]() {
- on_btn_exit_clicked();
- });
- }
- m_pPrivacyWidget->show();
-
- }
- else
- {
- getStudentInfoBySession();
- }
- initUI();
- m_pMobileLogin = nullptr;
- m_pStudentInfo = nullptr;
- m_pMobileLoginBtnTimer = std::make_shared<QTimer>();
- m_pMobileLoginBtnTimer->setInterval(500);
- connect(m_pMobileLoginBtnTimer.get(), &QTimer::timeout, this, &courseList::hideMobileLoginBtn);
- m_pStudentInfoBtnTimer = std::make_shared<QTimer>();
- m_pStudentInfoBtnTimer->setInterval(500);
- connect(m_pStudentInfoBtnTimer.get(), &QTimer::timeout, this, &courseList::hideStudentInfoBtn);
- m_pServerTime = std::make_shared<QTimer>();
- m_pServerTime->setInterval(1000);
- connect(m_pServerTime.get(), &QTimer::timeout, this, [&]() {
- ui->label_serverTime->adjustSize();
- ui->label_serverTime->setText(QString::fromLocal8Bit("服务器时间:%1")
- .arg(QDateTime::fromMSecsSinceEpoch(g_appInfoPtr->serverMTime()).toString("yyyy-MM-dd hh:mm:ss")));
- });
- m_pServerTime->start();
- m_pRefreshMenuTimer = std::make_shared<QTimer>();
- m_pRefreshMenuTimer->setInterval(1000 * 60 * 3);
- connect(m_pRefreshMenuTimer.get(), &QTimer::timeout, this, []() {
- CHttpRequestPackage hrp;
- hrp.sUri = "/api/ecs_core/rolePrivilege/getStudentClientMenu";
- hrp.nRequestType = RequestType::rtGetStudentClientMenu;
- hrp.sParamList.push_back(QString::fromLocal8Bit("rootOrgId,%1").arg(g_appInfoPtr->m_sRootOrgId));
- g_httpBllPtr->get(hrp);
- });
- m_pOnlineTimer = std::make_shared<QTimer>();
- m_pOnlineTimer->setInterval(1000*60*3);
- connect(m_pOnlineTimer.get(), &QTimer::timeout, this, []() {
- CHttpRequestPackage hrp1;
- hrp1.sUri = "/api/ecs_core/student/online_signal/" + QString::number(g_appInfoPtr->m_nStudentId);
- hrp1.nRequestType = RequestType::rtOnlineSignal;
- g_httpBllPtr->get(hrp1);
- });
- ui->btn_mobileLogin->installEventFilter(this);
- ui->btn_studentInfo->installEventFilter(this);
- m_pOnlineTimer->start();
- m_pRefreshMenuTimer->start();
- if (!g_appInfoPtr->m_sMenuLogoUrl.isEmpty())
- {
- QString sFileName = g_appInfoPtr->m_sMenuLogoUrl.right(g_appInfoPtr->m_sMenuLogoUrl.length() - g_appInfoPtr->m_sMenuLogoUrl.lastIndexOf("/") - 1);
- sFileName = g_appInfoPtr->m_sCacheFileDir + sFileName;
- CHttpRequestPackage hrp;
- hrp.sUri = g_appInfoPtr->m_sMenuLogoUrl;
- hrp.sCommonStr = sFileName;
- hrp.sCommonStr1 = __FILE__;
- hrp.sAdditionStr = "MenuLogoUrl";
- hrp.nRequestType = RequestType::rtDownLoadFile;
- hrp.nRetryCount = 3;
- g_httpBllPtr->downLoad(hrp);
- }
- else
- {
- ui->label_cl_org_icon->setPixmap(QPixmap(":/images/qm-logo.png").scaled(ui->label_cl_org_icon->width(), ui->label_cl_org_icon->height(),
- Qt::KeepAspectRatio, Qt::SmoothTransformation));
- }
- }
- courseList::~courseList()
- {
- awMsgBox::clear(this);
- delete ui;
- }
- void courseList::initUI()
- {
- QDesktopWidget *dekwiget = QApplication::desktop();
- setGeometry(0, 0, dekwiget->width(), dekwiget->height());
- ui->widget_cl_BG->setGeometry(0, 0, dekwiget->width(), dekwiget->height());
- ui->widget_menu->setGeometry(0, 0, g_appInfoPtr->m_fRate*96, height());
- ui->widget_top->setGeometry(ui->widget_menu->width(), 0, width() - ui->widget_menu->width(), g_appInfoPtr->m_fRate*56);
- ui->widget_bottom->setGeometry(ui->widget_top->x(), height() - g_appInfoPtr->m_fRate*38, ui->widget_top->width(), g_appInfoPtr->m_fRate*38);
- ui->stw_courseList->setGeometry(ui->widget_top->x(), ui->widget_top->y() + ui->widget_top->height(),
- ui->widget_top->width(), height() - ui->widget_top->height() - ui->widget_bottom->height());
- /*
- clOnlineExam *cloe = new clOnlineExam;
- cloe->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
- ui->stw_courseList->addWidget(cloe);
- clOnlineHomework *clow = new clOnlineHomework;
- clow->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
- ui->stw_courseList->addWidget(clow);
- clOnlinePractice *clop = new clOnlinePractice;
- clop->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
- ui->stw_courseList->addWidget(clop);
- clOfflineExam *cloffe = new clOfflineExam;
- cloffe->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
- ui->stw_courseList->addWidget(cloffe);
- clNoticeList *clnl = new clNoticeList;
- clnl->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
- ui->stw_courseList->addWidget(clnl);
- clEditPassword *clep = new clEditPassword;
- clep->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
- ui->stw_courseList->addWidget(clep);
- ui->stw_courseList->setCurrentIndex(0);
- */
-
- ui->label_cl_org_icon->setGeometry(g_appInfoPtr->m_fRate*15, g_appInfoPtr->m_fRate*15, g_appInfoPtr->m_fRate*66, g_appInfoPtr->m_fRate*66);
- ui->btn_onlineExam->setGeometry(g_appInfoPtr->m_fRate*20, g_appInfoPtr->m_fRate*103, g_appInfoPtr->m_fRate*56, g_appInfoPtr->m_fRate*66);
- ui->btn_onlineHomework->setGeometry(ui->btn_onlineExam->x(), ui->btn_onlineExam->y() + ui->btn_onlineExam->height() + g_appInfoPtr->m_fRate*17,
- ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
- ui->btn_onlinePractice->setGeometry(ui->btn_onlineExam->x(), ui->btn_onlineHomework->y() + ui->btn_onlineHomework->height() + g_appInfoPtr->m_fRate*17,
- ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
- ui->btn_offlineExam->setGeometry(ui->btn_onlineExam->x(), ui->btn_onlinePractice->y() + ui->btn_onlinePractice->height() + g_appInfoPtr->m_fRate*17,
- ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
- ui->btn_notice->setGeometry(ui->btn_onlineExam->x(), ui->btn_offlineExam->y() + ui->btn_offlineExam->height() + g_appInfoPtr->m_fRate*17,
- ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
- ui->btn_noticeNum->setGeometry(ui->btn_notice->x() + ui->btn_notice->width() - g_appInfoPtr->m_fRate*16, ui->btn_notice->y(),
- g_appInfoPtr->m_fRate*16, g_appInfoPtr->m_fRate*16);
- ui->btn_noticeNum->setVisible(false);
- ui->btn_editPassword->setGeometry(ui->btn_onlineExam->x(), ui->btn_notice->y() + ui->btn_notice->height() + g_appInfoPtr->m_fRate*17,
- ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
- ui->label_currentPlaceIcon->setGeometry(g_appInfoPtr->m_fRate*30, (ui->widget_top->height() - g_appInfoPtr->m_fRate*10)/2,
- g_appInfoPtr->m_fRate*10, g_appInfoPtr->m_fRate*10);
- ui->label_currrentPlace->adjustSize();
- ui->label_currrentPlace->setGeometry(ui->label_currentPlaceIcon->x() + ui->label_currentPlaceIcon->width() + g_appInfoPtr->m_fRate*10,
- (ui->widget_top->height() - ui->label_currrentPlace->height())/2, g_appInfoPtr->m_fRate*400, ui->label_currrentPlace->height());
- ui->btn_cl_close->setGeometry(ui->widget_top->width() - g_appInfoPtr->m_fRate*10 - g_appInfoPtr->m_fRate*24, g_appInfoPtr->m_fRate*16,
- g_appInfoPtr->m_fRate*24, g_appInfoPtr->m_fRate*24);
- ui->btn_minisize->setGeometry(ui->btn_cl_close->x() - g_appInfoPtr->m_fRate*6 - ui->btn_cl_close->width(), ui->btn_cl_close->y(),
- ui->btn_cl_close->width(), ui->btn_cl_close->height());
- ui->label_VLine->setGeometry(ui->btn_minisize->x() - g_appInfoPtr->m_fRate*21, ui->btn_cl_close->y(),
- g_appInfoPtr->m_fRate*1 < 1 ? 1 : g_appInfoPtr->m_fRate*1, g_appInfoPtr->m_fRate*24);
- ui->btn_exit->setGeometry(ui->label_VLine->x() - g_appInfoPtr->m_fRate*(20+24), ui->btn_cl_close->y(),
- ui->btn_cl_close->width(), ui->btn_cl_close->height());
- ui->btn_studentInfo->setGeometry(ui->btn_exit->x() - g_appInfoPtr->m_fRate*(10+90), ui->btn_cl_close->y(),
- g_appInfoPtr->m_fRate*90, g_appInfoPtr->m_fRate*24);
- ui->btn_studentInfo->setIconSize(QSize(g_appInfoPtr->m_fRate*8, g_appInfoPtr->m_fRate*8));
- ui->btn_studentInfo->setIcon(QIcon(":/images/icon-student-info.png"));
- ui->label_arrow->setGeometry(ui->btn_studentInfo->x() + (ui->btn_studentInfo->width() - g_appInfoPtr->m_fRate*12)/2,
- ui->btn_studentInfo->y() + ui->btn_studentInfo->height(),
- g_appInfoPtr->m_fRate*12, g_appInfoPtr->m_fRate*3);
- ui->label_arrow->setVisible(false);
- ui->btn_mobileLogin->setGeometry(ui->btn_studentInfo->x() - g_appInfoPtr->m_fRate*(10+167), ui->btn_cl_close->y(),
- g_appInfoPtr->m_fRate*167, g_appInfoPtr->m_fRate*24);
- ui->btn_mobileLogin->setIconSize(QSize(g_appInfoPtr->m_fRate*8, g_appInfoPtr->m_fRate*8));
- ui->btn_mobileLogin->setIcon(QIcon(":/images/icon-mobile-login.png"));
- ui->label_cl_company->adjustSize();
- ui->label_cl_company->setGeometry(g_appInfoPtr->m_fRate*30, (ui->widget_bottom->height() - ui->label_cl_company->height())/2,
- ui->label_cl_company->width(), ui->label_cl_company->height());
- ui->label_cl_version->adjustSize();
- ui->label_cl_version->setGeometry(ui->widget_bottom->width() - g_appInfoPtr->m_fRate*30 - ui->label_cl_version->width(),
- ui->label_cl_company->y(), ui->label_cl_version->width(), ui->label_cl_version->height());
-
- ui->label_serverTime->setText(QString::fromLocal8Bit("服务器时间:%1")
- .arg(QDateTime::fromMSecsSinceEpoch(g_appInfoPtr->serverMTime()).toString("yyyy-MM-dd hh:mm:ss")));
-
- ui->label_serverTime->adjustSize();
- ui->label_serverTime->setGeometry(ui->label_cl_version->x() - g_appInfoPtr->m_fRate*20 - ui->label_serverTime->width(), ui->label_cl_company->y(),
- ui->label_serverTime->width(), ui->label_serverTime->height());
- setCheck(COURSE_MENU_BTN_TYPE::cmbt_online_exam);
- }
- void courseList::menuBtnRePosistion()
- {
- int nTop = g_appInfoPtr->m_fRate * 103;
- if(ui->btn_onlineExam->isVisible())
- {
- ui->btn_onlineExam->setGeometry(g_appInfoPtr->m_fRate * 20, nTop, g_appInfoPtr->m_fRate * 56, g_appInfoPtr->m_fRate * 66);
- nTop = nTop + ui->btn_onlineExam->height() + g_appInfoPtr->m_fRate * 17;
- }
-
- if(ui->btn_onlineHomework->isVisible())
- {
- ui->btn_onlineHomework->setGeometry(ui->btn_onlineExam->x(), nTop,
- ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
- nTop = nTop + ui->btn_onlineExam->height() + g_appInfoPtr->m_fRate * 17;
- }
-
- if (ui->btn_onlinePractice->isVisible())
- {
- ui->btn_onlinePractice->setGeometry(ui->btn_onlineExam->x(), nTop,
- ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
- nTop = nTop + ui->btn_onlineExam->height() + g_appInfoPtr->m_fRate * 17;
- }
-
- if (ui->btn_offlineExam->isVisible())
- {
- ui->btn_offlineExam->setGeometry(ui->btn_onlineExam->x(), nTop,
- ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
- nTop = nTop + ui->btn_onlineExam->height() + g_appInfoPtr->m_fRate * 17;
- }
- if (ui->btn_notice->isVisible())
- {
- ui->btn_notice->setGeometry(ui->btn_onlineExam->x(), nTop,
- ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
- ui->btn_noticeNum->setGeometry(ui->btn_notice->x() + ui->btn_notice->width() - g_appInfoPtr->m_fRate * 16, ui->btn_notice->y(),
- g_appInfoPtr->m_fRate * 16, g_appInfoPtr->m_fRate * 16);
- nTop = nTop + ui->btn_onlineExam->height() + g_appInfoPtr->m_fRate * 17;
- }
-
- if (ui->btn_editPassword->isVisible())
- {
- ui->btn_editPassword->setGeometry(ui->btn_onlineExam->x(), ui->btn_notice->y() + ui->btn_notice->height() + g_appInfoPtr->m_fRate * 17,
- ui->btn_onlineExam->width(), ui->btn_onlineExam->height());
- }
- }
- void courseList::on_btn_minisize_clicked()
- {
- emit minisize();
- }
- void courseList::on_btn_cl_close_clicked()
- {
- // logout();
- // close();
- QCoreApplication::quit();
- }
- void courseList::setCheck(COURSE_MENU_BTN_TYPE cmbt)
- {
- QString sNormalSheet = QString(R"(outline:none;
- font-size:%1px;
- font-family:"Microsoft YaHei";
- font-weight:400;
- color:rgba(255,255,255,0.4);
- background:rgba(255,255,255,0);
- border-radius:%2;)").arg((int)(g_appInfoPtr->m_fRate*12)).arg(g_appInfoPtr->m_fRate*12);
- QString sCheckSheet = QString(R"(QPushButton
- {
- outline:none;
- font-size:%1px;
- font-family:"Microsoft YaHei";
- font-weight:400;
- color:rgba(255,255,255,1);
- border-radius:%2px;
- 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));
- })").arg((int)(g_appInfoPtr->m_fRate*12)).arg(g_appInfoPtr->m_fRate*12);
- ui->btn_onlineExam->setStyleSheet(sNormalSheet);
- ui->btn_onlineHomework->setStyleSheet(sNormalSheet);
- ui->btn_onlinePractice->setStyleSheet(sNormalSheet);
- ui->btn_offlineExam->setStyleSheet(sNormalSheet);
- ui->btn_notice->setStyleSheet(sNormalSheet);
- ui->btn_editPassword->setStyleSheet(sNormalSheet);
- if (m_pOnlineExam != nullptr)
- {
- m_pOnlineExam->hide();
- }
- if (m_pOnlineHomework != nullptr)
- {
- m_pOnlineHomework->hide();
- }
-
- if (m_pOnlinePractice != nullptr)
- {
- m_pOnlinePractice->hide();
- m_pOnlinePractice->releaseClopResult();
- }
- if (m_pClopReport != nullptr)
- {
- m_pClopReport->hide();
- }
-
- if (m_pOfflineExam != nullptr)
- {
- m_pOfflineExam->hide();
- }
-
- if (m_pNoticeList != nullptr)
- {
- m_pNoticeList->hide();
- }
- if (m_pEditPassword != nullptr)
- {
- m_pEditPassword->hide();
- }
- QString sCurrentPlace = "";
- if (cmbt == COURSE_MENU_BTN_TYPE::cmbt_online_exam)
- {
- if (m_pOnlineExam == nullptr)
- {
- m_pOnlineExam = std::make_shared<clOnlineExam>(ui->stw_courseList);
- m_pOnlineExam->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
- connect(m_pOnlineExam.get(), &clOnlineExam::enterExam, this, &courseList::onEnterExam);
- }
- m_pOnlineExam->show();
- ui->btn_onlineExam->setStyleSheet(sCheckSheet);
- sCurrentPlace = QString::fromLocal8Bit("当前所在位置:在线考试");
- }
- else if(cmbt == COURSE_MENU_BTN_TYPE::cmbt_online_homework)
- {
- if (m_pOnlineHomework == nullptr)
- {
- m_pOnlineHomework = std::make_shared<clOnlineHomework>(ui->stw_courseList);
- m_pOnlineHomework->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
- connect(m_pOnlineHomework.get(), &clOnlineHomework::enterExam, this, &courseList::onEnterExam);
- }
- m_pOnlineHomework->show();
- ui->btn_onlineHomework->setStyleSheet(sCheckSheet);
- sCurrentPlace = QString::fromLocal8Bit("当前所在位置:在线作业");
- }
- else if(cmbt == COURSE_MENU_BTN_TYPE::cmbt_online_practice)
- {
- if (m_pOnlinePractice == nullptr)
- {
- m_pOnlinePractice = std::make_shared<clOnlinePractice>(ui->stw_courseList);
- m_pOnlinePractice->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
- connect(m_pOnlinePractice.get(), &clOnlinePractice::enterExam, this, &courseList::onEnterExam);
- }
- m_pOnlinePractice->show();
- ui->btn_onlinePractice->setStyleSheet(sCheckSheet);
- sCurrentPlace = QString::fromLocal8Bit("当前所在位置:在线练习");
- }
- else if(cmbt == COURSE_MENU_BTN_TYPE::cmbt_offline_exam)
- {
- if (m_pOfflineExam == nullptr)
- {
- m_pOfflineExam = std::make_shared<clOfflineExam>(ui->stw_courseList);
- m_pOfflineExam->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
- }
- m_pOfflineExam->show();
- ui->btn_offlineExam->setStyleSheet(sCheckSheet);
- sCurrentPlace = QString::fromLocal8Bit("当前所在位置:离线考试");
- }
- else if(cmbt == COURSE_MENU_BTN_TYPE::cmbt_notice)
- {
- if (m_pNoticeList == nullptr)
- {
- m_pNoticeList = std::make_shared<clNoticeList>(ui->stw_courseList);
- m_pNoticeList->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
- }
- m_pNoticeList->show();
- ui->btn_notice->setStyleSheet(sCheckSheet);
- sCurrentPlace = QString::fromLocal8Bit("当前所在位置:公告通知");
- }
- else if(cmbt == COURSE_MENU_BTN_TYPE::cmbt_edit_password)
- {
- if (m_pEditPassword == nullptr)
- {
- m_pEditPassword = std::make_shared<clEditPassword>(ui->stw_courseList);
- m_pEditPassword->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
- }
- m_pEditPassword->show();
- ui->btn_editPassword->setStyleSheet(sCheckSheet);
- sCurrentPlace = QString::fromLocal8Bit("当前所在位置:修改密码");
- }
- ui->label_currrentPlace->setText(sCurrentPlace);
- }
- void courseList::onEnterExam(CL_OPERATION_TYPE cot, __int64 nExamId, __int64 nExamStudentId, QString sCourseCode, QString sCourseName)
- {
- if(cot == CL_OPERATION_TYPE::cot_online_exam)
- {
- g_appInfoPtr->m_oExamInfo.sExamType = EXAM_TYPES::ONLINE;
- }
- g_appInfoPtr->m_oExamInfo.nExamId = nExamId;
- g_appInfoPtr->m_oExamInfo.nExamStudentId = nExamStudentId;
- g_appInfoPtr->m_oExamInfo.sCourseCode = sCourseCode;
- g_appInfoPtr->m_oExamInfo.sCourseName = sCourseName;
- //开考限流
- m_nRetryCount = 0;
- CHttpRequestPackage hrp;
- hrp.sUri = QString("https://tcc.qmth.com.cn/rate_limit/prod/startExam/%1").arg(100);
- hrp.nRequestType = RequestType::rtStartExamLimit;
- g_httpBllPtr->getUrl(hrp);
- }
- void courseList::onStartExamLimit(CStartExamLimit startExamLimit)
- {
- if (startExamLimit.nCode == 200)
- {
- ++m_nRetryCount;
- if (startExamLimit.bPass)
- {
- CHttpRequestPackage hrp;
- hrp.sUri = QString("/api/ecs_exam_work/exam/ipLimit/%1").arg(g_appInfoPtr->m_oExamInfo.nExamId);
- hrp.nRequestType = RequestType::rtIpLimit;
- g_httpBllPtr->get(hrp);
- }
- else
- {
- //重试
- if(m_nRetryCount >= 3)
- {
- ShowMsg(QString::fromLocal8Bit("系统繁忙,请稍后重试"), this, MSG_ICON_TYPE::mit_error);
- }
- else
- {
- QTimer::singleShot(3*1000, this, [](){
- CHttpRequestPackage hrp;
- hrp.sUri = QString("https://tcc.qmth.com.cn/rate_limit/prod/startExam/%1").arg(100);
- hrp.nRequestType = RequestType::rtStartExamLimit;
- g_httpBllPtr->getUrl(hrp);
- });
- }
- }
- }
- else
- {
- ShowMsg(QString::fromLocal8Bit("开考失败"), this, MSG_ICON_TYPE::mit_error);
- }
- }
- void courseList::onIpLimit(CIpLimit ipLimit)
- {
- if (ipLimit.nCode == 200)
- {
- if (!ipLimit.bLimited)
- {
- //断点
- CHttpRequestPackage hrp;
- hrp.sUri = "/api/ecs_oe_student/client/exam/process/checkExamInProgress";
- hrp.nRequestType = RequestType::rtCheckExamInProgress;
- hrp.sCommonStr = EXAM_INPROGRESS_ENTER_TYPE::EIET_ENTER_EXAM;
- g_httpBllPtr->post(hrp);
- }
- else
- {
- ShowMsg(QString::fromLocal8Bit("当前ip限制参加考试"), this, MSG_ICON_TYPE::mit_error);
- }
- }
- else
- {
- ShowMsg(QString::fromLocal8Bit("开考失败"), this, MSG_ICON_TYPE::mit_error);
- }
- }
- void courseList::onGetExamProperty(CGetExamProperty getExamProperty)
- {
- if (getExamProperty.nCode == 200)
- {
- if (getExamProperty.sType == "CHECK_ENVIRONMENT,IS_FACE_CHECK,SNAPSHOT_INTERVAL,WARN_THRESHOLD,FACE_VERIFY_START_MINUTE,FACE_VERIFY_END_MINUTE,IS_STRANGER_ENABLE,IS_FACE_VERIFY_BEFORE")
- {
- g_appInfoPtr->m_oExamInfo.bIsFaceCheck = getExamProperty.bIsFaceCheck;
- g_appInfoPtr->m_oExamInfo.nWarnThreshold = getExamProperty.nWarnThreshold;
- g_appInfoPtr->m_oExamInfo.nSnapshotInterval = getExamProperty.nSnapshotInterval;
- g_appInfoPtr->m_oExamInfo.nFaceVerifyStartMinute = getExamProperty.nFaceVerifyStartMinute;
- g_appInfoPtr->m_oExamInfo.nFaceVerifyEndMinute = getExamProperty.nFaceVerifyEndMinute;
- g_appInfoPtr->m_oExamInfo.bIsStrangerEnable = getExamProperty.bIsStrangerEnable;
- g_appInfoPtr->m_oExamInfo.bIsLivenessBefore = getExamProperty.bIsLivenessBefore;
- if (getExamProperty.bCheckEnvironment && !g_appInfoPtr->m_oExamInfo.bIsExamInProgress)
- {
- if(m_pWhetherEnvTest == nullptr)
- {
- m_pWhetherEnvTest = std::make_shared<etWhetherEnvTest>(this);
- connect(m_pWhetherEnvTest.get(), &etWhetherEnvTest::envTest, this, [&](){
- m_pWhetherEnvTest.reset();
- //环境检测
- if (m_pEnvironmentalTest == nullptr)
- {
- m_pEnvironmentalTest = std::make_shared<environmentalTest>(this);
- connect(m_pEnvironmentalTest.get(), &environmentalTest::enterExam, this, [&](){
- m_pEnvironmentalTest.reset();
- //人脸识别
- CHttpRequestPackage hrp;
- hrp.sUri = QString("/api/ecs_exam_work/exam/faceCheckEnabled/%1")
- .arg(g_appInfoPtr->m_oExamInfo.nExamId);
- hrp.nRequestType = RequestType::rtFaceCheckEnabled;
- g_httpBllPtr->get(hrp);
- });
- }
- m_pEnvironmentalTest->show();
- });
- connect(m_pWhetherEnvTest.get(), &etWhetherEnvTest::skipEnvTest, this, [&](){
- m_pWhetherEnvTest.reset();
- //人脸识别
- CHttpRequestPackage hrp;
- hrp.sUri = QString("/api/ecs_exam_work/exam/faceCheckEnabled/%1")
- .arg(g_appInfoPtr->m_oExamInfo.nExamId);
- hrp.nRequestType = RequestType::rtFaceCheckEnabled;
- g_httpBllPtr->get(hrp);
- });
- }
- m_pWhetherEnvTest->show();
- }
- else
- {
- //人脸识别
- CHttpRequestPackage hrp;
- hrp.sUri = QString("/api/ecs_exam_work/exam/faceCheckEnabled/%1")
- .arg(g_appInfoPtr->m_oExamInfo.nExamId);
- hrp.nRequestType = RequestType::rtFaceCheckEnabled;
- g_httpBllPtr->get(hrp);
- }
- }
- }
- else
- {
- if(getExamProperty.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("获取考试信息失败"), this, MSG_ICON_TYPE::mit_error);
- }
- else
- {
- ShowMsg(getExamProperty.sMessage, this);
- }
- }
- }
- void courseList::onFaceCheckEnabled(CFaceCheckEnabled faceCheckEnabled)
- {
- if (faceCheckEnabled.nCode == 200)
- {
- //人脸检测
- g_appInfoPtr->m_oExamInfo.bFaceCheck = faceCheckEnabled.bEnabled;
- // if (faceCheckEnabled.bEnabled && !g_appInfoPtr->m_oExamInfo.bIsExamInProgress)
- // {
- // if (g_appInfoPtr->m_sStudentPhotoPath.isEmpty())
- // {
- // ShowMsg(QString::fromLocal8Bit("本场考试需要进行人脸检测,但是您没有上传底照,请联系老师"), this, MSG_ICON_TYPE::mit_error);
- // return;
- // }
- // if (m_pFaceCompare == nullptr)
- // {
- // m_pFaceCompare = std::make_shared<faceCompare>(this);
- // connect(m_pFaceCompare.get(), &faceCompare::exitFaceCompare, this, [&]() {
- // m_pFaceCompare.reset();
- // });
- // connect(m_pFaceCompare.get(), &faceCompare::faceComparePass, this, [&]() {
- // m_pFaceCompare.reset();
- // //活体检测
- // CHttpRequestPackage hrp;
- // hrp.sUri = QString("/api/ecs_exam_work/exam/identificationOfLivingEnabled/%1")
- // .arg(g_appInfoPtr->m_oExamInfo.nExamId);
- // hrp.nRequestType = RequestType::rtLivenessEnabled;
- // g_httpBllPtr->get(hrp);
- // });
- // }
- // m_pFaceCompare->show();
- // }
- // else
- {
- //活体检测
- CHttpRequestPackage hrp;
- hrp.sUri = QString("/api/ecs_exam_work/exam/identificationOfLivingEnabled/%1")
- .arg(g_appInfoPtr->m_oExamInfo.nExamId);
- hrp.nRequestType = RequestType::rtLivenessEnabled;
- g_httpBllPtr->get(hrp);
- }
- }
- else
- {
- if(faceCheckEnabled.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("获取人脸识别信息失败"), this, MSG_ICON_TYPE::mit_error);
- }
- else
- {
- ShowMsg(faceCheckEnabled.sMessage, this, MSG_ICON_TYPE::mit_error);
- }
- }
- }
- void courseList::doFaceCompare()
- {
- if (g_appInfoPtr->m_sStudentPhotoPath.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("本场考试需要进行人脸检测,但是您没有上传底照,请联系老师"), this, MSG_ICON_TYPE::mit_error);
- return;
- }
- if (m_pFaceCompare == nullptr)
- {
- m_pFaceCompare = std::make_shared<faceCompare>(this);
- connect(m_pFaceCompare.get(), &faceCompare::exitFaceCompare, this, [&]() {
- m_pFaceCompare.reset();
- });
- connect(m_pFaceCompare.get(), &faceCompare::faceComparePass, this, [&]() {
- m_pFaceCompare.reset();
- //进入待考
- enterWaitExam();
- });
- }
- m_pFaceCompare->show();
- }
- void courseList::onLivenessEnabled(CLivenessEnabled livenessEnabled)
- {
- if (livenessEnabled.nCode == 200)
- {
- g_appInfoPtr->m_oExamInfo.bLivenessCheck = livenessEnabled.bEnabled;
- GetOrgPropertiesByGroupWithoutCache();
- //进入待考
- // enterWaitExam();
- }
- else
- {
- if(livenessEnabled.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("获取活体信息失败"), this, MSG_ICON_TYPE::mit_error);
- }
- else
- {
- ShowMsg(livenessEnabled.sMessage, this, MSG_ICON_TYPE::mit_error);
- }
- }
- }
- void courseList::doLiveness()
- {
- //活体检测
- if(m_pFaceLiveness == nullptr)
- {
- m_pFaceLiveness = std::make_shared<faceLiveness>(FACE_LIVENESS_TYPE::flt_entry_exam, this);
- connect(m_pFaceLiveness.get(), &faceLiveness::faceLivenessFaild, this, [&](){
- g_appInfoPtr->m_oExamInfo.nFaceLiveVerifyId = 0;
- m_pFaceLiveness.reset();
- });
- connect(m_pFaceLiveness.get(), &faceLiveness::faceLivenessSucceed, this, [&](){
- g_appInfoPtr->m_oExamInfo.nFaceLiveVerifyId = 0;
- m_pFaceLiveness.reset();
- //进入待考
- enterWaitExam();
- });
- m_pFaceLiveness->show();
- }
- }
- void courseList::GetOrgPropertiesByGroupWithoutCache()
- {
- CHttpRequestPackage hrp;
- hrp.sUri = QString("/api/ecs_core/org/getOrgPropertiesByGroupWithoutCache/%1/config4Edit1")
- .arg(g_appInfoPtr->m_sRootOrgId);
- hrp.nRequestType = RequestType::rtGetOrgPropertiesByGroupWithoutCache;
- g_httpBllPtr->get(hrp);
- }
- void courseList::onGetOrgPropertiesByGroupWithoutCache(CGetOrgPropertiesByGroupWithoutCache orgProperties)
- {
- if(orgProperties.nCode == 200)
- {
- m_nRetryCount = 0;
- g_appInfoPtr->m_oExamInfo.nActionNum = orgProperties.nActionNum;
- g_appInfoPtr->m_oExamInfo.sActionOptions = orgProperties.sActionOptions;
- g_appInfoPtr->m_oExamInfo.sActionOrder = orgProperties.sActionOrder;
- g_appInfoPtr->m_oExamInfo.nActionDuration = orgProperties.nActionDuration;
- g_appInfoPtr->m_oExamInfo.nActionAlert = orgProperties.nActionAlert;
- g_appInfoPtr->m_oExamInfo.nAllActionDuration = orgProperties.nAllActionDuration;
- if(!g_appInfoPtr->m_oExamInfo.bIsExamInProgress)
- {
- if(g_appInfoPtr->m_oExamInfo.bIsLivenessBefore && g_appInfoPtr->m_oExamInfo.bIsFaceCheck)
- {
- doLiveness();
- }
- else if(g_appInfoPtr->m_oExamInfo.bFaceCheck)
- {
- doFaceCompare();
- }
- else
- {
- enterWaitExam();
- }
- }
- else
- {
- enterWaitExam();
- }
- }
- else
- {
- if(orgProperties.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("获取活体信息失败"), this, MSG_ICON_TYPE::mit_error);
- }
- else
- {
- ShowMsg(orgProperties.sMessage, this, MSG_ICON_TYPE::mit_error);
- }
- }
- }
- void courseList::enterWaitExam()
- {
- //进入待考
- if (m_pBackground == nullptr)
- {
- if (g_appInfoPtr->m_oExamInfo.bIsExamInProgress)
- {
- m_pBackground = std::make_shared<awBackground>(AW_WIDGET_TYPE::awwt_answerWidget, this);
- m_pResumeExam.reset();
- }
- else
- {
- m_pBackground = std::make_shared<awBackground>(AW_WIDGET_TYPE::awwt_waitExam, this);
- }
- connect(m_pBackground.get(), &awBackground::minisize, this, &courseList::minisize);
- connect(m_pBackground.get(), &awBackground::closeWidget, this, [&](){
- m_pBackground.reset();
- m_pRefreshMenuTimer->start();
- if(m_pOnlineExam)
- {
- m_pOnlineExam->refreshExam();
- }
- if(m_pOnlineHomework)
- {
- m_pOnlineHomework->refreshExam();
- }
- });
- connect(m_pBackground.get(), &awBackground::gobackLogin, this, [&](){
- m_pBackground.reset();
- logout();
- close();
- });
- connect(m_pBackground.get(), &awBackground::showPracticeInfo, this, [&](){
- m_pBackground.reset();
- CPracticeRecord pr;
- pr.nId = g_appInfoPtr->m_oExamInfo.nExamRecordDataId;
- pr.sCourseCode = g_appInfoPtr->m_oExamInfo.sCourseCode;
- pr.sCourseName = g_appInfoPtr->m_oExamInfo.sCourseName;
- if(m_pClopReport == nullptr)
- {
- m_pClopReport = std::make_shared<clopReport>(pr, true, ui->stw_courseList);
- connect(m_pClopReport.get(), &clopReport::goback, this, [&](){
- m_pClopReport.reset();
- if(m_pOnlinePractice)
- {
- m_pOnlinePractice->refreshExamInfo();
- }
- });
- m_pClopReport->setUI(0, 0, ui->stw_courseList->width(), ui->stw_courseList->height());
- }
- m_pClopReport->show();
- m_pRefreshMenuTimer->start();
- });
- }
- m_pBackground->show();
- m_pRefreshMenuTimer->stop();
- }
- void courseList::on_btn_onlineExam_clicked()
- {
- ui->stw_courseList->setCurrentIndex(0);
- setCheck(COURSE_MENU_BTN_TYPE::cmbt_online_exam);
- }
- void courseList::on_btn_onlineHomework_clicked()
- {
- ui->stw_courseList->setCurrentIndex(1);
- setCheck(COURSE_MENU_BTN_TYPE::cmbt_online_homework);
- }
- void courseList::on_btn_onlinePractice_clicked()
- {
- ui->stw_courseList->setCurrentIndex(2);
- setCheck(COURSE_MENU_BTN_TYPE::cmbt_online_practice);
- }
- void courseList::on_btn_offlineExam_clicked()
- {
- ui->stw_courseList->setCurrentIndex(3);
- setCheck(COURSE_MENU_BTN_TYPE::cmbt_offline_exam);
- }
- void courseList::on_btn_notice_clicked()
- {
- ui->stw_courseList->setCurrentIndex(4);
- setCheck(COURSE_MENU_BTN_TYPE::cmbt_notice);
- }
- void courseList::on_btn_editPassword_clicked()
- {
- ui->stw_courseList->setCurrentIndex(5);
- setCheck(COURSE_MENU_BTN_TYPE::cmbt_edit_password);
- }
- void courseList::on_btn_exit_clicked()
- {
- logout();
- close();
- }
- void courseList::logout()
- {
- CHttpRequestPackage hrp;
- hrp.sUri = "/api/ecs_core/auth/logout";
- hrp.nRequestType = RequestType::rtLogout;
- g_httpBllPtr->get(hrp);
- }
- bool courseList::eventFilter(QObject *obj, QEvent *ev)
- {
- if(ev->type() == QEvent::Enter)
- {
- if(obj == ui->btn_mobileLogin)
- {
- m_pMobileLoginBtnTimer->stop();
- if(m_pStudentInfo != nullptr)
- {
- m_pStudentInfo.reset();
- m_pStudentInfo = nullptr;
- }
- if(m_pMobileLogin == nullptr)
- {
- m_pMobileLogin = std::make_shared<clMobileLogin>(this);
- m_pMobileLogin->setUI(g_appInfoPtr->m_fRate*838, g_appInfoPtr->m_fRate*53, g_appInfoPtr->m_fRate*240, g_appInfoPtr->m_fRate*290);
- m_pMobileLogin->show();
- m_pMobileLogin->installEventFilter(this);
- }
- ui->btn_mobileLogin->setIcon(QIcon(":/images/icon-mobile-login-hover.png"));
- }
- else if(obj == ui->btn_studentInfo)
- {
- m_pStudentInfoBtnTimer->stop();
- if(m_pMobileLogin != nullptr)
- {
- m_pMobileLogin.reset();
- m_pMobileLogin = nullptr;
- }
- if(m_pStudentInfo == nullptr)
- {
- m_pStudentInfo = std::make_shared<clStudentInfo>(this);
- connect(m_pStudentInfo.get(), &clStudentInfo::sgnStudentLogout, this, [&]() {
- on_btn_exit_clicked();
- });
- connect(m_pStudentInfo.get(), &clStudentInfo::sgnStudentEditPassword, this, [&]() {
- if (m_pStudentInfo != nullptr)
- {
- m_pStudentInfo.reset();
- }
- on_btn_editPassword_clicked();
- });
- m_pStudentInfo->setUI(g_appInfoPtr->m_fRate*838, g_appInfoPtr->m_fRate*53, g_appInfoPtr->m_fRate*330, g_appInfoPtr->m_fRate*240);
- m_pStudentInfo->show();
- m_pStudentInfo->installEventFilter(this);
- }
- ui->btn_studentInfo->setIcon(QIcon(":/images/icon-student-info-hover.png"));
- }
- else if(obj == m_pMobileLogin.get())
- {
- m_pMobileLoginBtnTimer->stop();
- }
- else if(obj == m_pStudentInfo.get())
- {
- m_pStudentInfoBtnTimer->stop();
- }
- }
- else if(ev->type() == QEvent::Leave)
- {
- if(obj == ui->btn_mobileLogin || obj == m_pMobileLogin.get())
- {
- ui->btn_mobileLogin->setIcon(QIcon(":/images/icon-mobile-login.png"));
- m_pMobileLoginBtnTimer->start();
- }
- if(obj == ui->btn_studentInfo || obj == m_pStudentInfo.get())
- {
- ui->btn_studentInfo->setIcon(QIcon(":/images/icon-student-info.png"));
- m_pStudentInfoBtnTimer->start();
- }
- }
- return QWidget::eventFilter(obj, ev);
- }
- void courseList::hideStudentInfoBtn()
- {
- if(m_pStudentInfo != nullptr)
- {
- m_pStudentInfo.reset();
- }
- }
- void courseList::hideMobileLoginBtn()
- {
- if(m_pMobileLogin != nullptr)
- {
- m_pMobileLogin.reset();
- }
-
- }
- void courseList::getStudentInfoBySession()
- {
- CHttpRequestPackage hrp;
- hrp.sUri = "/api/ecs_core/student/getStudentInfoBySession";
- hrp.nRequestType = RequestType::rtGetStudentInfoBySession;
- g_httpBllPtr->get(hrp);
- }
- void courseList::onGetStudentInfoBySession(CGetStudentInfoBySession getStudentInfoBySession)
- {
- if (getStudentInfoBySession.nCode == 200)
- {
- g_appInfoPtr->m_nStudentId = getStudentInfoBySession.nId;
- g_appInfoPtr->m_sStudentName = getStudentInfoBySession.sName;
- g_appInfoPtr->m_nOrgId = getStudentInfoBySession.nOrgId;
- g_appInfoPtr->m_sOrgCode = getStudentInfoBySession.sOrgCode;
- g_appInfoPtr->m_sOrgName = getStudentInfoBySession.sOrgName;
- g_appInfoPtr->m_sStudentCode = getStudentInfoBySession.sStudentCode;
- g_appInfoPtr->m_sStudentIdentityNumber = getStudentInfoBySession.sIdentityNumber;
- g_appInfoPtr->m_sStudentPhotoPath = getStudentInfoBySession.sPhotoPath;
- g_appInfoPtr->m_bStudentEnable = getStudentInfoBySession.bEnable;
- ui->btn_studentInfo->setText(g_appInfoPtr->m_sStudentName);
- ui->btn_studentInfo->setVisible(g_appInfoPtr->m_bStudentEnable);
- ui->btn_mobileLogin->setVisible(g_appInfoPtr->m_bShowStudentClientAppQrcode);
- CHttpRequestPackage hrp;
- hrp.sUri = "/api/ecs_exam_work/exam_student/specialtyNameList";
- hrp.nRequestType = RequestType::rtSpecialtyNameList;
- g_httpBllPtr->get(hrp);
- if (!g_appInfoPtr->m_sStudentPhotoPath.isEmpty())
- {
- QString sFileName = g_appInfoPtr->m_sStudentPhotoPath.right(g_appInfoPtr->m_sStudentPhotoPath.length() - g_appInfoPtr->m_sStudentPhotoPath.lastIndexOf("/") - 1);
- sFileName = g_appInfoPtr->m_sCacheFileDir + sFileName;
- CHttpRequestPackage hrp;
- hrp.sUri = g_appInfoPtr->m_sStudentPhotoPath;
- hrp.sCommonStr = sFileName;
- hrp.sCommonStr1 = __FILE__;
- hrp.sAdditionStr = "StudentPhotoPath";
- hrp.nRequestType = RequestType::rtDownLoadFile;
- hrp.nRetryCount = 3;
- g_httpBllPtr->downLoad(hrp);
- }
- if (g_appInfoPtr->m_bShowStudentClientAppQrcode)
- {
- CHttpRequestPackage hrp;
- hrp.sUri = "/api/ecs_core/systemProperty/APP_DOWNLOAD_URL";
- hrp.nRequestType = RequestType::rtAppDownLoadUrl;
- g_httpBllPtr->get(hrp);
- }
- }
- else
- {
- if(getStudentInfoBySession.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("获取考生信息失败"), this, MSG_ICON_TYPE::mit_error);
- }
- else
- {
- ShowMsg(getStudentInfoBySession.sMessage, this, MSG_ICON_TYPE::mit_error);
- }
- courseList::getStudentInfoBySession();
- }
- }
- void courseList::onAppDownLoadUrl(CAppDownLoadUrl appDownLoadUrl)
- {
- if (appDownLoadUrl.nCode == 200)
- {
- g_appInfoPtr->m_sAppDownLoadUrl = appDownLoadUrl.sUrl;
- }
- else
- {
- if(appDownLoadUrl.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("获取APP下载地址失败"), this, MSG_ICON_TYPE::mit_error);
- }
- else
- {
- ShowMsg(appDownLoadUrl.sMessage, this, MSG_ICON_TYPE::mit_error);
- }
- }
- }
- void courseList::onDownLoadFile(CDownLoadFileInfo downLoadFileInfo)
- {
- if(downLoadFileInfo.sModuleName == __FILE__)
- {
- if (downLoadFileInfo.nCode == 200)
- {
- // QString sFileName = g_appInfoPtr->m_sStudentPhotoPath.right(g_appInfoPtr->m_sStudentPhotoPath.length() - g_appInfoPtr->m_sStudentPhotoPath.lastIndexOf("/") - 1);
- // sFileName = g_appInfoPtr->m_sCacheFileDir + sFileName;
- if (downLoadFileInfo.sAdditionStr == "MenuLogoUrl")
- {
- QString sFileName = g_appInfoPtr->m_sMenuLogoUrl.right(g_appInfoPtr->m_sMenuLogoUrl.length() - g_appInfoPtr->m_sMenuLogoUrl.lastIndexOf("/") - 1);
- sFileName = g_appInfoPtr->m_sCacheFileDir + sFileName;
- ui->label_cl_org_icon->setPixmap(QPixmap(sFileName).scaled(ui->label_cl_org_icon->width(), ui->label_cl_org_icon->height(),
- Qt::KeepAspectRatio, Qt::SmoothTransformation));
- }
- }
- else
- {
- if(downLoadFileInfo.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("下载失败"), this, MSG_ICON_TYPE::mit_error);
- }
- else
- {
- ShowMsg(downLoadFileInfo.sMessage, this, MSG_ICON_TYPE::mit_error);
- }
- }
- }
- }
- void courseList::onSpecialtyNameList(CSpecialtyNameList specialtyNameList)
- {
- if (specialtyNameList.nCode == 200)
- {
- g_appInfoPtr->m_sSpecialtyName = specialtyNameList.sSpecialtyName;
- CHttpRequestPackage hrp;
- hrp.sUri = "/api/ecs_oe_student/client/exam/process/checkExamInProgress";
- hrp.nRequestType = RequestType::rtCheckExamInProgress;
- hrp.sCommonStr = EXAM_INPROGRESS_ENTER_TYPE::EIET_COURSE_LIST;
- g_httpBllPtr->post(hrp);
- }
- else
- {
- if(specialtyNameList.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("获取专业信息失败"), this, MSG_ICON_TYPE::mit_error);
- }
- else
- {
- ShowMsg(specialtyNameList.sMessage, this, MSG_ICON_TYPE::mit_error);
- }
- }
- }
- void courseList::onCheckExamInProgress(CCheckExamInProgress checkExamInProgress)
- {
- if (checkExamInProgress.nCode == 200)
- {
- if (checkExamInProgress.bHasExamInProgress)
- {
- if (checkExamInProgress.bIsExceed)
- {
- //超过断点时长交卷
- g_appInfoPtr->m_oExamInfo.nExamRecordDataId = checkExamInProgress.nExamRecordDataId;
- g_appInfoPtr->m_oExamInfo.nExamId = checkExamInProgress.nExamId;
- CHttpRequestPackage hrp;
- hrp.sUri = QString("/api/ecs_oe_student/client/exam/process/endExam");
- hrp.sCommonStr = __FILE__;
- hrp.nRequestType = RequestType::rtEndExam;
- g_httpBllPtr->post(hrp);
-
- }
- else
- {
- //进入断点
- g_appInfoPtr->m_oExamInfo.nExamId = checkExamInProgress.nExamId;
- g_appInfoPtr->m_oExamInfo.nExamRecordDataId = checkExamInProgress.nExamRecordDataId;
- g_appInfoPtr->m_oExamInfo.sExamType = checkExamInProgress.sExamType;
- g_appInfoPtr->m_oExamInfo.bIsExamInProgress = true;
- if (m_pResumeExam == nullptr)
- {
- m_pResumeExam = std::make_shared<awResumeExam>(this);
- }
- m_pResumeExam->show();
- //环境监测
- CHttpRequestPackage hrp;
- hrp.sUri = QString("/api/ecs_exam_work/exam/getExamPropertyFromCacheByStudentSession/%1/%2")
- .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,IS_FACE_VERIFY_BEFORE");
- hrp.nRequestType = RequestType::rtGetExamProperty;
- hrp.sCommonStr = "CHECK_ENVIRONMENT,IS_FACE_CHECK,SNAPSHOT_INTERVAL,WARN_THRESHOLD,FACE_VERIFY_START_MINUTE,FACE_VERIFY_END_MINUTE,IS_STRANGER_ENABLE,IS_FACE_VERIFY_BEFORE";
- g_httpBllPtr->get(hrp);
- }
- }
- else
- {
- g_appInfoPtr->m_oExamInfo.bIsExamInProgress = false;
- if (checkExamInProgress.sEnterType == EXAM_INPROGRESS_ENTER_TYPE::EIET_COURSE_LIST)
- {
- CHttpRequestPackage hrp;
- hrp.sUri = "/api/ecs_core/rolePrivilege/getStudentClientMenu";
- hrp.nRequestType = RequestType::rtGetStudentClientMenu;
- hrp.sParamList.push_back(QString::fromLocal8Bit("rootOrgId,%1").arg(g_appInfoPtr->m_sRootOrgId));
- g_httpBllPtr->get(hrp);
- if (m_pWelcomeWidget == nullptr)
- {
- m_pWelcomeWidget = std::make_shared<welcomeWidget>(g_appInfoPtr->m_sStudentName, g_appInfoPtr->m_sStudentCode, g_appInfoPtr->m_sSpecialtyName, this);
- connect(m_pWelcomeWidget.get(), &welcomeWidget::exitWelcomeWidget, this, [&]() {
- m_pWelcomeWidget.reset();
- });
- }
- m_pWelcomeWidget->show();
- }
- else
- {
- //环境监测
- CHttpRequestPackage hrp;
- hrp.sUri = QString("/api/ecs_exam_work/exam/getExamPropertyFromCacheByStudentSession/%1/%2")
- .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,IS_FACE_VERIFY_BEFORE");
- hrp.nRequestType = RequestType::rtGetExamProperty;
- hrp.sCommonStr = "CHECK_ENVIRONMENT,IS_FACE_CHECK,SNAPSHOT_INTERVAL,WARN_THRESHOLD,FACE_VERIFY_START_MINUTE,FACE_VERIFY_END_MINUTE,IS_STRANGER_ENABLE,IS_FACE_VERIFY_BEFORE";
- g_httpBllPtr->get(hrp);
- }
- }
- }
- else
- {
- if(checkExamInProgress.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("获取断点信息失败"), this, MSG_ICON_TYPE::mit_error);
- }
- else
- {
- ShowMsg(checkExamInProgress.sMessage, this, MSG_ICON_TYPE::mit_error);
- }
- }
- }
- void courseList::onEndExam(CEndExam endExam)
- {
- if(endExam.sModuleName == __FILE__)
- {
- if (endExam.nCode == 200)
- {
- m_pRefreshMenuTimer->stop();
- if(m_pBackground != nullptr)
- {
- m_pBackground.reset();
- }
- m_pBackground = std::make_shared<awBackground>(AW_WIDGET_TYPE::awwt_examScore, this);
- connect(m_pBackground.get(), &awBackground::minisize, this, &courseList::minisize);
- connect(m_pBackground.get(), &awBackground::closeWidget, this, [&](){
- m_pBackground.reset();
- m_pRefreshMenuTimer->start();
- if(m_pOnlineExam)
- {
- m_pOnlineExam->refreshExam();
- }
- if(m_pOnlineHomework)
- {
- m_pOnlineHomework->refreshExam();
- }
- });
- m_pBackground->show();
- }
- else
- {
- if(endExam.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("交卷失败"), g_appInfoPtr->m_pAnsBgWidget, MSG_ICON_TYPE::mit_error);
- }
- else
- {
- ShowMsg(endExam.sMessage, g_appInfoPtr->m_pAnsBgWidget, MSG_ICON_TYPE::mit_error);
- }
- }
- }
- }
- void courseList::onGetStudentClientMenu(CGetStudentClientMenu getStudentClientMenu)
- {
- if (getStudentClientMenu.nCode == 200)
- {
- ui->btn_onlineExam->setVisible(false);
- ui->btn_onlineHomework->setVisible(false);
- ui->btn_onlinePractice->setVisible(false);
- ui->btn_offlineExam->setVisible(false);
- ui->btn_notice->setVisible(false);
- ui->btn_editPassword->setVisible(false);
- for (CStudentClientMenu scm : getStudentClientMenu.vMenus)
- {
- QString sMenuName = scm.sName;
- sMenuName.insert(sMenuName.length()/2, '\n');
- QString sMenuCode = scm.sCode.left(scm.sCode.lastIndexOf("_"));
- if (sMenuCode == "stu_online_exam")
- {
- ui->btn_onlineExam->setVisible(true);
- ui->btn_onlineExam->setText(sMenuName);
- }
- else if (sMenuCode == "stu_online_homework")
- {
- ui->btn_onlineHomework->setVisible(true);
- ui->btn_onlineHomework->setText(sMenuName);
- }
- else if (sMenuCode == "stu_online_practice")
- {
- ui->btn_onlinePractice->setVisible(true);
- ui->btn_onlinePractice->setText(sMenuName);
- }
- else if (sMenuCode == "stu_offline_exam")
- {
- ui->btn_offlineExam->setVisible(true);
- ui->btn_offlineExam->setText(sMenuName);
- }
- else if (sMenuCode == "stu_notice")
- {
- ui->btn_notice->setVisible(true);
- ui->btn_notice->setText(sMenuName);
- CHttpRequestPackage hrp;
- hrp.sUri = "/api/ecs_exam_work/notice/getUserNoticeList";
- hrp.nRequestType = RequestType::rtGetUserNoticeList;
- g_httpBllPtr->get(hrp);
- }
- else if (sMenuCode == "stu_modify_pwd")
- {
- ui->btn_editPassword->setVisible(true);
- ui->btn_editPassword->setText(sMenuName);
- }
- }
- menuBtnRePosistion();
- }
- else
- {
- if(getStudentClientMenu.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("获取菜单失败"), this, MSG_ICON_TYPE::mit_error);
- }
- else
- {
- ShowMsg(getStudentClientMenu.sMessage, this, MSG_ICON_TYPE::mit_error);
- }
- }
- }
- void courseList::onGetUserNoticeList(CGetUserNoticeList getUserNoticeList)
- {
- if (getUserNoticeList.nCode == 200)
- {
- if (m_pNoticeList == nullptr)
- {
- m_pNoticeList = std::make_shared<clNoticeList>(ui->stw_courseList);
- m_pNoticeList->setUI(ui->stw_courseList->width(), ui->stw_courseList->height());
- connect(m_pNoticeList.get(), &clNoticeList::unReadNoticeCount, this, [&](int nCount) {
- ui->btn_noticeNum->setText(QString::number(nCount));
- ui->btn_noticeNum->setVisible(nCount > 0);
-
- });
- connect(m_pNoticeList.get(), &clNoticeList::readNotice, this, [&](__int64 nId) {
- m_pNoticePopWidget->setNoticeRead(nId);
- });
- }
- m_pNoticeList->setNotice(getUserNoticeList.vNoticeList);
-
- if (m_pNoticePopWidget == nullptr)
- {
- m_pNoticePopWidget = std::make_shared<clNoticePopWidget>(this);
- m_pNoticePopWidget->setUI(g_appInfoPtr->m_fRate * 960, g_appInfoPtr->m_fRate * 558, g_appInfoPtr->m_fRate * 310, g_appInfoPtr->m_fRate * 200);
- connect(m_pNoticePopWidget.get(), &clNoticePopWidget::showNoticeDetail, this, [&](__int64 nId){
- setCheck(COURSE_MENU_BTN_TYPE::cmbt_notice);
- m_pNoticeList->viewNotice(nId);
- });
- }
-
- int nUnReadCount = 0;
- for (CNoticeInfo ni : getUserNoticeList.vNoticeList)
- {
- if (!ni.bHasRead)
- {
- m_pNoticePopWidget->addNotice(ni);
- ++nUnReadCount;
- }
- }
-
- ui->btn_noticeNum->setText(QString::number(nUnReadCount));
- ui->btn_noticeNum->setVisible(nUnReadCount > 0);
-
- if(m_pNoticePopWidget->noticeCount() > 0)
- {
- m_pNoticePopWidget->show();
- }
- }
- else
- {
- if(getUserNoticeList.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("获取通知信息失败"), this, MSG_ICON_TYPE::mit_error);
- }
- else
- {
- ShowMsg(getUserNoticeList.sMessage, this, MSG_ICON_TYPE::mit_error);
- }
- }
- }
|