Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

Business Development Related to Domain Editing

albert0af81758f43a
diff --git a/core/frontend/.env.development b/core/frontend/.env.development
index 4f96697c..35d3ecfe 100644
--- a/core/frontend/.env.development
+++ b/core/frontend/.env.development
@@ -3,4 +3,7 @@ NODE_ENV = 'development'
# API Prefix
API_URL_PREFIX = '/api'
-SERVER_NAME = '192.168.66.124'
\ No newline at end of file
+SERVER_NAME = '192.168.10.35'
+
+# 35机器账户:Pm5XFO5M
+# 35机器密码:rjmieOH3
\ No newline at end of file
diff --git a/core/frontend/package.json b/core/frontend/package.json
index eff13960..bc34c876 100644
--- a/core/frontend/package.json
+++ b/core/frontend/package.json
@@ -20,7 +20,9 @@
"axios": "^1.8.4",
"date-fns": "^4.1.0",
"echarts": "^5.6.0",
+ "highlight.js": "^11.11.1",
"lodash-es": "^4.17.21",
+ "markdown-it": "^14.1.0",
"monaco-editor": "^0.52.2",
"monaco-editor-nginx": "^2.0.2",
"pinia": "^3.0.1",
@@ -46,6 +48,7 @@
"@rsbuild/plugin-vue": "^1.0.7",
"@rsbuild/plugin-vue-jsx": "^1.1.0",
"@types/lodash-es": "^4.17.12",
+ "@types/markdown-it": "^14.1.2",
"@typescript-eslint/eslint-plugin": "^8.28.0",
"@typescript-eslint/parser": "^8.28.0",
"@unocss/preset-attributify": "66.1.2",
diff --git a/core/frontend/src/layout/components/Sidebar.vue b/core/frontend/src/layout/components/Sidebar.vue
index 755e519f..5f529bf6 100644
--- a/core/frontend/src/layout/components/Sidebar.vue
+++ b/core/frontend/src/layout/components/Sidebar.vue
@@ -111,7 +111,7 @@ const iconMap: Record<string, VNodeChild> = {
mailbox: <i class="i-custom:mailbox"></i>,
smtp: <i class="i-custom:smtp"></i>,
settings: <i class="i-mdi-settings-outline"></i>,
- template: <i class="i-mdi-settings-outline"></i>,
+ template: <i class="i-ic:baseline-view-comfy"></i>,
logout: <i class="i-mdi-logout"></i>,
}
@@ -120,7 +120,7 @@ const renderIcon = (key: string) => {
}
const handleUpdateMenu = (key: string) => {
- if (key === 'logout') {
+ if (key === 'logout') {
userStore.logout()
}
if (key === 'webmail') {
diff --git a/core/frontend/src/router/modules/domain.ts b/core/frontend/src/router/modules/domain.ts
index f54f6246..b66708fa 100644
--- a/core/frontend/src/router/modules/domain.ts
+++ b/core/frontend/src/router/modules/domain.ts
@@ -12,11 +12,11 @@ const route: RouteRecordRaw = {
component: () => import('@/views/domain/index.vue'),
},
{
- path: 'edit-domain',
+ path: 'edit-domain/:domain',
name: 'EditDomain',
component: () => import('@/views/domain/pages/editDomain/index.vue'),
},
],
}
-
+
export default route
diff --git a/core/frontend/src/router/modules/template.ts b/core/frontend/src/router/modules/template.ts
index 83c8d266..ccdad2dc 100644
--- a/core/frontend/src/router/modules/template.ts
+++ b/core/frontend/src/router/modules/template.ts
@@ -1,12 +1,24 @@
import type { RouteRecordRaw } from "vue-router";
-
+import { Layout } from '@/router/constant'
export default {
path: "/template",
+ component: Layout,
meta: {
sort: 3,
- title:"template",
+ title: "template",
key: 'template',
titleKey: 'layout.menu.template',
},
- component: () => import("@/views/template/index.vue")
+ children: [
+ {
+ path: "/template",
+ name: "template",
+ component: () => import("@/views/template/index.vue")
+ },
+ {
+ path: "ai-template",
+ name: "ai-template",
+ component: () => import("@/views/template/pages/AITemplate/index.vue")
+ }
+ ]
} as RouteRecordRaw
\ No newline at end of file
diff --git a/core/frontend/src/views/domain/index.vue b/core/frontend/src/views/domain/index.vue
index 2f4d11a4..03db8b12 100644
--- a/core/frontend/src/views/domain/index.vue
+++ b/core/frontend/src/views/domain/index.vue
@@ -15,11 +15,8 @@
</n-data-table>
</template>
<template #pageRight>
- <bt-table-page
- v-model:page="tableParams.page"
- v-model:page-size="tableParams.page_size"
- :item-count="tableTotal"
- @refresh="getTableData">
+ <bt-table-page v-model:page="tableParams.page" v-model:page-size="tableParams.page_size"
+ :item-count="tableTotal" @refresh="getTableData">
</bt-table-page>
</template>
<template #modal>
@@ -32,241 +29,248 @@
</template>
<script lang="tsx" setup>
-import { DataTableColumns, NFlex, NButton } from 'naive-ui'
-import { confirm, getByteUnit } from '@/utils'
-import { useModal } from '@/hooks/modal/useModal'
-import { useTableData } from '@/hooks/useTableData'
-import { deleteDomain, getDomainList } from '@/api/modules/domain'
-import type { MailDomain, MailDomainParams } from './interface'
+ import { DataTableColumns, NFlex, NButton, } from 'naive-ui'
+ import { confirm, getByteUnit } from '@/utils'
+ import { useModal } from '@/hooks/modal/useModal'
+ import { useTableData } from '@/hooks/useTableData'
+ import { deleteDomain, getDomainList } from '@/api/modules/domain'
+ import type { MailDomain, MailDomainParams } from './interface'
-import DomainForm from './components/DomainForm.vue'
-import DomainSsl from './components/DomainSsl/index.vue'
-import DomainDns from './components/DomainDns.vue'
+ import DomainForm from './components/DomainForm.vue'
+ import DomainSsl from './components/DomainSsl/index.vue'
+ import DomainDns from './components/DomainDns.vue'
-const { t } = useI18n()
-const { tableParams, tableList, loading, tableTotal, getTableData } = useTableData<
- MailDomain,
- MailDomainParams
->({
- immediate: true,
- params: {
- page: 1,
- page_size: 10,
- keyword: '',
- },
- fetchFn: getDomainList,
-})
+ const { t } = useI18n()
-const router = useRouter()
+ const { tableParams, tableList, loading, tableTotal, getTableData } = useTableData<
+ MailDomain,
+ MailDomainParams
+ >({
+ immediate: true,
+ params: {
+ page: 1,
+ page_size: 10,
+ keyword: '',
+ },
+ fetchFn: getDomainList,
+ })
-// Table columns
-const columns = ref<DataTableColumns<MailDomain>>([
- {
- key: 'domain',
- title: t('domain.columns.domain'),
- minWidth: 130,
- ellipsis: {
- tooltip: true,
+ const router = useRouter()
+
+ // Table columns
+ const columns = ref<DataTableColumns<MailDomain>>([
+ {
+ key: 'domain',
+ title: t('domain.columns.domain'),
+ minWidth: 130,
+ ellipsis: {
+ tooltip: true,
+ },
+ render: row => (
+ <NButton
+ text
+ type="primary"
+ onClick={() => {
+ router.push({
+ path: '/mailbox',
+ state: { domain: row.domain },
+ })
+ }}>
+ {row.domain}
+ </NButton>
+ ),
+ },
+ {
+ key: 'quota',
+ title: t('domain.columns.quota'),
+ render: row => getByteUnit(row.quota),
+ },
+ {
+ key: 'mailboxes',
+ title: t('domain.columns.mailboxes'),
+ },
+ {
+ key: 'mailbox_quota',
+ title: t('domain.columns.defaultMailboxSize'),
+ render: row => getByteUnit(row.mailbox_quota),
},
- render: row => (
- <NButton
- text
- type="primary"
- onClick={() => {
- router.push({
- path: '/mailbox',
- state: { domain: row.domain },
- })
- }}>
- {row.domain}
- </NButton>
- ),
- },
- {
- key: 'quota',
- title: t('domain.columns.quota'),
- render: row => getByteUnit(row.quota),
- },
- {
- key: 'mailboxes',
- title: t('domain.columns.mailboxes'),
- },
- {
- key: 'mailbox_quota',
- title: t('domain.columns.defaultMailboxSize'),
- render: row => getByteUnit(row.mailbox_quota),
- },
- // {
- // key: 'catch_all',
- // title: 'Catch All',
- // render: row => (
- // <NSwitch
- // value={row.catch_all}
- // size="small"
- // onUpdateValue={(val: boolean) => {
- // if (val) {
- // handleOpenCatch(row)
- // } else {
- // handleCloseCatch(row)
- // }
- // }}
- // />
- // ),
- // },
- {
- key: 'ssl',
- title: 'SSL',
- render: row => {
- if (row.cert_info && row.cert_info.endtime) {
- const ssl = row.cert_info
- const day = Math.floor((ssl.endtime * 1000 - Date.now()) / 1000 / 60 / 60 / 24)
+ // {
+ // key: 'catch_all',
+ // title: 'Catch All',
+ // render: row => (
+ // <NSwitch
+ // value={row.catch_all}
+ // size="small"
+ // onUpdateValue={(val: boolean) => {
+ // if (val) {
+ // handleOpenCatch(row)
+ // } else {
+ // handleCloseCatch(row)
+ // }
+ // }}
+ // />
+ // ),
+ // },
+ {
+ key: 'ssl',
+ title: 'SSL',
+ render: row => {
+ if (row.cert_info && row.cert_info.endtime) {
+ const ssl = row.cert_info
+ const day = Math.floor((ssl.endtime * 1000 - Date.now()) / 1000 / 60 / 60 / 24)
+ return (
+ <NButton
+ type={day < 0 ? 'error' : 'primary'}
+ text
+ onClick={() => {
+ handleShowSsl(row)
+ }}>
+ {day < 0 ? t('domain.ssl.expired') : t('domain.ssl.daysLeft', { days: day })}
+ </NButton>
+ )
+ }
return (
<NButton
- type={day < 0 ? 'error' : 'primary'}
+ type="warning"
text
onClick={() => {
handleShowSsl(row)
}}>
- {day < 0 ? t('domain.ssl.expired') : t('domain.ssl.daysLeft', { days: day })}
+ {t('domain.ssl.notSet')}
</NButton>
)
- }
- return (
- <NButton
- type="warning"
- text
- onClick={() => {
- handleShowSsl(row)
- }}>
- {t('domain.ssl.notSet')}
- </NButton>
- )
+ },
},
- },
- {
- title: t('domain.columns.actions'),
- key: 'actions',
- align: 'right',
- render: row => (
- <NFlex inline={true}>
- <NButton
- type="primary"
- text={true}
- onClick={() => {
- handleDNSRecord(row)
- }}>
- {t('domain.actions.dnsRecord')}
- </NButton>
- <NButton
- type="primary"
- text={true}
- onClick={() => {
- handleEdit(row)
- }}>
- {t('common.actions.edit')}
- </NButton>
- <NButton
- type="error"
- text={true}
- onClick={() => {
- handleDelete(row)
- }}>
- {t('common.actions.delete')}
- </NButton>
- </NFlex>
- ),
- },
-])
-
-const [FormModal, formModalApi] = useModal({
- component: DomainForm,
- state: {
- isEdit: false,
- refresh: getTableData,
- },
-})
+ {
+ title: t('domain.columns.actions'),
+ key: 'actions',
+ align: 'right',
+ render: row => (
+ <NFlex inline={true}>
+ <NButton
+ type="primary"
+ text={true}
+ onClick={() => {
+ handleDNSRecord(row)
+ }}>
+ {t('domain.actions.dnsRecord')}
+ </NButton>
+ <NButton
+ type="primary"
+ text={true}
+ onClick={() => {
+ //handleEdit(row)
+ router.push({
+ name: "EditDomain",
+ params: {
+ domain: row.domain
+ }
+ })
+ }}>
+ {t('common.actions.edit')}
+ </NButton>
+ <NButton
+ type="error"
+ text={true}
+ onClick={() => {
+ handleDelete(row)
+ }}>
+ {t('common.actions.delete')}
+ </NButton>
+ </NFlex>
+ ),
+ },
+ ])
-// Handle add domain
-const handleAddDomain = () => {
- formModalApi.setState({
- row: null,
- isEdit: false,
+ const [FormModal, formModalApi] = useModal({
+ component: DomainForm,
+ state: {
+ isEdit: false,
+ refresh: getTableData,
+ },
})
- formModalApi.open()
-}
-
-// Handle open catch all
-// const handleOpenCatch = (row: MailDomain) => {
-// catchModalApi.setState({ row })
-// catchModalApi.open()
-// }
-
-// Handle close catch all
-// const handleCloseCatch = (row: MailDomain) => {
-// console.log(row)
-// }
-
-const [SslModal, sslModalApi] = useModal({
- component: DomainSsl,
- state: {
- refresh: getTableData,
- },
-})
-// Handle show ssl
-const handleShowSsl = (row: MailDomain) => {
- sslModalApi.setState({ row })
- sslModalApi.open()
-}
+ // Handle add domain
+ const handleAddDomain = () => {
+ formModalApi.setState({
+ row: null,
+ isEdit: false,
+ })
+ formModalApi.open()
+ }
-const [DnsModal, dnsModalApi] = useModal({
- component: DomainDns,
- state: {
- refresh: getTableData,
- },
-})
+ // Handle open catch all
+ // const handleOpenCatch = (row: MailDomain) => {
+ // catchModalApi.setState({ row })
+ // catchModalApi.open()
+ // }
-// Handle DNS records
-const handleDNSRecord = (row: MailDomain) => {
- dnsModalApi.setState({ row })
- dnsModalApi.open()
-}
+ // Handle close catch all
+ // const handleCloseCatch = (row: MailDomain) => {
+ // console.log(row)
+ // }
-// Handle edit
-const handleEdit = (row: MailDomain) => {
- formModalApi.setState({
- row,
- isEdit: true,
+ const [SslModal, sslModalApi] = useModal({
+ component: DomainSsl,
+ state: {
+ refresh: getTableData,
+ },
})
- formModalApi.open()
-}
-// Handle delete
-const handleDelete = (row: MailDomain) => {
- confirm({
- title: t('domain.delete.title'),
- content: t('domain.delete.confirm', { domain: row.domain }),
- confirmText: t('common.actions.delete'),
- confirmType: 'error',
- onConfirm: async () => {
- await deleteDomain({ domain: row.domain })
- getTableData()
+ // Handle show ssl
+ const handleShowSsl = (row: MailDomain) => {
+ sslModalApi.setState({ row })
+ sslModalApi.open()
+ }
+
+ const [DnsModal, dnsModalApi] = useModal({
+ component: DomainDns,
+ state: {
+ refresh: getTableData,
},
})
-}
+
+ // Handle DNS records
+ const handleDNSRecord = (row: MailDomain) => {
+ dnsModalApi.setState({ row })
+ dnsModalApi.open()
+ }
+
+ // Handle edit
+ const handleEdit = (row: MailDomain) => {
+ formModalApi.setState({
+ row,
+ isEdit: true,
+ })
+ formModalApi.open()
+ }
+
+ // Handle delete
+ const handleDelete = (row: MailDomain) => {
+ confirm({
+ title: t('domain.delete.title'),
+ content: t('domain.delete.confirm', { domain: row.domain }),
+ confirmText: t('common.actions.delete'),
+ confirmType: 'error',
+ onConfirm: async () => {
+ await deleteDomain({ domain: row.domain })
+ getTableData()
+ },
+ })
+ }
</script>
<style lang="scss" scoped>
-.domain-container {
- padding: 16px;
- background-color: #fff;
- border-radius: 3px;
+ .domain-container {
+ padding: 16px;
+ background-color: #fff;
+ border-radius: 3px;
- .action-bar {
- display: flex;
- justify-content: space-between;
- margin-bottom: 16px;
+ .action-bar {
+ display: flex;
+ justify-content: space-between;
+ margin-bottom: 16px;
+ }
}
-}
</style>
diff --git a/core/frontend/src/views/domain/pages/editDomain/components/AISettings.vue b/core/frontend/src/views/domain/pages/editDomain/components/AISettings.vue
index da49b7bf..07a11414 100644
--- a/core/frontend/src/views/domain/pages/editDomain/components/AISettings.vue
+++ b/core/frontend/src/views/domain/pages/editDomain/components/AISettings.vue
@@ -2,35 +2,54 @@
<div class="content-wrapper">
<n-card class="mb-5">
<div class="page-tit" style="margin: 0;">
- <div class="back-tool">
- <i class="i-ri:apps-fill text-6"></i>
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:apps-fill text-6"></i>
+ </div>
+ <span class="tit-content">
+ AI Settings
+ </span>
+ </div>
+ <div class="right-tit">
+ <n-button type="primary" @click="updateAisettingsInfo(domain)">
+ <template #icon>
+ <i class="i-mingcute:save-2-line text-5"></i>
+ </template>
+ Save
+ </n-button>
</div>
- <span class="tit-content">
- AI Settings
- </span>
</div>
</n-card>
<n-card>
- <div class="page-tit">
- <span class="tit-content">
- Default AI Instructions
- </span>
+ <div class="page-tit mb-5">
+ <div class="left-tit">
+ <span class="tit-content">
+ Default AI Instructions
+ </span>
+ </div>
</div>
<n-form>
<n-form-item>
<template #label><span class="form-label">Instructions for Email Generation</span></template>
- <n-input type="textarea" :rows="13"></n-input>
+ <n-input type="textarea" :rows="13" v-model:value="prompt"></n-input>
</n-form-item>
</n-form>
- <div>These instructions will be used as default guidelines when generating new emails. You can override these instructions for individual emails as needed.</div>
+ <div>These instructions will be used as default guidelines when generating new emails. You can override
+ these
+ instructions for individual emails as needed.</div>
</n-card>
</div>
</template>
<script setup lang="ts">
-
+ import { getAisettingsInfo,updateAisettingsInfo } from "../controller/aiSettings.controller"
+ import { getEditDomainStoreData } from '../store';
+ const { prompt } = getEditDomainStoreData()
+ const route = useRoute()
+ const domain = route.params.domain as string
+ getAisettingsInfo(domain)
</script>
<style scoped lang="scss">
diff --git a/core/frontend/src/views/domain/pages/editDomain/components/CompanyProfile.vue b/core/frontend/src/views/domain/pages/editDomain/components/CompanyProfile.vue
index 91c9a2e2..20a2730d 100644
--- a/core/frontend/src/views/domain/pages/editDomain/components/CompanyProfile.vue
+++ b/core/frontend/src/views/domain/pages/editDomain/components/CompanyProfile.vue
@@ -2,23 +2,37 @@
<div class="content-wrapper">
<n-card class="mb-5">
<div class="page-tit">
- <div class="back-tool">
- <i class="i-ri:apps-fill text-6"></i>
+ <div class="left-tit">
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:apps-fill text-6"></i>
+ </div>
+ <span class="tit-content">
+ Company Detail
+ </span>
+ </div>
+ </div>
+ <div class="right-tit">
+ <n-button type="primary" @click="updateCompanyProfile(domain)">
+ <template #icon>
+ <i class="i-mingcute:save-2-line text-5"></i>
+ </template>
+ Save
+ </n-button>
</div>
- <span class="tit-content">
- Company Detail
- </span>
</div>
+ </n-card>
+ <n-card class="mb-5">
<n-form>
<div class="flex justify-between gap-5">
<n-form-item class="flex-1">
<template #label><span class="form-label">Legal Company Name</span></template>
- <n-input></n-input>
+ <n-input v-model:value="legal_company_name"></n-input>
</n-form-item>
<n-form-item class="flex-1">
- <template #label><span class="form-label">Website</span></template>
- <n-input></n-input>
+ <template #label><span class="form-label">web_site</span></template>
+ <n-input v-model:value="web_site"></n-input>
</n-form-item>
</div>
<n-form-item>
@@ -27,33 +41,35 @@
</n-form-item>
<n-form-item>
<template #label><span class="form-label">Additional Company Information</span></template>
- <n-input type="textarea" :rows="8"></n-input>
+ <n-input type="textarea" :rows="8" v-model:value="company_profile"></n-input>
</n-form-item>
</n-form>
</n-card>
<n-card>
- <div class="page-tit">
- <div class="back-tool">
- <i class="i-ri:apps-fill text-6"></i>
+ <div class="page-tit mb-20px">
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:apps-fill text-6"></i>
+ </div>
+ <span class="tit-content">
+ Contact Information
+ </span>
</div>
- <span class="tit-content">
- Contact Information
- </span>
</div>
<n-form>
<n-form-item>
<template #label><span class="form-label">Contact Email</span></template>
- <n-input></n-input>
+ <n-input v-model:value="email"></n-input>
</n-form-item>
<n-form-item>
<template #label><span class="form-label">Phone Number</span></template>
- <n-input></n-input>
+ <n-input v-model:value="phone"></n-input>
</n-form-item>
<n-form-item>
<template #label><span class="form-label">Support URL</span></template>
- <n-input></n-input>
+ <n-input v-model:value="support_url"></n-input>
</n-form-item>
</n-form>
</n-card>
@@ -61,7 +77,19 @@
</template>
<script setup lang="ts">
-
+ import { getCompanuyProfile, updateCompanyProfile } from '../controller/companyProfile.controller';
+ import { getEditDomainStoreData } from '../store';
+ const {
+ legal_company_name,
+ web_site,
+ phone,
+ company_profile,
+ email,
+ support_url,
+ } = getEditDomainStoreData()
+ const route = useRoute()
+ const domain = route.params.domain as string;
+ getCompanuyProfile(domain)
</script>
<style scoped lang="scss">
diff --git a/core/frontend/src/views/domain/pages/editDomain/components/FooterSettings.vue b/core/frontend/src/views/domain/pages/editDomain/components/FooterSettings.vue
index 60f012fd..72fd947e 100644
--- a/core/frontend/src/views/domain/pages/editDomain/components/FooterSettings.vue
+++ b/core/frontend/src/views/domain/pages/editDomain/components/FooterSettings.vue
@@ -2,30 +2,42 @@
<div class="content-wrapper">
<n-card class="mb-5">
<div class="page-tit" style="margin: 0;">
- <div class="back-tool">
- <i class="i-ri:apps-fill text-6"></i>
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:apps-fill text-6"></i>
+ </div>
+ <span class="tit-content">
+ Footer Settings
+ </span>
+ </div>
+ <div class="right-tit">
+ <n-button type="primary" @click="updateFootersettingsInfo(domain)">
+ <template #icon>
+ <i class="i-mingcute:save-2-line text-5"></i>
+ </template>
+ Save
+ </n-button>
</div>
- <span class="tit-content">
- Footer Settings
- </span>
</div>
</n-card>
<n-card>
- <div class="page-tit">
- <span class="tit-content">
- Additional Content
- </span>
+ <div class="page-tit mb-5">
+ <div class="left-tit">
+ <span class="tit-content">
+ Additional Content
+ </span>
+ </div>
</div>
<n-form>
<n-form-item>
<template #label><span class="form-label">Copyright Text</span></template>
- <n-input></n-input>
+ <n-input v-model:value="copyright_text"></n-input>
</n-form-item>
<n-form-item>
<template #label><span class="form-label">Disclaimer</span></template>
- <n-input type="textarea" :rows="8"></n-input>
+ <n-input type="textarea" :rows="8" v-model:value="disclaimer"></n-input>
</n-form-item>
</n-form>
</n-card>
@@ -33,7 +45,13 @@
</template>
<script setup lang="ts">
+ import { updateFootersettingsInfo, getFootersettingsInfo } from "../controller/footerSettings.controller"
+ import { getEditDomainStoreData } from '../store';
+ const { copyright_text, disclaimer } = getEditDomainStoreData()
+ const route = useRoute()
+ const domain = route.params.domain as string
+ getFootersettingsInfo(domain)
</script>
<style scoped lang="scss">
diff --git a/core/frontend/src/views/domain/pages/editDomain/components/ProjectDetails.vue b/core/frontend/src/views/domain/pages/editDomain/components/ProjectDetails.vue
index 4fbfcf2a..d04f603b 100644
--- a/core/frontend/src/views/domain/pages/editDomain/components/ProjectDetails.vue
+++ b/core/frontend/src/views/domain/pages/editDomain/components/ProjectDetails.vue
@@ -2,38 +2,51 @@
<div class="content-wrapper">
<n-card class="mb-5">
<div class="page-tit">
- <div class="back-tool">
- <i class="i-ri:apps-fill text-6"></i>
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:apps-fill text-6"></i>
+ </div>
+ <span class="tit-content">
+ Project Details
+ </span>
+ </div>
+ <div class="right-tit">
+ <n-button type="primary" @click="updateProjectDetail(domain)">
+ <template #icon>
+ <i class="i-mingcute:save-2-line text-5"></i>
+ </template>
+ Save
+ </n-button>
</div>
- <span class="tit-content">
- Project Details
- </span>
</div>
-
+ </n-card>
+ <n-card class="mb-5">
<n-form>
<n-form-item>
<template #label><span class="form-label">Project Name</span></template>
- <n-input></n-input>
+ <n-input v-model:value="project_name"></n-input>
</n-form-item>
<n-form-item>
<template #label><span class="form-label">Description</span></template>
- <n-input type="textarea" :rows="7"></n-input>
+ <n-input type="textarea" :rows="7" v-model:value="description"></n-input>
</n-form-item>
<n-form-item>
<template #label><span class="form-label">Industry</span></template>
- <n-select :options="industryOptions"></n-select>
+ <n-select :options="industryOptions" v-model:value="industry"></n-select>
</n-form-item>
</n-form>
</n-card>
- <n-card>
- <div class="page-tit">
- <div class="back-tool">
- <i class="i-ri:earth-fill text-6"></i>
+ <n-card class="mb-5">
+ <div class="page-tit mb-20px">
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:earth-fill text-6"></i>
+ </div>
+ <span class="tit-content">
+ Brand Logos
+ </span>
</div>
- <span class="tit-content">
- Brand Logos
- </span>
</div>
<div class="sub-tit">
@@ -46,30 +59,54 @@
<div class="operation-tit">Primary Logo</div>
<div class="operation-sub-tit">Horizontal version for headers</div>
<div class="logo-area">
- <div class="upload-logo-placeholder">
- <i class="i-carbon:cloud-upload text-7"></i>
+ <div class="upload-logo-placeholder" v-if="!primary_logo">
+ <i class="i-carbon:cloud-upload text-8"></i>
<span>Primary Logo</span>
</div>
+ <n-image :src="primary_logo" class="w-100% h-100%" v-else>
+ <template #error>
+ <div class="w-100% h-100% flex justify-center items-center flex-col gap-1.25">
+ <i class="i-mingcute:pic-line text-15"></i>
+ <span>loading failed</span>
+ </div>
+ </template>
+ </n-image>
</div>
</div>
<div class="operation-item">
<div class="operation-tit">Secondary Logo</div>
<div class="operation-sub-tit">Vertical/stacked version</div>
<div class="logo-area">
- <div class="upload-logo-placeholder">
- <i class="i-carbon:cloud-upload text-7"></i>
+ <div class="upload-logo-placeholder" v-if="!secondary_logo">
+ <i class="i-carbon:cloud-upload text-8"></i>
<span>Primary Logo</span>
</div>
+ <n-image :src="secondary_logo" class="w-100% h-100%" v-else>
+ <template #error>
+ <div class="w-100% h-100% flex justify-center items-center flex-col gap-1.25">
+ <i class="i-mingcute:pic-line text-15"></i>
+ <span>loading failed</span>
+ </div>
+ </template>
+ </n-image>
</div>
</div>
<div class="operation-item">
<div class="operation-tit">Favicon</div>
<div class="operation-sub-tit">Icon for browser tabs</div>
<div class="logo-area">
- <div class="upload-logo-placeholder">
- <i class="i-carbon:cloud-upload text-7"></i>
+ <div class="upload-logo-placeholder" v-if="!favicon">
+ <i class="i-carbon:cloud-upload text-8"></i>
<span>Primary Logo</span>
</div>
+ <n-image :src="favicon" class="w-100% h-100%" v-else>
+ <template #error>
+ <div class="w-100% h-100% flex justify-center items-center flex-col gap-1.25">
+ <i class="i-mingcute:pic-line text-15"></i>
+ <span>loading failed</span>
+ </div>
+ </template>
+ </n-image>
</div>
<div class="operation-tools">
<div class="tool-item">
@@ -88,16 +125,119 @@
</div>
</div>
</n-card>
+
+ <n-card>
+ <div class="page-tit">
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:earth-fill text-6"></i>
+ </div>
+ <span class="tit-content">
+ Knowledge Base
+ </span>
+ </div>
+
+ <div class="right-tit">
+ <n-button @click="knowledgeModalShow = true">New File</n-button>
+ </div>
+ </div>
+
+ <n-card class="mt-5" v-for="(item, index) in knowledge_base" :key="index"
+ style="background-color: var(--color-radio-1)">
+ <div class="knowledge-box">
+ <div class="top-info">
+ <div class="info-left">
+ <span class="info-tit">{{ item.title }}</span>
+ <span class="info-sub-tit">11 days ago</span>
+ </div>
+ <div class="info-right" @click="handleDelete(item)">
+ <i class="i-material-symbols:close-rounded text-5"></i>
+ </div>
+ </div>
+ <div class="operation">
+ <n-button type="primary" ghost @click="openEditKnowledge(item)">Edit</n-button>
+ <n-button type="primary" ghost>Preiview</n-button>
+ </div>
+ </div>
+ </n-card>
+ </n-card>
</div>
+
+ <!-- Add knowledge base -->
+ <n-modal v-model:show="knowledgeModalShow" preset="card" draggable :close-on-esc="false" :mask-closable="false"
+ title="New Knowledge File" class="w-150" :on-after-leave="closeKnowledgeModal">
+ <n-form>
+ <n-form-item label="File Name">
+ <n-input v-model:value="knowledgeTitle"></n-input>
+ </n-form-item>
+ <n-form-item label="Content">
+ <n-input type="textarea" :rows="8" v-model:value="knowledgeContent"></n-input>
+ </n-form-item>
+ </n-form>
+
+ <template #footer>
+ <div class="flex justify-end gap-5">
+ <n-button @click="closeKnowledgeModal">Cancel</n-button>
+ <n-button type="primary" @click="createOrUpdateKnowledge"
+ :disabled="!knowledgeTitle || !knowledgeContent">Create</n-button>
+ </div>
+ </template>
+ </n-modal>
+
</template>
<script setup lang="ts">
+ import { confirm } from '@/utils';
+ import { getProjectDetail, updateProjectDetail, createKnowledgeBase, closeKnowledgeModal, openEditKnowledge, updateKnowledgeBase, deleteKnowledgeBase } from '../controller/projectDetail.controller';
+ import { getEditDomainStoreData } from '../store';
+ import { KnowledgeBase } from '../dto';
+ const {
+ project_name,
+ description,
+ industry,
+ primary_logo,
+ secondary_logo,
+ favicon,
+ knowledge_base,
+ knowledgeModalShow,
+ isEditKnowledge,
+ knowledgeTitle,
+ knowledgeContent
+ } = getEditDomainStoreData()
+ const route = useRoute()
const industryOptions = ref([
{
label: "test",
value: "test"
}
])
+ const domain = route.params.domain as string
+
+
+ getProjectDetail(domain)
+ /**
+ * @description Create or update knowledge
+ */
+ function createOrUpdateKnowledge() {
+ if (isEditKnowledge.value) {
+ updateKnowledgeBase(domain)
+ } else {
+ createKnowledgeBase(domain)
+ }
+ }
+
+ /**
+ * @description Delete knowledge base
+ */
+ function handleDelete(knowledge: KnowledgeBase) {
+ confirm({
+ title: "Notice",
+ content: "Are you sure you want to delete?",
+ onConfirm() {
+ deleteKnowledgeBase(domain, knowledge)
+ }
+ })
+ }
</script>
<style scoped lang="scss">
@@ -157,15 +297,17 @@
.operation-tools {
@include base.row-flex-start;
gap: 10px;
+
.tool-item {
width: 34px;
height: 34px;
@include base.row-flex-center;
background: var(--color-bg-1);
- border:1px solid var(--color-border-1);
+ border: 1px solid var(--color-border-1);
border-radius: 5px;
color: var(--color-text-2);
cursor: pointer;
+
&:hover {
background: var(--color-bg-4);
}
@@ -177,5 +319,47 @@
.form-label {
@include mixin.form-label;
}
+
+ .knowledge-box {
+ @include base.col-flex;
+ justify-content: flex-start;
+ align-items: flex-start;
+
+ .top-info {
+ width: 100%;
+ @include base.row-flex;
+ justify-content: space-between;
+ align-items: flex-start;
+ margin-bottom: 20px;
+
+ .info-left {
+ @include base.col-flex;
+ justify-content: flex-start;
+ align-items: flex-start;
+
+ .info-tit {
+ font-size: 16px;
+ font-weight: bold;
+ }
+ }
+
+ .info-right {
+ @include base.row-flex-center;
+ align-items: center;
+ padding: 5px;
+ cursor: pointer;
+ transition: .15s all ease-in-out;
+
+ &:hover {
+ background: var(--color-border-2);
+ }
+ }
+ }
+
+ .operation {
+ @include base.row-flex-start;
+ gap: 15px;
+ }
+ }
}
</style>
\ No newline at end of file
diff --git a/core/frontend/src/views/domain/pages/editDomain/components/Sitemap.vue b/core/frontend/src/views/domain/pages/editDomain/components/Sitemap.vue
index 0598a7fe..375efd60 100644
--- a/core/frontend/src/views/domain/pages/editDomain/components/Sitemap.vue
+++ b/core/frontend/src/views/domain/pages/editDomain/components/Sitemap.vue
@@ -1,33 +1,75 @@
<template>
<div class="content-wrapper">
- <n-card>
+ <n-card class="mb-5">
<div class="page-tit">
- <div class="back-tool">
- <i class="i-ri:apps-fill text-6"></i>
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:apps-fill text-6"></i>
+ </div>
+ <span class="tit-content">
+ Sitemap
+ </span>
</div>
- <span class="tit-content">
- Sitemap
- </span>
+
</div>
+ </n-card>
- <n-form>
- <n-form-item>
- <div class="inline-form-items">
- <n-input class="name"></n-input>
- <n-input class="url"></n-input>
- <n-select class="type"></n-select>
- <div class="operation">
- <i class="i-material-symbols:close-rounded text-5"></i>
- </div>
+ <n-card>
+ <div v-for="(item, index) in sitemap" :key="index" class="mb-2.5">
+ <div class="inline-form-items">
+ <n-input v-model:value="item.title" class="name"></n-input>
+ <n-input v-model:value="item.uri_path" class="url"></n-input>
+ <div class="operation close" v-if="item.isSaved" @click="handleRemove(item, index)">
+ <i class="i-material-symbols:close-rounded text-5"></i>
+ </div>
+ <div v-else
+ :class="['operation', { save: item.title && item.uri_path }, { disabled: !item.title || !item.uri_path }]"
+ @click="handleSave(item,index)">
+ <i class="i-mingcute:save-2-line text-5"></i>
</div>
- </n-form-item>
- </n-form>
+ </div>
+ </div>
+ <div class="mt-5">
+ <n-button type="primary" @click="handleAdd">Add link</n-button>
+ </div>
</n-card>
</div>
</template>
<script setup lang="ts">
+ import { getSitemapInfo, addSitemapInfo, removeSiteMapInfo } from "../controller/sitemap.controller"
+ import { getEditDomainStoreData } from "../store"
+ import { SiteInfo } from "../dto"
+ const { sitemap } = getEditDomainStoreData()
+ const route = useRoute()
+ const domain = route.params.domain as string
+ getSitemapInfo(domain)
+ /**
+ * @description Add site url
+ */
+ async function handleSave(siteInfo: SiteInfo,index:number) {
+ await addSitemapInfo(domain, siteInfo.title, siteInfo.uri_path)
+ sitemap.value[index].isSaved = true
+ }
+
+ /**
+ * @description remove site url
+ */
+ async function handleRemove(siteInfo: SiteInfo, index: number) {
+ await removeSiteMapInfo(domain, siteInfo.uri_path)
+ sitemap.value.splice(index, 1)
+ }
+
+ /**
+ * @description Add link form
+ */
+ function handleAdd() {
+ sitemap.value.push({
+ title: "",
+ uri_path: ""
+ })
+ }
</script>
<style scoped lang="scss">
@@ -59,7 +101,7 @@
flex: 3.5;
}
- .type{
+ .type {
flex: 2;
}
@@ -71,10 +113,32 @@
border: 1px solid var(--color-border-1);
border-radius: 5px;
color: var(--color-text-2);
+ transition: .2s all ease-in-out;
cursor: pointer;
- &:hover {
- background: var(--color-bg-4);
+ &.close {
+ border-color: var(--color-error-1);
+ color: var(--color-error-1);
+ }
+
+ &.close:hover {
+ color: #fff;
+ background: var(--color-error-1);
+ }
+
+ &.save {
+ color: var(--color-primary-1);
+ border-color: var(--color-primary-1);
+ }
+
+ &.save:hover {
+ color: #fff;
+ background: var(--color-primary-hover-1);
+ }
+
+ &.disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
}
}
}
diff --git a/core/frontend/src/views/domain/pages/editDomain/components/Styling.vue b/core/frontend/src/views/domain/pages/editDomain/components/Styling.vue
index b3ffb733..e348235c 100644
--- a/core/frontend/src/views/domain/pages/editDomain/components/Styling.vue
+++ b/core/frontend/src/views/domain/pages/editDomain/components/Styling.vue
@@ -2,65 +2,95 @@
<div class="content-wrapper">
<n-card class="mb-5">
<div class="page-tit">
- <div class="back-tool">
- <i class="i-ri:apps-fill text-6"></i>
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:apps-fill text-6"></i>
+ </div>
+ <span class="tit-content">
+ Color Palette
+ </span>
+ </div>
+ <div class="right-tit">
+ <n-button type="primary" @click="updateStyleingInfo(domain)">
+ <template #icon>
+ <i class="i-mingcute:save-2-line text-5"></i>
+ </template>
+ Save
+ </n-button>
</div>
- <span class="tit-content">
- Color Palette
- </span>
</div>
-
+ </n-card>
+ <n-card class="mb-5">
<n-form>
<n-form-item>
<template #label><span class="form-label">Accent Color</span></template>
<div class="flex justify-between gap-2.5 w-100%">
- <n-color-picker style="width: 50px;" :modes="['hex','rgb','hsl','hsv']" :render-label="colorRenderLabel"></n-color-picker>
- <n-input></n-input>
+ <n-color-picker style="width: 50px;" :modes="['hex', 'rgb', 'hsl', 'hsv']"
+ :render-label="colorRenderLabel" v-model:value="accent_color"></n-color-picker>
+ <n-input v-model:value="accent_color"></n-input>
</div>
</n-form-item>
<n-form-item>
<template #label><span class="form-label">Text Color</span></template>
<div class="flex justify-between gap-2.5 w-100%">
- <n-color-picker style="width: 50px;" :modes="['hex','rgb','hsl','hsv']" :render-label="colorRenderLabel"></n-color-picker>
- <n-input></n-input>
+ <n-color-picker style="width: 50px;" :modes="['hex', 'rgb', 'hsl', 'hsv']"
+ :render-label="colorRenderLabel" v-model:value="text_color"></n-color-picker>
+ <n-input v-model:value="text_color"></n-input>
</div>
</n-form-item>
<n-form-item>
<template #label><span class="form-label">Page Background</span></template>
<div class="flex justify-between gap-2.5 w-100%">
- <n-color-picker style="width: 50px;" :modes="['hex','rgb','hsl','hsv']" :render-label="colorRenderLabel"></n-color-picker>
- <n-input></n-input>
+ <n-color-picker style="width: 50px;" :modes="['hex', 'rgb', 'hsl', 'hsv']"
+ :render-label="colorRenderLabel" v-model:value="page_background"></n-color-picker>
+ <n-input v-model:value="page_background"></n-input>
</div>
</n-form-item>
<n-form-item>
<template #label><span class="form-label">Container Background</span></template>
<div class="flex justify-between gap-2.5 w-100%">
- <n-color-picker style="width: 50px;" :modes="['hex','rgb','hsl','hsv']" :render-label="colorRenderLabel"></n-color-picker>
- <n-input></n-input>
+ <n-color-picker style="width: 50px;" :modes="['hex', 'rgb', 'hsl', 'hsv']"
+ :render-label="colorRenderLabel" v-model:value="container_background"></n-color-picker>
+ <n-input v-model:value="container_background"></n-input>
</div>
</n-form-item>
</n-form>
</n-card>
- <n-card>
- <div class="page-tit" style="margin-bottom: 10px;">
- <div class="back-tool">
- <i class="i-ri:apps-fill text-6"></i>
+ <!-- <n-card>
+ <div class="page-tit mb-2.5">
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:apps-fill text-6"></i>
+ </div>
+ <span class="tit-content">
+ Custom CSS
+ </span>
</div>
- <span class="tit-content">
- Custom CSS
- </span>
</div>
<div class="sub-tit mb-5">Add custom CSS styles to your email template</div>
<n-input type="textarea" :rows="15"></n-input>
- </n-card>
+ </n-card> -->
</div>
</template>
<script setup lang="tsx">
-function colorRenderLabel(){
- return ""
-}
+ import { getStylingInfo, updateStyleingInfo } from '../controller/styleing.controller'
+ import { getEditDomainStoreData } from '../store'
+ const {
+ accent_color,
+ text_color,
+ page_background,
+ container_background,
+ } = getEditDomainStoreData()
+ const route = useRoute()
+ const domain = route.params.domain as string
+ getStylingInfo(domain)
+
+
+ function colorRenderLabel() {
+ return ""
+ }
</script>
<style scoped lang="scss">
diff --git a/core/frontend/src/views/domain/pages/editDomain/components/Typography.vue b/core/frontend/src/views/domain/pages/editDomain/components/Typography.vue
index 54e41abc..0f99b6e6 100644
--- a/core/frontend/src/views/domain/pages/editDomain/components/Typography.vue
+++ b/core/frontend/src/views/domain/pages/editDomain/components/Typography.vue
@@ -2,12 +2,22 @@
<div class="content-wrapper">
<n-card class="mb-5">
<div class="page-tit" style="margin: 0;">
- <div class="back-tool">
- <i class="i-ri:apps-fill text-6"></i>
+ <div class="left-tit">
+ <div class="back-tool">
+ <i class="i-ri:apps-fill text-6"></i>
+ </div>
+ <span class="tit-content">
+ Typography
+ </span>
+ </div>
+ <div class="right-tit">
+ <n-button type="primary" @click="updateTypography(domain)">
+ <template #icon>
+ <i class="i-mingcute:save-2-line text-5"></i>
+ </template>
+ Save
+ </n-button>
</div>
- <span class="tit-content">
- Typography
- </span>
</div>
</n-card>
@@ -15,13 +25,15 @@
<n-form>
<n-form-item>
<template #label><span class="form-label">Heading Font</span></template>
- <n-input></n-input>
+ <n-input v-model:value="heading_font"></n-input>
</n-form-item>
<n-card class="form-desc">
<div class="container">
<div class="form-label">Preview:</div>
- <div class="desc">The quick brown fox jumps over the lazy dog</div>
+ <div class="desc" :style="{ fontFamily: heading_font }">The quick brown fox jumps over the lazy
+ dog
+ </div>
</div>
</n-card>
</n-form>
@@ -31,13 +43,14 @@
<n-form>
<n-form-item>
<template #label><span class="form-label">Body Font</span></template>
- <n-input></n-input>
+ <n-input v-model:value="body_font"></n-input>
</n-form-item>
<n-card class="form-desc">
<div class="container">
<div class="form-label">Preview:</div>
- <div class="desc">The quick brown fox jumps over the lazy dog</div>
+ <div class="desc" :style="{ fontFamily: body_font }">The quick brown fox jumps over the lazy dog
+ </div>
</div>
</n-card>
</n-form>
@@ -54,7 +67,15 @@
</template>
<script setup lang="ts">
-
+ import { updateTypography } from "../controller/typography.controller"
+ import { getEditDomainStoreData } from '../store';
+
+ const {
+ heading_font,
+ body_font,
+ } = getEditDomainStoreData()
+ const route = useRoute()
+ const domain = route.params.domain as string
</script>
<style scoped lang="scss">
@@ -84,7 +105,6 @@
.desc {
color: var(--color-text-1);
font-size: 14px;
- font-weight: bold;
}
}
}
@@ -93,11 +113,13 @@
.attention-tit {
margin-bottom: 10px;
}
+
.attention-item {
padding-left: 10px;
position: relative;
- &::before{
- content:"";
+
+ &::before {
+ content: "";
display: block;
width: 4px;
height: 4px;
diff --git a/core/frontend/src/views/domain/pages/editDomain/components/mixin.scss b/core/frontend/src/views/domain/pages/editDomain/components/mixin.scss
index cd77acf6..b7f0d3b8 100644
--- a/core/frontend/src/views/domain/pages/editDomain/components/mixin.scss
+++ b/core/frontend/src/views/domain/pages/editDomain/components/mixin.scss
@@ -7,27 +7,35 @@
}
@mixin page-tit {
- @include base.row-flex-start;
- margin-bottom: 20px;
+ @include base.row-flex;
+ justify-content: space-between;
gap: 5px;
- .back-tool {
- color: var(--color-primary-1);
+ .left-tit {
@include base.row-flex-start;
- gap: 5px;
- cursor: pointer;
- @include base.transition-all;
+ gap: 8px;
- .back-btn {
- font-size: 18px;
+ .back-tool {
+ color: var(--color-primary-1);
+ @include base.row-flex-start;
+ gap: 5px;
+ cursor: pointer;
+ @include base.transition-all;
+
+ .back-btn {
+ font-size: 18px;
+ }
}
- }
- .tit-content {
- font-size: 16px;
- color: var(--color-text-1);
- font-weight: bold;
+ .tit-content {
+ font-size: 16px;
+ color: var(--color-text-1);
+ font-weight: bold;
+ }
}
+
+ .right-tit {}
+
}
@mixin form-label {
diff --git a/core/frontend/src/views/domain/pages/editDomain/controller/aiSettings.controller.ts b/core/frontend/src/views/domain/pages/editDomain/controller/aiSettings.controller.ts
new file mode 100644
index 00000000..ee3b4dd1
--- /dev/null
+++ b/core/frontend/src/views/domain/pages/editDomain/controller/aiSettings.controller.ts
@@ -0,0 +1,36 @@
+/**
+ * @description Get ai settings info
+ */
+import { instance } from "@/api";
+import { instanceOptions } from "./companyProfile.controller";
+import { getEditDomainStoreData } from "../store";
+/**
+ * @description Get ai settings info
+ */
+export async function getAisettingsInfo(domain: string) {
+ const { prompt, hasGotAisettings } = getEditDomainStoreData()
+ if (hasGotAisettings.value) return
+ try {
+ const res = await instance.post("/askai/project/get_prompt", { domain }, instanceOptions) as Record<string, string>
+ prompt.value = res.prompt
+ hasGotAisettings.value = true
+ } catch (error) {
+ console.warn(error)
+ }
+}
+
+/**
+ * @description Update ai settings info
+ */
+export async function updateAisettingsInfo(domain: string) {
+ const { prompt } = getEditDomainStoreData()
+ try {
+ const res = await instance.post("/askai/project/modify_prompt", {
+ domain,
+ prompt: prompt.value
+ }, instanceOptions) as Record<string, string>
+ prompt.value = res.prompt
+ } catch (error) {
+ console.warn(error)
+ }
+}
\ No newline at end of file
diff --git a/core/frontend/src/views/domain/pages/editDomain/controller/companyProfile.controller.ts b/core/frontend/src/views/domain/pages/editDomain/controller/companyProfile.controller.ts
new file mode 100644
index 00000000..9d6f73bf
--- /dev/null
+++ b/core/frontend/src/views/domain/pages/editDomain/controller/companyProfile.controller.ts
@@ -0,0 +1,65 @@
+import { instance } from "@/api";
+import { getEditDomainStoreData } from "../store";
+export const instanceOptions = {
+ fetchOptions: {
+ loading: 'Loading... Please wait.',
+ successMessage: true,
+ }
+}
+/**
+ * @description Get company profile
+ *
+ * @param { string } domain
+ */
+export async function getCompanuyProfile(domain: string) {
+ const {
+ legal_company_name,
+ web_site,
+ company_profile,
+ email,
+ phone,
+ support_url,
+ hasGotCompanyProfile
+ } = getEditDomainStoreData()
+ if (hasGotCompanyProfile.value) return
+ try {
+ const res = await instance.post("/askai/project/get_company_profile", { domain }, instanceOptions) as Record<string, any>
+ legal_company_name.value = res.legal_company_name
+ web_site.value = res.web_site
+ company_profile.value = res.company_profile
+ email.value = res.email
+ phone.value = res.phone
+ support_url.value = res.support_url
+
+ hasGotCompanyProfile.value = true
+ } catch (error) {
+ console.warn(error)
+ }
+}
+
+/**
+ * @description Update company profile
+ */
+export async function updateCompanyProfile(domain: string) {
+ const {
+ legal_company_name,
+ web_site,
+ company_profile,
+ email,
+ phone,
+ support_url,
+ } = getEditDomainStoreData()
+ try {
+ await instance.post("/askai/project/modify_company_profile", {
+ domain,
+ legal_company_name: legal_company_name.value,
+ web_site: web_site.value,
+ company_profile: company_profile.value,
+ email: email.value,
+ phone: phone.value,
+ support_url: support_url.value,
+ }, instanceOptions) as Record<string, any>
+ } catch (error) {
+ console.warn(error)
+ }
+}
\ No newline at end of file
diff --git a/core/frontend/src/views/domain/pages/editDomain/controller/footerSettings.controller.ts b/core/frontend/src/views/domain/pages/editDomain/controller/footerSettings.controller.ts
new file mode 100644
index 00000000..87bb87a1
--- /dev/null
+++ b/core/frontend/src/views/domain/pages/editDomain/controller/footerSettings.controller.ts
@@ -0,0 +1,44 @@
+import { instance } from "@/api";
+import { instanceOptions } from "./companyProfile.controller";
+import { getEditDomainStoreData } from "../store";
+/***
+ * @description Get footer settings info
+ *
+ * @param { string } domain
+ */
+export async function getFootersettingsInfo(domain: string) {
+ const {
+ copyright_text,
+ disclaimer,
+ hasGotFootersettings
+ } = getEditDomainStoreData()
+ if (hasGotFootersettings.value) return
+ try {
+ const res = await instance.post("/askai/project/get_footer", { domain }, instanceOptions) as Record<string, string>
+ copyright_text.value = res.copyright_text
+ disclaimer.value = res.disclaimer
+ hasGotFootersettings.value = true
+ } catch (error) {
+ console.warn(error)
+ }
+}
+
+/**
+ * @description Update footer settings info
+ *
+ */
+export async function updateFootersettingsInfo(domain: string) {
+ const {
+ copyright_text,
+ disclaimer
+ } = getEditDomainStoreData()
+ try {
+ await instance.post("/askai/project/modify_footer", {
+ domain,
+ copyright_text: copyright_text.value,
+ disclaimer: disclaimer.value
+ }, instanceOptions) as Record<string, string>
+ } catch (error) {
+ console.warn(error)
+ }
+}
\ No newline at end of file
diff --git a/core/frontend/src/views/domain/pages/editDomain/controller/projectDetail.controller.ts b/core/frontend/src/views/domain/pages/editDomain/controller/projectDetail.controller.ts
new file mode 100644
index 00000000..53a92098
--- /dev/null
+++ b/core/frontend/src/views/domain/pages/editDomain/controller/projectDetail.controller.ts
@@ -0,0 +1,128 @@
+import { getEditDomainStoreData } from "../store";
+import { instance } from "@/api";
+import { instanceOptions } from "./companyProfile.controller"
+import { KnowledgeBase } from "../dto";
+import { confirm } from "@/utils";
+/**
+ * @description Get project detail
+ */
+export async function getProjectDetail(domainStr: string, noOption?: boolean) {
+ const { project_name, primary_logo, favicon, industry, description, secondary_logo, hasGotProjectDetail, knowledge_base } = getEditDomainStoreData()
+ if (hasGotProjectDetail.value) return
+ try {
+ const res = await instance.post("/askai/project/get_base_info", { domain: domainStr }, noOption ? {} : instanceOptions) as Record<string, any>
+ project_name.value = res.project_name;
+ primary_logo.value = res.primary_logo;
+ favicon.value = res.favicon;
+ industry.value = res.industry;
+ description.value = res.description;
+ secondary_logo.value = res.secondary_logo;
+ knowledge_base.value = res.knowledge_base
+ hasGotProjectDetail.value = true
+ } catch (error) {
+ console.warn(error)
+ }
+}
+
+/**
+ * @description Update project detail
+ */
+export async function updateProjectDetail(domainStr: string) {
+ const { project_name, primary_logo, favicon, industry, description, secondary_logo } = getEditDomainStoreData()
+ try {
+ await instance.post("/askai/project/modify_base_info", {
+ domain: domainStr,
+ project_name: project_name.value,
+ primary_logo: primary_logo.value,
+ favicon: favicon.value,
+ industry: industry.value,
+ description: description.value,
+ secondary_logo: secondary_logo.value,
+ }, instanceOptions)
+ } catch (error) {
+ console.warn(error)
+ }
+}
+
+/**
+ * @description Create knowledge base
+ */
+export async function createKnowledgeBase(domain: string) {
+ try {
+ const { knowledgeTitle, knowledgeContent, hasGotProjectDetail } = getEditDomainStoreData()
+ await instance.post("/askai/project/create_knowledge_base_file", {
+ domain,
+ title: knowledgeTitle.value,
+ content: knowledgeContent.value
+ }, instanceOptions) as Record<string, any>
+ hasGotProjectDetail.value = false
+ await getProjectDetail(domain, true)
+ closeKnowledgeModal()
+ } catch (error) {
+ console.warn(error)
+ }
+}
+
+/**
+ * @description Update knowledge base
+ */
+export async function updateKnowledgeBase(domain: string) {
+ const { activeKnowledge, hasGotProjectDetail, knowledgeTitle, knowledgeContent } = getEditDomainStoreData()
+ try {
+ await instance.post("/askai/project/modify_knowledge_base_file", {
+ domain,
+ title: knowledgeTitle.value,
+ content: knowledgeContent.value,
+ kid: activeKnowledge.value.kid
+ })
+ hasGotProjectDetail.value = false
+ await getProjectDetail(domain, true)
+ closeKnowledgeModal()
+ } catch (error) {
+ console.warn(error)
+ }
+}
+
+/**
+ * @description Close knowledge modal
+ */
+export function closeKnowledgeModal() {
+ const { knowledgeContent, knowledgeTitle, knowledgeModalShow, isEditKnowledge } = getEditDomainStoreData()
+ knowledgeContent.value = ""
+ knowledgeTitle.value = ""
+ knowledgeModalShow.value = false
+ isEditKnowledge.value = false
+}
+
+/**
+ * @description Open edit knowledge modal
+ */
+export function openEditKnowledge(knowledge: KnowledgeBase) {
+ const {
+ knowledgeTitle,
+ knowledgeContent,
+ knowledgeModalShow,
+ activeKnowledge,
+ isEditKnowledge,
+ } = getEditDomainStoreData()
+
+ activeKnowledge.value = knowledge
+ knowledgeTitle.value = knowledge.title
+ knowledgeContent.value = knowledge.content
+ knowledgeModalShow.value = true
+ isEditKnowledge.value = true
+}
+
+/**
+ * @description Delete knowledge base
+ */
+export async function deleteKnowledgeBase(domain: string, knowledge: KnowledgeBase) {
+ const { hasGotProjectDetail } = getEditDomainStoreData()
+ try {
+ await instance.post("/askai/project/remove_knowledge_base_file", { domain, kid: knowledge.kid }, instanceOptions)
+ hasGotProjectDetail.value = false
+ getProjectDetail(domain, true)
+ } catch (error) {
+ console.warn(error)
+ }
+}
\ No newline at end of file
diff --git a/core/frontend/src/views/domain/pages/editDomain/controller/sitemap.controller.ts b/core/frontend/src/views/domain/pages/editDomain/controller/sitemap.controller.ts
new file mode 100644
index 00000000..9b46b6d1
--- /dev/null
+++ b/core/frontend/src/views/domain/pages/editDomain/controller/sitemap.controller.ts
@@ -0,0 +1,45 @@
+import { instance } from "@/api";
+import { instanceOptions } from "./companyProfile.controller";
+import { getEditDomainStoreData } from "../store";
+import { SiteInfo } from "../dto";
+/**
+ * @description Get Sitemap info
+ *
+ * @param { string } domain
+ */
+export async function getSitemapInfo(domain: string) {
+ const { sitemap, hasGotSitemap } = getEditDomainStoreData()
+ if (hasGotSitemap.value) return
+ try {
+ const res = await instance.post("/askai/project/get_sitemap", { domain }) as SiteInfo[]
+ sitemap.value = res.length == 0 ? [{ title: "", uri_path: "" }] : res.map(item => {
+ item.isSaved = true
+ return item
+ })
+ hasGotSitemap.value = true
+ } catch (error) {
+ console.warn(error)
+ }
+}
+
+/**
+ * @description Add sitemap url
+ */
+export async function addSitemapInfo(domain: string, title: string, uri_path: string) {
+ try {
+ await instance.post("/askai/project/add_sitemap_node", { domain, title, uri_path }, instanceOptions)
+ } catch (error) {
+ console.warn(error)
+ }
+}
+
+/**
+ * @description Remove sitemap url
+ */
+export async function removeSiteMapInfo(domain: string, uri_path: string) {
+ try {
+ await instance.post("/askai/project/remove_sitemap_node", { domain, uri_path }, instanceOptions)
+ } catch (error) {
+ console.warn(error)
+ }
+}
\ No newline at end of file
diff --git a/core/frontend/src/views/domain/pages/editDomain/controller/styleing.controller.ts b/core/frontend/src/views/domain/pages/editDomain/controller/styleing.controller.ts
new file mode 100644
index 00000000..b67bdefc
--- /dev/null
+++ b/core/frontend/src/views/domain/pages/editDomain/controller/styleing.controller.ts
@@ -0,0 +1,60 @@
+import { instance } from "@/api";
+import { getEditDomainStoreData } from "../store";
+import { instanceOptions } from "./companyProfile.controller"
+/**
+ * @description Get styleing info
+ *
+ * @param { string } domain
+ */
+export async function getStylingInfo(domain: string) {
+ const {
+ accent_color,
+ text_color,
+ page_background,
+ container_background,
+ link_social_color,
+ link_footer_color,
+ heading_font,
+ body_font,
+ hasGotStyleing
+ } = getEditDomainStoreData()
+ if (hasGotStyleing.value) return
+ try {
+ const res = await instance.post("/askai/project/get_style_config", { domain }, instanceOptions) as Record<string, any>
+ accent_color.value = res.accent_color
+ text_color.value = res.text_color
+ page_background.value = res.page_background
+ container_background.value = res.container_background
+ link_social_color.value = res.link_social_color
+ link_footer_color.value = res.link_footer_color
+ heading_font.value = res.heading_font
+ body_font.value = res.body_font
+
+ hasGotStyleing.value = true
+ } catch (error) {
+ console.warn(error)
+ }
+}
+
+/**
+ * @description Update styleing info
+ */
+export async function updateStyleingInfo(domain: string) {
+ const {
+ accent_color,
+ text_color,
+ page_background,
+ container_background,
+ } = getEditDomainStoreData()
+ try {
+ await instance.post("/askai/project/modify_style_config", {
+ domain,
+ accent_color: accent_color.value,
+ text_color: text_color.value,
+ page_background: page_background.value,
+ container_background: container_background.value,
+ }, instanceOptions) as Record<string, any>
+ } catch (error) {
+ console.warn(error)
+ }
+}
\ No newline at end of file
diff --git a/core/frontend/src/views/domain/pages/editDomain/controller/typography.controller.ts b/core/frontend/src/views/domain/pages/editDomain/controller/typography.controller.ts
new file mode 100644
index 00000000..61f87820
--- /dev/null
+++ b/core/frontend/src/views/domain/pages/editDomain/controller/typography.controller.ts
@@ -0,0 +1,21 @@
+import { instance } from "@/api"
+import { getEditDomainStoreData } from "../store"
+import { instanceOptions } from "./companyProfile.controller"
+/**
+ * @description Update typography info
+ */
+export async function updateTypography(domain: string) {
+ const {
+ heading_font,
+ body_font,
+ } = getEditDomainStoreData()
+ try {
+ await instance.post("/askai/project/modify_style_config", {
+ domain,
+ heading_font: heading_font.value,
+ body_font: body_font.value
+ }, instanceOptions)
+ } catch (error) {
+ console.warn(error)
+ }
+}
\ No newline at end of file
diff --git a/core/frontend/src/views/domain/pages/editDomain/dto/index.ts b/core/frontend/src/views/domain/pages/editDomain/dto/index.ts
new file mode 100644
index 00000000..b47cfdc7
--- /dev/null
+++ b/core/frontend/src/views/domain/pages/editDomain/dto/index.ts
@@ -0,0 +1,14 @@
+/**
+ * @description Sitemap site url info
+ */
+export type SiteInfo = { title: string, uri_path: string, isSaved?: boolean }
+
+/**
+ * @description Profile detail knowledge base
+ */
+export type KnowledgeBase = {
+ title: string
+ content: string
+ kid: string
+ update_timme: number
+}
\ No newline at end of file
diff --git a/core/frontend/src/views/domain/pages/editDomain/index.vue b/core/frontend/src/views/domain/pages/editDomain/index.vue
index a21cfb42..76386b31 100644
--- a/core/frontend/src/views/domain/pages/editDomain/index.vue
+++ b/core/frontend/src/views/domain/pages/editDomain/index.vue
@@ -13,8 +13,7 @@
<!-- Content tabs -->
<div class="content-tabs">
- <div :class="['tab-item', { active: activeTab == item }]" @click="activeTab = item"
- v-for="(item, index) in menuList" :key="index">
+ <div v-for="(item, index) in menuList" :key="index" :class="['tab-item', { active: activeTab == item }]" @click="activeTab = item">
<span>{{ item }}</span>
</div>
</div>
@@ -43,7 +42,7 @@
"Footer Settings",
"AI Settings"
])
- const activeTab = ref("AI Settings")
+ const activeTab = ref("Footer Settings")
const contentMap = ref(new Map([
["Domain Configuration", DomainConfiguration],
["Project Details", ProjectDetails],
diff --git a/core/frontend/src/views/domain/pages/editDomain/store/index.ts b/core/frontend/src/views/domain/pages/editDomain/store/index.ts
new file mode 100644
index 00000000..4af90f3e
--- /dev/null
+++ b/core/frontend/src/views/domain/pages/editDomain/store/index.ts
@@ -0,0 +1,115 @@
+import { defineStore, storeToRefs } from "pinia";
+import { KnowledgeBase, SiteInfo } from "../dto";
+
+const editDomainStore = defineStore("editDomainStoroe", () => {
+ // Project detail
+ const hasGotProjectDetail = ref(false)
+ const domain = ref("")
+ const description = ref("")
+ const favicon = ref("")
+ const industry = ref("")
+ const primary_logo = ref("")
+ const project_name = ref("")
+ const secondary_logo = ref("")
+ const knowledge_base = ref<KnowledgeBase[]>([])
+ const activeKnowledge = ref<KnowledgeBase>({
+ title: "",
+ content: "",
+ kid: "",
+ update_timme: 0
+ })
+ const knowledgeTitle = ref("")
+ const knowledgeContent = ref("")
+ const knowledgeModalShow = ref(false)
+ const isEditKnowledge = ref(false)
+
+ // Company profile
+ const hasGotCompanyProfile = ref(false)
+ const legal_company_name = ref("")
+ const web_site = ref("")
+ const company_profile = ref("")
+ const email = ref("")
+ const phone = ref("")
+ const support_url = ref("")
+
+ // Styleing
+ const hasGotStyleing = ref(false)
+ const accent_color = ref("")
+ const text_color = ref("")
+ const page_background = ref("")
+ const container_background = ref("")
+ const link_social_color = ref("")
+ const link_footer_color = ref("")
+ const heading_font = ref("")
+ const body_font = ref("")
+
+ // Sitemap
+ const hasGotSitemap = ref(false)
+ const sitemap = ref<SiteInfo[]>([
+ {
+ title: "",
+ uri_path: ""
+ }
+ ])
+
+ // Footer settings
+ const hasGotFootersettings = ref(false)
+ const copyright_text = ref("")
+ const disclaimer = ref("")
+
+ // Ai settings
+ const hasGotAisettings = ref(false)
+ const prompt = ref("")
+
+ return {
+ hasGotProjectDetail,
+ domain,
+ description,
+ favicon,
+ industry,
+ primary_logo,
+ project_name,
+ secondary_logo,
+ knowledge_base,
+ activeKnowledge,
+ knowledgeTitle,
+ knowledgeContent,
+ knowledgeModalShow,
+ isEditKnowledge,
+
+ hasGotCompanyProfile,
+ legal_company_name,
+ web_site,
+ company_profile,
+ email,
+ phone,
+ support_url,
+
+ hasGotStyleing,
+ accent_color,
+ text_color,
+ page_background,
+ container_background,
+ link_social_color,
+ link_footer_color,
+ heading_font,
+ body_font,
+
+ hasGotSitemap,
+ sitemap,
+
+ hasGotFootersettings,
+ copyright_text,
+ disclaimer,
+
+ hasGotAisettings,
+ prompt
+ }
+})
+
+export function getEditDomainStoreData() {
+ const store = editDomainStore()
+ return {
+ ...storeToRefs(store)
+ }
+}
\ No newline at end of file
diff --git a/core/frontend/src/views/template/components/CreateTplModal.vue b/core/frontend/src/views/template/components/CreateTplModal.vue
new file mode 100644
index 00000000..ab8830df
--- /dev/null
+++ b/core/frontend/src/views/template/components/CreateTplModal.vue
@@ -0,0 +1,121 @@
+<template>
+ <n-modal v-model:show="show" preset="card" draggable :close-on-esc="false" :mask-closable="false" segmented class="w-110"
+ title="">
+ <div class="wrapper">
+ <div class="creation-methods">
+ <div v-for="(item, index) in methodsList" :key="index"
+ :class="['choose-item', { active: choosedMethod == item }]" @click="choosedMethod = item">
+ <!-- <i
+ :class="[choosedMethod == item ? 'i-material-symbols:check-circle' : 'i-material-symbols:check-circle-outline', 'text-6']"></i> -->
+ <span class="item-label">{{ item }}</span>
+ </div>
+ </div>
+ <div :class="['url-source', { hidden: choosedMethod !== 'AI' }]">
+ <span class="label">Source Url</span>
+ <n-input style="flex: 1;"></n-input>
+ </div>
+ <div class="desc">
+ Use AI tools to help you automatically generate email content and improve your work efficiency.
+ </div>
+ </div>
+
+ <template #footer>
+ <div class="flex justify-end">
+ <n-button type="primary" @click="jumpAndCreat">Create</n-button>
+ </div>
+ </template>
+ </n-modal>
+</template>
+
+<script setup lang="ts">
+ const router = useRouter()
+ const methodsList = ref(["Drag", "AI", "HTML"])
+ const choosedMethod = ref("")
+ const show = ref(false)
+ /**
+ * @description open modal
+ */
+ function open() {
+ show.value = true
+ }
+
+ /**
+ * @description close modal
+ */
+ function close() {
+ show.value = false
+ }
+
+ /**
+ * @description jump
+ */
+ function jumpAndCreat() {
+ router.push({ name: "ai-template" })
+ }
+ defineExpose({
+ open,
+ close
+ })
+</script>
+
+<style scoped lang="scss">
+ @use "@/styles/index" as base;
+
+ .wrapper {
+ @include base.col-flex-center;
+ height: 153px;
+ gap: 20px;
+
+ .creation-methods {
+ @include base.row-flex-center;
+ border-bottom: 1px solid var(--color-border-1);
+ width: 90%;
+ gap: 25px;
+
+ .choose-item {
+ @include base.row-flex-start;
+ gap: 5px;
+ padding: 6px 15px;
+ align-items: center;
+ cursor: pointer;
+ color: var(--color-text-2);
+ transition: .1s all ease-in-out;
+ box-sizing: border-box;
+
+ .item-label {
+ font-size: 16px;
+ transition: .2s all ease-in-out;
+ }
+
+ &:hover {
+ color: var(--color-primary-1);
+ // transform: scale(1.3) translate(0, -5px);
+ }
+
+ &.active {
+ color: var(--color-primary-1);
+ transform: scale(1.3) translate(0, -5px);
+ font-weight: bold;
+ border-bottom: 2px solid var(--color-primary-1);
+ }
+ }
+ }
+
+ .url-source {
+ width: 90%;
+ @include base.row-flex-start;
+ gap: 10px;
+
+ &.hidden {
+ visibility: hidden;
+ }
+ }
+
+ .desc {
+ width: 90%;
+ font-size: 14px;
+ color: var(--color-text-3);
+ }
+ }
+
+</style>
\ No newline at end of file
diff --git a/core/frontend/src/views/template/index.vue b/core/frontend/src/views/template/index.vue
index 1ce1aabb..372ca215 100644
--- a/core/frontend/src/views/template/index.vue
+++ b/core/frontend/src/views/template/index.vue
@@ -1,13 +1,43 @@
<template>
- <div>
-template
+ <div class="wrapper">
+ <!-- Page tit -->
+ <div class="page-tit">
+ <span class="tit-content">
+ Template
+ </span>
+ </div>
+
+ <!-- Content -->
+ <div class="container">
+ <div class="container-top">
+ <n-button type="primary" @click="handleCreateTpl">Create Template</n-button>
+ </div>
+ </div>
</div>
+
+ <CreateTplModal ref="createTplModalRef"/>
</template>
<script setup lang="ts">
-
+import CreateTplModal from './components/CreateTplModal.vue'
+const createTplModalRef = ref()
+/**
+ * @description open creation modal when click button
+ */
+function handleCreateTpl(){
+ createTplModalRef.value.open()
+}
</script>
-<style scoped>
+<style scoped lang="scss">
+@use "@/styles/index" as base;
+@use "./mixin.scss";
+
+.wrapper {
+ @include mixin.wrapper;
+ .page-tit {
+ @include mixin.page-tit;
+ }
+}
</style>
\ No newline at end of file
diff --git a/core/frontend/src/views/template/mixin.scss b/core/frontend/src/views/template/mixin.scss
new file mode 100644
index 00000000..4a2dd4c3
--- /dev/null
+++ b/core/frontend/src/views/template/mixin.scss
@@ -0,0 +1,40 @@
+@use "@/styles/index" as base;
+
+@mixin wrapper {
+ display: grid;
+ grid-template-rows: 40px 1fr;
+ height: calc(100%);
+ box-sizing: border-box;
+ padding: 24px;
+
+
+}
+
+@mixin page-tit {
+ @include base.row-flex-start;
+ margin-bottom: 20px;
+ gap: 15px;
+
+ .back-tool {
+ color: var(--color-primary-1);
+ @include base.row-flex-start;
+ gap: 5px;
+ cursor: pointer;
+ @include base.transition-all;
+
+ &:hover {
+ color: var(--color-primary-3);
+ }
+
+ .back-btn {
+ font-size: 18px;
+ }
+ }
+
+ .tit-content {
+ font-size: 18px;
+ color: var(--color-text-1);
+ font-weight: bold;
+ }
+}
+
diff --git a/core/frontend/src/views/template/pages/AITemplate/components/MarkdownRender.vue b/core/frontend/src/views/template/pages/AITemplate/components/MarkdownRender.vue
new file mode 100644
index 00000000..8e8347fc
--- /dev/null
+++ b/core/frontend/src/views/template/pages/AITemplate/components/MarkdownRender.vue
@@ -0,0 +1,13 @@
+<template>
+ <div>
+
+ </div>
+</template>
+
+<script setup lang="ts">
+
+</script>
+
+<style scoped>
+
+</style>
\ No newline at end of file
diff --git a/core/frontend/src/views/template/pages/AITemplate/highlight.theme.css b/core/frontend/src/views/template/pages/AITemplate/highlight.theme.css
new file mode 100644
index 00000000..79d29146
--- /dev/null
+++ b/core/frontend/src/views/template/pages/AITemplate/highlight.theme.css
@@ -0,0 +1,94 @@
+pre code.hljs {
+ display: block;
+ overflow-x: auto;
+ padding: 1em;
+ }
+ code.hljs {
+ padding: 3px 5px
+ }
+
+ pre {
+ color: var(--color-bg-2) !important;
+ }
+ /*
+
+ Atom One Dark by Daniel Gamage
+ Original One Dark Syntax theme from https://github.com/atom/one-dark-syntax
+
+ base: #282c34
+ mono-1: #abb2bf
+ mono-2: #818896
+ mono-3: #5c6370
+ hue-1: #56b6c2
+ hue-2: #61aeee
+ hue-3: #c678dd
+ hue-4: #98c379
+ hue-5: #e06c75
+ hue-5-2: #be5046
+ hue-6: #d19a66
+ hue-6-2: #e6c07b
+
+ */
+ .hljs {
+ color: #e4e4e4;
+ background: #282c34
+ }
+ .hljs-comment,
+ .hljs-quote {
+ color: #e1e2e4;
+ font-style: italic
+ }
+ .hljs-doctag,
+ .hljs-keyword,
+ .hljs-formula {
+ color: #c678dd
+ }
+ .hljs-section,
+ .hljs-name,
+ .hljs-selector-tag,
+ .hljs-deletion,
+ .hljs-subst {
+ color: #e06c75
+ }
+ .hljs-literal {
+ color: #56b6c2
+ }
+ .hljs-string,
+ .hljs-regexp,
+ .hljs-addition,
+ .hljs-attribute,
+ .hljs-meta .hljs-string {
+ color: #98c379
+ }
+ .hljs-attr,
+ .hljs-variable,
+ .hljs-template-variable,
+ .hljs-type,
+ .hljs-selector-class,
+ .hljs-selector-attr,
+ .hljs-selector-pseudo,
+ .hljs-number {
+ color: #d19a66
+ }
+ .hljs-symbol,
+ .hljs-bullet,
+ .hljs-link,
+ .hljs-meta,
+ .hljs-selector-id,
+ .hljs-title {
+ color: #61aeee
+ }
+ .hljs-built_in,
+ .hljs-title.class_,
+ .hljs-class .hljs-title {
+ color: #e6c07b
+ }
+ .hljs-emphasis {
+ font-style: italic
+ }
+ .hljs-strong {
+ font-weight: bold
+ }
+ .hljs-link {
+ text-decoration: underline
+ }
\ No newline at end of file
diff --git a/core/frontend/src/views/template/pages/AITemplate/index.vue b/core/frontend/src/views/template/pages/AITemplate/index.vue
new file mode 100644
index 00000000..0d659d77
--- /dev/null
+++ b/core/frontend/src/views/template/pages/AITemplate/index.vue
@@ -0,0 +1,307 @@
+<template>
+ <div class="wrapper">
+ <div class="page-tit">
+ <div class="back-tool">
+ <i class="i-ci:arrow-left-lg text-4"></i>
+ <div class="back-btn">back</div>
+ </div>
+ <span class="tit-content">
+ AI Template
+ </span>
+ </div>
+
+ <div class="ai-container">
+ <div class="chat-area">
+ <div ref="answerRef" class="answer">
+ <n-card style="height: 100%;">
+ <n-scrollbar :style="{ height: `${answerHeight! - 40}px` }">
+ <div class="answer-container">
+ <div class="ask-content">
+ <div class="pic">
+ <i
+ class="i-material-symbols:account-circle text-6 text-[var(--color-primary-hover-1)]"></i>
+ </div>
+ <div class="text">
+ 我有几个问题,帮我实现以下效果:<br />
+ 1. 定制一个618宝塔面板的优惠活动<br />
+ 2. 主题色为绿色<br />
+ 3. 价格区间可以参考官网设计的价格,但需要注意的是,如果企业版本和活动版本的优惠冲突,那就以企业版本的优先<br />
+ </div>
+ </div>
+ <div class="answer-content">
+ <div class="pic">
+ <span class="text-4 text-[var(--color-primary-hover-1)]">BillionMail</span>
+ </div>
+ <div class="text">
+ <div class="mb-2.5">好的,根据您的要求,我为您生成了以下代码结构,您可以直接复制运行: </div>
+ <div class="code-area">
+ <div class="code-tool">
+ <span>{{ languageTit }}</span>
+ <div class="tools">
+ <div class="tool-item">
+ <i class="i-material-symbols:chrome-restore-rounded text-5"></i>
+ <span>Copy</span>
+ </div>
+ <div class="tool-item">
+ <i class="i-mingcute:eye-2-fill text-5"></i>
+ <span>View</span>
+ </div>
+ </div>
+ </div>
+ <div v-html="codeHtml"></div>
+ </div>
+ </div>
+ <div class="answer-tool">
+ <div class="tool-item">
+ <i class="i-ri:refresh-line text-5"></i>
+ <span>Regenerate</span>
+ </div>
+ <div class="tool-item">
+ <i class="i-material-symbols:chrome-restore-rounded text-5"></i>
+ <span>Copy</span>
+ </div>
+ <div class="tool-item">
+ <i class="i-ri:information-2-fill text-5"></i>
+ <span>Info</span>
+ </div>
+ </div>
+ </div>
+ </div>
+ </n-scrollbar>
+ </n-card>
+ </div>
+ <div class="question">
+ <n-card style="height: 100%;">
+ <n-input type="textarea" class="question-input"></n-input>
+ <div class="send-btn">
+ <i
+ class="i-icon-park-twotone:new-picture text-8 text-[var(--color-primary-1)] hover-text-[var(--color-primary-hover-1)]"></i>
+ <i
+ class="i-icon-park-twotone:arrow-circle-up text-8 text-[var(--color-primary-1)] hover-text-[var(--color-primary-hover-1)]"></i>
+ </div>
+ </n-card>
+ </div>
+ </div>
+ <div class="view-area">
+ <n-card style="height: 100%;"></n-card>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script setup lang="ts">
+ import markdownit from "markdown-it"
+ import hljs from 'highlight.js';
+ import { useTemplateRef } from 'vue';
+ import "./highlight.theme.css"
+ const answerRef = useTemplateRef("answerRef")
+ const answerHeight = computed(() => {
+ return answerRef.value?.offsetHeight
+ })
+ const languageTit = ref("")
+ const md = markdownit({
+ html: true,
+ linkify: true,
+ typographer: true,
+ langPrefix: 'language-',
+ highlight: function (str, lang): any {
+ languageTit.value = lang
+ if (lang && hljs.getLanguage(lang)) {
+ try {
+ return hljs.highlight(lang, str).value;
+ } catch (__) { console.warn(__) }
+ }
+
+ return md.utils.escapeHtml(str);// 使用额外的默认转义
+ }
+ })
+
+
+const codeStr = `
+\`\`\`vue
+let a = 20;
+function calc(){
+ for(let i=0;i<a;i++){
+ console.log(\`这是用于测试的代码-\${i}\`)
+ }
+}
+
+class TestClass {
+ private name:string;
+ public age:nuumber
+
+ constructor(name:string,age:number){
+ this.name = name;
+ this.age = age
+ }
+}
+\`\`\`
+`;
+ const codeHtml = ref("")
+ codeHtml.value = md.render(codeStr)
+</script>
+
+<style scoped lang="scss">
+ @use "@/styles/index" as base;
+ @use "../../mixin.scss";
+
+ .wrapper {
+ @mixin content-card {
+ border-radius: 5px;
+ padding: 20px;
+ }
+
+ @include mixin.wrapper;
+
+ .page-tit {
+ @include mixin.page-tit;
+ }
+
+ .ai-container {
+ display: grid;
+ grid-template-columns: 500px 1fr;
+ gap: 15px;
+
+ .chat-area {
+ display: grid;
+ grid-template-rows: 1fr 230px;
+ gap: 15px;
+
+ .answer {
+ .answer-container {
+ padding: 30px 10px;
+
+ .ask-content,
+ .answer-content {
+ @include content-card();
+ background: var(--color-bg-3);
+ display: grid;
+ grid-template-rows: 30px 1fr;
+ gap: 10px;
+ margin-bottom: 20px;
+
+ .pic {
+ @include base.row-flex;
+ align-items: center;
+ }
+
+ @mixin item-tool {
+ @include base.row-flex-start;
+ cursor: pointer;
+ gap: 5px;
+ padding: 5px 10px;
+ align-items: center;
+ font-size: 12px;
+ border-radius: 3px;
+ transition:.1s all ease-in-out;
+
+ &:hover {
+ background: var(--color-primary-1);
+ color: #fff;
+ }
+
+ &:active{
+ background: var(--color-primary-3);
+ }
+ }
+
+ .text {
+ font-size: 14px;
+
+ .code-area {
+ .code-tool {
+ @include base.row-flex;
+ justify-content: space-between;
+ align-items: center;
+ height: 34px;
+ background: var(--color-card-text-1);
+ color: var(--color-bg-1);
+ padding: 0 0 0 10px;
+
+ .tools {
+ @include base.row-flex-start;
+ gap: 10px;
+
+ .tool-item {
+ height: 34px;
+ @include item-tool();
+ border-radius: 0;
+ }
+ }
+ }
+
+ :deep(pre) {
+ background: var(--color-menu-1);
+ margin: 0;
+ padding: 10px;
+ font-size: 14px;
+ }
+ }
+ }
+
+ .answer-tool {
+ @include base.row-flex-end;
+ border-top: 1px solid var(--color-border-1);
+ height: 30px;
+ padding-top: 20px;
+
+ .tool-item {
+ @include item-tool();
+ }
+ }
+ }
+
+ .answer-content {
+ background: var(--color-bg-2);
+ }
+ }
+ }
+
+ .question {
+ position: relative;
+
+ .question-input {
+ height: 100%;
+ font-size: 14px;
+ }
+
+ .send-btn {
+ position: absolute;
+ right: 30px;
+ bottom: 30px;
+ @include base.row-flex-start;
+ gap: 10px;
+
+ i {
+ cursor: pointer;
+ }
+ }
+ }
+ }
+
+ .view-area {
+ /* background: linear-gradient(-45deg, rgba(238, 152, 82, 0.3),rgba(35, 166, 213,.3), rgba(231, 60, 60, 0.3), rgba(35, 213, 171,.3));
+ background-size: 400% 400%;
+ animation: gradient 15s ease infinite;
+
+ @keyframes gradient {
+ 0% {
+ background-position: 0% 50%;
+ }
+
+ 50% {
+ background-position: 100% 50%;
+ }
+
+ 100% {
+ background-position: 0% 50%;
+ }
+ } */
+ }
+ }
+ }
+
+
+
+
+</style>
\ No newline at end of file
diff --git a/core/frontend/types/components.d.ts b/core/frontend/types/components.d.ts
index 31592c88..80c183c7 100644
--- a/core/frontend/types/components.d.ts
+++ b/core/frontend/types/components.d.ts
@@ -55,6 +55,7 @@ declare module 'vue' {
NGi: typeof import('naive-ui')['NGi']
NGrid: typeof import('naive-ui')['NGrid']
NIcon: typeof import('naive-ui')['NIcon']
+ NImage: typeof import('naive-ui')['NImage']
NInput: typeof import('naive-ui')['NInput']
NInputGroup: typeof import('naive-ui')['NInputGroup']
NInputGroupLabel: typeof import('naive-ui')['NInputGroupLabel']
@@ -69,6 +70,7 @@ declare module 'vue' {
NRadio: typeof import('naive-ui')['NRadio']
NRadioButton: typeof import('naive-ui')['NRadioButton']
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
+ NScrollbar: typeof import('naive-ui')['NScrollbar']
NSelect: typeof import('naive-ui')['NSelect']
NSkeleton: typeof import('naive-ui')['NSkeleton']
NSlider: typeof import('naive-ui')['NSlider']
diff --git a/core/frontend/yarn.lock b/core/frontend/yarn.lock
index eb1ee502..820e7b97 100644
--- a/core/frontend/yarn.lock
+++ b/core/frontend/yarn.lock
@@ -1038,6 +1038,11 @@
resolved "https://registry.yarnpkg.com/@types/katex/-/katex-0.16.7.tgz#03ab680ab4fa4fbc6cb46ecf987ecad5d8019868"
integrity sha512-HMwFiRujE5PjrgwHQ25+bsLJgowjGjm5Z8FVSf0N6PwgJrwxH0QxzHYDcKsTfV3wva0vzrpqMTJS2jXPr5BMEQ==
+"@types/linkify-it@^5":
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/@types/linkify-it/-/linkify-it-5.0.0.tgz#21413001973106cda1c3a9b91eedd4ccd5469d76"
+ integrity sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==
+
"@types/lodash-es@^4.17.12", "@types/lodash-es@^4.17.9":
version "4.17.12"
resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.17.12.tgz#65f6d1e5f80539aa7cfbfc962de5def0cf4f341b"
@@ -1050,6 +1055,19 @@
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.18.tgz#4710e7db5b3857103764bf7b7b666414e6141baf"
integrity sha512-KJ65INaxqxmU6EoCiJmRPZC9H9RVWCRd349tXM2M3O5NA7cY6YL7c0bHAHQ93NOfTObEQ004kd2QVHs/r0+m4g==
+"@types/markdown-it@^14.1.2":
+ version "14.1.2"
+ resolved "https://registry.yarnpkg.com/@types/markdown-it/-/markdown-it-14.1.2.tgz#57f2532a0800067d9b934f3521429a2e8bfb4c61"
+ integrity sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==
+ dependencies:
+ "@types/linkify-it" "^5"
+ "@types/mdurl" "^2"
+
+"@types/mdurl@^2":
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/@types/mdurl/-/mdurl-2.0.0.tgz#d43878b5b20222682163ae6f897b20447233bdfd"
+ integrity sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==
+
"@types/node-forge@^1.3.0":
version "1.3.11"
resolved "https://registry.yarnpkg.com/@types/node-forge/-/node-forge-1.3.11.tgz#0972ea538ddb0f4d9c2fa0ec5db5724773a604da"
@@ -2498,7 +2516,7 @@ enhanced-resolve@^5.17.1:
graceful-fs "^4.2.4"
tapable "^2.2.0"
-entities@^4.5.0:
+entities@^4.4.0, entities@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48"
integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==
@@ -3050,7 +3068,7 @@ hasown@^2.0.2:
dependencies:
function-bind "^1.1.2"
-highlight.js@^11.8.0:
+highlight.js@^11.11.1, highlight.js@^11.8.0:
version "11.11.1"
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-11.11.1.tgz#fca06fa0e5aeecf6c4d437239135fabc15213585"
integrity sha512-Xwwo44whKBVCYoliBQwaPvtd/2tYFkRQtXDWj1nackaV2JPXx3L0+Jvd8/qCJ2p+ML0/XVkJ2q+Mr+UVdpJK5w==
@@ -3328,6 +3346,13 @@ levn@^0.4.1:
prelude-ls "^1.2.1"
type-check "~0.4.0"
+linkify-it@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-5.0.0.tgz#9ef238bfa6dc70bd8e7f9572b52d369af569b421"
+ integrity sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==
+ dependencies:
+ uc.micro "^2.0.0"
+
loader-runner@^4.2.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1"
@@ -3435,6 +3460,18 @@ magic-string@^0.30.17:
dependencies:
"@jridgewell/sourcemap-codec" "^1.5.0"
+markdown-it@^14.1.0:
+ version "14.1.0"
+ resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-14.1.0.tgz#3c3c5992883c633db4714ccb4d7b5935d98b7d45"
+ integrity sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==
+ dependencies:
+ argparse "^2.0.1"
+ entities "^4.4.0"
+ linkify-it "^5.0.0"
+ mdurl "^2.0.0"
+ punycode.js "^2.3.1"
+ uc.micro "^2.1.0"
+
math-intrinsics@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9"
@@ -3445,6 +3482,11 @@ [email protected]:
resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.12.2.tgz#9ae6c41a9e65adf61318b32bff7b64fbfb13f8cf"
integrity sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA==
+mdurl@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-2.0.0.tgz#80676ec0433025dd3e17ee983d0fe8de5a2237e0"
+ integrity sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==
+
merge-stream@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"
@@ -3870,6 +3912,11 @@ proxy-from-env@^1.1.0:
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==
+punycode.js@^2.3.1:
+ version "2.3.1"
+ resolved "https://registry.yarnpkg.com/punycode.js/-/punycode.js-2.3.1.tgz#6b53e56ad75588234e79f4affa90972c7dd8cdb7"
+ integrity sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==
+
punycode@^2.1.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5"
@@ -4606,6 +4653,11 @@ typescript@^5.8.2:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.8.3.tgz#92f8a3e5e3cf497356f4178c34cd65a7f5e8440e"
integrity sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==
+uc.micro@^2.0.0, uc.micro@^2.1.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-2.1.0.tgz#f8d3f7d0ec4c3dea35a7e3c8efa4cb8b45c9e7ee"
+ integrity sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==
+
ufo@^1.5.4, ufo@^1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/ufo/-/ufo-1.6.1.tgz#ac2db1d54614d1b22c1d603e3aef44a85d8f146b"