Skip to content

Commit

Permalink
Merge pull request #551 from andywang425:dev
Browse files Browse the repository at this point in the history
7.1.9
close #542;
try to fix: #543, #533
  • Loading branch information
andywang425 authored Oct 1, 2024
2 parents 701b5ae + 71cbfde commit c3df561
Show file tree
Hide file tree
Showing 65 changed files with 1,456 additions and 1,246 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

## [Unreleased]

## [7.1.9] - 2024-10-1

### 新增

- 【编辑名单】功能支持给粉丝勋章排序

### 修复

- 移除元素面板中的小黄车改名为小橙车
- 尝试修复跨天导致的任务执行状态错误的bug

### 删除

- 移除【移除礼物星球】(礼物星球已经没了)

### 调整

- 【移除大乱斗入口】和【移除活动入口】模块合并到【移除直播画面上方杂项】
- 优化【领取年度大会员权益】的日志输出
- 💻 模块的运行条件(isEnabled)由 useModuleStore 统一管理,无需在 run 方法开头处判断

## [7.1.8] - 2024-8-28

### 新增
Expand Down
901 changes: 444 additions & 457 deletions package-lock.json

Large diffs are not rendered by default.

31 changes: 16 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bilibili-live-tasks-helper",
"private": true,
"version": "7.1.8",
"version": "7.1.9",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -17,34 +17,35 @@
"dependencies": {
"ajax-hook": "^3.0.3",
"crypto-js": "^4.2.0",
"element-plus": "^2.7.8",
"element-plus": "^2.8.4",
"hotkeys-js": "^3.13.7",
"lodash": "^4.17.21",
"luxon": "^3.4.4",
"luxon": "^3.5.0",
"mitt": "^3.0.1",
"pinia": "^2.2.0",
"vue": "^3.4.31"
"pinia": "^2.2.3",
"vue": "^3.4.31",
"vue-draggable-plus": "^0.5.3"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.10.4",
"@tsconfig/node20": "^20.1.4",
"@types/crypto-js": "^4.2.2",
"@types/luxon": "^3.4.2",
"@types/node": "^20.14.12",
"@vitejs/plugin-vue": "^5.1.1",
"@vitejs/plugin-vue-jsx": "^4.0.0",
"@types/node": "^20.16.10",
"@vitejs/plugin-vue": "^5.1.4",
"@vitejs/plugin-vue-jsx": "^4.0.1",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
"@vue/tsconfig": "^0.5.1",
"eslint": "^8.57.0",
"eslint-plugin-vue": "^9.27.0",
"npm-run-all2": "^6.2.2",
"eslint": "^8.57.1",
"eslint-plugin-vue": "^9.28.0",
"npm-run-all2": "^6.2.3",
"prettier": "^3.3.3",
"svgo": "^3.3.2",
"terser": "^5.31.3",
"typescript": "^5.5.4",
"vite": "^5.3.5",
"terser": "^5.34.1",
"typescript": "~5.5.4",
"vite": "^5.4.8",
"vite-plugin-monkey": "^4.0.6",
"vue-tsc": "^2.0.29"
"vue-tsc": "^2.1.6"
}
}
195 changes: 118 additions & 77 deletions src/components/LiveTasks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { Edit, Delete } from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox, ElTable } from 'element-plus'
import { useBiliStore } from '@/stores/useBiliStore'
import helpInfo from '@/library/help-info'
import { VueDraggable } from 'vue-draggable-plus'
import { useUIStore } from '@/stores/useUIStore'
import { arrayToMap } from '@/library/utils'
interface MedalInfoRow {
avatar: string
Expand All @@ -16,6 +19,10 @@ interface MedalInfoRow {
const moduleStore = useModuleStore()
const biliStore = useBiliStore()
const uiStore = useUIStore()
const medalTableMaxHeight = screen.height * 0.55
const danmuTableMaxHeight = screen.height * 0.5
const config = moduleStore.moduleConfig.DailyTasks.LiveTasks
const status = moduleStore.moduleStatus.DailyTasks.LiveTasks
Expand Down Expand Up @@ -68,15 +75,30 @@ const handleAddDanmu = () => {
}
const medalInfoPanelVisible = ref<boolean>(false)
const medalInfoTableData = computed<MedalInfoRow[] | undefined>(() =>
biliStore.filteredFansMedals?.map((medal) => ({
avatar: medal.anchor_info.avatar,
nick_name: medal.anchor_info.nick_name,
medal_name: medal.medal.medal_name,
medal_level: medal.medal.level,
roomid: medal.room_info.room_id
}))
)
const medalInfoTableData = computed({
get() {
const medals = biliStore.filteredFansMedals.map((medal) => ({
avatar: medal.anchor_info.avatar,
nick_name: medal.anchor_info.nick_name,
medal_name: medal.medal.medal_name,
medal_level: medal.medal.level,
roomid: medal.room_info.room_id
}))
if (uiStore.uiConfig.medalInfoPanelSortMode) {
const filteredMedals = medals.filter((medal) =>
config.medalTasks.isWhiteList
? config.medalTasks.roomidList.includes(medal.roomid)
: !config.medalTasks.roomidList.includes(medal.roomid)
)
const orderMap = arrayToMap(config.medalTasks.roomidList)
return filteredMedals.sort((a, b) => orderMap.get(a.roomid)! - orderMap.get(b.roomid)!)
}
return medals
},
set(newValue: MedalInfoRow[]) {
config.medalTasks.roomidList = newValue.map((row) => row.roomid)
}
})
/** 是否显示加载中图标 */
const medalInfoLoading = ref<boolean>(false)
/** 是否是第一次点击编辑名单按钮 */
Expand All @@ -99,8 +121,10 @@ const handleEditList = async () => {
watch(
medalInfoTableData,
(newData) => {
initSelection(newData)
medalInfoLoading.value = false
nextTick(() => {
initSelection(newData)
medalInfoLoading.value = false
})
},
{ once: true }
)
Expand Down Expand Up @@ -132,14 +156,16 @@ const initSelection = (rows?: MedalInfoRow[]) => {
}
}
function handleSelectionChange(selectedRows: MedalInfoRow[]) {
config.medalTasks.roomidList = selectedRows.map((row) => row.roomid)
function handleSelect(selection: MedalInfoRow[]) {
config.medalTasks.roomidList = selection.map((row) => row.roomid)
}
function handleRowClick(row: MedalInfoRow) {
// 切换当前行的选择状态
// @ts-expect-error
medalInfoTableRef.value?.toggleRowSelection(row, undefined)
medalInfoTableRef.value?.toggleRowSelection(row)
// 更新黑白名单
const selection: MedalInfoRow[] = medalInfoTableRef.value?.getSelectionRows()
config.medalTasks.roomidList = selection.map((row) => row.roomid)
}
</script>

Expand Down Expand Up @@ -194,9 +220,9 @@ function handleRowClick(row: MedalInfoRow) {
<el-space wrap :size="[8, 0]">
<el-switch v-model="config.medalTasks.watch.enabled" active-text="观看直播" />
<el-select v-model="config.medalTasks.watch.time" placeholder="Select" style="width: 70px">
<el-option v-for="i in 24" :key="i" :label="i * 5" :value="i * 5" />
<el-option v-for="i in 6" :key="i" :label="i * 5" :value="i * 5" />
</el-select>
<el-text>分钟</el-text>
<el-text>分钟 / 直播间</el-text>
<Info :item="helpInfo.DailyTasks.LiveTasks.medalTasks.watch" />
<TaskStatus :status="status.medalTasks.watch" />
</el-space>
Expand All @@ -207,6 +233,7 @@ function handleRowClick(row: MedalInfoRow) {
v-model="config.medalTasks.isWhiteList"
active-text="白名单"
inactive-text="黑名单"
@change="(val: any) => !val && (uiStore.uiConfig.medalInfoPanelSortMode = false)"
/>
<el-button type="primary" size="small" :icon="Edit" @click="handleEditList"
>编辑名单
Expand All @@ -228,23 +255,15 @@ function handleRowClick(row: MedalInfoRow) {
<el-text>查看。</el-text>
</el-row>
<br />
<el-row>
<el-text tag="b">注意:</el-text>
</el-row>
<el-row>
<el-text
>&emsp;&emsp;由于每天能通过完成任务获得亲密度的粉丝勋章数量有限,脚本默认仅为最多199个等级小于20的粉丝勋章完成观看直播任务。在脚本执行任务期间观看直播可能导致今天无法获取任何亲密度。
</el-text>
</el-row>
<!-- 弹窗 -->
<el-dialog
v-model="medalDanmuPanelVisible"
title="编辑弹幕内容"
:lock-scroll="false"
width="40%"
>
<el-table :data="danmuTableData" max-height="500">
<el-table-column type="index" width="50" />
<el-table :data="danmuTableData" :max-height="danmuTableMaxHeight">
<el-table-column type="index" width="80" />
<el-table-column prop="content" label="弹幕内容" />
<el-table-column label="操作" width="220" align="center">
<template #default="scope">
Expand All @@ -261,59 +280,81 @@ function handleRowClick(row: MedalInfoRow) {
<el-button type="primary" @click="handleAddDanmu">新增弹幕</el-button>
</template>
</el-dialog>
<el-dialog
v-model="medalInfoPanelVisible"
title="编辑粉丝勋章名单"
:lock-scroll="false"
width="40%"
>
<el-table
ref="medalInfoTableRef"
v-loading="medalInfoLoading"
:data="medalInfoTableData"
max-height="500"
empty-text="没有粉丝勋章"
@selection-change="handleSelectionChange"
@row-click="handleRowClick"
<el-dialog v-model="medalInfoPanelVisible" title="编辑粉丝勋章名单" :lock-scroll="false">
<VueDraggable
v-model="medalInfoTableData"
target="#draggable-fans-medal-table table tbody"
:disabled="!uiStore.uiConfig.medalInfoPanelSortMode"
:animation="150"
:scroll-sensitivity="36"
:scroll-speed="8"
>
<el-table-column type="selection" align="center" width="55" />
<el-table-column prop="avatar" label="头像" width="100">
<template #default="scope">
<div class="avatar-wrap">
<el-image
:src="scope.row.avatar"
loading="lazy"
referrerpolicy="origin"
class="avatar"
>
<template #error>
<el-image
src="//i0.hdslb.com/bfs/face/member/noface.jpg"
referrerpolicy="origin"
class="avatar"
/>
</template>
</el-image>
</div>
<el-table
id="draggable-fans-medal-table"
ref="medalInfoTableRef"
v-loading="medalInfoLoading"
:data="medalInfoTableData"
:max-height="medalTableMaxHeight"
empty-text="没有粉丝勋章"
@select="handleSelect"
@select-all="handleSelect"
@row-click="handleRowClick"
:row-key="(row: MedalInfoRow) => row.roomid.toString()"
>
<template v-if="!uiStore.uiConfig.medalInfoPanelSortMode">
<el-table-column type="selection" align="center" width="80" />
</template>
</el-table-column>
<el-table-column prop="nick_name" label="昵称" />
<el-table-column prop="medal_name" label="粉丝勋章" />
<el-table-column prop="medal_level" label="等级" width="80" sortable />
<el-table-column prop="roomid" label="房间号">
<template #default="scope">
<el-link
:href="'https://live.bilibili.com/' + scope.row.roomid + '?visit_id='"
rel="noreferrer"
type="primary"
target="_blank"
@click.stop
>
{{ scope.row.roomid }}
</el-link>
<template v-else>
<el-table-column type="index" align="center" width="80" />
</template>
</el-table-column>
</el-table>

<el-table-column prop="avatar" label="头像" width="100">
<template #default="scope">
<div class="avatar-wrap">
<el-image
:src="scope.row.avatar"
loading="lazy"
referrerpolicy="origin"
class="avatar"
>
<template #error>
<el-image
src="//i0.hdslb.com/bfs/face/member/noface.jpg"
referrerpolicy="origin"
class="avatar"
/>
</template>
</el-image>
</div>
</template>
</el-table-column>
<el-table-column prop="nick_name" label="昵称" />
<el-table-column prop="medal_name" label="粉丝勋章" />
<el-table-column prop="medal_level" label="等级" width="80" sortable />
<el-table-column prop="roomid" label="房间号">
<template #default="scope">
<el-link
:href="'https://live.bilibili.com/' + scope.row.roomid + '?visit_id='"
rel="noreferrer"
type="primary"
target="_blank"
@click.stop
>
{{ scope.row.roomid }}
</el-link>
</template>
</el-table-column>
</el-table>
</VueDraggable>
<template #footer>
<el-switch
:disabled="!config.medalTasks.isWhiteList"
v-model="uiStore.uiConfig.medalInfoPanelSortMode"
inactive-text="常规模式"
active-text="排序模式"
@change="(val: any) => !val && nextTick(() => initSelection(medalInfoTableData))"
/>
</template>
</el-dialog>
</div>
</template>
Expand Down
1 change: 0 additions & 1 deletion src/components/OtherTasks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,5 @@ const status = moduleStore.moduleStatus.DailyTasks.OtherTasks
</el-space>
</el-row>
<el-divider />
<!-- 说明 -->
</div>
</template>
3 changes: 2 additions & 1 deletion src/components/PanelAside.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { useUIStore } from '@/stores/useUIStore'
import type { MenuIndex } from '@/types'
const uiStore = useUIStore()
Expand Down Expand Up @@ -59,7 +60,7 @@ const items: MenuItem[] = [
:style="{ 'min-height': uiStore.scrollBarHeight }"
:collapse="uiStore.uiConfig.isCollapse"
unique-opened
@select="uiStore.setActiveMenuIndex"
@select="(index: string) => uiStore.setActiveMenuIndex(index as MenuIndex)"
id="aside-el-menu"
>
<template v-for="item in items">
Expand Down
Loading

0 comments on commit c3df561

Please sign in to comment.