Commit 58466bdf by NitefllWind

1.新增loading界面。

2.新增自定义弹窗。
3.所有返回POS接口新增prompt字段。
4.操作成功时不再弹窗提示。
5.修改会员认证接口。
6.给输入框设定默认焦点。
parent da6c1b8f
...@@ -21,7 +21,9 @@ SOURCES += main.cpp\ ...@@ -21,7 +21,9 @@ SOURCES += main.cpp\
fmvippanel.cpp \ fmvippanel.cpp \
fmvipfund.cpp \ fmvipfund.cpp \
fmvipdispatcher.cpp \ fmvipdispatcher.cpp \
fmvipforward.cpp fmvipforward.cpp \
fmmsgwnd.cpp \
fmloading.cpp
HEADERS += fmviporder.h \ HEADERS += fmviporder.h \
fmviplogin.h \ fmviplogin.h \
...@@ -29,19 +31,23 @@ HEADERS += fmviporder.h \ ...@@ -29,19 +31,23 @@ HEADERS += fmviporder.h \
fmvippanel.h \ fmvippanel.h \
fmvipfund.h \ fmvipfund.h \
fmvipdispatcher.h \ fmvipdispatcher.h \
fmvipforward.h fmvipforward.h \
fmmsgwnd.h \
fmloading.h
FORMS += forms/fmviporder.ui \ FORMS += forms/fmviporder.ui \
forms/fmviplogin.ui \ forms/fmviplogin.ui \
forms/fmvippanel.ui \ forms/fmvippanel.ui \
forms/fmvipfund.ui forms/fmvipfund.ui \
forms/fmmsgwnd.ui \
forms/fmloading.ui
RESOURCES += \ RESOURCES += \
res/FMVip.qrc res/FMVip.qrc
INCLUDEPATH += ../FMVipDC/ INCLUDEPATH += ../FMVipDC/
LIBS += -L..\FMVipTest -lFMVipDC
win32 { win32 {
RC_FILE = res/FMVip.rc RC_FILE = res/FMVip.rc
...@@ -50,4 +56,14 @@ RC_FILE = res/FMVip.rc ...@@ -50,4 +56,14 @@ RC_FILE = res/FMVip.rc
SUBDIRS += \ SUBDIRS += \
../FMVipDC/FMVipDC.pro ../FMVipDC/FMVipDC.pro
DESTDIR += ../FMVipTest
CONFIG(debug, debug|release) {
DESTDIR = $$PWD/../FMVipTest/Debug
TARGET = fmvip
LIBS += -L..\FMVipTest\Debug -lFMVipDC
} else {
DESTDIR = $$PWD/../FMVipTest/Release
TARGET = fmvip
LIBS += -L..\FMVipTest\Release -lFMVipDC
}
#include "fmloading.h"
#include "ui_fmloading.h"
FMLoading::FMLoading(QDialog *parent) :
QDialog(parent),
ui(new Ui::FMLoading)
{
ui->setupUi(this);
setWindowFlags(Qt::FramelessWindowHint);
movie = new QMovie(":/loading.gif");
movie->start();
ui->loading_lbl->setMovie(movie);
}
FMLoading::~FMLoading()
{
if(movie != NULL) {
delete movie;
movie = NULL;
}
delete ui;
}
#ifndef FMLOADING_H
#define FMLOADING_H
#include <QDialog>
#include <QMovie>
namespace Ui {
class FMLoading;
}
class FMLoading : public QDialog
{
Q_OBJECT
public:
explicit FMLoading(QDialog *parent = 0);
~FMLoading();
private:
Ui::FMLoading *ui;
QMovie *movie;
};
#endif // FMLOADING_H
#include "fmmsgwnd.h"
#include "ui_fmmsgwnd.h"
FMMsgWnd::FMMsgWnd(FMVipWnd *parent) :
FMVipWnd(parent),
ui(new Ui::FMMsgWnd)
{
ui->setupUi(this);
}
FMMsgWnd::~FMMsgWnd()
{
delete ui;
}
void FMMsgWnd::show(InfoType type, const QString &info)
{
switch (type) {
case InfoType::T_Normal:
ui->title_lbl->setText("");
break;
case InfoType::T_Success:
ui->title_lbl->setText("成功");
break;
case InfoType::T_Failure:
ui->title_lbl->setText("失败");
break;
default:
break;
}
ui->info_lbl->setText(info);
this->exec();
}
void FMMsgWnd::on_ok_btn_clicked()
{
this->close();
}
#ifndef FMMSGWND_H
#define FMMSGWND_H
#include "fmvipwnd.h"
namespace Ui {
class FMMsgWnd;
}
class FMMsgWnd : public FMVipWnd
{
Q_OBJECT
public:
explicit FMMsgWnd(FMVipWnd *parent = 0);
~FMMsgWnd();
enum InfoType
{
T_Normal,
T_Success,
T_Failure
};
void show(InfoType type = T_Normal, const QString &info = "");
private slots:
void on_ok_btn_clicked();
private:
Ui::FMMsgWnd *ui;
};
#endif // FMMSGWND_H
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "fmviporder.h" #include "fmviporder.h"
#include "fmvipfund.h" #include "fmvipfund.h"
#include "fmvipforward.h" #include "fmvipforward.h"
#include "fmmsgwnd.h"
#include <QDebug> #include <QDebug>
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject> #include <QJsonObject>
...@@ -28,6 +29,9 @@ FMVipDispatcher::FMVipDispatcher(QObject *parent) ...@@ -28,6 +29,9 @@ FMVipDispatcher::FMVipDispatcher(QObject *parent)
_sysIcon->setToolTip("FMVIP"); _sysIcon->setToolTip("FMVIP");
QMenu *menu = new QMenu(); QMenu *menu = new QMenu();
QAction *action = new QAction("退出", this);
connect(action, SIGNAL(triggered(bool)), this, SLOT(onQuit()));
menu->addAction(action);
// menu->addAction(addAction("退出", [=](){ // menu->addAction(addAction("退出", [=](){
// this->_ParseRequest("{\"fm_cmd\":\"-1\"}"); // this->_ParseRequest("{\"fm_cmd\":\"-1\"}");
// });) // });)
...@@ -37,6 +41,11 @@ FMVipDispatcher::FMVipDispatcher(QObject *parent) ...@@ -37,6 +41,11 @@ FMVipDispatcher::FMVipDispatcher(QObject *parent)
_sysIcon->show(); _sysIcon->show();
} }
void FMVipDispatcher::onQuit()
{
this->_ParseRequest("{\"fm_cmd\":\"-1\"}");
}
void FMVipDispatcher::onActiveSysTrayIcon(QSystemTrayIcon::ActivationReason reason) void FMVipDispatcher::onActiveSysTrayIcon(QSystemTrayIcon::ActivationReason reason)
{ {
switch (reason) { switch (reason) {
...@@ -59,7 +68,7 @@ INT FMVipDispatcher::_ParseRequest(LPSTR data) ...@@ -59,7 +68,7 @@ INT FMVipDispatcher::_ParseRequest(LPSTR data)
FMVipForward::instance()->resetSessionData(_posReqObj); FMVipForward::instance()->resetSessionData(_posReqObj);
isLastOne = true; isLastOne = true;
isOnlyForward = false; _serverRspData.clear();
// 唤起客户端界面 // 唤起客户端界面
emit requested(_posReqObj); emit requested(_posReqObj);
...@@ -72,10 +81,12 @@ BOOL FMVipDispatcher::_GetResponse(LPSTR &rsp, UINT &len) ...@@ -72,10 +81,12 @@ BOOL FMVipDispatcher::_GetResponse(LPSTR &rsp, UINT &len)
{ {
qDebug() << __FUNCTION__; qDebug() << __FUNCTION__;
// 服务器还未返回则一直阻塞
mutex.lock(); mutex.lock();
serverIsBusy.wait(&mutex); if(_serverRspData.isEmpty())
{
// 服务器还未返回则一直阻塞
serverIsBusy.wait(&mutex);
}
rsp = _serverRspData.data(); rsp = _serverRspData.data();
len = _serverRspData.length(); len = _serverRspData.length();
mutex.unlock(); mutex.unlock();
...@@ -139,7 +150,6 @@ void FMVipDispatcher::onRequest(const QJsonObject &jsonObj) ...@@ -139,7 +150,6 @@ void FMVipDispatcher::onRequest(const QJsonObject &jsonObj)
FMVipForward::instance()->clearSessionData(); FMVipForward::instance()->clearSessionData();
} else { } else {
_serverRspData = Err_ErrorFMCMD; _serverRspData = Err_ErrorFMCMD;
serverIsBusy.wakeAll();
} }
} }
...@@ -164,6 +174,7 @@ void FMVipDispatcher::onFinished() ...@@ -164,6 +174,7 @@ void FMVipDispatcher::onFinished()
void FMVipDispatcher::onServerResponsed(const QJsonObject &rspObj) void FMVipDispatcher::onServerResponsed(const QJsonObject &rspObj)
{ {
if(_vindow != 0) { if(_vindow != 0) {
_vindow->setIsBusy(false);
_vindow->deleteLater(); _vindow->deleteLater();
} }
...@@ -171,34 +182,42 @@ void FMVipDispatcher::onServerResponsed(const QJsonObject &rspObj) ...@@ -171,34 +182,42 @@ void FMVipDispatcher::onServerResponsed(const QJsonObject &rspObj)
QByteArray rspData = rspDoc.toJson(); QByteArray rspData = rspDoc.toJson();
_serverRspData = rspData; _serverRspData = rspData;
if( isLastOne ) {
serverIsBusy.wakeAll();
}
int status = rspObj["statusCode"].toInt(); int status = rspObj["statusCode"].toInt();
int prompt = rspObj["prompt"].toInt();
if(status == 100) {
if(isLastOne && !isOnlyForward) {
QMessageBox msgBox;
msgBox.setWindowTitle("提示"); // if(status == 100) {
msgBox.setText("操作成功"); // if(isLastOne && prompt == 0) {
msgBox.setAttribute(Qt::WA_QuitOnClose, false); // FMMsgWnd msgWnd;
msgBox.exec(); // msgWnd.show(FMMsgWnd::T_Success, "操作成功");
// QMessageBox msgBox(_vindow);
// msgBox.setWindowTitle("提示");
// msgBox.setText("操作成功");
// msgBox.setAttribute(Qt::WA_QuitOnClose, false);
// msgBox.exec();
// }
// }
if(status != 100) {
if(prompt == 0)
{
QString msg = rspObj["msg"].toString();
FMMsgWnd msgWnd;
msgWnd.show(FMMsgWnd::T_Failure, msg);
// QMessageBox msgBox;
// msgBox.setWindowTitle("错误");
// msgBox.setText(msg);
// msgBox.setAttribute(Qt::WA_QuitOnClose, false);
// msgBox.exec();
} }
}
else {
QString msg = rspObj["msg"].toString();
QMessageBox msgBox;
msgBox.setWindowTitle("错误");
msgBox.setText(msg);
msgBox.setAttribute(Qt::WA_QuitOnClose, false);
msgBox.exec();
requestSuccess = false; requestSuccess = false;
_vindow = 0; _vindow = 0;
serverIsBusy.wakeAll(); serverIsBusy.wakeAll();
} }
if( isLastOne ) {
serverIsBusy.wakeAll();
}
} }
// 向服务器发送请求 // 向服务器发送请求
...@@ -220,7 +239,6 @@ void FMVipDispatcher::login() ...@@ -220,7 +239,6 @@ void FMVipDispatcher::login()
void FMVipDispatcher::coupon() void FMVipDispatcher::coupon()
{ {
isOnlyForward = true;
onDoPost(); onDoPost();
} }
...@@ -268,19 +286,16 @@ void FMVipDispatcher::fund() ...@@ -268,19 +286,16 @@ void FMVipDispatcher::fund()
void FMVipDispatcher::final() void FMVipDispatcher::final()
{ {
isOnlyForward = true;
onDoPost(); onDoPost();
} }
void FMVipDispatcher::orderRefund() void FMVipDispatcher::orderRefund()
{ {
isOnlyForward = true;
onDoPost(); onDoPost();
} }
void FMVipDispatcher::orderRevoke() void FMVipDispatcher::orderRevoke()
{ {
isOnlyForward = true;
onDoPost(); onDoPost();
} }
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
#include <QMutex> #include <QMutex>
#include <QWaitCondition> #include <QWaitCondition>
#define Err_WindowClose "{\"statusCode\":1001,\"msg\":\"窗口异常关闭\"}" #define Err_WindowClose "{\"statusCode\":1001, \"prompt\":0, \"msg\":\"窗口异常关闭\"}"
#define Err_ErrorFMCMD "{\"statusCode\":1002,\"msg\":\"无法识别的请求类型\"}" #define Err_ErrorFMCMD "{\"statusCode\":1002, \"prompt\":1, \"msg\":\"无法识别的请求类型\"}"
#define _DEBUG #define _DEBUG
...@@ -49,6 +49,8 @@ private slots: ...@@ -49,6 +49,8 @@ private slots:
void onDoPost(); void onDoPost();
void onActiveSysTrayIcon(QSystemTrayIcon::ActivationReason); void onActiveSysTrayIcon(QSystemTrayIcon::ActivationReason);
void onQuit();
private: private:
FMVipWnd *_vindow; FMVipWnd *_vindow;
QJsonObject _posReqObj; QJsonObject _posReqObj;
...@@ -61,8 +63,6 @@ private: ...@@ -61,8 +63,6 @@ private:
QMutex mutex; QMutex mutex;
QWaitCondition serverIsBusy; QWaitCondition serverIsBusy;
BOOL requestSuccess; BOOL requestSuccess;
BOOL isOnlyForward;
}; };
#endif // FMVIPDISPATCHER_H #endif // FMVIPDISPATCHER_H
...@@ -164,8 +164,7 @@ void FMVipForward::login(const QJsonObject &job, QJsonObject &fmjob) ...@@ -164,8 +164,7 @@ void FMVipForward::login(const QJsonObject &job, QJsonObject &fmjob)
{ {
Q_UNUSED(job); Q_UNUSED(job);
fmjob["reqType"] = FM_VIP_LOGIN; fmjob["reqType"] = FM_VIP_LOGIN;
fmjob["payCode"] = sessionData("payCode"); fmjob["code"] = sessionData("code");
fmjob["mobile"] = sessionData("mobile");
} }
void FMVipForward::fund(const QJsonObject &job, QJsonObject &fmjob) void FMVipForward::fund(const QJsonObject &job, QJsonObject &fmjob)
{ {
...@@ -270,6 +269,7 @@ void FMVipForward::logined(const QJsonObject &serverJob, QJsonObject &posJob) ...@@ -270,6 +269,7 @@ void FMVipForward::logined(const QJsonObject &serverJob, QJsonObject &posJob)
{ {
QJsonObject memberObj = serverJob["memberInfo"].toObject(); QJsonObject memberObj = serverJob["memberInfo"].toObject();
posJob["fm_open_id"] = memberObj["account"]; posJob["fm_open_id"] = memberObj["account"];
posJob["prompt"] = 0;
addSessionData("fm_open_id", memberObj["account"].toString()); addSessionData("fm_open_id", memberObj["account"].toString());
addSessionData("amount", getString(memberObj["amount"].toInt())); addSessionData("amount", getString(memberObj["amount"].toInt()));
...@@ -283,16 +283,19 @@ void FMVipForward::funded(const QJsonObject &serverJob, QJsonObject &posJob) ...@@ -283,16 +283,19 @@ void FMVipForward::funded(const QJsonObject &serverJob, QJsonObject &posJob)
posJob["fm_id"] = cardInfo["memberTransId"]; posJob["fm_id"] = cardInfo["memberTransId"];
posJob["fm_open_id"] = cardInfo["account"]; posJob["fm_open_id"] = cardInfo["account"];
posJob["print"] = serverJob["print"]; posJob["print"] = serverJob["print"];
posJob["prompt"] = 0;
} }
void FMVipForward::couponed(const QJsonObject &serverJob, QJsonObject &posJob) void FMVipForward::couponed(const QJsonObject &serverJob, QJsonObject &posJob)
{ {
posJob["pid"] = serverJob["productCode"]; posJob["pid"] = serverJob["productCode"];
posJob["fm_open_id"] = serverJob["account"]; posJob["fm_open_id"] = serverJob["account"];
posJob["prompt"] = 1;
} }
void FMVipForward::payed(const QJsonObject &serverJob, QJsonObject &posJob) void FMVipForward::payed(const QJsonObject &serverJob, QJsonObject &posJob)
{ {
posJob["prompt"] = 0;
int codeAmount = serverJob["codeAmount"].toInt(); int codeAmount = serverJob["codeAmount"].toInt();
int scoreAmount = serverJob["scoreAmount"].toInt(); int scoreAmount = serverJob["scoreAmount"].toInt();
int paid_total_amount = sessionDataInt("paid_amount") + codeAmount + scoreAmount; int paid_total_amount = sessionDataInt("paid_amount") + codeAmount + scoreAmount;
...@@ -328,6 +331,7 @@ void FMVipForward::payed(const QJsonObject &serverJob, QJsonObject &posJob) ...@@ -328,6 +331,7 @@ void FMVipForward::payed(const QJsonObject &serverJob, QJsonObject &posJob)
void FMVipForward::finaled(const QJsonObject &serverJob, QJsonObject &posJob) void FMVipForward::finaled(const QJsonObject &serverJob, QJsonObject &posJob)
{ {
posJob["prompt"] = 1;
posJob["fm_id"] = serverJob["memberTransId"]; posJob["fm_id"] = serverJob["memberTransId"];
posJob["print1"] = serverJob["print1"]; posJob["print1"] = serverJob["print1"];
posJob["print2"] = serverJob["print2"]; posJob["print2"] = serverJob["print2"];
...@@ -335,14 +339,14 @@ void FMVipForward::finaled(const QJsonObject &serverJob, QJsonObject &posJob) ...@@ -335,14 +339,14 @@ void FMVipForward::finaled(const QJsonObject &serverJob, QJsonObject &posJob)
void FMVipForward::orderRefunded(const QJsonObject &serverJob, QJsonObject &posJob) void FMVipForward::orderRefunded(const QJsonObject &serverJob, QJsonObject &posJob)
{ {
posJob["prompt"] = 1;
Q_UNUSED(serverJob); Q_UNUSED(serverJob);
Q_UNUSED(posJob);
} }
void FMVipForward::orderRevoked(const QJsonObject &serverJob, QJsonObject &posJob) void FMVipForward::orderRevoked(const QJsonObject &serverJob, QJsonObject &posJob)
{ {
posJob["prompt"] = 1;
Q_UNUSED(serverJob); Q_UNUSED(serverJob);
Q_UNUSED(posJob);
} }
......
...@@ -25,6 +25,8 @@ FMVipFund::FMVipFund(QDialog *parent) : ...@@ -25,6 +25,8 @@ FMVipFund::FMVipFund(QDialog *parent) :
ui->id_label->setText(fm_id); ui->id_label->setText(fm_id);
ui->balance_label->setText(show_amount_str); ui->balance_label->setText(show_amount_str);
ui->amount_edit->setText(show_charge_amount_str); ui->amount_edit->setText(show_charge_amount_str);
ui->fund_btn->setFocus();
} }
FMVipFund::~FMVipFund() FMVipFund::~FMVipFund()
...@@ -47,5 +49,6 @@ void FMVipFund::on_fund_btn_clicked() ...@@ -47,5 +49,6 @@ void FMVipFund::on_fund_btn_clicked()
ui->fund_btn->setEnabled(false); ui->fund_btn->setEnabled(false);
setIsBusy(true);
emit doPost(); emit doPost();
} }
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <QNetworkReply> #include <QNetworkReply>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include "fmvipforward.h" #include "fmvipforward.h"
#include "fmloading.h"
FMVipLogin::FMVipLogin(QDialog *parent) : FMVipLogin::FMVipLogin(QDialog *parent) :
FMVipWnd(parent), FMVipWnd(parent),
...@@ -17,6 +18,7 @@ FMVipLogin::FMVipLogin(QDialog *parent) : ...@@ -17,6 +18,7 @@ FMVipLogin::FMVipLogin(QDialog *parent) :
QString operator_id = FMVipForward::instance()->sessionData("operator_id"); QString operator_id = FMVipForward::instance()->sessionData("operator_id");
QString business_date = FMVipForward::instance()->sessionData("business_date"); QString business_date = FMVipForward::instance()->sessionData("business_date");
ui->login_edit->setFocus();
ui->operator_label->setText(operator_id); ui->operator_label->setText(operator_id);
ui->bd_label->setText(business_date); ui->bd_label->setText(business_date);
} }
...@@ -32,19 +34,12 @@ void FMVipLogin::on_login_btn_clicked() ...@@ -32,19 +34,12 @@ void FMVipLogin::on_login_btn_clicked()
qDebug() << __FUNCTION__; qDebug() << __FUNCTION__;
QString id = ui->login_edit->text(); QString id = ui->login_edit->text();
// 手机号登陆 FMVipForward::instance()->addSessionData("code", id);
if(id.length() == 11) {
FMVipForward::instance()->addSessionData("mobile", id);
}
// 支付码登陆
else if(id.length() == 20) {
FMVipForward::instance()->addSessionData("payCode", id);
}
ui->login_btn->setEnabled(false); ui->login_btn->setEnabled(false);
ui->login_edit->setEnabled(false); ui->login_edit->setEnabled(false);
setIsBusy(true);
emit doPost(); emit doPost();
} }
......
...@@ -26,9 +26,13 @@ FMVipOrder::FMVipOrder(QDialog *parent) : ...@@ -26,9 +26,13 @@ FMVipOrder::FMVipOrder(QDialog *parent) :
ui->point_label->setText(score_str); ui->point_label->setText(score_str);
ui->balance_label->setText(orderInfo->getAmountStr()); ui->balance_label->setText(orderInfo->getAmountStr());
ui->price_label->setText(orderInfo->getNeedPayStr()); ui->price_label->setText(orderInfo->getNeedPayStr());
ui->standard_label->setText(QString("满%1元可享受优惠").arg(standard_amount));
if(standard_amount > 0) {
ui->standard_label->setText(QString("满%1元可享受储值金满额支付优惠").arg(standard_amount));
}
ui->pay_edit->setText(orderInfo->getPayAmountStr()); ui->pay_edit->setText(orderInfo->getPayAmountStr());
ui->pay_edit->setFocus();
} }
FMVipOrder::~FMVipOrder() FMVipOrder::~FMVipOrder()
...@@ -59,6 +63,7 @@ void FMVipOrder::on_pay_btn_clicked() ...@@ -59,6 +63,7 @@ void FMVipOrder::on_pay_btn_clicked()
ui->pay_btn->setEnabled(false); ui->pay_btn->setEnabled(false);
ui->pay_chk->setEnabled(false); ui->pay_chk->setEnabled(false);
setIsBusy(true);
emit doPost(); emit doPost();
} }
......
...@@ -10,9 +10,10 @@ ...@@ -10,9 +10,10 @@
#endif #endif
FMVipWnd::FMVipWnd(QDialog *parent) : FMVipWnd::FMVipWnd(QDialog *parent) :
QDialog(parent) QDialog(parent),
loadingWindow(new FMLoading(parent))
{ {
setWindowFlags(Qt::FramelessWindowHint); setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
setAttribute(Qt::WA_QuitOnClose, false); setAttribute(Qt::WA_QuitOnClose, false);
setIsBusy(false); setIsBusy(false);
} }
...@@ -47,7 +48,12 @@ void FMVipWnd::on_close_btn_clicked() ...@@ -47,7 +48,12 @@ void FMVipWnd::on_close_btn_clicked()
void FMVipWnd::setIsBusy(const bool isBusy) void FMVipWnd::setIsBusy(const bool isBusy)
{ {
Q_UNUSED(isBusy); if(isBusy)
{
loadingWindow->show();
}else{
loadingWindow->hide();
}
} }
int FMVipWnd::exec() int FMVipWnd::exec()
...@@ -68,7 +74,7 @@ int FMVipWnd::exec() ...@@ -68,7 +74,7 @@ int FMVipWnd::exec()
::AttachThreadInput(dwCurID,dwForeID,FALSE); ::AttachThreadInput(dwCurID,dwForeID,FALSE);
this->setFocus(); // this->setFocus();
return QDialog::exec(); return QDialog::exec();
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <QJsonObject> #include <QJsonObject>
#include <QMap> #include <QMap>
#include <QDebug> #include <QDebug>
#include "fmloading.h"
class FMVipWnd : public QDialog class FMVipWnd : public QDialog
{ {
...@@ -14,13 +15,15 @@ public: ...@@ -14,13 +15,15 @@ public:
//! Set current user profile (Json data) //! Set current user profile (Json data)
bool setProfile(const QByteArray&); bool setProfile(const QByteArray&);
void setIsBusy(const bool isBusy); void setIsBusy(const bool isBusy = true);
int exec(); int exec();
signals: signals:
void doPost(); void doPost();
public slots: public slots:
void on_close_btn_clicked(); void on_close_btn_clicked();
private:
FMLoading* loadingWindow;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
protected: protected:
bool nativeEvent(const QByteArray &eventType, void *message, long *result); bool nativeEvent(const QByteArray &eventType, void *message, long *result);
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FMLoading</class>
<widget class="QWidget" name="FMLoading">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>124</width>
<height>124</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="loading_lbl">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>124</width>
<height>124</height>
</rect>
</property>
<property name="text">
<string>loading...</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FMMsgWnd</class>
<widget class="QWidget" name="FMMsgWnd">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="info_lbl">
<property name="geometry">
<rect>
<x>90</x>
<y>100</y>
<width>211</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
<widget class="QPushButton" name="ok_btn">
<property name="geometry">
<rect>
<x>150</x>
<y>170</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>OK</string>
</property>
</widget>
<widget class="QPushButton" name="close_btn">
<property name="geometry">
<rect>
<x>360</x>
<y>0</y>
<width>31</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>X</string>
</property>
</widget>
<widget class="QLabel" name="title_lbl">
<property name="geometry">
<rect>
<x>150</x>
<y>30</y>
<width>91</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
...@@ -351,6 +351,11 @@ ...@@ -351,6 +351,11 @@
</layout> </layout>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<tabstops>
<tabstop>login_edit</tabstop>
<tabstop>login_btn</tabstop>
<tabstop>close_btn</tabstop>
</tabstops>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>
...@@ -462,7 +462,7 @@ ...@@ -462,7 +462,7 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>满 0 元可享受优惠</string> <string/>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
......
FMVip/res/loading.gif

38.7 KB | W: | H:

FMVip/res/loading.gif

3.81 KB | W: | H:

FMVip/res/loading.gif
FMVip/res/loading.gif
FMVip/res/loading.gif
FMVip/res/loading.gif
  • 2-up
  • Swipe
  • Onion skin
QT -= core QT -= core
TARGET = FMVipDC
TEMPLATE = lib TEMPLATE = lib
CONFIG += dll CONFIG += dll
...@@ -25,4 +25,11 @@ INCLUDEPATH += include ...@@ -25,4 +25,11 @@ INCLUDEPATH += include
LIBS += -lwinhttp -lws2_32 LIBS += -lwinhttp -lws2_32
DESTDIR += ../FMVipTest
CONFIG(debug, debug|release) {
DESTDIR = $$PWD/../FMVipTest/Debug
TARGET = FMVipDC
} else {
DESTDIR = $$PWD/../FMVipTest/Release
TARGET = FMVipDC
}
#include "fmsockserver.h" #include "fmsockserver.h"
#include <fmutils/fmutils.hpp> #include <fmutils/fmutils.hpp>
FMSockServer::FMSockServer(FMApiRelay *relay) : FMSockServer::FMSockServer(FMApiRelay *relay) :
_worker(0), _worker(0),
_port(0), _port(0),
...@@ -114,9 +113,10 @@ BOOL FMSockServer::_Listen() ...@@ -114,9 +113,10 @@ BOOL FMSockServer::_Listen()
io_data->socket = sclient; io_data->socket = sclient;
WSARecv(sclient, &io_data->buffer, 1, NULL, &io_data->flags, &io_data->overlap, FMSockServer::RecvRoutine); WSARecv(sclient, &io_data->buffer, 1, NULL, &io_data->flags, &io_data->overlap, FMSockServer::RecvRoutine);
DWORD res = SleepEx(1000, TRUE); DWORD res = SleepEx(1000, TRUE);
while (res != WAIT_IO_COMPLETION) { while (res != WAIT_IO_COMPLETION) {
FMLOG(_T("Rewaiting for I/O completion...")); FMLOG(_T("_Listen Rewaiting for I/O completion..."));
res = SleepEx(1000, TRUE); res = SleepEx(1000, TRUE);
} }
} }
...@@ -149,7 +149,6 @@ void FMSockServer::RecvRoutine(DWORD err, DWORD bytes, LPWSAOVERLAPPED overlappe ...@@ -149,7 +149,6 @@ void FMSockServer::RecvRoutine(DWORD err, DWORD bytes, LPWSAOVERLAPPED overlappe
HeapFree(GetProcessHeap(), 0, io_data); HeapFree(GetProcessHeap(), 0, io_data);
return; return;
} }
FMLOG(_T("Received bytes: %ld."), bytes); FMLOG(_T("Received bytes: %ld."), bytes);
if (io_data->header.flag == FMSOCKFLAG) { if (io_data->header.flag == FMSOCKFLAG) {
...@@ -175,9 +174,11 @@ void FMSockServer::RecvRoutine(DWORD err, DWORD bytes, LPWSAOVERLAPPED overlappe ...@@ -175,9 +174,11 @@ void FMSockServer::RecvRoutine(DWORD err, DWORD bytes, LPWSAOVERLAPPED overlappe
io_new_data->header = io_data->header; io_new_data->header = io_data->header;
WSARecv(io_new_data->socket, &io_new_data->buffer, 1, NULL, &io_new_data->flags, &io_new_data->overlap, FMSockServer::RecvRoutine); WSARecv(io_new_data->socket, &io_new_data->buffer, 1, NULL, &io_new_data->flags, &io_new_data->overlap, FMSockServer::RecvRoutine);
DWORD res = SleepEx(1000, TRUE); DWORD res = SleepEx(1000, TRUE);
while (res != WAIT_IO_COMPLETION) { while (res != WAIT_IO_COMPLETION) {
FMLOG(_T("Rewaiting for I/O completion...")); FMLOG(_T("RecvRoutine 1 Rewaiting for I/O completion..."));
res = SleepEx(1000, TRUE); res = SleepEx(1000, TRUE);
} }
} }
...@@ -192,19 +193,19 @@ void FMSockServer::RecvRoutine(DWORD err, DWORD bytes, LPWSAOVERLAPPED overlappe ...@@ -192,19 +193,19 @@ void FMSockServer::RecvRoutine(DWORD err, DWORD bytes, LPWSAOVERLAPPED overlappe
if (response) { if (response) {
send(io_data->socket, response, len, 0); send(io_data->socket, response, len, 0);
// LPFMSOCKDATA io_new_data = NULL; LPFMSOCKDATA io_new_data = NULL;
// io_new_data = (LPFMSOCKDATA)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMSOCKDATA)); io_new_data = (LPFMSOCKDATA)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMSOCKDATA));
// //! Receive length first //! Receive length first
// io_new_data->buffer.len = sizeof(io_new_data->header); io_new_data->buffer.len = sizeof(io_new_data->header);
// io_new_data->buffer.buf = (char*)&io_new_data->header; io_new_data->buffer.buf = (char*)&io_new_data->header;
// io_new_data->relay = io_data->relay; io_new_data->relay = io_data->relay;
// io_new_data->socket = io_data->socket; io_new_data->socket = io_data->socket;
// WSARecv(io_new_data->socket, &io_new_data->buffer, 1, NULL, &io_new_data->flags, &io_new_data->overlap, FMSockServer::RecvRoutine); WSARecv(io_new_data->socket, &io_new_data->buffer, 1, NULL, &io_new_data->flags, &io_new_data->overlap, FMSockServer::RecvRoutine);
// DWORD res = SleepEx(1000, TRUE); DWORD res = SleepEx(1000, TRUE);
// while (res != WAIT_IO_COMPLETION) { while (res != WAIT_IO_COMPLETION) {
// FMLOG(_T("Rewaiting for I/O completion...")); FMLOG(_T("RecvRoutine Rewaiting for I/O completion..."));
// res = SleepEx(1000, TRUE); res = SleepEx(1000, TRUE);
// } }
} }
else { else {
FMLOG(_T("Failed to determine response data.")); FMLOG(_T("Failed to determine response data."));
......
...@@ -38,6 +38,7 @@ typedef struct ...@@ -38,6 +38,7 @@ typedef struct
FMSOCKHEADER header; FMSOCKHEADER header;
char msg[1]; char msg[1];
}FMSOCKDATA, *LPFMSOCKDATA; }FMSOCKDATA, *LPFMSOCKDATA;
...@@ -72,10 +73,12 @@ private: ...@@ -72,10 +73,12 @@ private:
HANDLE _worker; HANDLE _worker;
FMApiRelay *_relay; FMApiRelay *_relay;
CRITICAL_SECTION _cs; CRITICAL_SECTION _cs;
}; };
//#ifdef __cplusplus //#ifdef __cplusplus
//} //}
//#endif //#endif
#endif // FMSOCKSERVER_H #endif // FMSOCKSERVER_H
\ No newline at end of file
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