将数据恢复,底图上传,查看底图,升级的http转化

This commit is contained in:
miao 2023-02-15 11:36:19 +08:00 committed by fangxiang
parent 71abf1bba2
commit e68eb4c8d6
6 changed files with 463 additions and 547 deletions

View File

@ -47,7 +47,6 @@
ref="uploader" ref="uploader"
:url="upload_url" :url="upload_url"
method="post" method="post"
:headers="generatorFileUploadHeaders"
:label="$t('select background image') + ':'" :label="$t('select background image') + ':'"
:accept="$store.state.isSpecialVideo() ? '.svdoj' : 'image/*'" :accept="$store.state.isSpecialVideo() ? '.svdoj' : 'image/*'"
:hide-upload-btn="true" :hide-upload-btn="true"
@ -56,6 +55,7 @@
@added="(files) => files && (file_count += files.length)" @added="(files) => files && (file_count += files.length)"
@removed="(files) => files && (file_count -= files.length)" @removed="(files) => files && (file_count -= files.length)"
/> />
<!-- :headers="generatorFileUploadHeaders" -->
</q-item-section> </q-item-section>
</q-item> </q-item>
</q-list> </q-list>
@ -70,7 +70,7 @@
no-caps no-caps
:loading="loading" :loading="loading"
color="primary" color="primary"
@click="showBackgroundImage" @click="showBackgroundImage()"
:label="$t('view current background image')" :label="$t('view current background image')"
/> />
<q-space /> <q-space />
@ -131,35 +131,11 @@ export default defineComponent({
loga(a: any) { loga(a: any) {
console.log(a); console.log(a);
}, },
generatorFileUploadHeaders(files: File[]) {
if (files.length > 0) {
return [
{
name: HttpProtocol.kHeaderXProductName,
value: HttpProtocol.getProductName($store),
},
{
name: HttpProtocol.kHeaderXFileLength,
value: files[0].size,
},
];
}
return [];
},
showDialog() { showDialog() {
show_dialog.value = true; show_dialog.value = true;
let client = GlobalData.getInstance().getCurrentClient(); let url = GlobalData.getInstance().createCurrentRequestUrl();
if (client) { if (url) {
let url = new URL(client.url); url.pathname = "/upload_background_image_file";
url.port =
GlobalData.getInstance().applicationConfig?.httpserver_port ??
HttpProtocol.DefaultHttpPort.toString();
url.pathname = HttpProtocol.RequestUploadFile;
url.protocol = "http:";
url.searchParams.append(
"type",
HttpProtocol.UploadTypeBackgroundImage
);
upload_url.value = url.toString(); upload_url.value = url.toString();
} }
}, },
@ -169,30 +145,24 @@ export default defineComponent({
file_count.value = 0; file_count.value = 0;
}, },
showBackgroundImage() { showBackgroundImage() {
const temp_port =
GlobalData.getInstance().applicationConfig?.httpserver_port ??
HttpProtocol.DefaultHttpPort.toString();
try { try {
const url = new URL( let url = GlobalData.getInstance().createCurrentRequestUrl();
GlobalData.getInstance().getCurrentClient()?.url ?? if (url) {
"http://127.0.0.1:" + temp_port url.pathname = "/get_background_image_file";
); viewerApi({
url.protocol = "http"; options: {
url.port = temp_port.toString(); toolbar: true,
url.pathname = "/static/background_image.png"; url: "data-source",
viewerApi({ initialViewIndex: 0,
options: {
toolbar: true,
url: "data-source",
initialViewIndex: 0,
},
images: [
{
src: url.toString(),
"data-source": url.toString(),
}, },
], images: [
}); {
src: url.toString(),
"data-source": url.toString(),
},
],
});
}
} catch {} } catch {}
}, },
async onSubmit() { async onSubmit() {

View File

@ -1065,12 +1065,13 @@ export default defineComponent({
setTimeout(() => { setTimeout(() => {
if (files.value.length != file_list.files.length) { if (files.value.length != file_list.files.length) {
$q.notify({ $q.notify({
type: "warning", type: "positive",
message: $t.t("file upload") + $t.t("fail") + "!", message: $t.t("file upload") + $t.t("finish") + "!",
position: "top", position: "top",
timeout: 1500, timeout: 1500,
}); });
loading.value = false; loading.value = false;
uploading.value=false;
} }
}, 500); }, 500);
}, },

View File

@ -47,8 +47,7 @@
class="full-width" class="full-width"
ref="uploader" ref="uploader"
:url="upload_url" :url="upload_url"
method="post" method="POST"
:headers="generatorFileUploadHeaders"
:label="$t('select data(DBP) file') + ':'" :label="$t('select data(DBP) file') + ':'"
accept=".dbp" accept=".dbp"
:hide-upload-btn="true" :hide-upload-btn="true"
@ -119,32 +118,11 @@ export default defineComponent({
upload_url, upload_url,
uploader, uploader,
file_count, file_count,
generatorFileUploadHeaders(files: File[]) {
if (files.length > 0) {
return [
{
name: HttpProtocol.kHeaderXProductName,
value: HttpProtocol.getProductName($store),
},
{
name: HttpProtocol.kHeaderXFileLength,
value: files[0].size,
},
];
}
return [];
},
showDialog() { showDialog() {
show_dialog.value = true; show_dialog.value = true;
let client = GlobalData.getInstance().getCurrentClient(); let url = GlobalData.getInstance().createCurrentRequestUrl();
if (client) { if (url) {
let url = new URL(client.url); url.pathname = "/upload_db_file";
url.port =
GlobalData.getInstance().applicationConfig?.httpserver_port ??
HttpProtocol.DefaultHttpPort.toString();
url.pathname = HttpProtocol.RequestUploadFile;
url.protocol = "http:";
url.searchParams.append("type", HttpProtocol.UploadTypeDatabase);
upload_url.value = url.toString(); upload_url.value = url.toString();
} }
}, },

View File

@ -61,7 +61,6 @@
ref="uploader_software" ref="uploader_software"
:url="upload_url_software" :url="upload_url_software"
method="post" method="post"
:headers="generatorFileUploadHeaders"
:label="$t('select software upgrade file') + ':'" :label="$t('select software upgrade file') + ':'"
accept=".zip,.tar,.tar.gz" accept=".zip,.tar,.tar.gz"
:hide-upload-btn="true" :hide-upload-btn="true"
@ -76,7 +75,6 @@
ref="uploader_rootfs" ref="uploader_rootfs"
:url="upload_url_rootfs" :url="upload_url_rootfs"
method="post" method="post"
:headers="generatorFileUploadHeaders"
:label="$t('select rootfs upgrade file') + ':'" :label="$t('select rootfs upgrade file') + ':'"
accept=".img" accept=".img"
:hide-upload-btn="true" :hide-upload-btn="true"
@ -85,6 +83,7 @@
@added="(files) => files && (file_count += files.length)" @added="(files) => files && (file_count += files.length)"
@removed="(files) => files && (file_count -= files.length)" @removed="(files) => files && (file_count -= files.length)"
/> />
<!-- :headers="generatorFileUploadHeaders" -->
</q-item-section> </q-item-section>
</q-item> </q-item>
</q-list> </q-list>
@ -92,9 +91,7 @@
<q-separator /> <q-separator />
<q-card-actions> <q-card-actions align="right">
<q-item-section>V: {{ server_version }}</q-item-section>
<q-space />
<q-btn <q-btn
:loading="loading" :loading="loading"
flat flat
@ -146,7 +143,6 @@ export default defineComponent({
let select_options = [$t.t("software"), $t.t("rootfs")]; let select_options = [$t.t("software"), $t.t("rootfs")];
let upgrade_type = ref($t.t("software")); let upgrade_type = ref($t.t("software"));
const server_version = ref("unknow");
return { return {
show_dialog, show_dialog,
@ -158,49 +154,18 @@ export default defineComponent({
file_count, file_count,
upgrade_type, upgrade_type,
select_options, select_options,
server_version,
generatorFileUploadHeaders(files: File[]) {
if (files.length > 0) {
return [
{
name: HttpProtocol.kHeaderXProductName,
value: HttpProtocol.getProductName($store),
},
{
name: HttpProtocol.kHeaderXFileLength,
value: files[0].size,
},
];
}
return [];
},
loga(a: any) { loga(a: any) {
console.log(a); console.log(a);
}, },
showDialog() { showDialog() {
show_dialog.value = true; show_dialog.value = true;
let client = GlobalData.getInstance().getCurrentClient(); let url = GlobalData.getInstance().createCurrentRequestUrl();
if (client) { if (url) {
let url = new URL(client.url); url.pathname = "/upload_soft_file";
url.port =
GlobalData.getInstance().applicationConfig?.httpserver_port ??
HttpProtocol.DefaultHttpPort.toString();
url.pathname = HttpProtocol.RequestUploadFile;
url.protocol = "http:";
url.searchParams.append("type", HttpProtocol.UploadTypeRootFS);
upload_url_rootfs.value = url.toString();
url.searchParams.set("type", HttpProtocol.UploadTypeSoftware);
upload_url_software.value = url.toString(); upload_url_software.value = url.toString();
try { url.pathname = "/upload_root_fs_file";
client?.getBuildInfo()?.then((build_info) => { upload_url_rootfs.value = url.toString();
if (build_info) {
server_version.value = build_info.version;
}
});
// console.log(build_info);
} catch {}
} }
}, },
resetData() { resetData() {

View File

@ -294,6 +294,7 @@ export default {
"open left tool bar": "Open Left Tool Bar", "open left tool bar": "Open Left Tool Bar",
"open right tool bar": "Open Right Tool Bar", "open right tool bar": "Open Right Tool Bar",
fail: " Fail", fail: " Fail",
finish:"Finish",
"edit group": "Edit Group", "edit group": "Edit Group",
"open window": "Open Window", "open window": "Open Window",
"close all windows": "Close All Windows", "close all windows": "Close All Windows",

View File

@ -5,6 +5,7 @@ export default {
" ": "", " ": "",
title: "MediaPlayerWebApp", title: "MediaPlayerWebApp",
failed: "失败", failed: "失败",
finish:"完成",
fail: "失败", fail: "失败",
error: "错误", error: "错误",
Confirm: "确认", Confirm: "确认",