This commit is contained in:
朱子楚\zhuzi
2023-09-08 00:21:28 +08:00
parent c92d807ec1
commit 573898149a
14 changed files with 266 additions and 490 deletions

View File

@ -397,7 +397,7 @@ FluObject{
onTap:{ navigationView.push(url) }
}
FluPaneItem{
title:"Screenshot"
title:"Screenshot(Todo)"
url:"qrc:/example/qml/page/T_Screenshot.qml"
onDropped:{ FluApp.navigate("/pageWindow",{title:title,url:url}) }
onTap:{ navigationView.push(url) }

View File

@ -56,7 +56,6 @@ FluContentPage{
onSuccess:
(result)=>{
text_info.text = result
console.debug(result)
}
onCache:
(result)=>{
@ -86,7 +85,8 @@ FluContentPage{
implicitHeight: 36
text: "Get请求"
onClicked: {
http.get("https://httpbingo.org/get",callable)
var request = http.newRequest("https://httpbingo.org/get")
http.get(request,callable)
}
}
FluButton{
@ -94,11 +94,13 @@ FluContentPage{
implicitHeight: 36
text: "Post表单请求"
onClicked: {
var param = {}
param.custname = "朱子楚"
param.custtel = "1234567890"
param.custemail = "zhuzichu520@gmail.com"
http.post("https://httpbingo.org/post",callable,param)
var request = http.newRequest("https://httpbingo.org/post")
var params = {}
params.custname = "朱子楚"
params.custtel = "1234567890"
params.custemail = "zhuzichu520@gmail.com"
request.params = params
http.post(request,callable)
}
}
FluButton{
@ -106,11 +108,13 @@ FluContentPage{
implicitHeight: 36
text: "Post Json请求"
onClicked: {
var param = {}
param.custname = "朱子楚"
param.custtel = "1234567890"
param.custemail = "zhuzichu520@gmail.com"
http.postJson("https://httpbingo.org/post",callable,param)
var request = http.newRequest("https://httpbingo.org/post")
var params = {}
params.custname = "朱子楚"
params.custtel = "1234567890"
params.custemail = "zhuzichu520@gmail.com"
request.params = params
http.postJson(request,callable)
}
}
FluButton{
@ -118,8 +122,9 @@ FluContentPage{
implicitHeight: 36
text: "Post String请求"
onClicked: {
var param = "我命由我不由天"
http.postString("https://httpbingo.org/post",callable,param)
var request = http.newRequest("https://httpbingo.org/post")
request.params = "我命由我不由天"
http.postString(request,callable)
}
}
FluProgressButton{
@ -133,8 +138,6 @@ FluContentPage{
}
FluProgressButton{
property bool downloading: false
property string saveFilePath: FluTools.getApplicationDirPath()+ "/download/big_buck_bunny.mp4"
property string resourcePath: "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
id:btn_breakpoint_download
implicitWidth: parent.width
implicitHeight: 36
@ -150,6 +153,11 @@ FluContentPage{
return "继续下载"
}
}
HttpRequest{
id:request_breakpoint_download
url: "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
downloadSavePath: FluTools.getApplicationDirPath()+ "/download/big_buck_bunny.mp4"
}
HttpCallable{
id:callable_breakpoint_download
onStart: {
@ -172,7 +180,7 @@ FluContentPage{
}
}
Component.onCompleted: {
progress = http_breakpoint_download.breakPointDownloadProgress(resourcePath,saveFilePath)
progress = http_breakpoint_download.getBreakPointProgress(request_breakpoint_download)
}
onClicked: {
if(downloading){
@ -180,9 +188,9 @@ FluContentPage{
return
}
if(progress === 1){
FluTools.showFileInFolder(saveFilePath)
FluTools.showFileInFolder(request_breakpoint_download.downloadSavePath)
}else{
http_breakpoint_download.download(resourcePath,callable_breakpoint_download,saveFilePath)
http_breakpoint_download.download(request_breakpoint_download,callable_breakpoint_download)
}
}
FluMenu{
@ -191,7 +199,7 @@ FluContentPage{
FluMenuItem{
text: "删除文件"
onClicked: {
if(FluTools.removeFile(btn_breakpoint_download.saveFilePath)){
if(FluTools.removeFile(request_breakpoint_download.downloadSavePath)){
btn_breakpoint_download.progress = 0
}
}
@ -221,9 +229,9 @@ FluContentPage{
implicitHeight: 36
text: "FirstCacheThenRequest缓存"
onClicked: {
var param = {}
param.cacheMode = "FirstCacheThenRequest"
http_cache_firstcachethenrequest.post("https://httpbingo.org/post",callable,param)
var request = http.newRequest("https://httpbingo.org/post")
request.params = {cacheMode:"FirstCacheThenRequest"}
http_cache_firstcachethenrequest.post(request,callable)
}
}
FluButton{
@ -231,9 +239,9 @@ FluContentPage{
implicitHeight: 36
text: "RequestFailedReadCache缓存"
onClicked: {
var param = {}
param.cacheMode = "RequestFailedReadCache"
http_cache_requestfailedreadcache.post("https://httpbingo.org/post",callable,param)
var request = http.newRequest("https://httpbingo.org/post")
request.params = {cacheMode:"RequestFailedReadCache"}
http_cache_requestfailedreadcache.post(request,callable)
}
}
@ -242,9 +250,9 @@ FluContentPage{
implicitHeight: 36
text: "IfNoneCacheRequest缓存"
onClicked: {
var param = {}
param.cacheMode = "IfNoneCacheRequest"
http_cache_ifnonecacherequest.post("https://httpbingo.org/post",callable,param)
var request = http.newRequest("https://httpbingo.org/post")
request.params = {cacheMode:"IfNoneCacheRequest"}
http_cache_ifnonecacherequest.post(request,callable)
}
}
FluButton{
@ -300,14 +308,16 @@ FluContentPage{
FileDialog {
id: file_dialog
onAccepted: {
var param = {}
var request = http.newRequest("https://httpbingo.org/post")
var params = {}
for(var i=0;i<selectedFiles.length;i++){
var fileUrl = selectedFiles[i]
var fileName = FluTools.getFileNameByUrl(fileUrl)
var filePath = FluTools.toLocalPath(fileUrl)
param[fileName] = filePath
params[fileName] = filePath
}
http.upload("https://httpbingo.org/post",callable_upload,param)
request.params = params
http.upload(request,callable_upload)
}
}
@ -339,11 +349,11 @@ FluContentPage{
id: folder_dialog
currentFolder: StandardPaths.standardLocations(StandardPaths.DownloadLocation)[0]
onAccepted: {
var path = FluTools.toLocalPath(currentFolder)+ "/big_buck_bunny.mp4"
http.download("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4",callable_download,path)
var request = http.newRequest("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4")
request.downloadSavePath = FluTools.toLocalPath(currentFolder)+ "/big_buck_bunny.mp4"
http.download(request,callable_download)
}
}
FluArea{
anchors{
top: layout_flick.top

View File

@ -334,21 +334,9 @@ CustomWindow {
}
}
// HttpRequest{
// id:reuqest
// url: "https://api.github.com/repos/zhuzichu520/FluentUI/releases/latest"
// }
function checkUpdate(){
var request = http.newRequest()
console.debug("-------------------->"+request)
request.url = "https://api.github.com/repos/zhuzichu520/FluentUI/releases/latest"
console.debug("-------------------->"+request.url)
http.get2(request,callable);
// http.get("https://api.github.com/repos/zhuzichu520/FluentUI/releases/latest",callable)
var request = http.newRequest("https://api.github.com/repos/zhuzichu520/FluentUI/releases/latest")
http.get(request,callable);
}
}