| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- <template>
- <a-drawer :title="state.info.file_name" placement="right" :closable="true" v-model:visible="visible" :mask="true"
- getContainer="#g-container" :wrap-style="{ position: 'absolute' }" wrapClassName="drawer-element-wrapper"
- @close="closeDrawer" width="600">
- <div class="info">
- <div>
- <ClockCircleOutlined /> {{ state.info.picture_time }}
- </div>
- <div>
- {{ state.info.size > 0 ? (state.info.size / 1024 / 1024).toFixed(1) + 'M' : '--' }}
- </div>
- <div>
- <div v-if="state.info.image_width && state.info.image_height">
- {{ state.info.image_width }}*{{ state.info.image_height }}
- </div>
- <div v-else>
- --
- </div>
- </div>
- <div>
- <span style="margin-right: 10px;">
- {{ state.info.latitude }}° N
- </span>
- <span>
- {{ state.info.longitude }}° E
- </span>
- </div>
- </div>
- <div class="image">
- <div class="image-background" v-if="state.imgLoading">
- <a-spin tip="加载中..." />
- </div>
- <Panoramic :src="state.info.url" v-else-if="state.info.media_type === 3" />
- <a-image width="100%" height="100%" style="object-fit: cover;" :src="state.info.url" :preview="false" v-else />
- </div>
- <div class="previewList">
- <div class="previewList-item">
- <img :src="state.info.thumbnail_url" />
- </div>
- </div>
- </a-drawer>
- </template>
- <script lang="ts" setup>
- import { reactive, watch } from 'vue';
- import { ClockCircleOutlined } from '@ant-design/icons-vue';
- import Panoramic from '/@/components/panoramic/index.vue';
- import { getWorkspaceId } from '/@/utils';
- import { apis } from '/@/api/custom';
- interface Props {
- visible: boolean,
- fileId: string,
- closeDrawer: () => void,
- };
- const props = withDefaults(defineProps<Props>(), {
- });
- const state = reactive({
- imgLoading: false,// 图片加载
- info: {
- url: '',
- thumbnail_url: '',// 缩略图
- media_type: 0,
- file_name: '',
- image_width: '',// 照片分辨率-宽度
- image_height: '',// 照片分辨率-高度
- size: 0,
- picture_time: '',// 拍摄时间
- longitude: '',// 经度
- latitude: '',// 纬度
- },
- })
- watch(() => props.fileId, async (newValue) => {
- if (props.visible && newValue) {
- const fileId = newValue.replace(/^resource__/, '');
- try {
- const res = await apis.fetchFileDetail(getWorkspaceId(), fileId);
- state.info = res.data;
- state.imgLoading = true;
- const img = new Image();
- img.src = state.info.url;
- img.onload = () => {
- state.imgLoading = false;
- };
- } catch (e) {
- console.error(e);
- }
- }
- });
- </script>
- <style lang="scss" scoped>
- .info {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 24px;
- }
- .image {
- width: 100%;
- height: 500px;
- &-background {
- width: 100%;
- height: 100%;
- padding: 100px;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- }
- .previewList {
- width: 100%;
- height: 70px;
- display: flex;
- justify-content: center;
- margin-top: 24px;
- &-item {
- width: 80px;
- height: 60px;
- border: 2px solid $primary;
- border-radius: 4px;
- margin-bottom: 10px;
- cursor: pointer;
- img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- }
- }
- }
- </style>
|