💄 调整角色 overlay 样式,修复一些报错

This commit is contained in:
BTMuli
2023-09-05 16:54:21 +08:00
parent 472459205c
commit e33f824cec
8 changed files with 132 additions and 104 deletions

View File

@@ -23,26 +23,27 @@ defineProps<TucDetailConstellationProps>();
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border-radius: 50%; border-radius: 50%;
cursor: pointer;
} }
.tuc-dc-lock { .tuc-dc-lock {
position: absolute; position: absolute;
display: flex; display: flex;
width: 50px; width: 54px;
height: 50px; height: 54px;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 3px;
border-radius: 50%; border-radius: 50%;
background-color: rgb(0 0 0 / 50%); background-color: rgb(0 0 0 / 50%);
} }
.tuc-dc-icon { .tuc-dc-icon {
width: 50px; width: 54px;
height: 50px; height: 54px;
padding: 5px; padding: 3px;
border: 1px solid rgb(0 0 0/20%);
border-radius: 50%; border-radius: 50%;
background: rgb(0 0 0/ 20%); background: rgb(50 56 68/50%);
} }
.tuc-dc-icon img { .tuc-dc-icon img {

View File

@@ -56,11 +56,12 @@ function parseDesc(desc: string): string {
align-items: start; align-items: start;
justify-content: space-around; justify-content: space-around;
margin-left: 5px; margin-left: 5px;
color: var(--tgc-dark-1);
} }
.tuc-ddc-top { .tuc-ddc-top {
height: 20px; height: 20px;
color: var(--common-color-blue-2); color: var(--tgc-blue-1);
} }
.tuc-ddc-bottom { .tuc-ddc-bottom {
@@ -72,6 +73,6 @@ function parseDesc(desc: string): string {
} }
.tuc-ddc-bottom :nth-child(3) { .tuc-ddc-bottom :nth-child(3) {
color: var(--common-color-yellow); color: var(--tgc-yellow-1);
} }
</style> </style>

View File

@@ -4,7 +4,7 @@
<span>圣遗物</span> <span>圣遗物</span>
</template> </template>
<template #content> <template #content>
<TucDetailRelic :model-value="props.modelValue" pos="props.modelValue.pos" /> <TucDetailRelic :model-value="props.modelValue" :pos="`${props.modelValue.pos}`" />
<div class="tuc-ddr-content"> <div class="tuc-ddr-content">
<div class="tuc-ddrc-top"> <div class="tuc-ddrc-top">
<span>{{ props.modelValue.name }}</span> <span>{{ props.modelValue.name }}</span>
@@ -48,6 +48,7 @@ const props = defineProps<TucDetailDescRelicProps>();
.tuc-ddrc-top { .tuc-ddrc-top {
height: 20px; height: 20px;
color: var(--tgc-dark-1);
} }
.tuc-ddrc-top :nth-child(1) { .tuc-ddrc-top :nth-child(1) {
@@ -55,7 +56,7 @@ const props = defineProps<TucDetailDescRelicProps>();
} }
.tuc-ddrc-top :nth-child(3) { .tuc-ddrc-top :nth-child(3) {
color: var(--common-color-yellow); color: var(--tgc-yellow-1);
} }
.tuc-ddrc-bottom { .tuc-ddrc-bottom {
@@ -69,6 +70,7 @@ const props = defineProps<TucDetailDescRelicProps>();
} }
.tuc-ddrd-title { .tuc-ddrd-title {
color: var(--tgc-dark-1);
font-family: var(--font-title); font-family: var(--font-title);
font-size: 16px; font-size: 16px;
} }

View File

@@ -49,6 +49,7 @@ const box = computed(() => {
align-items: start; align-items: start;
justify-content: space-around; justify-content: space-around;
margin-left: 5px; margin-left: 5px;
color: var(--tgc-dark-1);
} }
.tuc-ddwc-top { .tuc-ddwc-top {
@@ -61,7 +62,7 @@ const box = computed(() => {
.tuc-ddwc-top :nth-child(2), .tuc-ddwc-top :nth-child(2),
.tuc-ddwc-top :nth-child(4) { .tuc-ddwc-top :nth-child(4) {
color: var(--common-color-yellow); color: var(--tgc-yellow-1);
} }
.tuc-ddwc-bottom { .tuc-ddwc-bottom {

View File

@@ -15,15 +15,14 @@
<style lang="css" scoped> <style lang="css" scoped>
.tuc-dd-box { .tuc-dd-box {
padding: 10px; padding: 10px;
border: 2px solid var(--common-color-grey-2); border: 1px solid rgb(0 0 0 /40%);
border-radius: 5px; border-radius: 5px;
backdrop-filter: blur(20px); background: var(--tgc-white-1);
background: rgb(255 255 255 / 20%);
} }
.tuc-dd-title { .tuc-dd-title {
width: 100%; width: 100%;
color: var(--common-color-blue); color: var(--tgc-dark-1);
font-family: var(--font-title); font-family: var(--font-title);
font-size: 20px; font-size: 20px;
text-align: left; text-align: left;
@@ -31,9 +30,10 @@
.tuc-dd-divider { .tuc-dd-divider {
width: 100%; width: 100%;
height: 2px; height: 1px;
margin: 5px 0; margin: 5px 0;
background: var(--common-color-grey-2); background: var(--tgc-dark-1);
opacity: 0.5;
} }
.tuc-dd-content { .tuc-dd-content {
@@ -45,19 +45,15 @@
} }
.tuc-dd-desc { .tuc-dd-desc {
overflow: hidden;
width: 100%; width: 100%;
max-height: 50px; max-height: 50px;
margin-top: 5px; margin-top: 5px;
color: var(--common-color-black); color: var(--tgc-dark-1);
font-family: var(--font-text); font-family: var(--font-text);
font-size: 14px; font-size: 14px;
overflow-y: scroll; overflow-x: hidden;
overflow-y: auto;
text-align: left; text-align: left;
word-break: break-all; word-break: break-all;
&::-webkit-scrollbar {
display: none;
}
} }
</style> </style>

View File

@@ -1,14 +1,19 @@
<template> <template>
<TOverlay v-model="visible" hide :to-click="onCancel" blur-val="20px"> <TOverlay v-model="visible" hide :to-click="onCancel" blur-val="20px">
<!-- todo 优化样式 -->
<div class="tuc-do-box"> <div class="tuc-do-box">
<div class="tuc-do-bg"> <div class="tuc-do-bg">
<img :src="data.bg" alt="role" /> <img
:src="data.bg"
alt="role"
:style="{
objectFit: data.bgFit,
}"
/>
</div> </div>
<div class="tuc-do-quote">* 所有数据以游戏内为准此处仅供参考</div> <div class="tuc-do-quote">* 所有数据以游戏内为准此处仅供参考</div>
<!-- 衣装 --> <!-- 衣装 -->
<div v-if="data.costume.length > 0" class="tuc-do-costume"> <div v-if="data.costume.length > 0" class="tuc-do-costume">
<v-switch v-model="showCostumeSwitch" color="#faf7e8" @click="switchBg"> <v-switch v-model="showCostumeSwitch" color="#fb7299" @click="switchBg">
<template #label> <template #label>
<v-icon>mdi-tshirt-crew-outline</v-icon> <v-icon>mdi-tshirt-crew-outline</v-icon>
</template> </template>
@@ -23,7 +28,7 @@
<div <div
class="tuc-dol-item" class="tuc-dol-item"
:style="{ :style="{
border: selected.pos === 0 ? '2px solid var(--common-color-yellow)' : '', opacity: selected.pos === 0 ? '1' : '0.5',
}" }"
@click="showDetail(data.weapon, '武器', 0)" @click="showDetail(data.weapon, '武器', 0)"
> >
@@ -35,11 +40,11 @@
class="tuc-dol-item" class="tuc-dol-item"
:style="{ :style="{
cursor: item ? 'pointer' : 'default', cursor: item ? 'pointer' : 'default',
border: selected.pos === index + 1 ? '2px solid var(--common-color-yellow)' : '', opacity: selected.pos === index + 1 ? '1' : item ? '0.5' : '1',
}" }"
@click="showDetail(item, '圣遗物', index + 1)" @click="showDetail(item, '圣遗物', index + 1)"
> >
<TucDetailRelic :model-value="item" :pos="index.toString()" /> <TucDetailRelic :model-value="item" :pos="index + 1" />
</div> </div>
</div> </div>
<!-- 右侧环状排列6个命座 --> <!-- 右侧环状排列6个命座 -->
@@ -61,10 +66,10 @@
<div class="tuc-do-bottom"> <div class="tuc-do-bottom">
<TucDetailDescWeapon v-if="selected.type === '武器'" v-model="selectWeapon" /> <TucDetailDescWeapon v-if="selected.type === '武器'" v-model="selectWeapon" />
<TucDetailDescConstellation <TucDetailDescConstellation
v-else-if="selected.type === '命座'" v-if="selected.type === '命座'"
v-model="selectConstellation" v-model="selectConstellation"
/> />
<TucDetailDescRelic v-else-if="selected.type === '圣遗物'" v-model="selectRelic" /> <TucDetailDescRelic v-if="selected.type === '圣遗物'" v-model="selectRelic" />
</div> </div>
</div> </div>
</div> </div>
@@ -88,21 +93,20 @@ interface ToUcDetailProps {
interface ToUcDetailEmits { interface ToUcDetailEmits {
(e: "update:modelValue", value: boolean): void; (e: "update:modelValue", value: boolean): void;
(e: "cancel"): void; (e: "cancel"): void;
} }
type fixedLenArray<T, N extends number> = [T, ...T[]] & { length: N };
type relicsInfo = fixedLenArray<TGApp.Sqlite.Character.RoleReliquary | false, 5>;
interface ToUcDetailData { interface ToUcDetailData {
weapon: TGApp.Sqlite.Character.RoleWeapon; weapon: TGApp.Sqlite.Character.RoleWeapon;
constellation: TGApp.Sqlite.Character.RoleConstellation[]; constellation: TGApp.Sqlite.Character.RoleConstellation[];
reliquary: { reliquary: relicsInfo;
1: TGApp.Sqlite.Character.RoleReliquary | false;
2: TGApp.Sqlite.Character.RoleReliquary | false;
3: TGApp.Sqlite.Character.RoleReliquary | false;
4: TGApp.Sqlite.Character.RoleReliquary | false;
5: TGApp.Sqlite.Character.RoleReliquary | false;
};
costume: TGApp.Sqlite.Character.RoleCostume[]; costume: TGApp.Sqlite.Character.RoleCostume[];
bg: string; bg: string;
bgFit: "contain" | "cover";
} }
const emits = defineEmits<ToUcDetailEmits>(); const emits = defineEmits<ToUcDetailEmits>();
@@ -119,15 +123,10 @@ const showCostumeSwitch = ref(false);
const data = ref<ToUcDetailData>({ const data = ref<ToUcDetailData>({
weapon: <TGApp.Sqlite.Character.RoleWeapon>{}, weapon: <TGApp.Sqlite.Character.RoleWeapon>{},
constellation: [], constellation: [],
reliquary: { reliquary: [false, false, false, false, false],
1: false,
2: false,
3: false,
4: false,
5: false,
},
costume: [], costume: [],
bg: "", bg: "",
bgFit: "contain",
}); });
const selectConstellation = ref<TGApp.Sqlite.Character.RoleConstellation>( const selectConstellation = ref<TGApp.Sqlite.Character.RoleConstellation>(
<TGApp.Sqlite.Character.RoleConstellation>{}, <TGApp.Sqlite.Character.RoleConstellation>{},
@@ -138,49 +137,64 @@ const selectRelic = ref<TGApp.Sqlite.Character.RoleReliquary>(
); );
const selected = ref({ const selected = ref({
type: "武器" || "命之座" || "圣遗物", type: "武器" || "命之座" || "圣遗物",
pos: 0, // 用于标记选中的是哪个位置 pos: 0,
}); });
// 加载数据 // 重置数据
function loadData(): void { function resetData(): void {
if (!props.modelValue) return; data.value = {
data.value.weapon = JSON.parse(props.dataVal.weapon); weapon: <TGApp.Sqlite.Character.RoleWeapon>{},
data.value.constellation = JSON.parse(props.dataVal.constellation); constellation: [],
if (props.dataVal.reliquary !== "") { reliquary: [false, false, false, false, false],
const relics = <TGApp.Sqlite.Character.RoleReliquary[]>JSON.parse(props.dataVal.reliquary); costume: [],
relics.map((item) => { bg: "",
switch (item.pos) { bgFit: "contain",
case 1: };
data.value.reliquary["1"] = item;
break;
case 2:
data.value.reliquary["2"] = item;
break;
case 3:
data.value.reliquary["3"] = item;
break;
case 4:
data.value.reliquary["4"] = item;
break;
case 5:
data.value.reliquary["5"] = item;
break;
default:
break;
}
return item;
});
}
data.value.costume = JSON.parse(props.dataVal.costume);
data.value.bg = props.dataVal.img;
showCostumeSwitch.value = false;
selectWeapon.value = data.value.weapon;
selected.value = { selected.value = {
type: "武器", type: "武器",
pos: 0, pos: 0,
}; };
} }
// 加载数据
function loadData(): void {
if (!props.modelValue) return;
resetData();
data.value.weapon = JSON.parse(props.dataVal.weapon);
data.value.constellation = JSON.parse(props.dataVal.constellation);
if (props.dataVal.reliquary !== "") {
const relics = <TGApp.Sqlite.Character.RoleReliquary[]>JSON.parse(props.dataVal.reliquary);
const relicTemp: relicsInfo = [false, false, false, false, false];
relics.forEach((item) => {
switch (item.pos) {
case 1:
relicTemp[0] = item;
break;
case 2:
relicTemp[1] = item;
break;
case 3:
relicTemp[2] = item;
break;
case 4:
relicTemp[3] = item;
break;
case 5:
relicTemp[4] = item;
break;
default:
break;
}
});
data.value.reliquary = relicTemp;
}
data.value.costume = JSON.parse(props.dataVal.costume);
data.value.bg = props.dataVal.img;
data.value.bgFit = "contain";
showCostumeSwitch.value = false;
selectWeapon.value = data.value.weapon;
}
onMounted(() => { onMounted(() => {
loadData(); loadData();
}); });
@@ -209,11 +223,11 @@ function showDetail(
| TGApp.Sqlite.Character.RoleWeapon | TGApp.Sqlite.Character.RoleWeapon
| TGApp.Sqlite.Character.RoleReliquary | TGApp.Sqlite.Character.RoleReliquary
| false, | false,
type: "命座" | "武器" | "圣遗物", selectType: "命座" | "武器" | "圣遗物",
pos: number = 0, selectPos: number,
): void { ): void {
if (!item) return; if (!item) return;
switch (type) { switch (selectType) {
case "命座": case "命座":
selectConstellation.value = <TGApp.Sqlite.Character.RoleConstellation>item; selectConstellation.value = <TGApp.Sqlite.Character.RoleConstellation>item;
break; break;
@@ -227,16 +241,20 @@ function showDetail(
break; break;
} }
selected.value = { selected.value = {
type, type: selectType,
pos, pos: selectPos,
}; };
} }
function switchBg(): void { function switchBg(): void {
if (data.value.bg === props.dataVal.img) { if (!showCostumeSwitch.value) {
data.value.bg = data.value.costume[0].icon; data.value.bg = data.value.costume[0].icon;
data.value.bgFit = "cover";
showCostumeSwitch.value = true;
} else { } else {
data.value.bg = props.dataVal.img; data.value.bg = props.dataVal.img;
data.value.bgFit = "contain";
showCostumeSwitch.value = false;
} }
} }
</script> </script>
@@ -247,7 +265,7 @@ function switchBg(): void {
height: 620px; height: 620px;
padding: 10px; padding: 10px;
border-radius: 5px; border-radius: 5px;
background: rgb(255 255 255 / 30%); background: var(--tgc-white-1);
} }
.tuc-do-bg { .tuc-do-bg {
@@ -256,22 +274,27 @@ function switchBg(): void {
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 5px;
margin: 0 auto; margin: 0 auto;
} }
.tuc-do-bg img { .tuc-do-bg img {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: contain; border-radius: 5px;
} }
.tuc-do-quote { .tuc-do-quote {
position: absolute; position: absolute;
right: 10px; right: 0;
bottom: 5px; bottom: 0;
color: var(--common-color-grey-2); padding: 2px 5px;
font-family: var(--font-text); backdrop-filter: blur(10px);
font-size: 12px; background: rgb(0 0 0 /50%);
border-bottom-right-radius: 5px;
border-top-left-radius: 5px;
color: var(--tgc-white-1);
font-size: 14px;
} }
.tuc-do-costume { .tuc-do-costume {
@@ -279,18 +302,22 @@ function switchBg(): void {
z-index: 1; z-index: 1;
top: 5px; top: 5px;
right: 10px; right: 10px;
color: var(--tgc-pink-1);
} }
.tuc-do-costume-name { .tuc-do-costume-name {
position: absolute; position: absolute;
top: 5px; top: 10px;
left: 0; left: calc(50% - 80px);
width: 100%; width: 160px;
color: var(--common-color-white); border-radius: 5px;
font-family: var(--font-title); backdrop-filter: blur(5px);
background: var(--tgc-white-1);
color: var(--tgc-yellow-1);
font-family: var(--font-text);
font-size: 16px; font-size: 16px;
opacity: 0.8;
text-align: center; text-align: center;
text-shadow: 0 0 10px rgb(0 0 0 / 50%);
} }
.tuc-do-show { .tuc-do-show {
@@ -366,6 +393,7 @@ function switchBg(): void {
.tuc-dor-item { .tuc-dor-item {
position: absolute; position: absolute;
cursor: pointer;
} }
/* 环状排列6个命座 */ /* 环状排列6个命座 */

View File

@@ -14,7 +14,7 @@
<script lang="ts" setup> <script lang="ts" setup>
interface TucDetailRelicProps { interface TucDetailRelicProps {
modelValue: TGApp.Sqlite.Character.RoleReliquary | false; modelValue: TGApp.Sqlite.Character.RoleReliquary | false;
pos: string; pos: number;
} }
const props = defineProps<TucDetailRelicProps>(); const props = defineProps<TucDetailRelicProps>();
@@ -25,7 +25,7 @@ const props = defineProps<TucDetailRelicProps>();
width: 60px; width: 60px;
height: 60px; height: 60px;
border-radius: 5px; border-radius: 5px;
background: rgb(0 0 0 /20%); background: rgb(50 56 68/50%);
} }
.tuc-dr-bg { .tuc-dr-bg {

View File

@@ -29,7 +29,6 @@
</v-btn> </v-btn>
</div> </div>
</div> </div>
<!-- grid 布局参考 Snap.Hutao -->
<div class="uc-grid"> <div class="uc-grid">
<TucRoleBox <TucRoleBox
v-for="(role, index) in roleList" v-for="(role, index) in roleList"