Commit 6766623a by 戴尚尚

修改网络异常提示(改为更明显)

parent 192955d9
......@@ -112,16 +112,16 @@ bool FlowControl::_PullOrder()
QLOG_INFO() << QString("[---pull order---][requestData:%1]").arg(_GetJsonStr(sendJson));
result = m_pullOrderSocket->Request(sendJson, recvJson, error);
// qDebug() << "---------------------------------------------------------------";
// qDebug() << recvJson;
// qDebug() << "---------------------------------------------------------------";
qDebug() << "---------------------------------------------------------------";
qDebug() << recvJson;
qDebug() << "---------------------------------------------------------------";
QLOG_INFO() << QString("pull order finsh. [result:%1][msg:%2]")
.arg(result).arg(error);
if(!result)
{
netErrorIndex++;
emit setNetStatus("<font color='#ff0000'>异常</font>");
if(netErrorIndex > 50)
if(netErrorIndex > 1)
{
if(neterror)//如果之前网络正常,则开始语音提示网络错误
{
......@@ -140,9 +140,10 @@ bool FlowControl::_PullOrder()
neterror=true;
if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt())
{
QString error = recvJson[JSON_MESSAGE].toString();
error = recvJson[JSON_MESSAGE].toString();
QLOG_ERROR() << QString("pull orders error.[msg->%1]").arg(error);
emit showAlert(AlertForm::ERROR, QString("获取订单失败![%1]").arg(error));
}else
{
// 获取门店营业状态
......@@ -299,9 +300,14 @@ bool FlowControl::_PullOrder()
syncTime = recvJson[JSON_SYNCTIME].toInt()*1000;
}
}
if(error.contains(QString("重启"))){
QTimer::singleShot(2000, this, &FlowControl::_Login);
}else
{
QLOG_INFO() << QString("%1 msec after pull order...").arg(syncTime);
QTimer::singleShot(syncTime, this, &FlowControl::_PullOrder);
}
return result;
}
......
#include "mainForm.h"
#include "mainForm.h"
#include <QApplication>
#include <QDir>
#include <QResource>
......
......@@ -62,6 +62,8 @@ MainForm::MainForm(QWidget *parent) :
_Init();
// 开启时间定时器
m_timeTimer.start(1000);
connect(&FlowControl::GetInstance(), &FlowControl::startNetErrorRemind, this,&MainForm::onNetError);
}
MainForm::~MainForm()
......@@ -89,6 +91,8 @@ void MainForm::MyShow()
connect(m_padForm, &PadForm::numDelete, this, &MainForm::onNumDelete);
connect(m_padForm, &PadForm::numClear, ui->mainEdtSearch, &ClickedLineEdit::clear);
connect(m_detailForm,&DetailForm::showAlert,this,&MainForm::onShowAlert);
m_resultForm = new QListWidget(this);
m_resultForm->setObjectName("mainListWdg0");
m_resultForm->setFixedSize(240, 200);
......@@ -123,7 +127,7 @@ void MainForm::_Init()
// 初始化文字
ui->mainLabStoreid->setText(UI_STOREID);
ui->mainLabVersion->setText("1.3.9");
ui->mainLabVersion->setText("1.4.0");
ui->mainLabCashier->setText(UI_CASHIER);
// 初始化表
......@@ -315,6 +319,12 @@ QPushButton *MainForm::_GetTabBtnByOrderStatus(int orderStatus)
}
}
void MainForm::onNetError()
{
showFullScreen();
this->onShowAlert(AlertForm::ERROR, QString("网络通信出现异常,请及时关注商家手机版订单"));
}
void MainForm::onHideAlert()
{
m_alertForm->hide();
......
#ifndef MAINFORM_H
#ifndef MAINFORM_H
#define MAINFORM_H
#include <QDialog>
......@@ -153,6 +153,10 @@ signals:
void GetBusinessStatus();
private slots:
//响应网络错误
void onNetError();
/* 功能:初始化
* 参数:NULL
* 返回:NULL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment