|
@@ -26,6 +26,8 @@ wxAnswer::wxAnswer(QString sAnswerType, int nOrder, QWidget *parent) :
|
|
|
connect(g_httpBllPtr.get(), &CHttpBll::sgnSaveUploadedFileAcknowledgeStatus, this, &wxAnswer::onSaveUploadedFileAcknowledgeStatus);
|
|
|
qRegisterMetaType<CDownLoadFileInfo>("CDownLoadFileInfo");
|
|
|
connect(g_httpBllPtr.get(), &CHttpBll::sgnDownLoadFile, this, &wxAnswer::onDownLoadFile);
|
|
|
+ qRegisterMetaType<CGetWXUploadedFile>("CGetWXUploadedFile");
|
|
|
+ connect(g_httpBllPtr.get(), &CHttpBll::sgnGetWXUploadedFile, this, &wxAnswer::onGetWXUploadedFile);
|
|
|
|
|
|
if (g_websocketPtr == nullptr)
|
|
|
{
|
|
@@ -129,6 +131,21 @@ wxAnswer::wxAnswer(QString sAnswerType, int nOrder, QWidget *parent) :
|
|
|
}
|
|
|
|
|
|
});
|
|
|
+
|
|
|
+ m_pRefreshTimer = std::make_shared<QTimer>();
|
|
|
+ m_pRefreshTimer->setInterval(1000);
|
|
|
+ connect(m_pRefreshTimer.get(), &QTimer::timeout, this, [&]() {
|
|
|
+ --m_nRefreshSeconds;
|
|
|
+ ui->btn_refresh->setText(QString::fromLocal8Bit("倒计时%1s").arg(m_nRefreshSeconds));
|
|
|
+
|
|
|
+
|
|
|
+ if(m_nRefreshSeconds <= 0)
|
|
|
+ {
|
|
|
+ m_pRefreshTimer->stop();
|
|
|
+ ui->btn_refresh->setEnabled(true);
|
|
|
+ ui->btn_refresh->setText(QString::fromLocal8Bit("刷新"));
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
}
|
|
|
|
|
@@ -305,6 +322,11 @@ int wxAnswer::setUI(const int nWidth)
|
|
|
ui->label_wxa_status->setGeometry(ui->label_wxa_statusIcon->x() + ui->label_wxa_statusIcon->width() + g_appInfoPtr->m_fRate*10,
|
|
|
ui->label_wxa_statusIcon->y() + (ui->label_wxa_statusIcon->height() - ui->label_wxa_status->height())/2,
|
|
|
ui->label_wxa_status->width(), ui->label_wxa_status->height());
|
|
|
+ ui->btn_refresh->setGeometry(g_appInfoPtr->m_fRate*20, ui->widget_wxa->height() - g_appInfoPtr->m_fRate*(30 + 30),
|
|
|
+ g_appInfoPtr->m_fRate*80, g_appInfoPtr->m_fRate*30);
|
|
|
+ ui->label_refreshTip->adjustSize();
|
|
|
+ ui->label_refreshTip->setGeometry(ui->btn_refresh->x() + ui->btn_refresh->width() + g_appInfoPtr->m_fRate*10, ui->btn_refresh->y() + ui->btn_refresh->height()/2 - ui->label_refreshTip->height()/2,
|
|
|
+ ui->label_refreshTip->width(), ui->label_refreshTip->height());
|
|
|
ui->btn_wxa_comfirm->setGeometry((ui->widget_wxa->width() - g_appInfoPtr->m_fRate*120)/2, ui->widget_wxa->height() - g_appInfoPtr->m_fRate*(30 + 40),
|
|
|
g_appInfoPtr->m_fRate*120, g_appInfoPtr->m_fRate*40);
|
|
|
}
|
|
@@ -624,3 +646,115 @@ void wxAnswer::on_btn_etvt_volume_clicked()
|
|
|
}
|
|
|
m_bMute = !m_bMute;
|
|
|
}
|
|
|
+
|
|
|
+void wxAnswer::on_btn_refresh_clicked()
|
|
|
+{
|
|
|
+ ui->btn_refresh->setEnabled(false);
|
|
|
+
|
|
|
+ CHttpRequestPackage hrp;
|
|
|
+ hrp.sUri = "/api/ecs_oe_student/examControl/getUploadedFile";
|
|
|
+ hrp.nRequestType = RequestType::rtGetWXUploadedFile;
|
|
|
+ hrp.sParamList.push_back(QString("examRecordDataId,%1").arg(g_appInfoPtr->m_oExamInfo.nExamRecordDataId));
|
|
|
+ hrp.sParamList.push_back(QString("questionOrder,%1").arg(m_nOrder));
|
|
|
+ hrp.eParamType = HttpParamType::hptUrl;
|
|
|
+ g_httpBllPtr->post(hrp);
|
|
|
+
|
|
|
+ m_pRefreshTimer->start();
|
|
|
+ m_nRefreshSeconds = 20;
|
|
|
+ ui->btn_refresh->setText(QString::fromLocal8Bit("倒计时%1s").arg(m_nRefreshSeconds));
|
|
|
+}
|
|
|
+
|
|
|
+void wxAnswer::onGetWXUploadedFile(CGetWXUploadedFile getWXUploadedFile)
|
|
|
+{
|
|
|
+ if(getWXUploadedFile.nCode == 200)
|
|
|
+ {
|
|
|
+ if(getWXUploadedFile.sStatus == "UNCONFIRMED")
|
|
|
+ {
|
|
|
+ CHttpRequestPackage hrp;
|
|
|
+ hrp.sUri = "/api/ecs_oe_student/examControl/saveUploadedFileAcknowledgeStatus";
|
|
|
+ hrp.nRequestType = RequestType::rtSaveUploadedFileAcknowledgeStatus;
|
|
|
+ Json::Value jBody = Json::Value::null;
|
|
|
+ jBody["examRecordDataId"] = g_appInfoPtr->m_oExamInfo.nExamRecordDataId;
|
|
|
+ jBody["order"] = m_nOrder;
|
|
|
+ jBody["filePath"] = getWXUploadedFile.sFilePath.toStdString();
|
|
|
+ jBody["acknowledgeStatus"] = "CONFIRMED";
|
|
|
+ hrp.sParamList.push_back(QString("CustomBody,%1").arg(jBody.toStyledString().c_str()));
|
|
|
+ hrp.sCommonStr = getWXUploadedFile.sFilePath;
|
|
|
+ hrp.eParamType = HttpParamType::hptCustomBody;
|
|
|
+ g_httpBllPtr->post(hrp);
|
|
|
+
|
|
|
+
|
|
|
+ QString sFileUrl = getWXUploadedFile.sFilePath;
|
|
|
+ if(m_sAnswerType == "SINGLE_AUDIO")
|
|
|
+ {
|
|
|
+ m_sFileUrl = sFileUrl;
|
|
|
+ {
|
|
|
+ QString sFileName = sFileUrl.right(sFileUrl.length() - sFileUrl.lastIndexOf("/") - 1);
|
|
|
+ sFileName = g_appInfoPtr->m_sCacheFileDir + sFileName;
|
|
|
+ CHttpRequestPackage hrp;
|
|
|
+ hrp.sUri = sFileUrl;
|
|
|
+ hrp.sCommonStr = sFileName;
|
|
|
+ hrp.sCommonStr1 = __FILE__;
|
|
|
+ hrp.nRequestType = RequestType::rtDownLoadFile;
|
|
|
+ hrp.nRetryCount = 3;
|
|
|
+ g_httpBllPtr->downLoad(hrp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(m_picList == nullptr)
|
|
|
+ {
|
|
|
+ m_picList = std::make_shared<wPictureList>(g_appInfoPtr->m_fRate*108, g_appInfoPtr->m_fRate*10, ui->widget_wxa);
|
|
|
+ }
|
|
|
+
|
|
|
+ QStringList answerList = m_picList->getFileUrls().split(",");
|
|
|
+
|
|
|
+ QStringList fileList;
|
|
|
+ if(!sFileUrl.isEmpty())
|
|
|
+ {
|
|
|
+ fileList = sFileUrl.split(",");
|
|
|
+ for (QString sFile : fileList)
|
|
|
+ {
|
|
|
+ if(answerList.indexOf(sFile) < 0)
|
|
|
+ {
|
|
|
+ m_picList->AddPic(sFile);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(m_picList->itemCount() > 5)
|
|
|
+ {
|
|
|
+ ui->label_wxa_qrcode->setVisible(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ int nHeight = m_picList->setUI(g_appInfoPtr->m_fRate*30, ui->label_wxa_qrcode->y() + ui->label_wxa_qrcode->height() + g_appInfoPtr->m_fRate*20,
|
|
|
+ ui->widget_wxa->width() - g_appInfoPtr->m_fRate*30*2);
|
|
|
+ ui->btn_refresh->setGeometry(g_appInfoPtr->m_fRate*20, ui->widget_wxa->height() - g_appInfoPtr->m_fRate*(30 + 30),
|
|
|
+ g_appInfoPtr->m_fRate*80, g_appInfoPtr->m_fRate*30);
|
|
|
+ ui->label_refreshTip->adjustSize();
|
|
|
+ ui->label_refreshTip->setGeometry(ui->btn_refresh->x() + ui->btn_refresh->width() + g_appInfoPtr->m_fRate*10, ui->btn_refresh->y() + ui->btn_refresh->height()/2 - ui->label_refreshTip->height()/2,
|
|
|
+ ui->label_refreshTip->width(), ui->label_refreshTip->height());
|
|
|
+ ui->btn_wxa_comfirm->setGeometry((ui->widget_wxa->width() - g_appInfoPtr->m_fRate*120)/2, m_picList->y() + m_picList->height() + g_appInfoPtr->m_fRate*30,
|
|
|
+ g_appInfoPtr->m_fRate*120, g_appInfoPtr->m_fRate*40);
|
|
|
+ ui->widget_wxa->setGeometry((width() - g_appInfoPtr->m_fRate*760)/2, (height() - (ui->btn_wxa_comfirm->y() + ui->btn_wxa_comfirm->height() + g_appInfoPtr->m_fRate*30))/2,
|
|
|
+ g_appInfoPtr->m_fRate*760, ui->btn_wxa_comfirm->y() + ui->btn_wxa_comfirm->height() + g_appInfoPtr->m_fRate*30);
|
|
|
+
|
|
|
+
|
|
|
+ m_picList->show();
|
|
|
+ }
|
|
|
+ ui->label_wxa_status->setText(QString::fromLocal8Bit("已上传"));
|
|
|
+ ShowMsg(QString::fromLocal8Bit("小程序作答已更新"), g_appInfoPtr->m_pAnsBgWidget, MSG_ICON_TYPE::mit_information);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(getWXUploadedFile.sMessage.isEmpty())
|
|
|
+ {
|
|
|
+ ShowMsg(QString::fromLocal8Bit("同步拍照作答失败"), g_appInfoPtr->m_pAnsBgWidget, MSG_ICON_TYPE::mit_error);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShowMsg(getWXUploadedFile.sMessage, g_appInfoPtr->m_pAnsBgWidget, MSG_ICON_TYPE::mit_error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|