Skip to content

Commit 30a2dff

Browse files
committed
优化:后台管理中的图标选择增加提示信息
1 parent 91641be commit 30a2dff

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

Sourcecode/Song.ViewData/Methods/Platform.cs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,20 +250,29 @@ public string[] IconFonts()
250250
/// </summary>
251251
/// <returns>iconfont图标库的编码,带说明</returns>
252252
[HttpGet]
253-
//[Cache(Expires = 60 * 24 * 30)]
254-
public string[] IconJson()
253+
[Cache(Expires = 60 * 24 * 30)]
254+
public JArray IconJson()
255255
{
256256
string file = "/Utilities/Fonts/index.html";
257257
file = WeiSha.Core.Server.MapPath(file);
258258
string html = System.IO.File.ReadAllText(file, Encoding.UTF8);
259259
//
260-
List<string> list = new List<string>();
261-
string pattern = @"<div.*?>\\(.*?)<\/div>";
262-
foreach (Match match in Regex.Matches(html, pattern))
260+
JArray arr = new JArray();
261+
string pattern = @"<li>(.*?)<\/li>";
262+
foreach (Match match in Regex.Matches(html, pattern,RegexOptions.Singleline))
263263
{
264-
list.Add(match.Groups[1].Value);
264+
string li = match.Groups[1].Value;
265+
Match code = Regex.Match(li, @"<div.*?>\\(.*?)<\/div>", RegexOptions.Singleline);
266+
Match name = Regex.Match(li, @"<div class=""name"">(.*?)<\/div>", RegexOptions.Singleline);
267+
JObject jo = new JObject();
268+
if (code.Success)
269+
{
270+
jo.Add(code.Groups[1].Value,
271+
name.Success ? name.Groups[1].Value : "");
272+
}
273+
arr.Add(jo);
265274
}
266-
return list.ToArray();
275+
return arr;
267276
}
268277
/// <summary>
269278
/// 获取地址的gps坐标

Sourcecode/Song.WebSite/Song.WebSite.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,7 @@
12251225
<Content Include="Utilities\Components\Styles\upload-excel.css" />
12261226
<Content Include="Utilities\Components\upload-chunked.js" />
12271227
<Content Include="Utilities\Components\upload-excel.js" />
1228+
<Content Include="Utilities\ElementUi\version.txt" />
12281229
<Content Include="Utilities\Images\alpha.png" />
12291230
<Content Include="Utilities\Images\def_logo.jpg" />
12301231
<Content Include="Utilities\Images\head\head1.jpg" />

Sourcecode/Song.WebSite/Utilities/Components/icons.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Vue.component('icons', {
99
}
1010
},
1111
watch: {
12-
'selected': function (val, old) {
12+
'selected': function (val, old) {
1313
this.$emit('change', val);
1414
}
1515
},
@@ -20,7 +20,7 @@ Vue.component('icons', {
2020
var th = this;
2121
th.loading = true;
2222
//加载图标
23-
$api.cache('Platform/IconFonts').then(function (req) {
23+
$api.cache('Platform/IconJson').then(function (req) {
2424
th.loading = false;
2525
if (req.data.success) {
2626
th.data = req.data.result;
@@ -36,7 +36,9 @@ Vue.component('icons', {
3636
},
3737
template: `<div class="icons_select_panel">
3838
<div v-if="loading">loading...</div>
39-
<span v-for="ico in data" v-html="'&#x'+ico+';'" @click="selected=ico;show=false;"
40-
:selected="ico==selected"></span>
39+
<template v-for="ico in data">
40+
<span v-for="(value, key) in ico" v-html="'&#x'+key+';'" @click="selected=key;show=false;"
41+
:title="value" :selected="ico==selected"></span>
42+
</template>
4143
</div>`
4244
});

0 commit comments

Comments
 (0)