这个提交包含在:
binary-husky
2024-07-17 17:12:32 +00:00
父节点 ce940ff70f
当前提交 55e255220b
共有 2 个文件被更改,包括 15 次插入8 次删除

查看文件

@@ -172,7 +172,7 @@
padding: 15px; padding: 15px;
margin: 10px; margin: 10px;
flex: 0 0 calc(30% - 10px); flex: 0 0 calc(30% - 10px);
transition: opacity 0.5s ease-in-out; transition: opacity 0.2s ease-in-out;
opacity: 1; opacity: 1;
} }

查看文件

@@ -54,18 +54,21 @@ class WelcomeMessage {
this.max_welcome_card_num = 6; this.max_welcome_card_num = 6;
this.card_array = []; this.card_array = [];
this.static_welcome_message_previous = []; this.static_welcome_message_previous = [];
this.reflesh_time_interval = 15*1000;
} }
begin_render() { begin_render() {
this.update(); this.update();
this.startRefleshCards();
} }
async startRefleshCards() { async startRefleshCards() {
await new Promise(r => setTimeout(r, this.reflesh_time_interval));
await this.reflesh_cards(); await this.reflesh_cards();
if (this.visible){
setTimeout(() => { setTimeout(() => {
this.startRefleshCards.call(this); this.startRefleshCards.call(this);
}, 15000); }, 1);
}
} }
async reflesh_cards() { async reflesh_cards() {
@@ -110,8 +113,8 @@ class WelcomeMessage {
card.classList.add('hide'); card.classList.add('hide');
// 等待 500 毫秒 // 等待 250 毫秒
await new Promise(r => setTimeout(r, 250)); await new Promise(r => setTimeout(r, 200));
} }
})(); })();
} }
@@ -135,19 +138,23 @@ class WelcomeMessage {
} }
async update() { async update() {
console.log('update') // console.log('update')
if (!await this.isChatbotEmpty()) { if (!await this.isChatbotEmpty()) {
if (this.visible) { if (this.visible) {
this.removeWelcome(); this.removeWelcome();
this.visible = false; this.visible = false;
this.card_array = [];
this.static_welcome_message_previous = [];
} }
return; return;
} }
if (this.visible){ if (this.visible){
return; return;
} }
// console.log("welcome");
this.showWelcome(); this.showWelcome();
this.visible = true; this.visible = true;
this.startRefleshCards();
} }
showCard(message) { showCard(message) {