mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 11:17:15 +08:00
update
This commit is contained in:
parent
d014997d52
commit
59f9495f31
@ -19,7 +19,6 @@ Window {
|
|||||||
}
|
}
|
||||||
request.headers["token"] ="yyds"
|
request.headers["token"] ="yyds"
|
||||||
request.headers["os"] ="pc"
|
request.headers["os"] ="pc"
|
||||||
console.debug(JSON.stringify(request))
|
|
||||||
return request
|
return request
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
onError:
|
onError:
|
||||||
(status,errorString)=>{
|
(status,errorString)=>{
|
||||||
|
console.debug(status+"->"+errorString)
|
||||||
showError(errorString)
|
showError(errorString)
|
||||||
}
|
}
|
||||||
onSuccess:
|
onSuccess:
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QQuickWindow>
|
#include <QQuickWindow>
|
||||||
|
#include <QNetworkProxy>
|
||||||
|
#include <QSslConfiguration>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <FramelessHelper/Quick/framelessquickmodule.h>
|
#include <FramelessHelper/Quick/framelessquickmodule.h>
|
||||||
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
||||||
@ -12,7 +14,7 @@
|
|||||||
|
|
||||||
FRAMELESSHELPER_USE_NAMESPACE
|
FRAMELESSHELPER_USE_NAMESPACE
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
//将样式设置为Basic,不然会导致组件显示异常
|
//将样式设置为Basic,不然会导致组件显示异常
|
||||||
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
|
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
|
||||||
|
@ -10,6 +10,8 @@ FluHttp::FluHttp(QObject *parent)
|
|||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
{
|
{
|
||||||
enabledBreakpointDownload(false);
|
enabledBreakpointDownload(false);
|
||||||
|
timeout(15);
|
||||||
|
retry(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_INVOKABLE void FluHttp::postString(QString params,QVariantMap headers){
|
Q_INVOKABLE void FluHttp::postString(QString params,QVariantMap headers){
|
||||||
@ -18,6 +20,8 @@ Q_INVOKABLE void FluHttp::postString(QString params,QVariantMap headers){
|
|||||||
HttpClient client;
|
HttpClient client;
|
||||||
Q_EMIT start();
|
Q_EMIT start();
|
||||||
client.post(_url)
|
client.post(_url)
|
||||||
|
.retry(retry())
|
||||||
|
.timeout(timeout())
|
||||||
.bodyWithRaw(request[params].toString().toUtf8())
|
.bodyWithRaw(request[params].toString().toUtf8())
|
||||||
.headers(request["headers"].toMap())
|
.headers(request["headers"].toMap())
|
||||||
.onSuccess([=](QString result) {
|
.onSuccess([=](QString result) {
|
||||||
@ -39,6 +43,8 @@ void FluHttp::post(QVariantMap params,QVariantMap headers){
|
|||||||
HttpClient client;
|
HttpClient client;
|
||||||
Q_EMIT start();
|
Q_EMIT start();
|
||||||
client.post(_url)
|
client.post(_url)
|
||||||
|
.retry(retry())
|
||||||
|
.timeout(timeout())
|
||||||
.headers(headers)
|
.headers(headers)
|
||||||
.bodyWithFormData(request["params"].toMap())
|
.bodyWithFormData(request["params"].toMap())
|
||||||
.headers(request["headers"].toMap())
|
.headers(request["headers"].toMap())
|
||||||
@ -61,6 +67,8 @@ void FluHttp::postJson(QVariantMap params,QVariantMap headers){
|
|||||||
HttpClient client;
|
HttpClient client;
|
||||||
Q_EMIT start();
|
Q_EMIT start();
|
||||||
client.post(_url)
|
client.post(_url)
|
||||||
|
.retry(retry())
|
||||||
|
.timeout(timeout())
|
||||||
.headers(headers)
|
.headers(headers)
|
||||||
.bodyWithRaw(QJsonDocument::fromVariant(request["params"]).toJson())
|
.bodyWithRaw(QJsonDocument::fromVariant(request["params"]).toJson())
|
||||||
.headers(request["headers"].toMap())
|
.headers(request["headers"].toMap())
|
||||||
@ -83,6 +91,8 @@ void FluHttp::get(QVariantMap params,QVariantMap headers){
|
|||||||
HttpClient client;
|
HttpClient client;
|
||||||
Q_EMIT start();
|
Q_EMIT start();
|
||||||
client.get(_url)
|
client.get(_url)
|
||||||
|
.retry(retry())
|
||||||
|
.timeout(timeout())
|
||||||
.queryParams(request["params"].toMap())
|
.queryParams(request["params"].toMap())
|
||||||
.headers(request["headers"].toMap())
|
.headers(request["headers"].toMap())
|
||||||
.onSuccess([=](QString result) {
|
.onSuccess([=](QString result) {
|
||||||
@ -105,6 +115,8 @@ Q_INVOKABLE void FluHttp::download(QString path,QVariantMap params,QVariantMap h
|
|||||||
HttpClient client;
|
HttpClient client;
|
||||||
Q_EMIT start();
|
Q_EMIT start();
|
||||||
client.get(_url)
|
client.get(_url)
|
||||||
|
.retry(retry())
|
||||||
|
.timeout(timeout())
|
||||||
.download(path)
|
.download(path)
|
||||||
.enabledBreakpointDownload(_enabledBreakpointDownload)
|
.enabledBreakpointDownload(_enabledBreakpointDownload)
|
||||||
.queryParams(request["params"].toMap())
|
.queryParams(request["params"].toMap())
|
||||||
|
@ -11,6 +11,8 @@ class FluHttp : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY_AUTO(QString,url);
|
Q_PROPERTY_AUTO(QString,url);
|
||||||
Q_PROPERTY_AUTO(bool,enabledBreakpointDownload)
|
Q_PROPERTY_AUTO(bool,enabledBreakpointDownload)
|
||||||
|
Q_PROPERTY_AUTO(int,timeout)
|
||||||
|
Q_PROPERTY_AUTO(int,retry);
|
||||||
QML_NAMED_ELEMENT(FluHttp)
|
QML_NAMED_ELEMENT(FluHttp)
|
||||||
private:
|
private:
|
||||||
QVariant invokeIntercept(const QVariant& params,const QVariant& headers,const QString& method);
|
QVariant invokeIntercept(const QVariant& params,const QVariant& headers,const QString& method);
|
||||||
|
Loading…
Reference in New Issue
Block a user