fix: debug with type error checks

This commit is contained in:
pa
2025-07-16 14:23:06 +09:00
committed by Natsumi
parent 0e50a67c25
commit b23687430e
13 changed files with 217 additions and 194 deletions

View File

@@ -77,7 +77,8 @@
base64SignatureFile: '',
signatureMd5: '',
fileId: '',
avatarId: ''
avatarId: '',
worldId: ''
});
function uploadWorldImage() {
@@ -114,8 +115,9 @@
function onFileChangeWorldImage(e) {
const clearFile = function () {
if (document.querySelector('#WorldImageUploadButton')) {
document.querySelector('#WorldImageUploadButton').value = '';
const fileInput = /** @type {HTMLInputElement} */ (document.querySelector('#WorldImageUploadButton'));
if (fileInput) {
fileInput.value = '';
}
};
const files = e.target.files || e.dataTransfer.files;
@@ -144,10 +146,10 @@
const r = new FileReader();
r.onload = async function (file) {
try {
const base64File = await resizeImageToFitLimits(btoa(r.result));
const base64File = await resizeImageToFitLimits(btoa(r.result.toString()));
// 10MB
const fileMd5 = await genMd5(base64File);
const fileSizeInBytes = parseInt(file.total, 10);
const fileSizeInBytes = parseInt(file.total.toString(), 10);
const base64SignatureFile = await genSig(base64File);
const signatureMd5 = await genMd5(base64SignatureFile);
const signatureSizeInBytes = parseInt(await genLength(base64SignatureFile), 10);
@@ -168,7 +170,8 @@
base64SignatureFile,
signatureMd5,
fileId,
worldId
worldId,
...worldImage.value
};
const params = {
fileMd5,
@@ -231,7 +234,7 @@
if (json.status !== 200) {
changeWorldImageDialogLoading.value = false;
$throw('World image upload failed', json, params.url);
$throw(json.status, 'World image upload failed', params.url);
}
const args = {
json,
@@ -284,7 +287,7 @@
if (json.status !== 200) {
changeWorldImageDialogLoading.value = false;
$throw('World image upload failed', json, params.url);
$throw(json.status, 'World image upload failed', params.url);
}
const args = {
json,

View File

@@ -73,7 +73,7 @@
</el-checkbox>
<template #footer>
<div style="display: flex">
<el-button size="small" @click="setWorldTagsDialog.visible = false">
<el-button size="small" @click="isVisible = false">
{{ t('dialog.set_world_tags.cancel') }}
</el-button>
<el-button type="primary" size="small" @click="saveSetWorldTagsDialog">
@@ -168,13 +168,13 @@
const authorTags = [];
const contentTags = [];
props.oldTags.forEach((tag) => {
if (tag.startsWith('author_tag_')) {
authorTags.unshift(tag.substring(11));
if (String(tag).startsWith('author_tag_')) {
authorTags.unshift(String(tag).substring(11));
}
if (tag.startsWith('content_')) {
contentTags.unshift(tag.substring(8));
if (String(tag).startsWith('content_')) {
contentTags.unshift(String(tag).substring(8));
}
switch (tag) {
switch (String(tag)) {
case 'content_horror':
D.contentHorror = true;
break;

View File

@@ -723,10 +723,10 @@
style="margin-left: 5px"
@click="downloadAndSaveJson(worldDialog.id, worldDialog.ref)"></el-button>
<el-tree :data="treeData" style="margin-top: 5px; font-size: 12px">
<template slot-scope="scope">
<template #default="{ data }">
<span>
<span style="font-weight: bold; margin-right: 5px" v-text="scope.data.key"></span>
<span v-if="!scope.data.children" v-text="scope.data.value"></span>
<span style="font-weight: bold; margin-right: 5px" v-text="data.key"></span>
<span v-if="!data.children" v-text="data.value"></span>
</span>
</template>
</el-tree>
@@ -856,7 +856,8 @@
const timeInLab = computed(() => {
return timeToText(
new Date(worldDialog.value.ref.publicationDate) - new Date(worldDialog.value.ref.labsPublicationDate)
new Date(worldDialog.value.ref.publicationDate).getTime() -
new Date(worldDialog.value.ref.labsPublicationDate).getTime()
);
});
@@ -1194,7 +1195,7 @@
worldRequest
.saveWorld({
id: world.id,
capacity: instance.inputValue
capacity: Number(instance.inputValue)
})
.then((args) => {
proxy.$message({
@@ -1224,7 +1225,7 @@
worldRequest
.saveWorld({
id: world.id,
recommendedCapacity: instance.inputValue
recommendedCapacity: Number(instance.inputValue)
})
.then((args) => {
proxy.$message({