Commit 8880ff01 by haojie

1

parent 3e4a86e5
<template> <template>
<div class="custom-copywriting-generation-page"> <div class="custom-copywriting-generation-page">
<div class="custom-copywriting-generation" v-show="!loading"> <div
class="custom-copywriting-generation"
v-show="!loading"
ref="CopywritingBox"
>
<img class="tip-box" :src="res_img ?? imgs.tips" alt="" /> <img class="tip-box" :src="res_img ?? imgs.tips" alt="" />
<div class="interaction-form"> <div class="interaction-form">
<div class="basic-info" v-for="item in AdminData.list" :key="item.name"> <div class="basic-info" v-for="item in AdminData.list" :key="item.name">
...@@ -56,18 +60,19 @@ import CustomTextArea from '@/components/custom/textarea.vue'; ...@@ -56,18 +60,19 @@ import CustomTextArea from '@/components/custom/textarea.vue';
import CustomInput from '@/components/custom/input/index.vue'; import CustomInput from '@/components/custom/input/index.vue';
import CustomResetButton from '@/components/custom/resetbutton.vue'; import CustomResetButton from '@/components/custom/resetbutton.vue';
import CustomGptMessage from '@/components/custom/gptmessage.vue'; import CustomGptMessage from '@/components/custom/gptmessage.vue';
import { onBeforeMount, reactive, ref } from 'vue'; import { onBeforeMount, reactive, ref, nextTick } from 'vue';
import { getScenesList, useSubmitConversation } from '@/utils/api/scenes'; import { getScenesList, useSubmitConversation } from '@/utils/api/scenes';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { show_message } from '@/utils/tdesign_tool'; import { show_message } from '@/utils/tdesign_tool';
import { FormExample, ConversationKey } from '@/utils/api/Task'; import { FormExample, ConversationKey } from '@/utils/api/Task';
import CustomLoading from '@/components/custom/loading2.vue'; import CustomLoading from '@/components/custom/loading2.vue';
import { Validationrules } from '@/utils/tool'; import { Validationrules, ChangePageHeight } from '@/utils/tool';
const route = useRoute(); const route = useRoute();
const id = route.query.id; const id = route.query.id;
const imgs = { const imgs = {
tips: new URL('../../assets/img/tips.png', import.meta.url).href, tips: new URL('../../assets/img/tips.png', import.meta.url).href,
}; };
const CopywritingBox = ref();
// 场景id // 场景id
const scenario_id = ref(); const scenario_id = ref();
// 场景示例图 // 场景示例图
...@@ -94,6 +99,12 @@ const MessageList = reactive({ ...@@ -94,6 +99,12 @@ const MessageList = reactive({
// 存本地的完整对话列表 // 存本地的完整对话列表
localList: getLocalList(), localList: getLocalList(),
}); });
// 元素高度和页面高度比较
const getElementHeight = () => {
if (CopywritingBox.value) {
ChangePageHeight(CopywritingBox.value);
}
};
// 获取后台配置的组件 // 获取后台配置的组件
const getAdminComponent = async () => { const getAdminComponent = async () => {
try { try {
...@@ -126,6 +137,9 @@ const getAdminComponent = async () => { ...@@ -126,6 +137,9 @@ const getAdminComponent = async () => {
AdminData.list = list; AdminData.list = list;
} }
loading.value = false; loading.value = false;
nextTick(() => {
getElementHeight();
});
} catch (e) { } catch (e) {
console.log(e); console.log(e);
loading.value = false; loading.value = false;
...@@ -220,9 +234,10 @@ onBeforeMount(async () => { ...@@ -220,9 +234,10 @@ onBeforeMount(async () => {
.custom-copywriting-generation { .custom-copywriting-generation {
display: flex; display: flex;
padding-top: @page-padding-top; padding-top: @page-padding-top;
padding-bottom: @page-padding-top;
.tip-box { .tip-box {
width: 50%; width: 50%;
object-fit: contain; // object-fit: contain;
} }
.interaction-form { .interaction-form {
background: #2d2d2d; background: #2d2d2d;
...@@ -266,6 +281,9 @@ onBeforeMount(async () => { ...@@ -266,6 +281,9 @@ onBeforeMount(async () => {
height: 1px; height: 1px;
background: #565656; background: #565656;
} }
.custom-gpt-message {
max-height: none;
}
& > :not(:first-child) { & > :not(:first-child) {
margin-top: 20px; margin-top: 20px;
} }
......
...@@ -183,6 +183,9 @@ onBeforeMount(() => { ...@@ -183,6 +183,9 @@ onBeforeMount(() => {
} }
} }
} }
.t-loading--center {
background: rgba(255, 255, 255, 0.1);
}
} }
.custom-pagination { .custom-pagination {
padding: 12px 0; padding: 12px 0;
......
<template>
<div class="tdesign-demo-image-viewer__base">
<t-image-viewer :images="[img]">
<template #trigger="{ open }">
<div class="tdesign-demo-image-viewer__ui-image">
<img
alt="test"
:src="img"
class="tdesign-demo-image-viewer__ui-image--img"
/>
<div class="tdesign-demo-image-viewer__ui-image--hover" @click="open">
<span><BrowseIcon size="1.4em" /> 预览</span>
</div>
</div>
</template>
</t-image-viewer>
</div>
</template>
<script setup lang="ts">
import { BrowseIcon } from 'tdesign-icons-vue-next';
import { ImageViewer as TImageViewer } from 'tdesign-vue-next';
const props = defineProps<{
img: string;
}>();
</script>
<style scoped>
.tdesign-demo-image-viewer__ui-image {
width: 100%;
height: 100%;
display: inline-flex;
position: relative;
justify-content: center;
align-items: center;
border-radius: var(--td-radius-small);
overflow: hidden;
}
.tdesign-demo-image-viewer__ui-image--hover {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
left: 0;
top: 0;
opacity: 0;
background-color: rgba(0, 0, 0, 0.6);
color: var(--td-text-color-anti);
line-height: 22px;
transition: 0.2s;
}
.tdesign-demo-image-viewer__ui-image:hover
.tdesign-demo-image-viewer__ui-image--hover {
opacity: 1;
cursor: pointer;
}
.tdesign-demo-image-viewer__ui-image--img {
width: 85px;
height: 85px;
border-radius: 8px;
cursor: pointer;
position: absolute;
}
.tdesign-demo-image-viewer__ui-image--footer {
padding: 0 16px;
height: 56px;
width: 100%;
line-height: 56px;
font-size: 16px;
position: absolute;
bottom: 0;
color: var(--td-text-color-anti);
background-image: linear-gradient(
0deg,
rgba(0, 0, 0, 0.4) 0%,
rgba(0, 0, 0, 0) 100%
);
display: flex;
box-sizing: border-box;
}
.tdesign-demo-image-viewer__ui-image--title {
flex: 1;
}
.tdesign-demo-popup__reference {
margin-left: 16px;
}
.tdesign-demo-image-viewer__ui-image--icons .tdesign-demo-icon {
cursor: pointer;
}
.tdesign-demo-image-viewer__base {
width: 150px;
height: 85px;
display: flex;
justify-content: center;
align-items: center;
}
</style>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</div> </div>
</template> </template>
<template #url="{ row }"> <template #url="{ row }">
<img class="img" :src="row.url" alt="" /> <ImageViewer :img="row.url"></ImageViewer>
</template> </template>
<template #download> <template #download>
<span class="download-text"> 下载 </span> <span class="download-text"> 下载 </span>
...@@ -46,10 +46,13 @@ import { onBeforeMount, reactive, ref } from 'vue'; ...@@ -46,10 +46,13 @@ import { onBeforeMount, reactive, ref } from 'vue';
import { getGenerateRecords } from '@/utils/api/scenes'; import { getGenerateRecords } from '@/utils/api/scenes';
import { Pagination as TPagination } from 'tdesign-vue-next'; import { Pagination as TPagination } from 'tdesign-vue-next';
import { TASKTYPE } from '@/utils/api/Task'; import { TASKTYPE } from '@/utils/api/Task';
import ImageViewer from './ImageViewer.vue';
const RecordList = reactive({ const RecordList = reactive({
// 绘图列表 // 绘图列表
list: [], list: [],
}); });
// 最后展示的预览图
const LastImage = ref('');
const loading = ref(false); const loading = ref(false);
const pageNum = ref<number>(1); const pageNum = ref<number>(1);
const pageSize = ref<number>(10); const pageSize = ref<number>(10);
...@@ -80,6 +83,7 @@ const columns = [ ...@@ -80,6 +83,7 @@ const columns = [
title: '图片', title: '图片',
colKey: 'url', colKey: 'url',
align: 'center', align: 'center',
className: 'td-img',
}, },
{ {
title: '下载', title: '下载',
...@@ -175,6 +179,8 @@ onBeforeMount(() => { ...@@ -175,6 +179,8 @@ onBeforeMount(() => {
cursor: pointer; cursor: pointer;
} }
} }
.td-img {
}
} }
} }
} }
......
<template> <template>
<div class="custom-image-generation-box"> <div class="custom-image-generation-box">
<div class="generation-box" v-show="!loading"> <div class="generation-box" v-show="!loading" ref="GenerationBox">
<div class="interaction-form"> <div class="interaction-form">
<div class="basic-info" v-for="item in AdminData.list" :key="item.name"> <div class="basic-info" v-for="item in AdminData.list" :key="item.name">
<div class="label">*{{ item.name }}</div> <div class="label">*{{ item.name }}</div>
...@@ -97,10 +97,12 @@ import { FormExample2, CustomNum } from '@/utils/api/Task'; ...@@ -97,10 +97,12 @@ import { FormExample2, CustomNum } from '@/utils/api/Task';
import { Validationrules } from '@/utils/tool'; import { Validationrules } from '@/utils/tool';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { show_message } from '@/utils/tdesign_tool'; import { show_message } from '@/utils/tdesign_tool';
//
const loading = ref(false); const loading = ref(false);
const route = useRoute(); const route = useRoute();
const id = route.query.id; const id = route.query.id;
// el
const GenerationBox = ref();
// 定时器 // 定时器
let IntervalImg: any = null; let IntervalImg: any = null;
// 本次提交的数量 // 本次提交的数量
...@@ -332,7 +334,11 @@ onBeforeUnmount(() => { ...@@ -332,7 +334,11 @@ onBeforeUnmount(() => {
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex;
justify-content: center;
align-items: center;
.generation-box { .generation-box {
width: 100%;
display: flex; display: flex;
padding-bottom: 30px; padding-bottom: 30px;
.generate-result { .generate-result {
......
...@@ -282,7 +282,7 @@ export const filterRepeatTimestamp = (list: any, newList: any) => { ...@@ -282,7 +282,7 @@ export const filterRepeatTimestamp = (list: any, newList: any) => {
}; };
/** /**
* * 后台配置组件正则校验
* @param rules * @param rules
* @param value * @param value
* @returns * @returns
...@@ -310,3 +310,16 @@ export const Validationrules = ( ...@@ -310,3 +310,16 @@ export const Validationrules = (
return ''; return '';
} }
}; };
export const ChangePageHeight = (el: HTMLElement) => {
if (el) {
// 获取元素高度
const el_height = el.clientHeight;
const client = el.getBoundingClientRect();
if (client.bottom > el_height) {
// 铺满屏幕
el.style.height = '100%';
el.style.minHeight = el_height + 'px';
}
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment