Commit c9eb219e authored by chenqikuai's avatar chenqikuai

refactor:藏品列表重命名、藏品类型更新、藏品管理菜单更新

parent a0092a16
...@@ -9,19 +9,19 @@ export const columns = [ ...@@ -9,19 +9,19 @@ export const columns = [
{ {
label: "发行时间", label: "发行时间",
prop: "", prop: "",
width: 200, width: 250,
slotName: "time", slotName: "time",
}, },
{ {
label: "发行状态", label: "发行状态",
prop: "", prop: "",
slotName: "status", slotName: "status",
width: 180, width: 200,
}, },
{ {
label: "操作", label: "操作",
prop: "", prop: "",
slotName: "transfer", slotName: "transfer",
width: 70, width: 100,
}, },
] as iTableColumn[]; ] as iTableColumn[];
...@@ -8,26 +8,21 @@ export const columns = [ ...@@ -8,26 +8,21 @@ export const columns = [
slotName: "name", slotName: "name",
}, },
{ {
label: "通证标识",
prop: "identifier",
width: 300,
},
{
label: "发行时间", label: "发行时间",
prop: "create_time", prop: "create_time",
slotName: "create_time", slotName: "create_time",
width: 200, width: 250,
}, },
{ {
label: "发行状态", label: "发行状态",
prop: "", prop: "",
slotName: "status", slotName: "status",
width: 180, width: 200,
}, },
{ {
label: "操作", label: "操作",
slotName: "transfer", slotName: "transfer",
prop: "", prop: "",
width: 70, width: 100,
}, },
] as iTableColumn[]; ] as iTableColumn[];
...@@ -3,20 +3,8 @@ ...@@ -3,20 +3,8 @@
<div class="flex flex-col w-full h-full"> <div class="flex flex-col w-full h-full">
<div class="flex items-center flex-shrink-0"> <div class="flex items-center flex-shrink-0">
<Search <Search
:model-value=" :model-value="currentSearchStr"
activedMenu === eCollectionType.picture @update:model-value="handleCurrentSearchStrChange"
? searchStrOfPicture
: searchStrOfAlbum
"
@update:model-value="
(v) => {
if (activedMenu === eCollectionType.picture) {
searchStrOfPicture = v;
} else {
searchStrOfAlbum = v;
}
}
"
placeholder="搜索" placeholder="搜索"
></Search> ></Search>
<Avatar class="ml-7"></Avatar> <Avatar class="ml-7"></Avatar>
...@@ -83,26 +71,26 @@ ...@@ -83,26 +71,26 @@
></syMenu> ></syMenu>
<div class="flex-grow overflow-hidden relative"> <div class="flex-grow overflow-hidden relative">
<PictureTable <CopyrightTable
v-if="tableDataOfPicture.length !== 0" v-if="tableDataOfPicture.length !== 0"
ref="pictureTableRef" ref="copyrightTableRef"
v-show="activedMenu === eCollectionType.picture" v-show="activedMenu === eCollectionType.copright"
:active="activedMenu === eCollectionType.picture" :active="activedMenu === eCollectionType.copright"
:table-data="tableDataOfPicture" :table-data="tableDataOfPicture"
:loading="loadingOfPicture" :loading="loadingOfPicture"
@scroll-to-end="fetchNextPageOfPicture" @scroll-to-end="fetchNextPageOfPicture"
@transferExecuted="handleTransferExecuted" @transferExecuted="handleTransferExecuted"
></PictureTable> ></CopyrightTable>
<Empty <Empty
v-if=" v-if="
activedMenu === eCollectionType.picture && activedMenu === eCollectionType.copright &&
!loadingOfPicture && !loadingOfPicture &&
tableDataOfPicture.length === 0 tableDataOfPicture.length === 0
" "
class="absolute top-1/3 left-1/2 transform -translate-x-1/2 -translate-y-1/2" class="absolute top-1/3 left-1/2 transform -translate-x-1/2 -translate-y-1/2"
> >
{{ {{
searchingStrOfPicture === "" debouncedSearchStrOfCopyright === ""
? "暂无数据" ? "暂无数据"
: "没有找到匹配结果,尝试其他关键词搜索" : "没有找到匹配结果,尝试其他关键词搜索"
}} }}
...@@ -125,7 +113,7 @@ ...@@ -125,7 +113,7 @@
class="absolute top-1/3 left-1/2 transform -translate-x-1/2 -translate-y-1/2" class="absolute top-1/3 left-1/2 transform -translate-x-1/2 -translate-y-1/2"
> >
{{ {{
searchingStrOfAlbum === "" debouncedSearchStrOfAlbum === ""
? "暂无数据" ? "暂无数据"
: "没有找到匹配结果,尝试其他关键词搜索" : "没有找到匹配结果,尝试其他关键词搜索"
}} }}
...@@ -135,7 +123,7 @@ ...@@ -135,7 +123,7 @@
</LayoutVue> </LayoutVue>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onBeforeMount, ref, watch } from "vue"; import { computed, onBeforeMount, ref, watch } from "vue";
import { GO_URLS, syButton, syMenu } from "cqk-sy-ui"; import { GO_URLS, syButton, syMenu } from "cqk-sy-ui";
import LayoutVue from "@/components/Layout.vue"; import LayoutVue from "@/components/Layout.vue";
...@@ -143,7 +131,7 @@ import Search from "@/components/Search/index.vue"; ...@@ -143,7 +131,7 @@ import Search from "@/components/Search/index.vue";
import Avatar from "@/components/Avatar/index.vue"; import Avatar from "@/components/Avatar/index.vue";
import Title from "@/components/Title.vue"; import Title from "@/components/Title.vue";
import Icon from "@/components/Icon/index.vue"; import Icon from "@/components/Icon/index.vue";
import PictureTable from "./components/PictureTable/index.vue"; import CopyrightTable from "./components/CopyrightTable/index.vue";
import AlbumTable from "./components/AlbumTable/index.vue"; import AlbumTable from "./components/AlbumTable/index.vue";
import { eCollectionType } from "../PassMaker/types"; import { eCollectionType } from "../PassMaker/types";
...@@ -157,23 +145,46 @@ import Empty from "@/components/Empty/index.vue"; ...@@ -157,23 +145,46 @@ import Empty from "@/components/Empty/index.vue";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import { router } from "@/router"; import { router } from "@/router";
const searchStrOfPicture = ref(""); const searchStrOfCopyright = ref("");
const searchStrOfDerivatives = ref("");
const searchStrOfAlbum = ref(""); const searchStrOfAlbum = ref("");
const searchingStrOfPicture = ref(""); const debouncedSearchStrOfCopyright = ref("");
const searchingStrOfAlbum = ref(""); const debouncedSearchStrOfDerivatives = ref("");
const debouncedSearchStrOfAlbum = ref("");
const pictureTableRef = ref<InstanceType<typeof PictureTable>>(); const copyrightTableRef = ref<InstanceType<typeof CopyrightTable>>();
const activedMenu = ref(eCollectionType.picture); const activedMenu = ref(eCollectionType.copright);
const menuList = [ const menuList = [
{ label: "藏品列表", value: eCollectionType.picture }, { label: "版权", value: eCollectionType.copright },
{ label: "专辑列表", value: eCollectionType.album }, { label: "衍生品", value: eCollectionType.derivatives },
{ label: "专辑", value: eCollectionType.album },
]; ];
const currentSearchStr = computed(() => {
if (activedMenu.value === eCollectionType.copright) {
return searchStrOfCopyright.value;
} else if (activedMenu.value === eCollectionType.derivatives) {
return searchStrOfDerivatives.value;
} else if (activedMenu.value === eCollectionType.album) {
return searchStrOfAlbum.value;
}
return "";
});
function handleCurrentSearchStrChange(str: string) {
if (activedMenu.value === eCollectionType.copright) {
searchStrOfCopyright.value = str;
} else if (activedMenu.value === eCollectionType.derivatives) {
searchStrOfDerivatives.value = str;
} else if (activedMenu.value === eCollectionType.album) {
searchStrOfAlbum.value = str;
}
}
const route = useRoute(); const route = useRoute();
onBeforeMount(() => { onBeforeMount(() => {
activedMenu.value = activedMenu.value =
(route.query.type as eCollectionType) || eCollectionType.picture; (route.query.type as eCollectionType) || eCollectionType.copright;
}); });
watch(activedMenu, (menu) => { watch(activedMenu, (menu) => {
...@@ -242,7 +253,7 @@ async function fetchPictureData({ ...@@ -242,7 +253,7 @@ async function fetchPictureData({
params: { params: {
page: page, page: page,
page_size: page_size, page_size: page_size,
name: searchStrOfPicture.value, name: searchStrOfCopyright.value,
}, },
}); });
return { return {
...@@ -252,10 +263,10 @@ async function fetchPictureData({ ...@@ -252,10 +263,10 @@ async function fetchPictureData({
} }
watchDebounced( watchDebounced(
searchStrOfPicture, searchStrOfCopyright,
() => { () => {
refetchPicture().then(() => { refetchPicture().then(() => {
searchingStrOfPicture.value = searchStrOfPicture.value; debouncedSearchStrOfCopyright.value = searchStrOfCopyright.value;
}); });
}, },
{ debounce: watchStrChangeDebounceTime } { debounce: watchStrChangeDebounceTime }
...@@ -265,19 +276,19 @@ watchDebounced( ...@@ -265,19 +276,19 @@ watchDebounced(
searchStrOfAlbum, searchStrOfAlbum,
() => { () => {
refetchAlbum().then(() => { refetchAlbum().then(() => {
searchingStrOfAlbum.value = searchStrOfAlbum.value; debouncedSearchStrOfAlbum.value = searchStrOfAlbum.value;
}); });
}, },
{ debounce: watchStrChangeDebounceTime } { debounce: watchStrChangeDebounceTime }
); );
function refetchPicture() { function refetchPicture() {
pictureTableRef.value?.scrollTo(0, 0); copyrightTableRef.value?.scrollTo(0, 0);
return __refetchOfPicture(); return __refetchOfPicture();
} }
function refetchAlbum() { function refetchAlbum() {
pictureTableRef.value?.scrollTo(0, 0); copyrightTableRef.value?.scrollTo(0, 0);
return __refetchOfAlbum(); return __refetchOfAlbum();
} }
......
<template> <template>
<HandleAllKindsOfType <HandleAllKindsOfType
v-if="activedMenu === eCollectionType.picture" v-if="activedMenu === eCollectionType.derivatives"
type="uploadPicture" type="uploadPicture"
:file="fileData" :file="fileData"
@clear=" @clear="
......
export enum eCollectionType { export enum eCollectionType {
picture = "picture", /**版权 */
copright = "copright",
/**衍生品 */
derivatives = "derivatives",
/**专辑 */
album = "album", album = "album",
} }
...@@ -85,7 +85,7 @@ const fetchTableData = async ({ ...@@ -85,7 +85,7 @@ const fetchTableData = async ({
}) => { }) => {
// 当前状态 // 当前状态
let res: any; let res: any;
if (type.value === eCollectionType.picture) { if (type.value === eCollectionType.derivatives) {
res = await $ajax({ res = await $ajax({
type: "get", type: "get",
url: GO_URLS.transferList, url: GO_URLS.transferList,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment