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