Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
poc-fe
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poc
poc-fe
Commits
50622da7
Commit
50622da7
authored
May 27, 2025
by
tyyin lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore(首页): 图片上传展示调整
parent
39755c80
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
43 deletions
+71
-43
useUploadImage.ts
src/composables/useUploadImage.ts
+1
-1
footer-operation.vue
src/views/home/components/footer-operation.vue
+5
-7
index.vue
src/views/home/components/rich-text-input-box/index.vue
+65
-35
No files found.
src/composables/useUploadImage.ts
View file @
50622da7
...
@@ -6,7 +6,7 @@ import i18n from '@/locales'
...
@@ -6,7 +6,7 @@ import i18n from '@/locales'
const
{
t
}
=
i18n
.
global
const
{
t
}
=
i18n
.
global
interface
UploadImageItem
{
export
interface
UploadImageItem
{
id
:
string
id
:
string
url
:
string
url
:
string
status
:
'pending'
|
'uploading'
|
'finished'
|
'error'
|
'removed'
status
:
'pending'
|
'uploading'
|
'finished'
|
'error'
|
'removed'
...
...
src/views/home/components/footer-operation.vue
View file @
50622da7
...
@@ -3,7 +3,6 @@ import { computed, h, nextTick, ref, shallowRef, useTemplateRef, watch, toValue
...
@@ -3,7 +3,6 @@ import { computed, h, nextTick, ref, shallowRef, useTemplateRef, watch, toValue
import
type
{
AgentApplicationRecordItem
,
MessageItemInterface
}
from
'../types'
import
type
{
AgentApplicationRecordItem
,
MessageItemInterface
}
from
'../types'
import
{
fetchAgentApplicationSelectList
,
fetchFileUpload
}
from
'@/apis/home-agent'
import
{
fetchAgentApplicationSelectList
,
fetchFileUpload
}
from
'@/apis/home-agent'
import
{
nanoid
}
from
'nanoid'
import
{
nanoid
}
from
'nanoid'
import
{
CloseSmall
}
from
'@icon-park/vue-next'
import
fetchEventStreamSource
from
'../utils/fetch-event-stream-source'
import
fetchEventStreamSource
from
'../utils/fetch-event-stream-source'
import
{
throttle
}
from
'lodash-es'
import
{
throttle
}
from
'lodash-es'
import
{
useI18n
}
from
'vue-i18n'
import
{
useI18n
}
from
'vue-i18n'
...
@@ -80,10 +79,6 @@ const isQuestionSubmitBtnDisabled = computed(() => {
...
@@ -80,10 +79,6 @@ const isQuestionSubmitBtnDisabled = computed(() => {
)
)
})
})
const
isHasUploadImage
=
computed
(()
=>
{
return
uploadImageList
.
value
.
length
>
0
})
const
isEnglishLanguage
=
computed
(()
=>
systemLanguageStore
.
currentLanguageInfo
.
key
===
'en'
)
const
isEnglishLanguage
=
computed
(()
=>
systemLanguageStore
.
currentLanguageInfo
.
key
===
'en'
)
const
isEnableUploadImage
=
computed
(()
=>
{
const
isEnableUploadImage
=
computed
(()
=>
{
...
@@ -618,9 +613,12 @@ defineExpose({
...
@@ -618,9 +613,12 @@ defineExpose({
v-model:editor-mode-enable=
"editorModeEnable"
v-model:editor-mode-enable=
"editorModeEnable"
:is-question-submit-btn-disabled=
"isQuestionSubmitBtnDisabled"
:is-question-submit-btn-disabled=
"isQuestionSubmitBtnDisabled"
:work-mode=
"workMode"
:work-mode=
"workMode"
:upload-image-list=
"uploadImageList"
@
submit-question=
"questionSubmit"
@
submit-question=
"questionSubmit"
@
work-mode-switch=
"onWorkModeChange"
@
work-mode-switch=
"onWorkModeChange"
@
remove-upload-image=
"handleRemoveUploadImage"
/>
/>
<!-- <n-input
<!-- <n-input
v-model:value.trim="questionContent"
v-model:value.trim="questionContent"
class="content-input"
class="content-input"
...
@@ -639,7 +637,7 @@ defineExpose({
...
@@ -639,7 +637,7 @@ defineExpose({
</template>
</template>
</n-input> -->
</n-input> -->
<div
v-show=
"isHasUploadImage"
class=
"absolute bottom-[9px] left-[11px] flex gap-[11px]"
>
<
!-- <
div v-show="isHasUploadImage" class="absolute bottom-[9px] left-[11px] flex gap-[11px]">
<div
<div
v-for="uploadImageItem in uploadImageList"
v-for="uploadImageItem in uploadImageList"
:key="uploadImageItem.id"
:key="uploadImageItem.id"
...
@@ -666,7 +664,7 @@ defineExpose({
...
@@ -666,7 +664,7 @@ defineExpose({
/>
/>
</div>
</div>
</div>
</div>
</div>
</div>
-->
</div>
</div>
<div
class=
"mt-[14px] text-center text-[13px] text-[#999]"
>
<div
class=
"mt-[14px] text-center text-[13px] text-[#999]"
>
...
...
src/views/home/components/rich-text-input-box/index.vue
View file @
50622da7
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
nextTick
,
onMounted
,
ref
,
shallowRef
,
watch
,
watchEffect
}
from
'vue'
import
{
computed
,
nextTick
,
onMounted
,
ref
,
shallowRef
,
watch
,
watchEffect
}
from
'vue'
import
SceneList
from
'./components/scene-list.vue'
import
SceneList
from
'./components/scene-list.vue'
import
TemplateMenu
from
'./components/template-menu.vue'
import
TemplateMenu
from
'./components/template-menu.vue'
import
Quill
from
'quill/core'
import
Quill
from
'quill/core'
...
@@ -11,10 +11,14 @@ import { Delta } from 'quill/core'
...
@@ -11,10 +11,14 @@ import { Delta } from 'quill/core'
import
type
{
TemplateMenuConfig
}
from
'@/views/home/components/rich-text-input-box/data/template-menu'
import
type
{
TemplateMenuConfig
}
from
'@/views/home/components/rich-text-input-box/data/template-menu'
import
{
debounce
}
from
'lodash-es'
import
{
debounce
}
from
'lodash-es'
import
type
{
WorkModeType
}
from
'@/views/home/components/rich-text-input-box/types/index'
import
type
{
WorkModeType
}
from
'@/views/home/components/rich-text-input-box/types/index'
import
type
{
UploadImageItem
}
from
'@/composables/useUploadImage'
import
{
UploadStatus
}
from
'@/enums/upload-status'
import
{
CloseSmall
}
from
'@icon-park/vue-next'
interface
Props
{
interface
Props
{
isQuestionSubmitBtnDisabled
:
boolean
isQuestionSubmitBtnDisabled
:
boolean
workMode
:
WorkModeType
workMode
:
WorkModeType
uploadImageList
:
UploadImageItem
[]
}
}
const
props
=
defineProps
<
Props
>
()
const
props
=
defineProps
<
Props
>
()
...
@@ -22,6 +26,7 @@ const props = defineProps<Props>()
...
@@ -22,6 +26,7 @@ const props = defineProps<Props>()
const
emit
=
defineEmits
<
{
const
emit
=
defineEmits
<
{
submitQuestion
:
[
question
:
string
]
submitQuestion
:
[
question
:
string
]
workModeSwitch
:
[
workMode
:
'ApplicationMode'
|
'SceneMode'
]
workModeSwitch
:
[
workMode
:
'ApplicationMode'
|
'SceneMode'
]
removeUploadImage
:
[
id
:
string
]
}
>
()
}
>
()
const
questionContent
=
defineModel
<
string
>
(
'questionContent'
,
{
default
:
''
})
const
questionContent
=
defineModel
<
string
>
(
'questionContent'
,
{
default
:
''
})
...
@@ -42,7 +47,13 @@ const isInputFocus = ref(false)
...
@@ -42,7 +47,13 @@ const isInputFocus = ref(false)
const
showSceneList
=
ref
(
false
)
const
showSceneList
=
ref
(
false
)
const
showTemplateMenu
=
ref
(
false
)
const
showTemplateMenu
=
ref
(
false
)
// const editorModeEnable = ref(false)
const
uploadImageInfo
=
computed
(()
=>
{
const
imageInfo
=
props
.
uploadImageList
[
0
]
return
imageInfo
?
{
id
:
imageInfo
.
id
,
url
:
imageInfo
.
url
.
split
(
'/'
).
reverse
()[
0
],
status
:
imageInfo
.
status
}
:
{
url
:
''
,
id
:
''
}
})
const
onQuillTextChange
=
debounce
((
delta
:
Delta
)
=>
{
const
onQuillTextChange
=
debounce
((
delta
:
Delta
)
=>
{
const
question
=
quillContentExtractor
(
delta
)
const
question
=
quillContentExtractor
(
delta
)
...
@@ -202,7 +213,25 @@ function onTemplateConfirm(templateConfig: TemplateMenuConfig['templateList'][0]
...
@@ -202,7 +213,25 @@ function onTemplateConfirm(templateConfig: TemplateMenuConfig['templateList'][0]
</div>
</div>
</n-scrollbar>
</n-scrollbar>
<div
class=
"mt-[8px] flex items-center justify-end px-[12px]"
>
<div
class=
"mt-[8px] flex items-center justify-between px-[12px]"
>
<div
class=
"pt-[2px]"
>
<div
v-if=
"uploadImageInfo.url"
class=
"relative select-none rounded-[4px] border border-[#e0e0e6] bg-[#fafafc] px-[12px] py-[4px] text-[12px]"
:class=
"
{ '!border-[#F25744]': uploadImageInfo.status === UploadStatus.ERROR }"
>
<n-ellipsis
style=
"max-width: 200px"
>
{{
uploadImageInfo
.
url
}}
</n-ellipsis>
<div
class=
"absolute right-[-4px] top-[-4px] flex size-[16px] cursor-pointer items-center justify-center rounded-full bg-[rgba(0,0,0,0.55)] hover:opacity-80"
@
click=
"() => $emit('removeUploadImage', uploadImageInfo.id)"
>
<CloseSmall
theme=
"outline"
size=
"14"
fill=
"#fff"
/>
</div>
</div>
</div>
<div
class=
"flex items-center"
>
<Transition>
<Transition>
<div
v-show=
"workMode === 'SceneMode'"
class=
"mr-[15px]"
>
<div
v-show=
"workMode === 'SceneMode'"
class=
"mr-[15px]"
>
<n-tooltip
trigger=
"hover"
>
<n-tooltip
trigger=
"hover"
>
...
@@ -240,6 +269,7 @@ function onTemplateConfirm(templateConfig: TemplateMenuConfig['templateList'][0]
...
@@ -240,6 +269,7 @@ function onTemplateConfirm(templateConfig: TemplateMenuConfig['templateList'][0]
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
</template>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment