mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 11:17:15 +08:00
update
This commit is contained in:
parent
3fefb08140
commit
dba7332d89
@ -102,7 +102,7 @@ FluContentPage{
|
|||||||
param.custname = "朱子楚"
|
param.custname = "朱子楚"
|
||||||
param.custtel = "1234567890"
|
param.custtel = "1234567890"
|
||||||
param.custemail = "zhuzichu520@gmail.com"
|
param.custemail = "zhuzichu520@gmail.com"
|
||||||
http.postJson("https://httpbingo.org/post",callable,param)
|
// http.postJson("https://httpbingo.org/post",callable,param)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluButton{
|
FluButton{
|
||||||
@ -125,7 +125,7 @@ FluContentPage{
|
|||||||
console.debug(status+";"+errorString)
|
console.debug(status+";"+errorString)
|
||||||
}
|
}
|
||||||
var param = "我命由我不由天"
|
var param = "我命由我不由天"
|
||||||
http.postString("https://httpbingo.org/post",callable,param)
|
// http.postString("https://httpbingo.org/post",callable,param)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluButton{
|
FluButton{
|
||||||
|
@ -57,7 +57,7 @@ FluScrollablePage{
|
|||||||
FluSlider{
|
FluSlider{
|
||||||
id:slider_size
|
id:slider_size
|
||||||
from:60
|
from:60
|
||||||
to:200
|
to:260
|
||||||
value: 120
|
value: 120
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,8 @@ void FluHttp::handleReply(QNetworkReply* reply){
|
|||||||
_cache.append(reply);
|
_cache.append(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluHttp::post(QString url,QJSValue callable,QVariantMap params,QVariantMap headers){
|
void FluHttp::post(QString url,QJSValue callable,QMap<QString, QVariant> params,QMap<QString, QVariant> headers){
|
||||||
QVariantMap data = invokeIntercept(params,headers,"post").toMap();
|
QMap<QString, QVariant> data = invokeIntercept(params,headers,"post").toMap();
|
||||||
QThreadPool::globalInstance()->start([=](){
|
QThreadPool::globalInstance()->start([=](){
|
||||||
onStart(callable);
|
onStart(callable);
|
||||||
for (int i = 0; i < retry(); ++i) {
|
for (int i = 0; i < retry(); ++i) {
|
||||||
@ -82,8 +82,8 @@ void FluHttp::post(QString url,QJSValue callable,QVariantMap params,QVariantMap
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluHttp::postString(QString url,QJSValue callable,QString params,QVariantMap headers){
|
void FluHttp::postString(QString url,QJSValue callable,QString params,QMap<QString, QVariant> headers){
|
||||||
QVariantMap data = invokeIntercept(params,headers,"postString").toMap();
|
QMap<QString, QVariant> data = invokeIntercept(params,headers,"postString").toMap();
|
||||||
QThreadPool::globalInstance()->start([=](){
|
QThreadPool::globalInstance()->start([=](){
|
||||||
onStart(callable);
|
onStart(callable);
|
||||||
for (int i = 0; i < retry(); ++i) {
|
for (int i = 0; i < retry(); ++i) {
|
||||||
@ -121,8 +121,8 @@ void FluHttp::postString(QString url,QJSValue callable,QString params,QVariantMa
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluHttp::postJson(QString url,QJSValue callable,QVariantMap params,QVariantMap headers){
|
void FluHttp::postJson(QString url,QJSValue callable,QMap<QString, QVariant> params,QMap<QString, QVariant> headers){
|
||||||
QVariantMap data = invokeIntercept(params,headers,"postJson").toMap();
|
QMap<QString, QVariant> data = invokeIntercept(params,headers,"postJson").toMap();
|
||||||
QThreadPool::globalInstance()->start([=](){
|
QThreadPool::globalInstance()->start([=](){
|
||||||
onStart(callable);
|
onStart(callable);
|
||||||
for (int i = 0; i < retry(); ++i) {
|
for (int i = 0; i < retry(); ++i) {
|
||||||
@ -160,8 +160,8 @@ void FluHttp::postJson(QString url,QJSValue callable,QVariantMap params,QVariant
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluHttp::get(QString url,QJSValue callable,QVariantMap params,QVariantMap headers){
|
void FluHttp::get(QString url,QJSValue callable,QMap<QString, QVariant> params,QMap<QString, QVariant> headers){
|
||||||
QVariantMap data = invokeIntercept(params,headers,"get").toMap();
|
QMap<QString, QVariant> data = invokeIntercept(params,headers,"get").toMap();
|
||||||
QThreadPool::globalInstance()->start([=](){
|
QThreadPool::globalInstance()->start([=](){
|
||||||
for (int i = 0; i < retry(); ++i) {
|
for (int i = 0; i < retry(); ++i) {
|
||||||
onStart(callable);
|
onStart(callable);
|
||||||
@ -198,8 +198,8 @@ void FluHttp::get(QString url,QJSValue callable,QVariantMap params,QVariantMap h
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluHttp::download(QString url,QJSValue callable,QString filePath,QVariantMap params,QVariantMap headers){
|
void FluHttp::download(QString url,QJSValue callable,QString filePath,QMap<QString, QVariant> params,QMap<QString, QVariant> headers){
|
||||||
QVariantMap data = invokeIntercept(params,headers,"download").toMap();
|
QMap<QString, QVariant> data = invokeIntercept(params,headers,"download").toMap();
|
||||||
QThreadPool::globalInstance()->start([=](){
|
QThreadPool::globalInstance()->start([=](){
|
||||||
onStart(callable);
|
onStart(callable);
|
||||||
QNetworkAccessManager manager;
|
QNetworkAccessManager manager;
|
||||||
@ -239,7 +239,7 @@ void FluHttp::download(QString url,QJSValue callable,QString filePath,QVariantMa
|
|||||||
}
|
}
|
||||||
|
|
||||||
QVariant FluHttp::invokeIntercept(const QVariant& params,const QVariant& headers,const QString& method){
|
QVariant FluHttp::invokeIntercept(const QVariant& params,const QVariant& headers,const QString& method){
|
||||||
QVariantMap requet = {
|
QMap<QString, QVariant> requet = {
|
||||||
{"params",params},
|
{"params",params},
|
||||||
{"headers",headers},
|
{"headers",headers},
|
||||||
{"method",method}
|
{"method",method}
|
||||||
|
@ -26,11 +26,12 @@ private:
|
|||||||
public:
|
public:
|
||||||
explicit FluHttp(QObject *parent = nullptr);
|
explicit FluHttp(QObject *parent = nullptr);
|
||||||
~FluHttp();
|
~FluHttp();
|
||||||
Q_INVOKABLE void get(QString url,QJSValue callable,QVariantMap params = {},QVariantMap headers = {});
|
//神坑!!! 如果参数使用QVariantMap会有问题,在6.4.3版本中QML一调用就会编译失败。所有改用QMap<QString, QVariant>
|
||||||
Q_INVOKABLE void post(QString url,QJSValue callable,QVariantMap params = {},QVariantMap headers = {});
|
Q_INVOKABLE void get(QString url,QJSValue callable,QMap<QString, QVariant> = {},QMap<QString, QVariant> headers = {});
|
||||||
Q_INVOKABLE void postString(QString url,QJSValue callable,QString params = "",QVariantMap headers = {});
|
Q_INVOKABLE void post(QString url,QJSValue callable,QMap<QString, QVariant> = {},QMap<QString, QVariant> headers = {});
|
||||||
Q_INVOKABLE void postJson(QString url,QJSValue callable,QVariantMap params = {},QVariantMap headers = {});
|
Q_INVOKABLE void postString(QString url,QJSValue callable,QString params = "",QMap<QString, QVariant> headers = {});
|
||||||
Q_INVOKABLE void download(QString url,QJSValue callable,QString filePath,QVariantMap params = {},QVariantMap headers = {});
|
Q_INVOKABLE void postJson(QString url,QJSValue callable,QMap<QString, QVariant> params = {},QMap<QString, QVariant> headers = {});
|
||||||
|
Q_INVOKABLE void download(QString url,QJSValue callable,QString filePath,QMap<QString, QVariant> params = {},QMap<QString, QVariant> headers = {});
|
||||||
Q_INVOKABLE void cancel();
|
Q_INVOKABLE void cancel();
|
||||||
private:
|
private:
|
||||||
QList<QPointer<QNetworkReply>> _cache;
|
QList<QPointer<QNetworkReply>> _cache;
|
||||||
|
Loading…
Reference in New Issue
Block a user