diff --git a/apps/wiki/calendar.js b/apps/wiki/calendar.js index ad4492c9..92e34137 100644 --- a/apps/wiki/calendar.js +++ b/apps/wiki/calendar.js @@ -1,6 +1,7 @@ import fetch from 'node-fetch' import moment from 'moment' import { Character } from '../../models/index.js' +import { Data } from '../../components/index.js' import lodash from 'lodash' const ignoreIds = [495, // 有奖问卷调查开启! @@ -105,7 +106,7 @@ let Cal = { } } catch (e) { } - Data.setCacheJSON('cache:calendar:detail', timeMap, 60 * 10) + await Data.setCacheJSON('cache:calendar:detail', timeMap, 60 * 10) } return { listData, timeMap } }, diff --git a/models/character-lib/CharMeta.js b/models/character-lib/CharMeta.js index 08d6ed5b..7a7f9f97 100644 --- a/models/character-lib/CharMeta.js +++ b/models/character-lib/CharMeta.js @@ -113,8 +113,9 @@ const CharMeta = { let lens = [] let len = 0 let descs = [] + const maxChars = 26 for (let desc of inputs) { - if (len + desc.length < 56) { + if (len + desc.length < maxChars * 2) { lens.push(desc.length) descs.push(desc) len += desc.length @@ -122,16 +123,20 @@ const CharMeta = { break } } - if (len <= 28) { + if (len <= maxChars - 6) { return descs.join(',') } - let ret = [[], [], []] + let ret = [[], []] let idx = 0 for (let desc of descs) { - if (ret[idx].join(' ').length + desc.length > 28) { + if (ret[idx].join(' ').length + desc.length > maxChars) { idx++ } + ret[idx] = ret[idx] || [] ret[idx].push(desc) + if (descs.length === 2) { + idx++ + } } return ret[0].join(',') + '
' + ret[1].join(',') } diff --git a/resources/wiki/character-wiki.css b/resources/wiki/character-wiki.css index 535c302f..61f3546f 100644 --- a/resources/wiki/character-wiki.css +++ b/resources/wiki/character-wiki.css @@ -28,7 +28,7 @@ body { height: 500px; } .char-desc { - padding-left: 220px; + padding-left: 200px; font-size: 14px; } .char-meta { diff --git a/resources/wiki/character-wiki.less b/resources/wiki/character-wiki.less index 8f871f13..3348083b 100644 --- a/resources/wiki/character-wiki.less +++ b/resources/wiki/character-wiki.less @@ -38,7 +38,7 @@ body { } .char-desc { - padding-left: 220px; + padding-left: 200px; font-size: 14px; }