修改diy显示处理

v1.4.0
于肖磊 2025-07-16 10:18:01 +08:00
parent c928b71ec8
commit cd74477007
4 changed files with 17 additions and 5 deletions

View File

@ -12,6 +12,8 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { get_cookie, set_cookie, get_math } from '@/utils'; import { get_cookie, set_cookie, get_math } from '@/utils';
import { commonStore } from '@/store';
const common_store = commonStore();
const props = defineProps({ const props = defineProps({
dataId: { dataId: {
type: String, type: String,
@ -49,7 +51,9 @@ watch(
uid_val = get_math(); uid_val = get_math();
set_cookie('uid_name', uid_val); set_cookie('uid_name', uid_val);
} }
new_link.value = (import.meta.env.VITE_APP_BASE_API == '/dev-api' ? import.meta.env.VITE_APP_BASE_API_URL : pro_url) + '?s=diy/preview/id/' + props.dataId + '&system_type=default' + token.value + '&uid=' + uid_val; let url = common_store.common.preview_url;
// ?
new_link.value = url + (url.includes('?') ? '&id=' : '?id=') + props.dataId + '&system_type=default' + token.value + '&uid=' + uid_val;
} }
} }
); );

View File

@ -2,11 +2,18 @@
<div :style="style_container"> <div :style="style_container">
<div :style="style_img_container"> <div :style="style_img_container">
<div class="video re" :style="style"> <div class="video re" :style="style">
<template v-if="video && !video_img"> <template v-if="isEmpty(video) && isEmpty(video_img)">
<video :src="video" class="w h"></video> <image-empty v-model="video_img" fit="contain" error-img-style="width:60px;height:60px;"></image-empty>
</template> </template>
<template v-else> <template v-else>
<image-empty v-model="video_img" error-img-style="width:60px;height:60px;"></image-empty> <template v-if="!isEmpty(video)">
<video :src="video" controls class="w h"></video>
</template>
<template v-if="!isEmpty(video_img)">
<div class="middle w h">
<image-empty v-model="video_img" fit="contain" error-img-style="width:60px;height:60px;"></image-empty>
</div>
</template>
</template> </template>
<img :src="video_src" class="middle box-shadow-sm round" width="60" height="60" /> <img :src="video_src" class="middle box-shadow-sm round" width="60" height="60" />
</div> </div>
@ -16,6 +23,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { common_styles_computer, common_img_computer } from '@/utils'; import { common_styles_computer, common_img_computer } from '@/utils';
import { commonStore } from '@/store'; import { commonStore } from '@/store';
import { isEmpty } from 'lodash';
const common_store = commonStore(); const common_store = commonStore();
/** /**
* @description: 视频 渲染 * @description: 视频 渲染

View File

@ -37,6 +37,7 @@ export const commonStore = defineStore('common', () => {
site_logo: '', site_logo: '',
site_name: '', site_name: '',
} as any, // 基础数据配置参数 } as any, // 基础数据配置参数
preview_url: '',
}); });
// 存储链接数据 // 存储链接数据
const set_common = (data: any) => { const set_common = (data: any) => {

View File

@ -27,7 +27,6 @@ import { cloneDeep, isEmpty, omit } from 'lodash';
import DiyAPI, { diyData, headerAndFooter, diyConfig } from '@/api/diy'; import DiyAPI, { diyData, headerAndFooter, diyConfig } from '@/api/diy';
import CommonAPI from '@/api/common'; import CommonAPI from '@/api/common';
import { commonStore } from '@/store'; import { commonStore } from '@/store';
import { de } from 'element-plus/es/locale';
const common_store = commonStore(); const common_store = commonStore();
interface diy_data_item { interface diy_data_item {
id: string; id: string;