mirror of
https://github.com/jiangrui1994/CloudSaver.git
synced 2026-01-11 23:58: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']
|
RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
RouterView: typeof import('vue-router')['RouterView']
|
RouterView: typeof import('vue-router')['RouterView']
|
||||||
SearchBar: typeof import('./src/components/SearchBar.vue')['default']
|
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 {
|
export interface ComponentCustomProperties {
|
||||||
vLoading: typeof import('element-plus/es')['ElLoadingDirective']
|
vLoading: typeof import('element-plus/es')['ElLoadingDirective']
|
||||||
|
|||||||
@@ -52,7 +52,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-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
|
>转存</el-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@@ -60,7 +66,10 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<div v-for="group in store.resources" :key="group.id" class="resource-group">
|
<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
|
<el-link
|
||||||
class="group-title"
|
class="group-title"
|
||||||
:href="`https://t.me/s/${group.id}`"
|
:href="`https://t.me/s/${group.id}`"
|
||||||
@@ -84,7 +93,7 @@
|
|||||||
</el-link>
|
</el-link>
|
||||||
|
|
||||||
<el-tooltip effect="dark" :content="group.displayList ? '收起' : '展开'" placement="top">
|
<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 }">
|
<el-icon :class="{ 'is-active': group.displayList }">
|
||||||
<ArrowDown />
|
<ArrowDown />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
@@ -156,7 +165,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-footer">
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -187,7 +202,7 @@ const store = useResourceStore();
|
|||||||
const showDetail = ref(false);
|
const showDetail = ref(false);
|
||||||
const currentResource = ref<ResourceItem | null>(null);
|
const currentResource = ref<ResourceItem | null>(null);
|
||||||
|
|
||||||
const emit = defineEmits(["save", "loadMore", "searchMovieforTag"]);
|
const emit = defineEmits(["save", "loadMore", "jump", "searchMovieforTag"]);
|
||||||
|
|
||||||
const handleSave = (resource: ResourceItem) => {
|
const handleSave = (resource: ResourceItem) => {
|
||||||
if (showDetail.value) {
|
if (showDetail.value) {
|
||||||
@@ -196,6 +211,10 @@ const handleSave = (resource: ResourceItem) => {
|
|||||||
emit("save", resource);
|
emit("save", resource);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleJump = (resource: ResourceItem) => {
|
||||||
|
emit("jump", resource);
|
||||||
|
};
|
||||||
|
|
||||||
const showResourceDetail = (resource: ResourceItem) => {
|
const showResourceDetail = (resource: ResourceItem) => {
|
||||||
currentResource.value = resource;
|
currentResource.value = resource;
|
||||||
showDetail.value = true;
|
showDetail.value = true;
|
||||||
@@ -244,10 +263,14 @@ const handleLoadMore = (channelId: string) => {
|
|||||||
backdrop-filter: var(--theme-blur);
|
backdrop-filter: var(--theme-blur);
|
||||||
-webkit-backdrop-filter: var(--theme-blur);
|
-webkit-backdrop-filter: var(--theme-blur);
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
border-radius: var(--theme-radius) var(--theme-radius) 0 0;
|
border-radius: var(--theme-radius);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
|
&.is-active {
|
||||||
|
border-radius: var(--theme-radius) var(--theme-radius) 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
.group-title {
|
.group-title {
|
||||||
@include flex-center;
|
@include flex-center;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
|
|||||||
@@ -78,7 +78,8 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="180">
|
<el-table-column label="操作" width="180">
|
||||||
<template #default="{ row }">
|
<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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -118,8 +119,7 @@ import { useUserSettingStore } from "@/stores/userSetting";
|
|||||||
const userStore = useUserSettingStore();
|
const userStore = useUserSettingStore();
|
||||||
|
|
||||||
const store = useResourceStore();
|
const store = useResourceStore();
|
||||||
|
const emit = defineEmits(["save", "loadMore", "searchMovieforTag", "jump"]);
|
||||||
const emit = defineEmits(["save", "loadMore", "searchMovieforTag"]);
|
|
||||||
|
|
||||||
const location = computed(() => window.location);
|
const location = computed(() => window.location);
|
||||||
|
|
||||||
@@ -127,6 +127,10 @@ const handleSave = (resource: Resource) => {
|
|||||||
emit("save", resource);
|
emit("save", resource);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleJump = (resource: Resource) => {
|
||||||
|
emit("jump", resource);
|
||||||
|
};
|
||||||
|
|
||||||
// 添加加载更多处理函数
|
// 添加加载更多处理函数
|
||||||
const handleLoadMore = (channelId: string) => {
|
const handleLoadMore = (channelId: string) => {
|
||||||
emit("loadMore", channelId);
|
emit("loadMore", channelId);
|
||||||
|
|||||||
@@ -50,9 +50,17 @@
|
|||||||
|
|
||||||
<!-- 转存按钮 -->
|
<!-- 转存按钮 -->
|
||||||
<div class="info__action">
|
<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>
|
||||||
|
<van-button
|
||||||
|
v-if="item.isSupportSave"
|
||||||
|
type="primary"
|
||||||
|
size="mini"
|
||||||
|
round
|
||||||
|
@click="handleSave(item)"
|
||||||
|
>转存</van-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -74,6 +82,7 @@ const props = defineProps<{
|
|||||||
// 事件定义
|
// 事件定义
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: "save", resource: ResourceItem): void;
|
(e: "save", resource: ResourceItem): void;
|
||||||
|
(e: "jump", resource: ResourceItem): void;
|
||||||
(e: "searchMovieforTag", tag: string): void;
|
(e: "searchMovieforTag", tag: string): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
@@ -100,6 +109,9 @@ const handleSave = (resource: ResourceItem) => {
|
|||||||
emit("save", resource);
|
emit("save", resource);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleJump = (resource: ResourceItem) => {
|
||||||
|
emit("jump", resource);
|
||||||
|
};
|
||||||
const openUrl = (url: string) => {
|
const openUrl = (url: string) => {
|
||||||
window.open(url);
|
window.open(url);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -128,7 +128,16 @@ export const useResourceStore = defineStore("resource", {
|
|||||||
}
|
}
|
||||||
let { data = [] } = await resourceApi.search(keyword || "", channelId, lastMessageId);
|
let { data = [] } = await resourceApi.search(keyword || "", channelId, lastMessageId);
|
||||||
this.keyword = keyword || "";
|
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) {
|
if (isLoadMore) {
|
||||||
const findedIndex = this.resources.findIndex((item) => item.id === data[0]?.id);
|
const findedIndex = this.resources.findIndex((item) => item.id === data[0]?.id);
|
||||||
if (findedIndex !== -1) {
|
if (findedIndex !== -1) {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export interface ResourceItem {
|
|||||||
cloudType: string;
|
cloudType: string;
|
||||||
messageId?: string;
|
messageId?: string;
|
||||||
isLastMessage?: boolean;
|
isLastMessage?: boolean;
|
||||||
|
isSupportSave?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Resource {
|
export interface Resource {
|
||||||
|
|||||||
@@ -56,6 +56,7 @@
|
|||||||
:is="userStore.displayStyle === 'table' ? ResourceTable : ResourceCard"
|
:is="userStore.displayStyle === 'table' ? ResourceTable : ResourceCard"
|
||||||
v-if="resourceStore.resources.length > 0"
|
v-if="resourceStore.resources.length > 0"
|
||||||
@load-more="handleLoadMore"
|
@load-more="handleLoadMore"
|
||||||
|
@jump="handleJump"
|
||||||
@search-moviefor-tag="searchMovieforTag"
|
@search-moviefor-tag="searchMovieforTag"
|
||||||
@save="handleSave"
|
@save="handleSave"
|
||||||
/>
|
/>
|
||||||
@@ -230,6 +231,10 @@ const handleLoadMore = (channelId: string) => {
|
|||||||
resourceStore.searchResources("", true, channelId);
|
resourceStore.searchResources("", true, channelId);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleJump = (resource: ResourceItem) => {
|
||||||
|
window.open(resource.cloudLinks[0], "_blank");
|
||||||
|
};
|
||||||
|
|
||||||
const searchMovieforTag = (tag: string) => {
|
const searchMovieforTag = (tag: string) => {
|
||||||
router.push({ path: "/resource", query: { keyword: tag } });
|
router.push({ path: "/resource", query: { keyword: tag } });
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
<ResourceCard
|
<ResourceCard
|
||||||
:current-channel-id="currentTab"
|
:current-channel-id="currentTab"
|
||||||
@save="handleSave"
|
@save="handleSave"
|
||||||
|
@jump="handleJump"
|
||||||
@search-moviefor-tag="searchMovieforTag"
|
@search-moviefor-tag="searchMovieforTag"
|
||||||
/>
|
/>
|
||||||
</van-tab>
|
</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) => {
|
const handleFolderSelect = (folders: Folder[] | null) => {
|
||||||
if (!currentResource.value) return;
|
if (!currentResource.value) return;
|
||||||
currentFolderPath.value = folders;
|
currentFolderPath.value = folders;
|
||||||
|
|||||||
Reference in New Issue
Block a user