remove FluHttp

This commit is contained in:
朱子楚\zhuzi
2023-11-29 21:35:06 +08:00
parent 6a925bdad3
commit 394d0ab244
23 changed files with 136 additions and 1696 deletions

View File

@ -9,6 +9,7 @@ import "../component"
FluContentPage{
id:root
title:"Network"
FluNetworkCallable{
@ -60,6 +61,7 @@ FluContentPage{
.addQuery("name","孙悟空")
.addQuery("age",500)
.addQuery("address","花果山水帘洞")
.bind(root)
.go(callable)
}
}
@ -71,6 +73,7 @@ FluContentPage{
text_info.text = ""
FluNetwork.postBody("https://httpbingo.org/post")
.setBody("花果山水帘洞美猴王齐天大圣孙悟空")
.bind(root)
.go(callable)
}
}
@ -84,6 +87,7 @@ FluContentPage{
.add("name","孙悟空")
.add("age",500)
.add("address","花果山水帘洞")
.bind(root)
.go(callable)
}
}
@ -97,6 +101,7 @@ FluContentPage{
.add("name","孙悟空")
.add("age",500)
.add("address","花果山水帘洞")
.bind(root)
.go(callable)
}
}
@ -110,6 +115,7 @@ FluContentPage{
.add("name","孙悟空")
.add("age",500)
.add("address","花果山水帘洞")
.bind(root)
.go(callable)
}
}
@ -121,6 +127,7 @@ FluContentPage{
text_info.text = ""
FluNetwork.putBody("https://httpbingo.org/put")
.setBody("花果山水帘洞美猴王齐天大圣孙悟空")
.bind(root)
.go(callable)
}
}
@ -134,6 +141,7 @@ FluContentPage{
.add("name","孙悟空")
.add("age",500)
.add("address","花果山水帘洞")
.bind(root)
.go(callable)
}
}
@ -147,6 +155,7 @@ FluContentPage{
.add("name","孙悟空")
.add("age",500)
.add("address","花果山水帘洞")
.bind(root)
.go(callable)
}
}
@ -160,6 +169,7 @@ FluContentPage{
.add("name","孙悟空")
.add("age",500)
.add("address","花果山水帘洞")
.bind(root)
.go(callable)
}
}
@ -171,6 +181,7 @@ FluContentPage{
text_info.text = ""
FluNetwork.patchBody("https://httpbingo.org/patch")
.setBody("花果山水帘洞美猴王齐天大圣孙悟空")
.bind(root)
.go(callable)
}
}
@ -184,6 +195,7 @@ FluContentPage{
.add("name","孙悟空")
.add("age",500)
.add("address","花果山水帘洞")
.bind(root)
.go(callable)
}
}
@ -197,6 +209,7 @@ FluContentPage{
.add("name","孙悟空")
.add("age",500)
.add("address","花果山水帘洞")
.bind(root)
.go(callable)
}
}
@ -210,6 +223,7 @@ FluContentPage{
.add("name","孙悟空")
.add("age",500)
.add("address","花果山水帘洞")
.bind(root)
.go(callable)
}
}
@ -221,6 +235,7 @@ FluContentPage{
text_info.text = ""
FluNetwork.deleteBody("https://httpbingo.org/delete")
.setBody("花果山水帘洞美猴王齐天大圣孙悟空")
.bind(root)
.go(callable)
}
}
@ -234,6 +249,7 @@ FluContentPage{
.add("name","孙悟空")
.add("age",500)
.add("address","花果山水帘洞")
.bind(root)
.go(callable)
}
}
@ -247,6 +263,7 @@ FluContentPage{
.add("name","孙悟空")
.add("age",500)
.add("address","花果山水帘洞")
.bind(root)
.go(callable)
}
}
@ -260,6 +277,7 @@ FluContentPage{
.add("name","孙悟空")
.add("age",500)
.add("address","花果山水帘洞")
.bind(root)
.go(callable)
}
}
@ -275,6 +293,7 @@ FluContentPage{
.add("name","孙悟空")
.add("age",500)
.add("address","花果山水帘洞")
.bind(root)
.go(callable)
}
}
@ -290,6 +309,7 @@ FluContentPage{
.add("age",500)
.add("address","花果山水帘洞")
.add("cacheMode","RequestFailedReadCache")
.bind(root)
.go(callable)
}
}
@ -305,6 +325,7 @@ FluContentPage{
.add("age",500)
.add("address","花果山水帘洞")
.add("cacheMode","IfNoneCacheRequest")
.bind(root)
.go(callable)
}
}
@ -320,6 +341,7 @@ FluContentPage{
.add("age",500)
.add("address","花果山水帘洞")
.add("cacheMode","FirstCacheThenRequest")
.bind(root)
.go(callable)
}
}
@ -337,6 +359,7 @@ FluContentPage{
.add("address","花果山水帘洞")
.add("timeout","5000")
.add("retry","3")
.bind(root)
.go(callable)
}
}
@ -355,7 +378,26 @@ FluContentPage{
implicitHeight: 36
text: "Download File"
onClicked: {
folder_dialog.open()
folder_dialog.showDialog(function(path){
FluNetwork.get("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4")
.toDownload(path)
.bind(root)
.go(callable_download_file)
})
}
}
FluProgressButton{
id:btn_download_breakpoint
implicitWidth: parent.width
implicitHeight: 36
text: "Breakpoint Download File"
onClicked: {
folder_dialog.showDialog(function(path){
FluNetwork.get("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4")
.toDownload(path,true)
.bind(root)
.go(callable_breakpoint_download_file)
})
}
}
}
@ -410,6 +452,31 @@ FluContentPage{
}
}
FluNetworkCallable{
id:callable_breakpoint_download_file
onStart: {
btn_download_breakpoint.progress = 0
btn_download_breakpoint.disabled = true
}
onFinish: {
btn_download_breakpoint.disabled = false
}
onError:
(status,errorString,result)=>{
btn_download_breakpoint.progress = 0
showError(errorString)
console.debug(status+";"+errorString+";"+result)
}
onSuccess:
(result)=>{
showSuccess(result)
}
onDownloadProgress:
(recv,total)=>{
btn_download_breakpoint.progress = recv/total
}
}
FileDialog {
id: file_dialog
onAccepted: {
@ -417,18 +484,23 @@ FluContentPage{
.setRetry(0)//请求失败后不重复请求
.add("accessToken","12345678")
.addFile("file",FluTools.toLocalPath(file_dialog.selectedFile))
.bind(root)
.go(callable_upload_file)
}
}
FileDialog {
property var onSelectListener
id: folder_dialog
folder: StandardPaths.standardLocations(StandardPaths.DownloadLocation)[0]
currentFile: StandardPaths.standardLocations(StandardPaths.DownloadLocation)[0]+"/big_buck_bunny.mp4"
fileMode: FileDialog.SaveFile
onAccepted: {
FluNetwork.get("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4")
.toDownload(FluTools.toLocalPath(folder_dialog.currentFile))
.go(callable_download_file)
folder_dialog.onSelectListener(FluTools.toLocalPath(folder_dialog.currentFile))
}
function showDialog(listener){
folder_dialog.onSelectListener = listener
folder_dialog.open()
}
}