#include "courseList.h" #include "ui_courseList.h" #include "awMsgBox.h" #include #include #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); ui->btn_minisize->setVisible(!g_appInfoPtr->m_bFullScreenTop); qRegisterMetaType("CGetStudentInfoBySession"); connect(g_httpBllPtr.get(), &CHttpBll::sgnGetStudentInfoBySession, this, &courseList::onGetStudentInfoBySession); qRegisterMetaType("CSpecialtyNameList"); connect(g_httpBllPtr.get(), &CHttpBll::sgnSpecialtyNameList, this, &courseList::onSpecialtyNameList); qRegisterMetaType("CCheckExamInProgress"); connect(g_httpBllPtr.get(), &CHttpBll::sgnCheckExamInProgress, this, &courseList::onCheckExamInProgress); qRegisterMetaType("CGetStudentClientMenu"); connect(g_httpBllPtr.get(), &CHttpBll::sgnGetStudentClientMenu, this, &courseList::onGetStudentClientMenu); qRegisterMetaType("CGetUserNoticeList"); connect(g_httpBllPtr.get(), &CHttpBll::sgnGetUserNoticeList, this, &courseList::onGetUserNoticeList); qRegisterMetaType("CDownLoadFileInfo"); connect(g_httpBllPtr.get(), &CHttpBll::sgnDownLoadFile, this, &courseList::onDownLoadFile); qRegisterMetaType("CAppDownLoadUrl"); connect(g_httpBllPtr.get(), &CHttpBll::sgnAppDownLoadUrl, this, &courseList::onAppDownLoadUrl); qRegisterMetaType("CStartExamLimit"); connect(g_httpBllPtr.get(), &CHttpBll::sgnStartExamLimit, this, &courseList::onStartExamLimit); qRegisterMetaType("CIpLimit"); connect(g_httpBllPtr.get(), &CHttpBll::sgnIpLimit, this, &courseList::onIpLimit); qRegisterMetaType("CGetExamProperty"); connect(g_httpBllPtr.get(), &CHttpBll::sgnGetExamProperty, this, &courseList::onGetExamProperty); qRegisterMetaType("CFaceCheckEnabled"); connect(g_httpBllPtr.get(), &CHttpBll::sgnFaceCheckEnabled, this, &courseList::onFaceCheckEnabled); qRegisterMetaType("CLivenessEnabled"); connect(g_httpBllPtr.get(), &CHttpBll::sgnLivenessEnabled, this, &courseList::onLivenessEnabled); qRegisterMetaType("CEndExam"); connect(g_httpBllPtr.get(), &CHttpBll::sgnEndExam, this, &courseList::onEndExam); qRegisterMetaType("CGetOrgPropertiesByGroupWithoutCache"); connect(g_httpBllPtr.get(), &CHttpBll::sgnGetOrgPropertiesByGroupWithoutCache, this, &courseList::onGetOrgPropertiesByGroupWithoutCache); qRegisterMetaType("CSkipFaceCheckParam"); connect(g_httpBllPtr.get(), &CHttpBll::sgnSkipFaceCheckParam, this, &courseList::onSkipFaceCheckParam); 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(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(); m_pMobileLoginBtnTimer->setInterval(500); connect(m_pMobileLoginBtnTimer.get(), &QTimer::timeout, this, &courseList::hideMobileLoginBtn); m_pStudentInfoBtnTimer = std::make_shared(); m_pStudentInfoBtnTimer->setInterval(500); connect(m_pStudentInfoBtnTimer.get(), &QTimer::timeout, this, &courseList::hideStudentInfoBtn); m_pServerTime = std::make_shared(); 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(); 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(); 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->label_cl_company->setVisible(false); 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(); qApp->exit(); } 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(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(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(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(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(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(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,FACE_VERIFY_START_MINUTE,FACE_VERIFY_END_MINUTE,IS_STRANGER_ENABLE,IS_FACE_VERIFY_BEFORE,FACE_VERIFY_FORCE_EXIT") { g_appInfoPtr->m_oExamInfo.bIsFaceCheck = getExamProperty.bIsFaceCheck; // g_appInfoPtr->m_oExamInfo.nFaceThreshold = getExamProperty.nFaceThreshold; 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; g_appInfoPtr->m_bInprogressFaceLivenessFailedForceExit = getExamProperty.bFaceVerifyForceExit; if (getExamProperty.bCheckEnvironment && !g_appInfoPtr->m_oExamInfo.bIsExamInProgress) { if(m_pWhetherEnvTest == nullptr) { m_pWhetherEnvTest = std::make_shared(this); connect(m_pWhetherEnvTest.get(), &etWhetherEnvTest::envTest, this, [&](){ m_pWhetherEnvTest.reset(); //环境检测 if (m_pEnvironmentalTest == nullptr) { m_pEnvironmentalTest = std::make_shared(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(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(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(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; g_appInfoPtr->m_oExamInfo.nFaceThreshold = orgProperties.nFaceThreshold; if(!g_appInfoPtr->m_oExamInfo.bIsExamInProgress) { if((g_appInfoPtr->m_oExamInfo.bIsLivenessBefore && g_appInfoPtr->m_oExamInfo.bIsFaceCheck) || g_appInfoPtr->m_oExamInfo.bFaceCheck) { //获取是否跳过人脸识别参数 getSkipFaceCheckParam(); } 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::onSkipFaceCheckParam(CSkipFaceCheckParam skipFaceCheckParam) { if(skipFaceCheckParam.nCode == 200) { g_appInfoPtr->m_bSkipFaceCheck = skipFaceCheckParam.bSkipFaceCheck; if(g_appInfoPtr->m_oExamInfo.bIsLivenessBefore && g_appInfoPtr->m_oExamInfo.bIsFaceCheck && !g_appInfoPtr->m_bSkipFaceCheck) { doLiveness(); } else { doFaceCompare(); } } else { if(skipFaceCheckParam.sMessage.isEmpty()) { ShowMsg(QString::fromLocal8Bit("获取人脸参数失败"), this, MSG_ICON_TYPE::mit_error); } else { ShowMsg(skipFaceCheckParam.sMessage, this, MSG_ICON_TYPE::mit_error); } } } void courseList::getSkipFaceCheckParam() { CHttpRequestPackage hrp; hrp.sUri = QString("/api/ecs_exam_work/exam/skip/face/check") ; hrp.sParamList.push_back(QString("examId,%1").arg(g_appInfoPtr->m_oExamInfo.nExamId)); hrp.sParamList.push_back(QString("examStudentId,%1").arg(g_appInfoPtr->m_oExamInfo.nExamStudentId)); hrp.nRequestType = RequestType::rtSkipFaceCheckParam; hrp.eParamType = HttpParamType::hptUrl; g_httpBllPtr->post(hrp); } void courseList::enterWaitExam() { //进入待考 if (m_pBackground == nullptr) { if (g_appInfoPtr->m_oExamInfo.bIsExamInProgress) { m_pBackground = std::make_shared(AW_WIDGET_TYPE::awwt_answerWidget, this); m_pResumeExam.reset(); } else { m_pBackground = std::make_shared(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(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(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(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; hrp.nRetryCount = 3; 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(this); } m_pResumeExam->show(); //环境监测 getExamProperty(); } } 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(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 { //环境监测 getExamProperty(); } } } 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::getExamProperty() { 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,FACE_VERIFY_START_MINUTE,FACE_VERIFY_END_MINUTE,IS_STRANGER_ENABLE,IS_FACE_VERIFY_BEFORE,FACE_VERIFY_FORCE_EXIT"); hrp.nRequestType = RequestType::rtGetExamProperty; hrp.sCommonStr = "CHECK_ENVIRONMENT,IS_FACE_CHECK,SNAPSHOT_INTERVAL,FACE_VERIFY_START_MINUTE,FACE_VERIFY_END_MINUTE,IS_STRANGER_ENABLE,IS_FACE_VERIFY_BEFORE,FACE_VERIFY_FORCE_EXIT"; g_httpBllPtr->get(hrp); } 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(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(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(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); } } }