upper Article type to timi-web
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { Article, ArticleRanking, ArticleView } from "@/types/Article";
|
||||
import { axios, Page, PageResult } from "timi-web";
|
||||
import { Article, ArticleView, axios, Page, PageResult } from "timi-web";
|
||||
import { ArticleRanking } from "@/types/Article.ts";
|
||||
|
||||
async function page(page: Page): Promise<PageResult<Article<any>>> {
|
||||
return axios.post("/article/list", page);
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { Article } from "@/types/Article";
|
||||
import { Article } from "timi-web";
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
list: Article<any>[]
|
||||
|
||||
@ -25,9 +25,8 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { CommentBizType, MarkdownView, SettingKey, SettingMapper, Time } from "timi-web";
|
||||
import { ArticleView, CommentBizType, MarkdownView, SettingKey, SettingMapper, Time } from "timi-web";
|
||||
import ArticleAPI from "@/api/ArticleAPI";
|
||||
import { ArticleView } from "@/types/Article";
|
||||
import { Comment } from "timi-tdesign-pc";
|
||||
|
||||
// 文章
|
||||
|
||||
@ -55,8 +55,19 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ArticleAttachType, ArticleMusicExtendData, ArticleView } from "@/types/Article.ts";
|
||||
import { CommentBizType, CommonAPI, Icon, MarkdownView, SettingKey, SettingMapper, Time, Toolkit } from "timi-web";
|
||||
import {
|
||||
ArticleAttachType,
|
||||
ArticleMusicExtendData,
|
||||
ArticleView,
|
||||
CommentBizType,
|
||||
CommonAPI,
|
||||
Icon,
|
||||
MarkdownView,
|
||||
SettingKey,
|
||||
SettingMapper,
|
||||
Time,
|
||||
Toolkit
|
||||
} from "timi-web";
|
||||
import { Comment } from "timi-tdesign-pc";
|
||||
|
||||
const props = defineProps<{
|
||||
@ -73,6 +84,7 @@ const articleTime = computed(() => {
|
||||
return "编辑于 " + Time.toPassedDateTime(article.value.updatedAt);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
});
|
||||
|
||||
// 专辑封面
|
||||
@ -87,7 +99,7 @@ const coverUrl = computed(() => {
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
})
|
||||
});
|
||||
|
||||
// 展开可播放媒体
|
||||
const activeMediaIndex = ref();
|
||||
|
||||
@ -13,8 +13,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { CommentBizType, MarkdownView, SettingKey, SettingMapper, Time } from "timi-web";
|
||||
import { ArticleView } from "@/types/Article";
|
||||
import { ArticleView, CommentBizType, MarkdownView, SettingKey, SettingMapper, Time } from "timi-web";
|
||||
import { Comment } from "timi-tdesign-pc";
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
@ -58,8 +58,19 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ArticleAttachType, ArticleSoftwareExtendData, ArticleView } from "@/types/Article.ts";
|
||||
import { CommentBizType, CommonAPI, IOSize, MarkdownView, SettingKey, SettingMapper, Time, Toolkit } from "timi-web";
|
||||
import {
|
||||
ArticleAttachType,
|
||||
ArticleSoftwareExtendData,
|
||||
ArticleView,
|
||||
CommentBizType,
|
||||
CommonAPI,
|
||||
IOSize,
|
||||
MarkdownView,
|
||||
SettingKey,
|
||||
SettingMapper,
|
||||
Time,
|
||||
Toolkit
|
||||
} from "timi-web";
|
||||
import { Comment } from "timi-tdesign-pc";
|
||||
|
||||
const props = defineProps<{
|
||||
@ -76,6 +87,7 @@ const articleTime = computed(() => {
|
||||
return "编辑于 " + Time.toPassedDateTime(article.value.updatedAt);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
});
|
||||
|
||||
const coverUrl = computed(() => {
|
||||
@ -89,7 +101,7 @@ const coverUrl = computed(() => {
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
@ -1,57 +1,4 @@
|
||||
import { AttachmentView, Model } from "timi-web";
|
||||
|
||||
// 文章
|
||||
export type Article<E extends ArticleMusicExtendData | ArticleSoftwareExtendData> = {
|
||||
title?: string;
|
||||
type: ArticleType;
|
||||
digest?: string;
|
||||
data?: string;
|
||||
extendData?: E;
|
||||
reads: number;
|
||||
likes: number;
|
||||
showComment: boolean;
|
||||
canComment: boolean;
|
||||
canRanking: boolean;
|
||||
} & Model;
|
||||
|
||||
export type ArticleView<E extends ArticleMusicExtendData | ArticleSoftwareExtendData> = {
|
||||
comments?: number;
|
||||
clazz: ArticleClass;
|
||||
labels: ArticleLabel[];
|
||||
attachmentList: AttachmentView[];
|
||||
} & Article<E>;
|
||||
|
||||
export enum ArticleType {
|
||||
|
||||
/** 公版 */
|
||||
PUBLIC,
|
||||
|
||||
/** 音乐 */
|
||||
MUSIC,
|
||||
|
||||
/** 软件 */
|
||||
SOFTWARE
|
||||
}
|
||||
|
||||
export enum ArticleAttachType {
|
||||
|
||||
COVER,
|
||||
}
|
||||
|
||||
// 文章分类
|
||||
export type ArticleClass = {
|
||||
name?: string;
|
||||
isOther?: boolean;
|
||||
order?: number;
|
||||
|
||||
count?: number;
|
||||
} & Model;
|
||||
|
||||
// 文章标签
|
||||
export type ArticleLabel = {
|
||||
name?: string;
|
||||
count?: number;
|
||||
} & Model;
|
||||
import { Model } from "timi-web";
|
||||
|
||||
// 每周排行
|
||||
export type ArticleRanking = {
|
||||
@ -59,53 +6,3 @@ export type ArticleRanking = {
|
||||
count?: number;
|
||||
recentAt?: number;
|
||||
} & Model;
|
||||
|
||||
export type ArticleMusicExtendData = {
|
||||
title: string;
|
||||
list: ArticleMusicItem[];
|
||||
info: {
|
||||
key: string;
|
||||
value: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
export type ArticleSoftwareExtendData = {
|
||||
url?: string;
|
||||
downloads: ArticleSoftwareDownload[];
|
||||
format: string;
|
||||
runtime: ArticleSoftwareRuntime[];
|
||||
size: number;
|
||||
version: string;
|
||||
password?: string;
|
||||
}
|
||||
|
||||
export enum ArticleSoftwareDownloadType {
|
||||
|
||||
TIMI_MONGO,
|
||||
|
||||
TIMI_COS,
|
||||
|
||||
URL
|
||||
}
|
||||
|
||||
export enum ArticleSoftwareRuntime {
|
||||
|
||||
JVM,
|
||||
|
||||
WINDOWS,
|
||||
|
||||
LINUX,
|
||||
|
||||
MAC_OS
|
||||
}
|
||||
|
||||
export type ArticleSoftwareDownload = {
|
||||
type: ArticleSoftwareDownloadType;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export type ArticleMusicItem = {
|
||||
title: string;
|
||||
audio?: string;
|
||||
video?: string;
|
||||
}
|
||||
|
||||
@ -37,13 +37,12 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { Icon } from "timi-web";
|
||||
import { ArticleView, Icon } from "timi-web";
|
||||
import ArticleAPI from "@/api/ArticleAPI";
|
||||
import ArticleAbout from "@/components/article/template/ArticleAbout.vue";
|
||||
import ArticleMusic from "@/components/article/template/ArticleMusic.vue";
|
||||
import ArticlePublic from "@/components/article/template/ArticlePublic.vue";
|
||||
import ArticleSoftware from "@/components/article/template/ArticleSoftware.vue";
|
||||
import { ArticleView } from "@/types/Article";
|
||||
import { type Component } from "vue";
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
@ -68,9 +68,9 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { deviceStore, Icon, Page, PageResult, Toolkit } from "timi-web";
|
||||
import { Article, deviceStore, Icon, Page, PageResult, Toolkit } from "timi-web";
|
||||
import ArticleAPI from "@/api/ArticleAPI";
|
||||
import { Article, ArticleRanking } from "@/types/Article";
|
||||
import { ArticleRanking } from "@/types/Article";
|
||||
import ArticleList from "@/components/article/ArticleList.vue";
|
||||
import { Friend } from "@/types/Friend.ts";
|
||||
import BlogAPI from "@/api/BlogAPI.ts";
|
||||
|
||||
Reference in New Issue
Block a user