155 lines
3.7 KiB
Vue
Raw Normal View History

2021-12-20 13:36:54 +08:00
<template>
2021-12-21 10:06:03 +08:00
<!-- mask-closable 暂时是失效的不知道为啥 -->
<n-modal
class="go-modal-box"
2022-01-08 14:27:56 +08:00
v-model:show="modalShow"
@afterLeave="closeHandle"
2021-12-21 10:06:03 +08:00
>
<n-card hoverable size="small">
<div class="list-content">
<!-- 标题 -->
<n-space class="list-content-top go-px-0" justify="center">
<n-space>
<n-text>
{{ cardData?.title || '' }}
</n-text>
2021-12-20 13:36:54 +08:00
</n-space>
2021-12-21 10:06:03 +08:00
</n-space>
<!-- 顶部按钮 -->
<n-space class="list-content-top">
2022-02-26 17:38:24 +08:00
<MacOsControlBtn
2021-12-21 10:06:03 +08:00
:narrow="true"
:hidden="['close']"
@remove="closeHandle"
/>
</n-space>
<!-- 中间 -->
<div class="list-content-img">
<img
:src="
requireUrl('../assets/images/project', 'moke-20211219181327.png')
"
:alt="cardData?.title"
/>
2021-12-20 13:36:54 +08:00
</div>
2021-12-21 10:06:03 +08:00
</div>
<template #action>
<n-space class="list-footer" justify="space-between">
<n-text depth="3">
{{ $t('project.last_edit') }}:
2021-12-21 10:06:03 +08:00
<n-time :time="new Date()" format="yyyy-MM-dd hh:mm" />
</n-text>
<!-- 工具 -->
<n-space>
<n-text>
<n-badge
class="animation-twinkle"
dot
:color="cardData?.release ? '#34c749' : '#fcbc40'"
/>
{{
cardData?.release
? $t('project.release')
: $t('project.unreleased')
}}
2021-12-21 10:06:03 +08:00
</n-text>
2021-12-20 13:36:54 +08:00
2021-12-21 10:06:03 +08:00
<template v-for="item in fnBtnList" :key="item.key">
<n-tooltip placement="bottom" trigger="hover">
<template #trigger>
2021-12-23 12:17:25 +08:00
<n-button size="small" @click="handleSelect(item.key)">
2021-12-21 10:06:03 +08:00
<template #icon>
<component :is="item.icon" />
</template>
</n-button>
</template>
<component :is="item.label"></component>
2021-12-21 10:06:03 +08:00
</n-tooltip>
</template>
2021-12-20 13:36:54 +08:00
</n-space>
2021-12-21 10:06:03 +08:00
<!-- end -->
</n-space>
</template>
</n-card>
2021-12-20 13:36:54 +08:00
</n-modal>
</template>
<script setup lang="ts">
2022-01-08 14:27:56 +08:00
import { reactive } from 'vue'
import { renderIcon, renderLang, requireUrl } from '@/utils'
2021-12-20 13:36:54 +08:00
import { icon } from '@/plugins'
2022-02-26 17:38:24 +08:00
import { MacOsControlBtn } from '@/components/MacOsControlBtn'
2021-12-22 15:31:20 +08:00
2021-12-20 13:36:54 +08:00
const { HammerIcon } = icon.ionicons5
2021-12-23 12:17:25 +08:00
const emit = defineEmits(['close', 'edit'])
2021-12-20 13:36:54 +08:00
const props = defineProps({
2022-01-08 14:27:56 +08:00
modalShow: Boolean,
2021-12-20 13:36:54 +08:00
cardData: Object
})
2021-12-22 15:31:20 +08:00
const fnBtnList = reactive([
2021-12-20 13:36:54 +08:00
{
label: renderLang('global.r_edit'),
2021-12-20 13:36:54 +08:00
key: 'edit',
icon: renderIcon(HammerIcon)
}
2021-12-22 15:31:20 +08:00
])
2021-12-20 13:36:54 +08:00
2021-12-23 12:17:25 +08:00
const handleSelect = (key: string) => {
switch (key) {
case 'edit':
editHandle()
break
}
}
// 编辑处理
const editHandle = () => {
emit('edit', props.cardData)
}
2021-12-20 13:36:54 +08:00
// 关闭对话框
const closeHandle = () => {
emit('close')
}
</script>
<style lang="scss" scoped>
$padding: 30px;
$contentHeight: calc(80vh);
2021-12-21 10:06:03 +08:00
$contentWidth: calc(82vw);
@include go('modal-box') {
width: $contentWidth;
2021-12-20 13:36:54 +08:00
.list-content {
margin-top: 20px;
border-radius: $--border-radius-base;
overflow: hidden;
@include background-image('background-point');
2021-12-20 13:36:54 +08:00
@extend .go-point-bg;
&-top {
position: absolute;
2021-12-21 10:06:03 +08:00
top: 7px;
left: 0px;
padding-left: 10px;
2021-12-20 13:36:54 +08:00
height: 22px;
2021-12-21 10:06:03 +08:00
width: $contentWidth;
2021-12-20 13:36:54 +08:00
}
&-img {
@extend .go-flex-center;
img {
2021-12-21 10:06:03 +08:00
max-height: $contentHeight;
min-height: 200px;
max-width: 100%;
2021-12-20 13:36:54 +08:00
@extend .go-border-radius;
}
}
}
.list-footer {
line-height: 30px;
}
}
</style>