basic-card.vue
3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<script setup lang="ts">
import { Activity } from "@/types/activity";
import { computed } from "vue";
import { User } from "@/types/user";
import UserTag from "@/views/demo-show/components/user-tag.vue";
import { unionBy } from "lodash";
import useActivityApi from "@/api/activity";
const props = defineProps<{ data: Activity }>();
const links = computed(() => {
return unionBy(props.data.links || [], "id");
});
const inSideLyricist = computed(
(): User[] => links.value?.filter((item: User) => props.data.expand?.lyricist?.ids?.indexOf(item.id) !== -1) || []
);
const outSideLyricist = computed(() => props.data.expand?.lyricist?.supplement || []);
const inSideComposer = computed(
(): User[] => links.value?.filter((item: User) => props.data.expand?.composer?.ids?.indexOf(item.id) !== -1) || []
);
const outSideComposer = computed(() => props.data?.expand?.composer?.supplement || []);
</script>
<template>
<a-card v-show="data" :bordered="false">
<a-form :model="data" auto-label-width label-align="left">
<a-layout>
<a-layout-sider :width="130" style="background: none; box-shadow: none; padding-top: 6px">
<a-image show-loader :height="130" :width="130" :src="data.cover" />
</a-layout-sider>
<a-layout-content style="margin-left: 16px">
<a-form-item :hide-label="true">
<div class="title">{{ data.song_name }}</div>
<a-tag v-for="item in data.tags" :key="item.id" size="small" style="margin-right: 5px">
{{ item.name }}
</a-tag>
<span style="font-size: 10px">
{{ useActivityApi.statusOption.find((item) => item.value === data.status)?.label }}
</span>
</a-form-item>
<a-form-item :label-col-style="{ flex: 0 }" :wrapper-col-style="{ flex: 'unset', width: 'inherit' }"
:show-colon="true" label="关联用户">
<div v-if="data?.user">{{ data.user?.nick_name }}</div>
<div v-else>无</div>
</a-form-item>
<a-form-item style="margin-bottom: 0 !important" hide-label>
<a-form-item :label-col-style="{ flex: 0 }" :show-colon="true" label="作词">
<user-tag v-for="item in inSideLyricist" :key="item.id" :user="{ nick_name: item.nick_name }"
style="margin-right: 5px" />
<user-tag v-for="item in outSideLyricist" :key="`lyricist-${item}`" :user="{ nick_name: item }"
style="margin-right: 5px" />
</a-form-item>
<a-form-item :label-col-style="{ flex: 0 }" :show-colon="true" label="作曲">
<user-tag v-for="item in inSideComposer" :key="item.id" :user="{ nick_name: item.nick_name }"
style="margin-right: 5px" />
<user-tag v-for="item in outSideComposer" :key="`lyricist-${item}`" :user="{ nick_name: item }"
style="margin-right: 5px" />
</a-form-item>
</a-form-item>
<a-form-item style="margin-bottom: 0 !important" :label-col-style="{ flex: 0 }" :show-colon="true"
label="创建信息">
<span v-if="data?.user" style="margin-right: 8px">{{ data.user.nick_name }}</span>
<span style="margin-right: 8px">{{ data.created_at }} </span>
</a-form-item>
</a-layout-content>
</a-layout>
</a-form>
</a-card>
</template>
<style lang="less" scoped>
.arco-form-item {
margin-bottom: 10px;
}
.arco-form-item-label-col {
flex: 0;
}
.title {
font-size: 16px;
font-weight: bold;
margin-right: 8px;
}
.right {
margin: 0 20px;
min-width: 600px;
}
</style>