|
|
@@ -134,8 +134,8 @@
|
|
|
</div>
|
|
|
<div class="modal-footer">
|
|
|
<button class="btn btn-secondary" @click="showAIModal = false">关闭</button>
|
|
|
- <button class="btn btn-secondary">预览</button>
|
|
|
- <button class="btn btn-primary" @click="useEmail">保存使用</button>
|
|
|
+ <button class="btn btn-secondary" @click="previewEmail" :disabled="!emailContent">预览</button>
|
|
|
+ <button class="btn btn-primary" @click="useEmail" :disabled="!emailContent">保存使用</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -143,11 +143,13 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { ref } from 'vue'
|
|
|
+ import { useRouter } from 'vue-router'
|
|
|
import ckeditor from '@/components/ckeditor/index.vue'
|
|
|
import { getSopById, saveGenerateEmail } from '@/api/marketing'
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
|
|
const showAIModal = ref(false)
|
|
|
+ const router = useRouter()
|
|
|
const userInfo = JSON.parse(localStorage.getItem('userInfo'))
|
|
|
const aiGenerator = ref({
|
|
|
inputs: {
|
|
|
@@ -383,6 +385,17 @@
|
|
|
console.error('Fetch error:', error);
|
|
|
}
|
|
|
}
|
|
|
+ const previewEmail = () => {
|
|
|
+ sessionStorage.setItem('aiEmailPreview', JSON.stringify({
|
|
|
+ subject: emailSubject.value,
|
|
|
+ content: emailContent.value
|
|
|
+ }))
|
|
|
+ const { href } = router.resolve({
|
|
|
+ path: '/emails/detail',
|
|
|
+ query: { preview: '1' }
|
|
|
+ })
|
|
|
+ window.open(href, '_blank')
|
|
|
+ }
|
|
|
const useEmail = () => {
|
|
|
let params = {
|
|
|
id: typeData.value.filter(item => item.name == aiGenerator.value.inputs.scene)[0].id,
|