mirror of
https://github.com/xfgryujk/blivechat.git
synced 2025-03-13 11:20:42 +08:00
前端优化
This commit is contained in:
parent
32ba4187aa
commit
7f25c219d8
@ -66,6 +66,7 @@ export default {
|
||||
return {
|
||||
MESSAGE_TYPE_MEMBER: constants.MESSAGE_TYPE_MEMBER,
|
||||
|
||||
curTime: new Date(),
|
||||
updateTimerId: window.setInterval(this.updateProgress.bind(this), 1000),
|
||||
pinnedMessage: null
|
||||
}
|
||||
@ -108,7 +109,7 @@ export default {
|
||||
color2 = config.colors.headerBg
|
||||
pinTime = config.pinTime
|
||||
}
|
||||
let progress = (1 - (new Date() - message.addTime) / (60 * 1000) / pinTime) * 100
|
||||
let progress = (1 - (this.curTime - message.addTime) / (60 * 1000) / pinTime) * 100
|
||||
if (progress < 0) {
|
||||
progress = 0
|
||||
} else if (progress > 100) {
|
||||
@ -129,7 +130,7 @@ export default {
|
||||
return 'CN¥' + formatCurrency(message.price)
|
||||
},
|
||||
updateProgress() {
|
||||
let curTime = new Date()
|
||||
this.curTime = new Date()
|
||||
for (let i = 0; i < this.messages.length;) {
|
||||
let pinTime
|
||||
if (this.messages[i].type === constants.MESSAGE_TYPE_MEMBER) {
|
||||
@ -138,7 +139,7 @@ export default {
|
||||
let config = constants.getPriceConfig(this.messages[i].price)
|
||||
pinTime = config.pinTime
|
||||
}
|
||||
if ((curTime - this.messages[i].addTime) / (60 * 1000) >= pinTime) {
|
||||
if ((this.curTime - this.messages[i].addTime) / (60 * 1000) >= pinTime) {
|
||||
if (this.pinnedMessage == this.messages[i]) {
|
||||
this.pinnedMessage = null
|
||||
}
|
||||
@ -147,8 +148,6 @@ export default {
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
this.$forceUpdate()
|
||||
},
|
||||
onItemClick(message) {
|
||||
if (this.pinnedMessage == message) {
|
||||
|
@ -514,7 +514,7 @@ export default {
|
||||
return true
|
||||
}
|
||||
// 防止在OBS中卡住,超过一定时间也可以自动滚动
|
||||
return new Date() - this.cantScrollStartTime >= 10 * 1000
|
||||
return new Date() - this.cantScrollStartTime >= 5 * 1000
|
||||
},
|
||||
refreshCantScrollStartTime() {
|
||||
// 有鼠标事件时刷新,防止用户看弹幕时自动滚动
|
||||
|
@ -15,7 +15,9 @@
|
||||
</el-aside>
|
||||
<el-main>
|
||||
<el-button v-show="isMobile" class="menu-button" icon="el-icon-s-unfold" @click="hideSidebar = false"></el-button>
|
||||
<router-view></router-view>
|
||||
<keep-alive>
|
||||
<router-view></router-view>
|
||||
</keep-alive>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</template>
|
||||
|
Loading…
Reference in New Issue
Block a user