feat: ai生成页面功能屏蔽

This commit is contained in:
pixel(奇淼
2024-10-26 12:37:27 +08:00
parent d1da92d040
commit 7fff2833c3
6 changed files with 2 additions and 118 deletions
@@ -1,40 +0,0 @@
<template>
<div>
<div class="gva-search-box" >
<div class="w-full relative">
<el-input v-model="prompt" type="textarea" :rows="8" class="w-full"></el-input>
<div class="absolute right-2 bottom-2">
<el-button :loading="loading" @click="aiPainter()" type="primary"><ai-gva />{{html?'修改':'生成'}}</el-button>
<el-button :loading="loading" v-if="html" @click="aiPainter(true)" type="primary"><ai-gva />重新生成</el-button>
<el-button :loading="loading" v-if="html" @click="getCode" type="primary">复制代码</el-button>
</div>
</div>
</div>
<div class="w-full">
<DynamicHtmlRenderer :htmlContent="html" />
</div>
</div>
</template>
<script setup>
import {painter} from "@/api/autoCode";
import DynamicHtmlRenderer from "@/view/systemTools/aiPainter/components/dynamicHtmlRenderer.vue";
import { ref } from 'vue'
const loading = ref(false)
const prompt = ref('')
const html = ref(``)
const aiPainter = async (flag) => {
const res = await painter({
html: flag?'':html.value,
prompt: prompt.value
})
html.value = res.data
}
const getCode = () => {
navigator.clipboard.writeText(html.value).then(() => {
Message.success('复制成功');
}, () => {
Message.error('复制失败');
});
}
</script>
@@ -1,46 +0,0 @@
<template>
<div>
<iframe ref="iframe" class="w-full h-screen"></iframe>
</div>
</template>
<script setup>
import { onMounted, ref, watch } from 'vue';
const props = defineProps({
htmlContent: {
type: String,
required: true,
},
});
const iframe = ref(null);
const updateIframeContent = () => {
if (iframe.value) {
const doc = iframe.value.contentDocument || iframe.value.contentWindow.document;
doc.open();
doc.write(`
<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
</head>
<body>${props.htmlContent}</body>
</html>
`);
doc.close();
}
};
onMounted(() => {
updateIframeContent();
});
watch(() => props.htmlContent, () => {
updateIframeContent();
});
</script>
<style scoped>
</style>
+1 -1
View File
@@ -805,7 +805,7 @@
<script setup>
import FieldDialog from '@/view/systemTools/autoCode/component/fieldDialog.vue'
import PreviewCodeDialog from '@/view/systemTools/autoCode/component/previewCodeDialg.vue'
import PreviewCodeDialog from '@/view/systemTools/autoCode/component/previewCodeDialog.vue'
import { toUpperCase, toHump, toSQLLine, toLowerCase } from '@/utils/stringFun'
import { createTemp, getDB, getTable, getColumn, preview, getMeta, getPackageApi,llmAuto } from '@/api/autoCode'
import { getDict } from '@/utils/dictionary'