|
|
|
@ -378,20 +378,45 @@ export class MarkNodeData {
|
|
|
|
|
* 最短3秒 |
|
|
|
|
*/ |
|
|
|
|
getShowTime() { |
|
|
|
|
let textNum = 0; |
|
|
|
|
let textNum = 0; // 总长度
|
|
|
|
|
let num_ch = 0;//中文的个数
|
|
|
|
|
let num_dan = 0; //单字符
|
|
|
|
|
let num_point = 0;//标点
|
|
|
|
|
if (this.describe != null) { |
|
|
|
|
// let str_noBlank = this.describe.replace(/\s*/g, "");
|
|
|
|
|
textNum = this.describe.length; |
|
|
|
|
let re = /[\u4E00-\u9FA5]/; //测试中文字符的正则
|
|
|
|
|
|
|
|
|
|
if (re.test(this.describe)) //使用正则判断是否存在中文
|
|
|
|
|
{ |
|
|
|
|
num_ch = this.describe.match(re).length; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let re2 = /\w/; //所有单字符
|
|
|
|
|
if (re2.test(this.describe)) //使用正则判断是否存在中文
|
|
|
|
|
{ |
|
|
|
|
num_dan = this.describe.match(re2).length; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
num_point = textNum - num_ch - num_dan; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let timeScale = 0.3; |
|
|
|
|
|
|
|
|
|
let minTime = 4; //最短停留时间
|
|
|
|
|
|
|
|
|
|
let result = textNum * timeScale + 1; |
|
|
|
|
let result = textNum * timeScale + 0.6 - textNum * num_dan * 0.06; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// let result = textNum * 0.15 + num_ch * 0.15 + num_point * 0.15 + num_dan * 0.07
|
|
|
|
|
|
|
|
|
|
if (result < minTime) { |
|
|
|
|
result = minTime; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
result -= 0.06 * textNum; |
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|