zhengyiming
2025-02-10 0f686ea1fe4700a909a6159efcf1fcb0e1f88a17
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
<template>
  <div class="publish-circle-friend-file-item-wrapper">
    <slot />
    <div v-if="status != 'success'" class="nut-uploader__preview__progress">
      <template v-if="status != 'ready'">
        <Failure v-if="status == 'error'" color="#fff" />
        <Loading v-else name="loading" color="#fff" />
      </template>
      <view class="nut-uploader__preview__progress__msg">{{ message }}</view>
    </div>
    <div @click="emit('delete')" class="publish-circle-friend-file-item-del-wrapper">
      <Failure color="rgba(0,0,0,0.6)" class="publish-circle-friend-file-item-del" />
    </div>
  </div>
</template>
 
<script setup lang="ts">
import { Failure, Loading } from '@nutui/icons-vue-taro';
 
defineOptions({
  name: 'FileWrapper',
});
 
type Props = {
  status?: 'ready' | 'uploading' | 'success' | 'error';
  message?: string;
};
 
const props = withDefaults(defineProps<Props>(), {
  status: 'success',
});
 
const emit = defineEmits<{
  (e: 'delete'): void;
}>();
</script>
 
<style lang="scss">
@import '@/styles/common.scss';
 
.publish-circle-friend-file-item-wrapper {
  padding: 10px;
  box-sizing: border-box;
  // height: 150px;
  width: 100%;
  height: 100%;
  position: relative;
 
  &.video-wrapper {
    width: 300px;
    height: 150px;
  }
 
  .publish-circle-friend-file-item-del-wrapper {
    padding: 20px;
    position: absolute;
    right: 4px;
    top: 4px;
    transform: translate(50%, -50%);
    z-index: 100;
  }
 
  .publish-circle-friend-file-item-del {
    --nut-icon-width: 30px;
    --nut-icon-height: 30px;
    display: block !important;
  }
 
  .publish-circle-friend-img-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }
 
  .publish-circle-friend-img {
    // object-fit: cover;
    width: 100%;
    height: 100%;
  }
 
  .publish-circle-friend-video {
    width: 100%;
    height: 100%;
  }
}
</style>