1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111 |
- #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);
-
- 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);
- }
- 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_pRefreshTimer = std::make_shared<QTimer>();
- m_pRefreshTimer->setInterval(1000*60*3);
- connect(m_pRefreshTimer.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);
- 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);
- }
- courseList::~courseList()
- {
- 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*30, g_appInfoPtr->m_fRate*30, g_appInfoPtr->m_fRate*36, g_appInfoPtr->m_fRate*36);
- 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, 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->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()
- {
- close();
- logout();
- }
- 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();
- }
-
- 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)
- {
- 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;
- //开考限流
- 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)
- {
- 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
- {
- //重试
- }
- }
- else
- {
- ShowMsg(QString::fromLocal8Bit("开考失败"), this);
- }
- }
- 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);
- }
- }
- else
- {
- ShowMsg(QString::fromLocal8Bit("开考失败"), this);
- }
- }
- 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")
- {
- 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;
- 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);
- }
- 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 (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);
- }
- else
- {
- ShowMsg(faceCheckEnabled.sMessage, this);
- }
- }
- }
- void courseList::onLivenessEnabled(CLivenessEnabled livenessEnabled)
- {
- if (livenessEnabled.nCode == 200)
- {
- g_appInfoPtr->m_oExamInfo.bLivenessCheck = livenessEnabled.bEnabled;
- //进入待考
- enterWaitExam();
- }
- else
- {
- if(livenessEnabled.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("获取活体信息失败"), this);
- }
- else
- {
- ShowMsg(livenessEnabled.sMessage, this);
- }
- }
- }
- 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::closeWidget, this, [&](){
- m_pBackground.reset();
- });
- 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();
- });
- m_pClopReport->setUI(0, 0, ui->stw_courseList->width(), ui->stw_courseList->height());
- }
- m_pClopReport->show();
- });
- }
- m_pBackground->show();
- }
- 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()
- {
- close();
- logout();
- }
- 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.nRequestType = RequestType::rtDownLoadFile;
- 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);
- }
- else
- {
- ShowMsg(getStudentInfoBySession.sMessage, this);
- }
- }
- }
- 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);
- }
- else
- {
- ShowMsg(appDownLoadUrl.sMessage, this);
- }
- }
- }
- void courseList::onDownLoadFile(CDownLoadFileInfo downLoadFileInfo)
- {
- 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.sFileName == sFileName)
- {
- if (downLoadFileInfo.nCode == 200)
- {
-
- }
- else
- {
- if(downLoadFileInfo.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("下载失败"), this);
- }
- else
- {
- ShowMsg(downLoadFileInfo.sMessage, this);
- }
- }
- }
- }
- 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);
- }
- else
- {
- ShowMsg(specialtyNameList.sMessage, this);
- }
- }
- }
- void courseList::onCheckExamInProgress(CCheckExamInProgress checkExamInProgress)
- {
- if (checkExamInProgress.nCode == 200)
- {
- if (checkExamInProgress.bHasExamInProgress)
- {
- if (checkExamInProgress.bIsExceed)
- {
- //超过断点时长交卷
-
-
- }
- 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");
- 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";
- g_httpBllPtr->get(hrp);
- }
- }
- else
- {
- 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");
- 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";
- g_httpBllPtr->get(hrp);
- }
- }
- }
- else
- {
- if(checkExamInProgress.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("获取断点信息失败"), this);
- }
- else
- {
- ShowMsg(checkExamInProgress.sMessage, this);
- }
- }
- }
- 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)
- {
- if (scm.sCode == "stu_online_exam_0")
- {
- ui->btn_onlineExam->setVisible(true);
- }
- else if (scm.sCode == "stu_online_homework_0")
- {
- ui->btn_onlineHomework->setVisible(true);
- }
- else if (scm.sCode == "stu_online_practice_0")
- {
- ui->btn_onlinePractice->setVisible(true);
- }
- else if (scm.sCode == "stu_offline_exam_0")
- {
- ui->btn_offlineExam->setVisible(true);
- }
- else if (scm.sCode == "stu_notice_0")
- {
- ui->btn_notice->setVisible(true);
- CHttpRequestPackage hrp;
- hrp.sUri = "/api/ecs_exam_work/notice/getUserNoticeList";
- hrp.nRequestType = RequestType::rtGetUserNoticeList;
- g_httpBllPtr->get(hrp);
- }
- else if (scm.sCode == "stu_modify_pwd_0")
- {
- ui->btn_editPassword->setVisible(true);
- }
- }
- menuBtnRePosistion();
- }
- else
- {
- if(getStudentClientMenu.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("获取菜单失败"), this);
- }
- else
- {
- ShowMsg(getStudentClientMenu.sMessage, this);
- }
- }
- }
- 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());
- }
- 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);
- }
-
- for (CNoticeInfo ni : getUserNoticeList.vNoticeList)
- {
- if (!ni.bHasRead)
- {
- m_pNoticePopWidget->addNotice(ni);
- }
- }
-
- if(m_pNoticePopWidget->noticeCount() > 0)
- {
- ui->btn_noticeNum->setVisible(true);
- ui->btn_noticeNum->setText(QString::number(m_pNoticePopWidget->noticeCount()));
-
- m_pNoticePopWidget->show();
- }
- }
- else
- {
- if(getUserNoticeList.sMessage.isEmpty())
- {
- ShowMsg(QString::fromLocal8Bit("获取通知信息失败"), this);
- }
- else
- {
- ShowMsg(getUserNoticeList.sMessage, this);
- }
- }
- }
|