Commit c39f8eab by xiaoqing.gu

1、分离获取档口信息的代码成单独的函数 2、修改主界面的样式表

parent 4f8ef409
......@@ -73,35 +73,9 @@ void StallsGetWork::workstart()
while(!_stopflag)
{
//获取档口信息
QJsonObject json, recvjson;
QString realurl;
QString error;
if(!GetStallsDataProcess::getStallsOptRequest(json, _storeinfo[JSON_KEY_PARTNERID].toString()))
{
QLOG_ERROR() << "getStallsOptRequest failed";
return;
}
QLOG_INFO() << "getStallsOptRequest request json : " << json;
if(!GetStallsDataProcess::getRealUrl(ADVANCEORDER, json, _url, realurl))
{
QLOG_ERROR() << "getStallsOptRequest getRealUrl failed";
return;
}
QLOG_INFO() << "getStallsOptRequest request url :" << realurl;
if(!this->S_Request(json, recvjson, realurl, error))
{
QLOG_ERROR() << "getStallsOptRequest failed : " << error;
return;
}
QLOG_INFO() << "getStallsOptRequest return json : " << recvjson;
QJsonObject recvjson = getStallsInfo();
//判断recvjson,如果返回失败和一种,则不推送这个消息
//判断recvjson,如果返回失败和没有商品列表,则不推送这个消息
QJsonObject tmpjson;
QJsonArray tmparray;
if(recvjson.contains(EVENT_KEY_RESULT) && recvjson[EVENT_KEY_RESULT].toObject().contains(EVENT_KEY_FILEPRODUCTLIST)) {
......@@ -123,3 +97,35 @@ void StallsGetWork::workstart()
_stoped = true;
}
QJsonObject StallsGetWork::getStallsInfo()
{
QJsonObject json, recvjson;
QString realurl;
QString error;
if(!GetStallsDataProcess::getStallsOptRequest(json, _storeinfo[JSON_KEY_PARTNERID].toString()))
{
QLOG_ERROR() << "getStallsOptRequest failed";
return QJsonObject();
}
QLOG_INFO() << "getStallsOptRequest request json : " << json;
if(!GetStallsDataProcess::getRealUrl(ADVANCEORDER, json, _url, realurl))
{
QLOG_ERROR() << "getStallsOptRequest getRealUrl failed";
return QJsonObject();
}
QLOG_INFO() << "getStallsOptRequest request url :" << realurl;
if(!this->S_Request(json, recvjson, realurl, error))
{
QLOG_ERROR() << "getStallsOptRequest failed : " << error;
return QJsonObject();
}
QLOG_INFO() << "getStallsOptRequest return json : " << recvjson;
return recvjson;
}
......@@ -29,6 +29,8 @@ signals:
public slots:
void workstart();
private:
QJsonObject getStallsInfo();
QVariantMap _storeinfo;
QString _token;
......
......@@ -1093,13 +1093,13 @@ void NewMainForm::onSetStalls(QJsonObject json)
QJsonObject tmpjson = tmparray[i].toObject();
QString stallsStr;
stallsList.append(tmpjson[EVENT_KEY_FILENAME].toString());
stallsStr.append(tmpjson[EVENT_KEY_FILENAME].toString() + QString::fromLocal8Bit(":"));
stallsStr.append(tmpjson[EVENT_KEY_FILENAME].toString() + QString::fromLocal8Bit(""));
if(tmpjson.contains(EVENT_KEY_PRODUCTLIST)) {
QJsonArray proarray = tmpjson[EVENT_KEY_PRODUCTLIST].toArray();
if(proarray.size() != 0) {
for(int j = 0;j < proarray.size();j++) {
stallsStr.append(proarray[j].toObject()[EVENT_KEY_FILEPRODUCT].toString() + QString::fromLocal8Bit(" "));
stallsStr.append(proarray[j].toObject()[EVENT_KEY_FILEPRODUCT].toString() + QString::fromLocal8Bit(" "));
}
}
}
......@@ -1112,6 +1112,7 @@ void NewMainForm::onSetStalls(QJsonObject json)
for(int k = 0; k < productList.size(); k++) {
ui->stallsTextBrowser->append(QString(productList.at(k)));
}
ui->stallsTextBrowser->anchorAt(QPoint(0,0));
}
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1647</width>
<height>733</height>
<width>1644</width>
<height>762</height>
</rect>
</property>
<property name="minimumSize">
......@@ -246,10 +246,16 @@ QTabWidget#newmaintbwgt QTabBar::tab
font: 16px &quot;微软雅黑&quot;;
color: rgb(51, 51, 51);
}
#newlabel_11,#newlabel_12,#newmaincombx_del,#newmainvtn_ordersave,#newmainrdbtn_self,#newmainrdbtn_auto
#newlabel_11,#newlabel_12,#newmaincombx_del,#newmainvtn_ordersave,#newmainrdbtn_self,#newmainrdbtn_auto,#newmaincmbox_stalls,#label_stalls
{
font: 16px &quot;微软雅黑&quot;;
color: rgb(51, 51, 51);
}
#stallsTextBrowser
{
font: 16px &quot;微软雅黑&quot;;
color: rgb(51, 51, 51);
background-color:rgb(255, 255, 203);
}</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,7">
......@@ -1140,7 +1146,7 @@ QTabWidget#newmaintbwgt QTabBar::tab
<attribute name="title">
<string>打印设置</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_8" stretch="0,7,0,2">
<layout class="QVBoxLayout" name="verticalLayout_8" stretch="0,7,2">
<property name="spacing">
<number>0</number>
</property>
......@@ -3676,19 +3682,6 @@ QTabWidget#newmaintbwgt QTabBar::tab
</widget>
</item>
<item>
<spacer name="verticalSpacer_22">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QWidget" name="widget_3" native="true">
<property name="styleSheet">
<string notr="true"/>
......@@ -3713,8 +3706,14 @@ QTabWidget#newmaintbwgt QTabBar::tab
<widget class="QLabel" name="label_stalls">
<property name="minimumSize">
<size>
<width>100</width>
<height>30</height>
<width>65</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>65</width>
<height>16777215</height>
</size>
</property>
<property name="text">
......@@ -3730,9 +3729,12 @@ QTabWidget#newmaintbwgt QTabBar::tab
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<width>80</width>
<height>20</height>
</size>
</property>
......@@ -3742,8 +3744,14 @@ QTabWidget#newmaintbwgt QTabBar::tab
<widget class="QComboBox" name="newmaincmbox_stalls">
<property name="minimumSize">
<size>
<width>150</width>
<height>30</height>
<width>180</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>180</width>
<height>16777215</height>
</size>
</property>
</widget>
......@@ -3764,7 +3772,14 @@ QTabWidget#newmaintbwgt QTabBar::tab
</layout>
</item>
<item>
<widget class="QTextBrowser" name="stallsTextBrowser"/>
<widget class="QTextBrowser" name="stallsTextBrowser">
<property name="minimumSize">
<size>
<width>0</width>
<height>120</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
......
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