/
RelevanceOtherTip.razor
121 lines (110 loc) · 4.06 KB
/
RelevanceOtherTip.razor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
@inject IDataCacheService _dataCatcheService
<a target="_blank" href="@GetLink()" class="a-font-color" rel="noreferrer">
<div class="div-shadow rounded bg-opacity aticle-home-layout p-3 h-100">
<div class="" style="height: 100%; align-content: center;display:flex;">
@if (string.IsNullOrWhiteSpace(GetImage()))
{
<div style="display: flex; flex-direction: column; justify-content: center;">
<header class="text-truncate-2">
<h5 class="fw-bold" style=" display: inline;">@GetName()</h5>
</header>
<span class="text-truncate-3">
@GetValue()
</span>
</div>
}
else
{
if (_dataCatcheService.IsApp)
{
<div style=" display: flex; flex-direction: column; justify-content: center;">
<img src="@GetImage()" style="width: 50px;" />
</div>
<div class="ps-3" style="display: flex; flex-direction: column; justify-content: center;">
<header class="text-truncate-2">
<h5 class="fw-bold" style=" display: inline;">@GetName()</h5>
</header>
<span class="text-truncate-3">
@GetValue()
</span>
</div>
}
else
{
<div style=" display: flex; flex-direction: column; justify-content: center;">
<img src="@GetImage()" style="width: 50px;" />
</div>
<div class="ps-3" style="display: flex; flex-direction: column; justify-content: center;">
<header class="text-truncate-2">
<h5 class="fw-bold" style=" display: inline;">@GetName()</h5>
</header>
<span class="text-truncate-3">
@GetValue()
</span>
</div>
}
}
</div>
</div>
</a>
@code {
[Parameter]
public RelevancesKeyValueModel Model { get; set; }
[Parameter]
public bool IsVideo { get; set; }
public string GetImage()
{
var image= Model.DisplayName switch
{
"萌娘百科" => "Moegirl.png",
"Bangumi" => "Bangumi.png",
"百度百科" => "BaiDuWiki.png",
"2DFan" => "2DFan.png",
"中文维基百科" => "Wiki.png",
"月幕Galgame" => "YMGal.png",
"Bilibili" => "bilibili.png",
"bilibili" => "bilibili.png",
"WikiData" => "Wikidata.png",
"微博" => "weibo.png",
"AcFun" => "AcFun.png",
"知乎" => "zhihu.png",
"爱发电" => "Afdian.png",
"Pixiv" => "pixiv.png",
"Twitter" => "twitter.png",
"YouTube" => "Youtube.png",
"Facebook" => "Facebook.png",
"官网" => "SmartHome.png",
"摩点" => "modian.png",
_ => null
};
if(string.IsNullOrWhiteSpace(image))
{
return null;
}
return "https://res.cngal.org/_content/CnGalWebSite.Shared/images/" + image;
}
public string GetValue()
{
return Model.DisplayName switch
{
"VNDB" => "VNDB.org力争成为一个关于视觉小说的全面的信息数据库",
_ => Model.DisplayValue
};
}
public string GetName()
{
return Model.DisplayName switch
{
"bilibili" => IsVideo ? "前往 bilibili 观看" : Model.DisplayName,
_ => Model.DisplayName
};
}
public string GetLink()
{
return Model.DisplayName switch
{
"月幕Galgame" => Model.Link.Replace("www.ymgal.com", "www.ymgal.games"),
_ => Model.Link
};
}
}