Skip to content

Commit 1ad5de5

Browse files
author
puhui999
committed
Merge remote-tracking branch 'refs/remotes/yudao/dev' into dev-crm
2 parents eeb76bb + ccf21dd commit 1ad5de5

File tree

27 files changed

+935
-218
lines changed

27 files changed

+935
-218
lines changed

.image/common/ai-feature.png

20.7 KB
Loading

.image/common/ai-preview.gif

348 KB
Loading

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,26 +191,24 @@ ps:核心功能已经实现,正在对接微信小程序中...
191191

192192
### 商城系统
193193

194+
演示地址:<https://doc.iocoder.cn/mall-preview/>
195+
194196
![功能图](/.image/common/mall-feature.png)
195197

196198
![功能图](/.image/common/mall-preview.png)
197199

198-
_前端基于 crmeb uniapp 经过授权重构,优化代码实现,接入芋道快速开发平台_
199-
200-
演示地址:<https://doc.iocoder.cn/mall-preview/>
201-
202200
### ERP 系统
203201

204-
![功能图](/.image/common/erp-feature.png)
205-
206202
演示地址:<https://doc.iocoder.cn/erp-preview/>
207203

208-
### CRM 系统
204+
![功能图](/.image/common/erp-feature.png)
209205

210-
![功能图](/.image/common/crm-feature.png)
206+
### CRM 系统
211207

212208
演示地址:<https://doc.iocoder.cn/crm-preview/>
213209

210+
![功能图](/.image/common/crm-feature.png)
211+
214212
## 🐷 演示图
215213

216214
### 系统功能

src/api/ai/image/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ export const ImageApi = {
5656
getImagePageMy: async (params: PageParam) => {
5757
return await request.get({ url: `/ai/image/my-page`, params })
5858
},
59+
// 获取公开的绘图记录
60+
getImagePagePublic: async (params: PageParam) => {
61+
return await request.get({ url: `/ai/image/public-page`, params })
62+
},
5963
// 获取【我的】绘图记录
6064
getImageMy: async (id: number) => {
6165
return await request.get({ url: `/ai/image/get-my?id=${id}` })

src/api/ai/write/index.ts

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import { fetchEventSource } from '@microsoft/fetch-event-source'
2+
3+
import { getAccessToken } from '@/utils/auth'
4+
import { config } from '@/config/axios/config'
5+
import { AiWriteTypeEnum } from '@/views/ai/utils/constants'
6+
import request from '@/config/axios'
7+
8+
export interface WriteVO {
9+
type: AiWriteTypeEnum.WRITING | AiWriteTypeEnum.REPLY // 1:撰写 2:回复
10+
prompt: string // 写作内容提示 1。撰写 2回复
11+
originalContent: string // 原文
12+
length: number // 长度
13+
format: number // 格式
14+
tone: number // 语气
15+
language: number // 语言
16+
userId?: number // 用户编号
17+
platform?: string // 平台
18+
model?: string // 模型
19+
generatedContent?: string // 生成的内容
20+
errorMessage?: string // 错误信息
21+
createTime?: Date // 创建时间
22+
}
23+
24+
export interface AiWritePageReqVO extends PageParam {
25+
userId?: number // 用户编号
26+
type?: AiWriteTypeEnum // 写作类型
27+
platform?: string // 平台
28+
createTime?: [string, string] // 创建时间
29+
}
30+
31+
export interface AiWriteRespVo {
32+
id: number
33+
userId: number
34+
type: number
35+
platform: string
36+
model: string
37+
prompt: string
38+
generatedContent: string
39+
originalContent: string
40+
length: number
41+
format: number
42+
tone: number
43+
language: number
44+
errorMessage: string
45+
createTime: string
46+
}
47+
48+
export const WriteApi = {
49+
writeStream: ({
50+
data,
51+
onClose,
52+
onMessage,
53+
onError,
54+
ctrl
55+
}: {
56+
data: WriteVO
57+
onMessage?: (res: any) => void
58+
onError?: (...args: any[]) => void
59+
onClose?: (...args: any[]) => void
60+
ctrl: AbortController
61+
}) => {
62+
const token = getAccessToken()
63+
return fetchEventSource(`${config.base_url}/ai/write/generate-stream`, {
64+
method: 'post',
65+
headers: {
66+
'Content-Type': 'application/json',
67+
Authorization: `Bearer ${token}`
68+
},
69+
openWhenHidden: true,
70+
body: JSON.stringify(data),
71+
onmessage: onMessage,
72+
onerror: onError,
73+
onclose: onClose,
74+
signal: ctrl.signal
75+
})
76+
},
77+
// 获取写作列表
78+
getWritePage: (params: AiWritePageReqVO) => {
79+
return request.get<PageResult<AiWriteRespVo[]>>({ url: `/ai/write/page`, params })
80+
},
81+
// 删除写作
82+
deleteWrite(id: number) {
83+
return request.delete({ url: `/ai/write/delete`, params: { id } })
84+
}
85+
}

src/api/ai/writer/index.ts

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/components/MarkdownView/index.vue

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,36 @@
1-
21
<template>
32
<div ref="contentRef" class="markdown-view" v-html="contentHtml"></div>
43
</template>
54

65
<script setup lang="ts">
7-
import {useClipboard} from "@vueuse/core";
8-
9-
import {marked} from 'marked'
6+
import { useClipboard } from '@vueuse/core'
7+
import { marked } from 'marked'
108
import 'highlight.js/styles/vs2015.min.css'
119
import hljs from 'highlight.js'
12-
import {ref} from "vue";
1310
14-
const {copy} = useClipboard() // 初始化 copy 到粘贴板
11+
// 定义组件属性
12+
const props = defineProps({
13+
content: {
14+
type: String,
15+
required: true
16+
}
17+
})
18+
19+
const message = useMessage() // 消息弹窗
20+
const { copy } = useClipboard() // 初始化 copy 到粘贴板
1521
const contentRef = ref()
22+
const contentHtml = ref<any>() // 渲染的html内容
23+
const { content } = toRefs(props) // 将 props 变为引用类型
1624
1725
// 代码高亮:https://highlightjs.org/
1826
// 转换 markdown:marked
1927
20-
// marked 渲染器
28+
/** marked 渲染器 */
2129
const renderer = {
2230
code(code, language, c) {
2331
let highlightHtml
2432
try {
25-
highlightHtml = hljs.highlight(code, {language: language, ignoreIllegals: true}).value
33+
highlightHtml = hljs.highlight(code, { language: language, ignoreIllegals: true }).value
2634
} catch (e) {
2735
// skip
2836
}
@@ -36,50 +44,30 @@ marked.use({
3644
renderer: renderer
3745
})
3846
39-
// 渲染的html内容
40-
const contentHtml = ref<any>()
41-
42-
// 定义组件属性
43-
const props = defineProps({
44-
content: {
45-
type: String,
46-
required: true
47-
}
48-
})
49-
50-
// 将 props 变为引用类型
51-
const { content } = toRefs(props)
52-
53-
// 监听 content 变化
47+
/** 监听 content 变化 */
5448
watch(content, async (newValue, oldValue) => {
55-
await renderMarkdown(newValue);
49+
await renderMarkdown(newValue)
5650
})
5751
58-
// 渲染 markdown
52+
/** 渲染 markdown */
5953
const renderMarkdown = async (content: string) => {
6054
contentHtml.value = await marked(content)
6155
}
6256
63-
// 组件挂在时
64-
onMounted(async () => {
57+
/** 初始化 **/
58+
onMounted(async () => {
6559
// 解析转换 markdown
66-
await renderMarkdown(props.content as string);
67-
//
60+
await renderMarkdown(props.content as string)
6861
// 添加 copy 监听
6962
contentRef.value.addEventListener('click', (e: any) => {
70-
console.log(e)
7163
if (e.target.id === 'copy') {
7264
copy(e.target?.dataset?.copy)
73-
ElMessage({
74-
message: '复制成功!',
75-
type: 'success'
76-
})
65+
message.success('复制成功!')
7766
}
7867
})
7968
})
8069
</script>
8170

82-
8371
<style lang="scss">
8472
.markdown-view {
8573
font-family: PingFang SC;

src/layout/components/AppView.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,24 @@ provide('reload', reload)
3838
:class="[
3939
'p-[var(--app-content-padding)] w-[calc(100%-var(--app-content-padding)-var(--app-content-padding))] bg-[var(--app-content-bg-color)] dark:bg-[var(--el-bg-color)]',
4040
{
41-
'!h-[calc(100%-var(--app-content-padding)-var(--app-content-padding)-var(--app-footer-height))]':
41+
'!min-h-[calc(100%-var(--app-content-padding)-var(--app-content-padding)-var(--app-footer-height))]':
4242
(fixedHeader &&
4343
(layout === 'classic' || layout === 'topLeft' || layout === 'top') &&
4444
footer) ||
4545
(!tagsView && layout === 'top' && footer),
46-
'!h-[calc(100%-var(--app-content-padding)-var(--app-content-padding)-var(--app-footer-height)-var(--tags-view-height))]':
46+
'!min-h-[calc(100%-var(--app-content-padding)-var(--app-content-padding)-var(--app-footer-height)-var(--tags-view-height))]':
4747
tagsView && layout === 'top' && footer,
4848
49-
'!h-[calc(100%-var(--tags-view-height)-var(--app-content-padding)-var(--app-content-padding)-var(--top-tool-height)-var(--app-footer-height))]':
49+
'!min-h-[calc(100%-var(--tags-view-height)-var(--app-content-padding)-var(--app-content-padding)-var(--top-tool-height)-var(--app-footer-height))]':
5050
!fixedHeader && layout === 'classic' && footer,
5151
52-
'!h-[calc(100%-var(--tags-view-height)-var(--app-content-padding)-var(--app-content-padding)-var(--app-footer-height))]':
52+
'!min-h-[calc(100%-var(--tags-view-height)-var(--app-content-padding)-var(--app-content-padding)-var(--app-footer-height))]':
5353
!fixedHeader && layout === 'topLeft' && footer,
5454
55-
'!h-[calc(100%-var(--top-tool-height)-var(--app-content-padding)-var(--app-content-padding))]':
55+
'!min-h-[calc(100%-var(--top-tool-height)-var(--app-content-padding)-var(--app-content-padding))]':
5656
fixedHeader && layout === 'cutMenu' && footer,
5757
58-
'!h-[calc(100%-var(--top-tool-height)-var(--app-content-padding)-var(--app-content-padding)-var(--tags-view-height))]':
58+
'!min-h-[calc(100%-var(--top-tool-height)-var(--app-content-padding)-var(--app-content-padding)-var(--tags-view-height))]':
5959
!fixedHeader && layout === 'cutMenu' && footer
6060
}
6161
]"

src/router/modules/remaining.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -70,26 +70,26 @@ const remainingRouter: AppRouteRecordRaw[] = [
7070
}
7171
]
7272
},
73-
{
74-
path: '/ai/music',
75-
component: Layout,
76-
redirect: '/index',
77-
name: 'AIMusic',
78-
meta: {},
79-
children: [
80-
{
81-
path: 'index',
82-
component: () => import('@/views/ai/music/components/index.vue'),
83-
name: 'AIMusicIndex',
84-
meta: {
85-
title: 'AI 音乐',
86-
icon: 'ep:home-filled',
87-
noCache: false,
88-
affix: true
89-
}
90-
}
91-
]
92-
},
73+
// {
74+
// path: '/ai/music',
75+
// component: Layout,
76+
// redirect: '/index',
77+
// name: 'AIMusic',
78+
// meta: {},
79+
// children: [
80+
// {
81+
// path: 'index',
82+
// component: () => import('@/views/ai/music/components/index.vue'),
83+
// name: 'AIMusicIndex',
84+
// meta: {
85+
// title: 'AI 音乐',
86+
// icon: 'ep:home-filled',
87+
// noCache: false,
88+
// affix: true
89+
// }
90+
// }
91+
// ]
92+
// },
9393
{
9494
path: '/user',
9595
component: Layout,

src/utils/dict.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,5 +222,10 @@ export enum DICT_TYPE {
222222
AI_PLATFORM = 'ai_platform', // AI 平台
223223
AI_IMAGE_STATUS = 'ai_image_status', // AI 图片状态
224224
AI_MUSIC_STATUS = 'ai_music_status', // AI 音乐状态
225-
AI_GENERATE_MODE = 'ai_generate_mode' // AI 生成模式
225+
AI_GENERATE_MODE = 'ai_generate_mode', // AI 生成模式
226+
AI_WRITE_TYPE = 'ai_write_type', // AI 写作类型
227+
AI_WRITE_LENGTH = 'ai_write_length', // AI 写作长度
228+
AI_WRITE_FORMAT = 'ai_write_format', // AI 写作格式
229+
AI_WRITE_TONE = 'ai_write_tone', // AI 写作语气
230+
AI_WRITE_LANGUAGE = 'ai_write_language' // AI 写作语言
226231
}

0 commit comments

Comments
 (0)