🚸 完善名片解析处理

This commit is contained in:
BTMuli
2025-12-02 22:55:07 +08:00
parent c2ea3cf026
commit b0b3120b7b

View File

@@ -1,13 +1,14 @@
<!-- 名片详情浮窗 -->
<template> <template>
<TOverlay v-model="visible" v-if="props.data"> <TOverlay v-if="props.data" v-model="visible">
<div class="ton-container"> <div class="ton-container">
<slot name="left"></slot> <slot name="left"></slot>
<div class="ton-box"> <div class="ton-box">
<img <img
alt="bg"
class="ton-bg"
v-if="props.data" v-if="props.data"
:src="`/WIKI/nameCard/profile/${props.data.name}.webp`" :src="`/WIKI/nameCard/profile/${props.data.name}.webp`"
alt="bg"
class="ton-bg"
/> />
<div class="ton-content"> <div class="ton-content">
<span>{{ props.data.name }}</span> <span>{{ props.data.name }}</span>
@@ -17,11 +18,11 @@
<TwnTypeTag :type="props.data.type" class="ton-type" /> <TwnTypeTag :type="props.data.type" class="ton-type" />
<div class="ton-sign">ID:{{ props.data.id }} | TeyvatGuide v{{ version }}</div> <div class="ton-sign">ID:{{ props.data.id }} | TeyvatGuide v{{ version }}</div>
<v-btn <v-btn
class="ton-share"
@click="shareNameCard"
variant="outlined"
:loading="loading" :loading="loading"
class="ton-share"
data-html2canvas-ignore data-html2canvas-ignore
variant="outlined"
@click="shareNameCard"
> >
<v-icon>mdi-share-variant</v-icon> <v-icon>mdi-share-variant</v-icon>
<span>分享</span> <span>分享</span>
@@ -31,7 +32,7 @@
</div> </div>
</TOverlay> </TOverlay>
</template> </template>
<script setup lang="ts"> <script lang="ts" setup>
import showSnackbar from "@comp/func/snackbar.js"; import showSnackbar from "@comp/func/snackbar.js";
import TwnTypeTag from "@comp/pageWiki/twn-type-tag.vue"; import TwnTypeTag from "@comp/pageWiki/twn-type-tag.vue";
import { getVersion } from "@tauri-apps/api/app"; import { getVersion } from "@tauri-apps/api/app";
@@ -83,6 +84,7 @@ function parseNameCard(desc: string): string {
function parseDesc(desc: string, inQuote: boolean = false): string[] { function parseDesc(desc: string, inQuote: boolean = false): string[] {
let res = desc.replace(/。/g, "。\n"); let res = desc.replace(/。/g, "。\n");
res = res.replace(//g, "\n"); res = res.replace(//g, "\n");
/* 闲云·鹤云 */
if (props?.data?.id !== 210187) { if (props?.data?.id !== 210187) {
res = res.replace(//g, "\n"); res = res.replace(//g, "\n");
res = res.replace(//g, "\n"); res = res.replace(//g, "\n");
@@ -93,12 +95,23 @@ function parseDesc(desc: string, inQuote: boolean = false): string[] {
if (!desc.includes("!」")) res = res.replace(//g, "\n"); if (!desc.includes("!」")) res = res.replace(//g, "\n");
res = res.replace(/…/g, "…\n"); res = res.replace(/…/g, "…\n");
res = res.replace(/…\n…/g, "……\n"); res = res.replace(/…\n…/g, "……\n");
/* 瓦雷莎·力源 */
if (props?.data?.id === 210236) res = res.replace(/…\n/g, "…"); if (props?.data?.id === 210236) res = res.replace(/…\n/g, "…");
/* 伊安珊·不懈 */
if (props?.data?.id === 210237) { if (props?.data?.id === 210237) {
res = res.replace(/…\n/g, "…\n"); res = res.replace(/…\n/g, "…\n");
res = res.replace(/」/g, "」\n"); res = res.replace(/」/g, "」\n");
} }
if (props?.data?.id === 210254) res = res.replace(/\n」/g, "」\n"); if (
/* 菲林斯·誓灯 */
props?.data?.id === 210254 ||
/* 杜林·曜心 */
props?.data?.id === 210263 ||
/* 雅珂达·帮手 */
props?.data?.id === 210264
) {
res = res.replace(/\n」/g, "」\n");
}
const match = res.split("\n"); const match = res.split("\n");
let array: string[] = []; let array: string[] = [];
for (const item of match) { for (const item of match) {