🎈 pref: V1.5.8 优化哔哩哔哩简介限制算法

This commit is contained in:
zhiyu1998 2024-03-16 15:05:35 +08:00
parent 4f7d31c124
commit 698a64e179
3 changed files with 5 additions and 3 deletions

View File

@ -6,7 +6,7 @@ translateAppId: '' # 百度翻译APP ID
translateSecret: '' # 百度翻译密匙
biliSessData: '' # 哔哩哔哩的SESSDATA
biliIntroLenLimit: 50 # 哔哩哔哩简介长度限制
biliIntroLenLimit: 50 # 哔哩哔哩简介长度限制,填 0 或者 -1 可以不做任何限制,显示完整简介
biliDuration: 480 # 哔哩哔哩限制的最大视频时长默认8分钟单位
douyinCookie: '' # douyin's cookie, 格式odin_tt=xxx;sessionid_ss=xxx;ttwid=xxx;passport_csrf_token=xxx;msToken=xxx;

View File

@ -105,7 +105,7 @@ export function supportGuoba() {
component: "Input",
required: false,
componentProps: {
placeholder: "请输入哔哩哔哩的简介长度限制默认50个字符",
placeholder: "请输入哔哩哔哩的简介长度限制默认50个字符,填 0 或者 -1 可以不做任何限制,显示完整简介",
},
},
{

View File

@ -287,7 +287,9 @@ export function containsChineseOrPunctuation(str) {
* @returns {*|string}
*/
export function truncateString(inputString, maxLength = 50) {
if (inputString.length <= maxLength) {
if (maxLength === 0 || maxLength === -1) {
return inputString;
} else if (inputString.length <= maxLength) {
return inputString;
} else {
// 截取字符串,保留前面 maxLength 个字符