perf: 签到记录窗口添加打开签到机器人

This commit is contained in:
kuaifan 2025-08-11 05:15:35 +08:00
parent 0f41172468
commit 9b12a829d2
2 changed files with 37 additions and 1 deletions

View File

@ -16,6 +16,10 @@
</TimelineItem>
</Timeline>
<div class="setting-checkin-button" @click="calendarShow=true">{{ $L('查看更多签到数据') }}</div>
<div class="setting-checkin-button" @click="openBot">
{{ $L('打开签到机器人') }}
<Loading v-if="openBotIng"/>
</div>
<Divider orientation="left">{{ $L('签到设置') }}</Divider>
<div class="setting-checkin-row">
@ -82,6 +86,7 @@ export default {
data() {
return {
loadIng: 0,
openBotIng: 0,
formData: [],
faceimgs: [],
@ -209,7 +214,7 @@ export default {
latelySection(section) {
return section.map(item => {
return `${item[0]} - ${item[1] || 'None'}`
return `${item[0]} - ${item[1] || 'none'}`
}).join('<br/>')
},
@ -238,6 +243,29 @@ export default {
}).finally(_ => {
this.calendarLoading--;
})
},
async openBot() {
this.openBotIng++;
try {
const {data} = await this.$store.dispatch("call", {
url: 'users/search',
data: {
keys: {
key: 'check-in@bot.system',
bot: 1,
}
},
})
if (data.length === 0) {
throw new Error('机器人暂未开启');
}
await this.$store.dispatch("openDialogUserid", data[0].userid)
} catch (error) {
$A.modalError(error.msg || '机器人暂未开启');
} finally {
this.openBotIng--;
}
}
}
}

View File

@ -252,12 +252,20 @@
overflow: auto;
}
.setting-checkin-button {
display: flex;
align-items: center;
gap: 8px;
padding-bottom: 4px;
cursor: pointer;
color: #2b85e4;
&:hover {
text-decoration: underline;
}
> svg {
width: 16px;
height: 16px;
margin: 0;
}
}
&.submit {
position: absolute;