2023-12-06 02:07:39 +00:00
|
|
|
<template>
|
2023-12-07 09:53:01 +00:00
|
|
|
<div v-if="loading">
|
|
|
|
<v-row justify="center">
|
2023-12-07 09:54:25 +00:00
|
|
|
<v-col cols="12" md="4" xl="2" v-for="n in 3" :key="n">
|
2023-12-07 10:50:15 +00:00
|
|
|
<v-skeleton-loader
|
|
|
|
v-for="n in 2"
|
|
|
|
:key="n"
|
2023-12-07 09:53:01 +00:00
|
|
|
class="mx-auto border mt-3"
|
2023-12-07 07:09:42 +00:00
|
|
|
max-width="300"
|
|
|
|
type="image, article"
|
|
|
|
></v-skeleton-loader>
|
|
|
|
</v-col>
|
|
|
|
</v-row>
|
|
|
|
</div>
|
2023-12-07 10:50:15 +00:00
|
|
|
<div v-else>
|
|
|
|
<v-row>
|
|
|
|
<v-col cols="12" md="4" xl="2" v-for="document in documents.Data" :key="document.id">
|
|
|
|
<v-card class="mt-3">
|
|
|
|
<v-card-title>{{ document.Title }}</v-card-title>
|
|
|
|
<v-card-subtitle>{{
|
|
|
|
document.Chunked ? "分块的文档" : "还没有处理"
|
|
|
|
}}</v-card-subtitle>
|
|
|
|
<v-card-subtitle>
|
|
|
|
{{ new Date(document.CreatedAt).toLocaleString() }}
|
|
|
|
</v-card-subtitle>
|
|
|
|
<v-card-text>{{ document.content }}</v-card-text>
|
|
|
|
<v-card-actions>
|
|
|
|
<v-btn text color="primary">详情</v-btn>
|
|
|
|
<v-btn text color="secondary">编辑</v-btn>
|
|
|
|
</v-card-actions>
|
|
|
|
</v-card>
|
|
|
|
</v-col>
|
|
|
|
</v-row>
|
|
|
|
|
|
|
|
</div>
|
2023-12-07 09:53:01 +00:00
|
|
|
<div v-if="documents.Total == 0">
|
|
|
|
<v-alert text="看样子你还没有创建任何文档。"></v-alert>
|
|
|
|
</div>
|
|
|
|
|
2023-12-07 10:50:15 +00:00
|
|
|
<div class="text-center">
|
|
|
|
<v-container>
|
|
|
|
<v-row justify="center">
|
|
|
|
<v-col cols="8">
|
|
|
|
<v-container class="max-width">
|
|
|
|
<v-pagination
|
|
|
|
v-model="page"
|
|
|
|
class="my-4"
|
|
|
|
:length="documents.Total"
|
|
|
|
:disabled="loading"
|
|
|
|
@update:model-value="load"
|
|
|
|
></v-pagination>
|
|
|
|
</v-container>
|
|
|
|
</v-col>
|
|
|
|
</v-row>
|
|
|
|
</v-container>
|
|
|
|
</div>
|
2023-12-07 09:53:01 +00:00
|
|
|
|
2023-12-07 10:50:15 +00:00
|
|
|
<v-btn class="mt-3" @click="goto_create_document">创建</v-btn>
|
2023-12-06 02:07:39 +00:00
|
|
|
</template>
|
|
|
|
|
2023-12-07 06:39:34 +00:00
|
|
|
<script setup>
|
2023-12-07 07:09:42 +00:00
|
|
|
import { document } from "@/plugins/api";
|
|
|
|
import router from "@/router";
|
|
|
|
import { ref } from "vue";
|
2023-12-07 06:39:34 +00:00
|
|
|
|
2023-12-07 07:09:42 +00:00
|
|
|
const libraryId = router.currentRoute.value.params.LibraryId;
|
|
|
|
const page = ref(1);
|
2023-12-07 09:53:01 +00:00
|
|
|
const documents = ref({});
|
2023-12-07 07:09:42 +00:00
|
|
|
const loading = ref(false);
|
2023-12-07 06:58:43 +00:00
|
|
|
|
|
|
|
function load() {
|
2023-12-07 07:09:42 +00:00
|
|
|
loading.value = true;
|
2023-12-07 06:58:43 +00:00
|
|
|
|
2023-12-07 07:09:42 +00:00
|
|
|
document
|
2023-12-07 09:53:01 +00:00
|
|
|
.libraryLibraryIdDocumentsGet(page.value, libraryId)
|
2023-12-07 07:09:42 +00:00
|
|
|
.then((r) => {
|
|
|
|
documents.value = r.data;
|
|
|
|
})
|
|
|
|
.finally(() => {
|
|
|
|
loading.value = false;
|
|
|
|
});
|
2023-12-07 06:58:43 +00:00
|
|
|
}
|
2023-12-07 06:39:34 +00:00
|
|
|
|
2023-12-07 07:09:42 +00:00
|
|
|
load();
|
|
|
|
console.log(libraryId);
|
2023-12-07 09:53:01 +00:00
|
|
|
|
|
|
|
function goto_create_document() {
|
|
|
|
router.push({
|
|
|
|
name: "library.documents.create",
|
|
|
|
params: {
|
2023-12-07 10:50:15 +00:00
|
|
|
LibraryId: libraryId,
|
|
|
|
},
|
|
|
|
});
|
2023-12-07 09:53:01 +00:00
|
|
|
}
|
2023-12-07 06:39:34 +00:00
|
|
|
</script>
|