mirror of
https://github.com/hi2shark/nazhua.git
synced 2026-01-12 15:20:43 +08:00
✨ 增加自定义的地区flag支持
This commit is contained in:
parent
280387fba5
commit
8de81431ca
29
src/components/server-flag.vue
Normal file
29
src/components/server-flag.vue
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<template>
|
||||||
|
<span
|
||||||
|
class="server-flag"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="fi"
|
||||||
|
:class="'fi-' + lastFlag"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { computed } from 'vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
info: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const lastFlag = computed(() => {
|
||||||
|
let flag = props.info?.Host?.CountryCode || 'un';
|
||||||
|
if (props.info?.PublicNote?.customData?.flag) {
|
||||||
|
flag = props.info.PublicNote.customData.flag;
|
||||||
|
}
|
||||||
|
return flag.toLowerCase();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@ -6,12 +6,14 @@ import config from './config';
|
|||||||
|
|
||||||
import DotDotBox from './components/dot-dot-box.vue';
|
import DotDotBox from './components/dot-dot-box.vue';
|
||||||
import Popover from './components/popover.vue';
|
import Popover from './components/popover.vue';
|
||||||
|
import ServerFlag from './components/server-flag.vue';
|
||||||
|
|
||||||
export default (app) => {
|
export default (app) => {
|
||||||
app.use(router);
|
app.use(router);
|
||||||
app.use(store);
|
app.use(store);
|
||||||
app.component('DotDotBox', DotDotBox);
|
app.component('DotDotBox', DotDotBox);
|
||||||
app.component('Popover', Popover);
|
app.component('Popover', Popover);
|
||||||
|
app.component('ServerFlag', ServerFlag);
|
||||||
|
|
||||||
app.config.globalProperties.$hasSarasaTerm = !import.meta.env.VITE_DISABLE_SARASA_TERM_SC;
|
app.config.globalProperties.$hasSarasaTerm = !import.meta.env.VITE_DISABLE_SARASA_TERM_SC;
|
||||||
app.config.globalProperties.$config = config;
|
app.config.globalProperties.$config = config;
|
||||||
|
|||||||
@ -3,13 +3,8 @@
|
|||||||
class="server-head"
|
class="server-head"
|
||||||
padding="16px"
|
padding="16px"
|
||||||
>
|
>
|
||||||
<div class="server-flag">
|
<div class="server-flag-box">
|
||||||
<div class="server-flag-font">
|
<server-flag :info="info" />
|
||||||
<span
|
|
||||||
class="fi"
|
|
||||||
:class="'fi-' + (info?.Host?.CountryCode || 'un')"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="server-name-and-slogan">
|
<div class="server-name-and-slogan">
|
||||||
<div class="server-name-group">
|
<div class="server-name-group">
|
||||||
@ -97,7 +92,7 @@ const platformLogoIconClassName = computed(() => hostUtils.getPlatformLogoIconCl
|
|||||||
gap: 12px;
|
gap: 12px;
|
||||||
transition: 0.3s;
|
transition: 0.3s;
|
||||||
|
|
||||||
.server-flag {
|
.server-flag-box {
|
||||||
--flag-size: 72px;
|
--flag-size: 72px;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: calc(var(--flag-size) * 1.33333333);
|
width: calc(var(--flag-size) * 1.33333333);
|
||||||
@ -105,7 +100,7 @@ const platformLogoIconClassName = computed(() => hostUtils.getPlatformLogoIconCl
|
|||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
.server-flag-font {
|
.server-flag {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
|
|||||||
@ -15,14 +15,7 @@
|
|||||||
@click="openDetail"
|
@click="openDetail"
|
||||||
>
|
>
|
||||||
<div class="server-name-group left-box">
|
<div class="server-name-group left-box">
|
||||||
<span
|
<server-flag :info="info" />
|
||||||
class="server-flag"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
class="fi"
|
|
||||||
:class="'fi-' + (info?.Host?.CountryCode || 'un')"
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
<span class="server-name">
|
<span class="server-name">
|
||||||
{{ info.Name }}
|
{{ info.Name }}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@ -9,14 +9,7 @@
|
|||||||
@click="openDetail"
|
@click="openDetail"
|
||||||
>
|
>
|
||||||
<div class="list-column-item list-column-item--server-flag">
|
<div class="list-column-item list-column-item--server-flag">
|
||||||
<span
|
<server-flag :info="info" />
|
||||||
class="server-flag"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
class="fi"
|
|
||||||
:class="'fi-' + (info?.Host?.CountryCode || 'un')"
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="list-column-item list-column-item--server-name">
|
<div class="list-column-item list-column-item--server-name">
|
||||||
<span
|
<span
|
||||||
|
|||||||
@ -130,7 +130,7 @@ const worldMapPosition = computed(() => {
|
|||||||
if (Object.keys(config.nazhua).includes('detailWorldMapPosition')) {
|
if (Object.keys(config.nazhua).includes('detailWorldMapPosition')) {
|
||||||
return config.nazhua.detailWorldMapPosition;
|
return config.nazhua.detailWorldMapPosition;
|
||||||
}
|
}
|
||||||
return 'bottom';
|
return 'top';
|
||||||
});
|
});
|
||||||
|
|
||||||
function handleWorldMapWidth() {
|
function handleWorldMapWidth() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user