mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-15 09:48:14 +08:00
🐛 修复分享图生成错误
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, onUpdated, reactive } from "vue";
|
import { onMounted, onUpdated, ref } from "vue";
|
||||||
|
|
||||||
import { saveImgLocal } from "../../utils/TGShare";
|
import { saveImgLocal } from "../../utils/TGShare";
|
||||||
|
|
||||||
@@ -23,21 +23,23 @@ interface DucDetailOlbProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<DucDetailOlbProps>();
|
const props = defineProps<DucDetailOlbProps>();
|
||||||
let constellations = reactive<TGApp.Sqlite.Character.RoleConstellation[]>([]);
|
const constellations = ref<TGApp.Sqlite.Character.RoleConstellation[]>([]);
|
||||||
|
|
||||||
function loadData() {
|
async function loadData() {
|
||||||
constellations = props.modelValue;
|
const tempConstellations = props.modelValue;
|
||||||
constellations.map(
|
for (const constellation of tempConstellations) {
|
||||||
async (constellation) => (constellation.icon = await saveImgLocal(constellation.icon)),
|
if (constellation.icon.startsWith("blob:")) return;
|
||||||
);
|
constellation.icon = await saveImgLocal(constellation.icon);
|
||||||
|
}
|
||||||
|
constellations.value = tempConstellations;
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
loadData();
|
await loadData();
|
||||||
});
|
});
|
||||||
|
|
||||||
onUpdated(() => {
|
onUpdated(async () => {
|
||||||
loadData();
|
await loadData();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ const getTitle = computed(() => {
|
|||||||
if (props.mode === "avatar") {
|
if (props.mode === "avatar") {
|
||||||
return `${props.data.name}`;
|
return `${props.data.name}`;
|
||||||
} else {
|
} else {
|
||||||
// 按照长度折行,一行最多显示 10 个字
|
|
||||||
const descriptionList = props.data.description.split("");
|
const descriptionList = props.data.description.split("");
|
||||||
return descriptionList.reduce((prev: string, cur: string, index: number) => {
|
return descriptionList.reduce((prev: string, cur: string, index: number) => {
|
||||||
if (index % 10 === 0) {
|
if (index % 10 === 0) {
|
||||||
@@ -41,7 +40,7 @@ const getTitle = computed(() => {
|
|||||||
}, "");
|
}, "");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const boxData = computed(() => {
|
const boxData = computed<TItemBoxData>(() => {
|
||||||
if (props.mode === "avatar") {
|
if (props.mode === "avatar") {
|
||||||
return {
|
return {
|
||||||
bg: `/icon/bg/${props.data.star}-Star.webp`,
|
bg: `/icon/bg/${props.data.star}-Star.webp`,
|
||||||
@@ -51,6 +50,7 @@ const boxData = computed(() => {
|
|||||||
display: "inner",
|
display: "inner",
|
||||||
innerHeight: 0,
|
innerHeight: 0,
|
||||||
innerText: "",
|
innerText: "",
|
||||||
|
clickable: false,
|
||||||
lt: `/icon/element/${props.data.element}.webp`,
|
lt: `/icon/element/${props.data.element}.webp`,
|
||||||
ltSize: "30px",
|
ltSize: "30px",
|
||||||
};
|
};
|
||||||
@@ -63,6 +63,7 @@ const boxData = computed(() => {
|
|||||||
display: "inner",
|
display: "inner",
|
||||||
innerHeight: 0,
|
innerHeight: 0,
|
||||||
innerText: "",
|
innerText: "",
|
||||||
|
clickable: false,
|
||||||
lt: `/icon/weapon/${props.data.type}.webp`,
|
lt: `/icon/weapon/${props.data.type}.webp`,
|
||||||
ltSize: "30px",
|
ltSize: "30px",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, onUpdated, reactive } from "vue";
|
import { onMounted, onUpdated, ref } from "vue";
|
||||||
|
|
||||||
import { saveImgLocal } from "../../utils/TGShare";
|
import { saveImgLocal } from "../../utils/TGShare";
|
||||||
|
|
||||||
@@ -17,13 +17,15 @@ interface DucDetailOrtProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<DucDetailOrtProps>();
|
const props = defineProps<DucDetailOrtProps>();
|
||||||
let talents = reactive<TGApp.Sqlite.Character.RoleTalent[]>([]);
|
const talents = ref<TGApp.Sqlite.Character.RoleTalent[]>([]);
|
||||||
|
|
||||||
async function loadData(): Promise<void> {
|
async function loadData(): Promise<void> {
|
||||||
talents = props.modelValue;
|
const tempTalent = props.modelValue;
|
||||||
for (const talent of talents) {
|
for (const talent of tempTalent) {
|
||||||
|
if (talent.icon.startsWith("blob:")) return;
|
||||||
talent.icon = await saveImgLocal(talent.icon);
|
talent.icon = await saveImgLocal(talent.icon);
|
||||||
}
|
}
|
||||||
|
talents.value = tempTalent;
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
@@ -60,6 +62,7 @@ onUpdated(async () => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
color: var(--tgc-white-1);
|
||||||
font-family: var(--font-title);
|
font-family: var(--font-title);
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
text-shadow: 0 0 5px rgba(0 0 0/40%);
|
text-shadow: 0 0 5px rgba(0 0 0/40%);
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
<div class="duc-doc-lt">
|
<div class="duc-doc-lt">
|
||||||
<DucDetailOlt :data="props.dataVal" mode="avatar" />
|
<DucDetailOlt :data="props.dataVal" mode="avatar" />
|
||||||
<DucDetailOlt :data="JSON.parse(props.dataVal.weapon)" mode="weapon" />
|
<DucDetailOlt :data="JSON.parse(props.dataVal.weapon)" mode="weapon" />
|
||||||
<!-- todo cors -->
|
|
||||||
<v-btn
|
<v-btn
|
||||||
class="duc-doc-btn"
|
class="duc-doc-btn"
|
||||||
@click="share"
|
@click="share"
|
||||||
@@ -49,7 +48,6 @@ import DucDetailOlt from "./duc-detail-olt.vue";
|
|||||||
import DucDetailOrt from "./duc-detail-ort.vue";
|
import DucDetailOrt from "./duc-detail-ort.vue";
|
||||||
import TGSqlite from "../../plugins/Sqlite";
|
import TGSqlite from "../../plugins/Sqlite";
|
||||||
import { generateShareImg } from "../../utils/TGShare";
|
import { generateShareImg } from "../../utils/TGShare";
|
||||||
import showSnackbar from "../func/snackbar";
|
|
||||||
import TOverlay from "../main/t-overlay.vue";
|
import TOverlay from "../main/t-overlay.vue";
|
||||||
|
|
||||||
interface DucDetailOverlayProps {
|
interface DucDetailOverlayProps {
|
||||||
@@ -72,10 +70,10 @@ const visible = computed({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// share
|
||||||
|
const loading = ref<boolean>(false);
|
||||||
// 渲染数据
|
// 渲染数据
|
||||||
const nameCard = ref<string | false>(false);
|
const nameCard = ref<string | false>(false);
|
||||||
// 加载
|
|
||||||
const loading = ref<boolean>(false);
|
|
||||||
|
|
||||||
function onOverlayCancel() {
|
function onOverlayCancel() {
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
@@ -181,6 +179,10 @@ async function share(): Promise<void> {
|
|||||||
row-gap: 10px;
|
row-gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.duc-doc-btn {
|
||||||
|
color: var(--tgc-white-1);
|
||||||
|
}
|
||||||
|
|
||||||
.duc-doc-rt {
|
.duc-doc-rt {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
|
|||||||
Reference in New Issue
Block a user