Skip to content

Commit

Permalink
fe: 如果有未完成的签到,显示有未读消息的提示。
Browse files Browse the repository at this point in the history
  • Loading branch information
wjcjttl committed Oct 20, 2024
1 parent 12abe26 commit f1f8034
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
1 change: 1 addition & 0 deletions resource/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
"selectColumns": "Select Columns",
"selectedTags": "Selected Tags",
"week": "Expressed in weeks",
"showNotAttended": "Show not attended",
"timeline": "Time line",
"settings": "Settings",
"statistic": "Statistic",
Expand Down
1 change: 1 addition & 0 deletions resource/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
"selectColumns": "过滤列",
"selectedTags": "标签分组过滤",
"week": "时间显示为周数",
"showNotAttended": "未签到的站点",
"timeline": "时间轴",
"settings": "参数",
"statistic": "数据图表",
Expand Down
4 changes: 4 additions & 0 deletions resource/schemas/NexusPHP/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@
"messageCount": {
"selector": ["td[style*='background: red'] a[href*='messages.php']", "div[style*='background: red'] a[href*='messages.php']"],
"filters": ["query.text().match(/(\\d+)/)", "(query && query.length>=2)?parseInt(query[1]):0"]
},
"notAttended": {
"selector": ["a[class*='faqlink']"],
"filters": ["query.text().match(/(签到得|簽到得|立即签到)/)", "(query && query.length>=1)?1:0"]
}
}
},
Expand Down
17 changes: 13 additions & 4 deletions src/options/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
@change="updateViewOptions"></v-switch>
<v-switch color="success" v-model="showLastUpdateTimeAsRelativeTime" :label="$t('home.showLastUpdateTimeAsRelativeTime')"
@change="updateViewOptions"></v-switch>
<v-switch color="success" v-model="showNotAttended" :label="$t('home.showNotAttended')"
@change="updateViewOptions"></v-switch>
</v-container>
</v-card>
</v-menu>
Expand Down Expand Up @@ -91,12 +93,13 @@
<!-- 站点 -->
<td v-if="showColumn('name')" class="center">
<v-badge color="red messageCount" overlap>
<!-- 有未读消息或签到消息。未读消息可以在站点设置里关闭。签到消息可以在本页顶部设置里关闭。 -->
<template v-slot:badge v-if="
!props.item.disableMessageCount &&
props.item.user.messageCount > 0
(!props.item.disableMessageCount && props.item.user.messageCount > 0 ) ||
(showNotAttended && props.item.user.notAttended > 0)
" :title="$t('home.newMessage')">
{{
props.item.user.messageCount > 10
(props.item.user.messageCount > 10 || props.item.user.messageCount == 0)
? ""
: props.item.user.messageCount
}}
Expand Down Expand Up @@ -605,6 +608,7 @@ export default Vue.extend({
showHnR: true,
showLastUpdateTimeAsRelativeTime:true,
showWeek: false,
showNotAttended: false,
};
},
created() {
Expand Down Expand Up @@ -655,7 +659,10 @@ export default Vue.extend({
},
allUnReadMsgSites() {
// @ts-ignore
return this.allSitesSorted.filter((site: Site) => !site.disableMessageCount && ((site.user?.messageCount || 0) > 0))
return this.allSitesSorted.filter((site: Site) =>
(!site.disableMessageCount && (site.user?.messageCount || 0) > 0) ||
(this.showNotAttended && (site.user?.notAttended || 0) > 0)
)
},
allTaggedSites() {
// @ts-ignore
Expand Down Expand Up @@ -786,6 +793,7 @@ export default Vue.extend({
showHnR: true,
showLastUpdateTimeAsRelativeTime:true,
showWeek: false,
showNotAttended: false,
selectedHeaders: this.selectedHeaders,
});
Object.assign(this, viewOptions);
Expand Down Expand Up @@ -1329,6 +1337,7 @@ export default Vue.extend({
showHnR: this.showHnR,
showLastUpdateTimeAsRelativeTime: this.showLastUpdateTimeAsRelativeTime,
showWeek: this.showWeek,
showNotAttended: this.showNotAttended,
selectedHeaders: this.selectedHeaders,
selectedTags: this.selectedTags,
},
Expand Down
3 changes: 2 additions & 1 deletion src/options/views/UserDataTimeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ export default Vue.extend({
res = res.concat(allUnTaggedSites)
}
if (tags.includes(ETagType.unReadMsg)) {
let allUnReadMsgSites = sites.filter((site: Site) => (site.user?.messageCount || 0) > 0)
// 有未读消息或签到消息
let allUnReadMsgSites = sites.filter((site: Site) => (site.user?.messageCount || 0) > 0 || (site.user?.notAttended || 0) > 0)
res = res.concat(allUnReadMsgSites)
}
if (tags.includes(ETagType.statusError)) {
Expand Down

0 comments on commit f1f8034

Please sign in to comment.