将数据恢复,底图上传,查看底图,升级的http转化
This commit is contained in:
parent
71abf1bba2
commit
e68eb4c8d6
|
@ -47,7 +47,6 @@
|
|||
ref="uploader"
|
||||
:url="upload_url"
|
||||
method="post"
|
||||
:headers="generatorFileUploadHeaders"
|
||||
:label="$t('select background image') + ':'"
|
||||
:accept="$store.state.isSpecialVideo() ? '.svdoj' : 'image/*'"
|
||||
:hide-upload-btn="true"
|
||||
|
@ -56,6 +55,7 @@
|
|||
@added="(files) => files && (file_count += files.length)"
|
||||
@removed="(files) => files && (file_count -= files.length)"
|
||||
/>
|
||||
<!-- :headers="generatorFileUploadHeaders" -->
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
|
@ -70,7 +70,7 @@
|
|||
no-caps
|
||||
:loading="loading"
|
||||
color="primary"
|
||||
@click="showBackgroundImage"
|
||||
@click="showBackgroundImage()"
|
||||
:label="$t('view current background image')"
|
||||
/>
|
||||
<q-space />
|
||||
|
@ -131,35 +131,11 @@ export default defineComponent({
|
|||
loga(a: any) {
|
||||
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() {
|
||||
show_dialog.value = true;
|
||||
let client = GlobalData.getInstance().getCurrentClient();
|
||||
if (client) {
|
||||
let url = new URL(client.url);
|
||||
url.port =
|
||||
GlobalData.getInstance().applicationConfig?.httpserver_port ??
|
||||
HttpProtocol.DefaultHttpPort.toString();
|
||||
url.pathname = HttpProtocol.RequestUploadFile;
|
||||
url.protocol = "http:";
|
||||
url.searchParams.append(
|
||||
"type",
|
||||
HttpProtocol.UploadTypeBackgroundImage
|
||||
);
|
||||
let url = GlobalData.getInstance().createCurrentRequestUrl();
|
||||
if (url) {
|
||||
url.pathname = "/upload_background_image_file";
|
||||
upload_url.value = url.toString();
|
||||
}
|
||||
},
|
||||
|
@ -169,30 +145,24 @@ export default defineComponent({
|
|||
file_count.value = 0;
|
||||
},
|
||||
showBackgroundImage() {
|
||||
const temp_port =
|
||||
GlobalData.getInstance().applicationConfig?.httpserver_port ??
|
||||
HttpProtocol.DefaultHttpPort.toString();
|
||||
try {
|
||||
const url = new URL(
|
||||
GlobalData.getInstance().getCurrentClient()?.url ??
|
||||
"http://127.0.0.1:" + temp_port
|
||||
);
|
||||
url.protocol = "http";
|
||||
url.port = temp_port.toString();
|
||||
url.pathname = "/static/background_image.png";
|
||||
viewerApi({
|
||||
options: {
|
||||
toolbar: true,
|
||||
url: "data-source",
|
||||
initialViewIndex: 0,
|
||||
},
|
||||
images: [
|
||||
{
|
||||
src: url.toString(),
|
||||
"data-source": url.toString(),
|
||||
let url = GlobalData.getInstance().createCurrentRequestUrl();
|
||||
if (url) {
|
||||
url.pathname = "/get_background_image_file";
|
||||
viewerApi({
|
||||
options: {
|
||||
toolbar: true,
|
||||
url: "data-source",
|
||||
initialViewIndex: 0,
|
||||
},
|
||||
],
|
||||
});
|
||||
images: [
|
||||
{
|
||||
src: url.toString(),
|
||||
"data-source": url.toString(),
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
} catch {}
|
||||
},
|
||||
async onSubmit() {
|
||||
|
|
|
@ -1065,12 +1065,13 @@ export default defineComponent({
|
|||
setTimeout(() => {
|
||||
if (files.value.length != file_list.files.length) {
|
||||
$q.notify({
|
||||
type: "warning",
|
||||
message: $t.t("file upload") + $t.t("fail") + "!",
|
||||
type: "positive",
|
||||
message: $t.t("file upload") + $t.t("finish") + "!",
|
||||
position: "top",
|
||||
timeout: 1500,
|
||||
});
|
||||
loading.value = false;
|
||||
uploading.value=false;
|
||||
}
|
||||
}, 500);
|
||||
},
|
||||
|
|
|
@ -47,8 +47,7 @@
|
|||
class="full-width"
|
||||
ref="uploader"
|
||||
:url="upload_url"
|
||||
method="post"
|
||||
:headers="generatorFileUploadHeaders"
|
||||
method="POST"
|
||||
:label="$t('select data(DBP) file') + ':'"
|
||||
accept=".dbp"
|
||||
:hide-upload-btn="true"
|
||||
|
@ -119,32 +118,11 @@ export default defineComponent({
|
|||
upload_url,
|
||||
uploader,
|
||||
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() {
|
||||
show_dialog.value = true;
|
||||
let client = GlobalData.getInstance().getCurrentClient();
|
||||
if (client) {
|
||||
let url = new URL(client.url);
|
||||
url.port =
|
||||
GlobalData.getInstance().applicationConfig?.httpserver_port ??
|
||||
HttpProtocol.DefaultHttpPort.toString();
|
||||
url.pathname = HttpProtocol.RequestUploadFile;
|
||||
url.protocol = "http:";
|
||||
url.searchParams.append("type", HttpProtocol.UploadTypeDatabase);
|
||||
let url = GlobalData.getInstance().createCurrentRequestUrl();
|
||||
if (url) {
|
||||
url.pathname = "/upload_db_file";
|
||||
upload_url.value = url.toString();
|
||||
}
|
||||
},
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
ref="uploader_software"
|
||||
:url="upload_url_software"
|
||||
method="post"
|
||||
:headers="generatorFileUploadHeaders"
|
||||
:label="$t('select software upgrade file') + ':'"
|
||||
accept=".zip,.tar,.tar.gz"
|
||||
:hide-upload-btn="true"
|
||||
|
@ -76,7 +75,6 @@
|
|||
ref="uploader_rootfs"
|
||||
:url="upload_url_rootfs"
|
||||
method="post"
|
||||
:headers="generatorFileUploadHeaders"
|
||||
:label="$t('select rootfs upgrade file') + ':'"
|
||||
accept=".img"
|
||||
:hide-upload-btn="true"
|
||||
|
@ -85,6 +83,7 @@
|
|||
@added="(files) => files && (file_count += files.length)"
|
||||
@removed="(files) => files && (file_count -= files.length)"
|
||||
/>
|
||||
<!-- :headers="generatorFileUploadHeaders" -->
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
|
@ -92,9 +91,7 @@
|
|||
|
||||
<q-separator />
|
||||
|
||||
<q-card-actions>
|
||||
<q-item-section>V: {{ server_version }}</q-item-section>
|
||||
<q-space />
|
||||
<q-card-actions align="right">
|
||||
<q-btn
|
||||
:loading="loading"
|
||||
flat
|
||||
|
@ -146,7 +143,6 @@ export default defineComponent({
|
|||
|
||||
let select_options = [$t.t("software"), $t.t("rootfs")];
|
||||
let upgrade_type = ref($t.t("software"));
|
||||
const server_version = ref("unknow");
|
||||
|
||||
return {
|
||||
show_dialog,
|
||||
|
@ -158,49 +154,18 @@ export default defineComponent({
|
|||
file_count,
|
||||
upgrade_type,
|
||||
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) {
|
||||
console.log(a);
|
||||
},
|
||||
showDialog() {
|
||||
show_dialog.value = true;
|
||||
|
||||
let client = GlobalData.getInstance().getCurrentClient();
|
||||
if (client) {
|
||||
let url = new URL(client.url);
|
||||
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);
|
||||
let url = GlobalData.getInstance().createCurrentRequestUrl();
|
||||
if (url) {
|
||||
url.pathname = "/upload_soft_file";
|
||||
upload_url_software.value = url.toString();
|
||||
try {
|
||||
client?.getBuildInfo()?.then((build_info) => {
|
||||
if (build_info) {
|
||||
server_version.value = build_info.version;
|
||||
}
|
||||
});
|
||||
// console.log(build_info);
|
||||
} catch {}
|
||||
url.pathname = "/upload_root_fs_file";
|
||||
upload_url_rootfs.value = url.toString();
|
||||
}
|
||||
},
|
||||
resetData() {
|
||||
|
|
|
@ -294,6 +294,7 @@ export default {
|
|||
"open left tool bar": "Open Left Tool Bar",
|
||||
"open right tool bar": "Open Right Tool Bar",
|
||||
fail: " Fail",
|
||||
finish:"Finish",
|
||||
"edit group": "Edit Group",
|
||||
"open window": "Open Window",
|
||||
"close all windows": "Close All Windows",
|
||||
|
|
|
@ -5,6 +5,7 @@ export default {
|
|||
" ": "",
|
||||
title: "MediaPlayerWebApp",
|
||||
failed: "失败",
|
||||
finish:"完成",
|
||||
fail: "失败",
|
||||
error: "错误",
|
||||
Confirm: "确认",
|
||||
|
|
Loading…
Reference in New Issue