mirror of
https://github.com/jiangrui1994/CloudSaver.git
synced 2026-01-10 15:18:46 +08:00
feat:增加跳转按钮
This commit is contained in:
18
frontend/components.d.ts
vendored
18
frontend/components.d.ts
vendored
@@ -43,6 +43,24 @@ declare module 'vue' {
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
SearchBar: typeof import('./src/components/SearchBar.vue')['default']
|
||||
VanBackTop: typeof import('vant/es')['BackTop']
|
||||
VanButton: typeof import('vant/es')['Button']
|
||||
VanCell: typeof import('vant/es')['Cell']
|
||||
VanCellGroup: typeof import('vant/es')['CellGroup']
|
||||
VanCheckbox: typeof import('vant/es')['Checkbox']
|
||||
VanCheckboxGroup: typeof import('vant/es')['CheckboxGroup']
|
||||
VanEmpty: typeof import('vant/es')['Empty']
|
||||
VanIcon: typeof import('vant/es')['Icon']
|
||||
VanImage: typeof import('vant/es')['Image']
|
||||
VanLoading: typeof import('vant/es')['Loading']
|
||||
VanOverlay: typeof import('vant/es')['Overlay']
|
||||
VanPopup: typeof import('vant/es')['Popup']
|
||||
VanSearch: typeof import('vant/es')['Search']
|
||||
VanTab: typeof import('vant/es')['Tab']
|
||||
VanTabbar: typeof import('vant/es')['Tabbar']
|
||||
VanTabbarItem: typeof import('vant/es')['TabbarItem']
|
||||
VanTabs: typeof import('vant/es')['Tabs']
|
||||
VanTag: typeof import('vant/es')['Tag']
|
||||
}
|
||||
export interface ComponentCustomProperties {
|
||||
vLoading: typeof import('element-plus/es')['ElLoadingDirective']
|
||||
|
||||
@@ -52,7 +52,13 @@
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="currentResource && handleSave(currentResource)"
|
||||
<el-button type="primary" plain @click="currentResource && handleJump(currentResource)"
|
||||
>跳转</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="currentResource?.isSupportSave"
|
||||
type="primary"
|
||||
@click="currentResource && handleSave(currentResource)"
|
||||
>转存</el-button
|
||||
>
|
||||
</div>
|
||||
@@ -60,7 +66,10 @@
|
||||
</el-dialog>
|
||||
|
||||
<div v-for="group in store.resources" :key="group.id" class="resource-group">
|
||||
<div class="group-header" @click="group.displayList = !group.displayList">
|
||||
<div
|
||||
:class="{ 'group-header': true, 'is-active': group.displayList }"
|
||||
@click="group.displayList = !group.displayList"
|
||||
>
|
||||
<el-link
|
||||
class="group-title"
|
||||
:href="`https://t.me/s/${group.id}`"
|
||||
@@ -84,7 +93,7 @@
|
||||
</el-link>
|
||||
|
||||
<el-tooltip effect="dark" :content="group.displayList ? '收起' : '展开'" placement="top">
|
||||
<el-button class="toggle-btn" type="text" @click="group.displayList = !group.displayList">
|
||||
<el-button class="toggle-btn" type="text">
|
||||
<el-icon :class="{ 'is-active': group.displayList }">
|
||||
<ArrowDown />
|
||||
</el-icon>
|
||||
@@ -156,7 +165,13 @@
|
||||
</div>
|
||||
|
||||
<div class="card-footer">
|
||||
<el-button type="primary" @click="handleSave(resource)">转存</el-button>
|
||||
<el-button type="primary" plain @click="handleJump(resource)">跳转</el-button>
|
||||
<el-button
|
||||
v-if="resource.isSupportSave"
|
||||
type="primary"
|
||||
@click="handleSave(resource)"
|
||||
>转存</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -187,7 +202,7 @@ const store = useResourceStore();
|
||||
const showDetail = ref(false);
|
||||
const currentResource = ref<ResourceItem | null>(null);
|
||||
|
||||
const emit = defineEmits(["save", "loadMore", "searchMovieforTag"]);
|
||||
const emit = defineEmits(["save", "loadMore", "jump", "searchMovieforTag"]);
|
||||
|
||||
const handleSave = (resource: ResourceItem) => {
|
||||
if (showDetail.value) {
|
||||
@@ -196,6 +211,10 @@ const handleSave = (resource: ResourceItem) => {
|
||||
emit("save", resource);
|
||||
};
|
||||
|
||||
const handleJump = (resource: ResourceItem) => {
|
||||
emit("jump", resource);
|
||||
};
|
||||
|
||||
const showResourceDetail = (resource: ResourceItem) => {
|
||||
currentResource.value = resource;
|
||||
showDetail.value = true;
|
||||
@@ -244,10 +263,14 @@ const handleLoadMore = (channelId: string) => {
|
||||
backdrop-filter: var(--theme-blur);
|
||||
-webkit-backdrop-filter: var(--theme-blur);
|
||||
z-index: 10;
|
||||
border-radius: var(--theme-radius) var(--theme-radius) 0 0;
|
||||
border-radius: var(--theme-radius);
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
|
||||
&.is-active {
|
||||
border-radius: var(--theme-radius) var(--theme-radius) 0 0;
|
||||
}
|
||||
|
||||
.group-title {
|
||||
@include flex-center;
|
||||
gap: 12px;
|
||||
|
||||
@@ -78,7 +78,8 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="180">
|
||||
<template #default="{ row }">
|
||||
<el-button @click="handleSave(row)">转存</el-button>
|
||||
<el-button type="primary" plain @click="handleJump(row)">跳转</el-button>
|
||||
<el-button v-if="row.isSupportSave" @click="handleSave(row)">转存</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -118,8 +119,7 @@ import { useUserSettingStore } from "@/stores/userSetting";
|
||||
const userStore = useUserSettingStore();
|
||||
|
||||
const store = useResourceStore();
|
||||
|
||||
const emit = defineEmits(["save", "loadMore", "searchMovieforTag"]);
|
||||
const emit = defineEmits(["save", "loadMore", "searchMovieforTag", "jump"]);
|
||||
|
||||
const location = computed(() => window.location);
|
||||
|
||||
@@ -127,6 +127,10 @@ const handleSave = (resource: Resource) => {
|
||||
emit("save", resource);
|
||||
};
|
||||
|
||||
const handleJump = (resource: Resource) => {
|
||||
emit("jump", resource);
|
||||
};
|
||||
|
||||
// 添加加载更多处理函数
|
||||
const handleLoadMore = (channelId: string) => {
|
||||
emit("loadMore", channelId);
|
||||
|
||||
@@ -50,9 +50,17 @@
|
||||
|
||||
<!-- 转存按钮 -->
|
||||
<div class="info__action">
|
||||
<van-button type="primary" size="mini" round @click="handleSave(item)">
|
||||
转存
|
||||
<van-button type="primary" size="mini" round plain @click="handleJump(item)">
|
||||
跳转
|
||||
</van-button>
|
||||
<van-button
|
||||
v-if="item.isSupportSave"
|
||||
type="primary"
|
||||
size="mini"
|
||||
round
|
||||
@click="handleSave(item)"
|
||||
>转存</van-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -74,6 +82,7 @@ const props = defineProps<{
|
||||
// 事件定义
|
||||
const emit = defineEmits<{
|
||||
(e: "save", resource: ResourceItem): void;
|
||||
(e: "jump", resource: ResourceItem): void;
|
||||
(e: "searchMovieforTag", tag: string): void;
|
||||
}>();
|
||||
|
||||
@@ -100,6 +109,9 @@ const handleSave = (resource: ResourceItem) => {
|
||||
emit("save", resource);
|
||||
};
|
||||
|
||||
const handleJump = (resource: ResourceItem) => {
|
||||
emit("jump", resource);
|
||||
};
|
||||
const openUrl = (url: string) => {
|
||||
window.open(url);
|
||||
};
|
||||
|
||||
@@ -128,7 +128,16 @@ export const useResourceStore = defineStore("resource", {
|
||||
}
|
||||
let { data = [] } = await resourceApi.search(keyword || "", channelId, lastMessageId);
|
||||
this.keyword = keyword || "";
|
||||
data = data.filter((item) => item.list.length > 0);
|
||||
data = data
|
||||
.filter((item) => item.list.length > 0)
|
||||
.map((x) => ({
|
||||
...x,
|
||||
list: x.list.map((item) => ({
|
||||
...item,
|
||||
isSupportSave: CLOUD_DRIVES.some((drive) => drive.regex.test(item.cloudLinks[0])),
|
||||
})),
|
||||
}));
|
||||
console.log(data);
|
||||
if (isLoadMore) {
|
||||
const findedIndex = this.resources.findIndex((item) => item.id === data[0]?.id);
|
||||
if (findedIndex !== -1) {
|
||||
|
||||
@@ -11,6 +11,7 @@ export interface ResourceItem {
|
||||
cloudType: string;
|
||||
messageId?: string;
|
||||
isLastMessage?: boolean;
|
||||
isSupportSave?: boolean;
|
||||
}
|
||||
|
||||
export interface Resource {
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
:is="userStore.displayStyle === 'table' ? ResourceTable : ResourceCard"
|
||||
v-if="resourceStore.resources.length > 0"
|
||||
@load-more="handleLoadMore"
|
||||
@jump="handleJump"
|
||||
@search-moviefor-tag="searchMovieforTag"
|
||||
@save="handleSave"
|
||||
/>
|
||||
@@ -230,6 +231,10 @@ const handleLoadMore = (channelId: string) => {
|
||||
resourceStore.searchResources("", true, channelId);
|
||||
};
|
||||
|
||||
const handleJump = (resource: ResourceItem) => {
|
||||
window.open(resource.cloudLinks[0], "_blank");
|
||||
};
|
||||
|
||||
const searchMovieforTag = (tag: string) => {
|
||||
router.push({ path: "/resource", query: { keyword: tag } });
|
||||
};
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
<ResourceCard
|
||||
:current-channel-id="currentTab"
|
||||
@save="handleSave"
|
||||
@jump="handleJump"
|
||||
@search-moviefor-tag="searchMovieforTag"
|
||||
/>
|
||||
</van-tab>
|
||||
@@ -192,6 +193,10 @@ const handleSave = async (resource: ResourceItem) => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleJump = (resource: ResourceItem) => {
|
||||
window.open(resource.cloudLinks[0], "_blank");
|
||||
};
|
||||
|
||||
const handleFolderSelect = (folders: Folder[] | null) => {
|
||||
if (!currentResource.value) return;
|
||||
currentFolderPath.value = folders;
|
||||
|
||||
Reference in New Issue
Block a user