diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json index ff73334..313e671 100644 --- a/.eslintrc-auto-import.json +++ b/.eslintrc-auto-import.json @@ -5,6 +5,8 @@ "ComputedRef": true, "DirectiveBinding": true, "EffectScope": true, + "ElMessage": true, + "ElMessageBox": true, "ExtractDefaultPropTypes": true, "ExtractPropTypes": true, "ExtractPublicPropTypes": true, @@ -71,8 +73,6 @@ "watch": true, "watchEffect": true, "watchPostEffect": true, - "watchSyncEffect": true, - "ElMessage": true, - "ElMessageBox": true + "watchSyncEffect": true } } diff --git a/src/assets/icons/svg/code.svg b/src/assets/icons/svg/code.svg new file mode 100644 index 0000000..734790f --- /dev/null +++ b/src/assets/icons/svg/code.svg @@ -0,0 +1 @@ + diff --git a/src/components/FilesSelect/index.vue b/src/components/FilesSelect/index.vue new file mode 100644 index 0000000..63427e8 --- /dev/null +++ b/src/components/FilesSelect/index.vue @@ -0,0 +1,150 @@ + + + + + + diff --git a/src/stores/modules/files.ts b/src/stores/modules/files.ts new file mode 100644 index 0000000..3c40bc4 --- /dev/null +++ b/src/stores/modules/files.ts @@ -0,0 +1,23 @@ +import type { FilesCardProps } from 'vue-element-plus-x/types/FilesCard'; +// 对话聊天的文件上传列表 +import { defineStore } from 'pinia'; + +export const useFilesStore = defineStore('files', () => { + const filesList = ref([]); + + // 设置文件列表 + const setFilesList = (list: FilesCardProps & { file: File }[]) => { + filesList.value = list; + }; + + // 根据索引删除 文件 + const deleteFileByIndex = (index: number) => { + filesList.value.splice(index, 1); + }; + + return { + filesList, + setFilesList, + deleteFileByIndex, + }; +}); diff --git a/src/styles/elx.scss b/src/styles/elx.scss new file mode 100644 index 0000000..420e09d --- /dev/null +++ b/src/styles/elx.scss @@ -0,0 +1,36 @@ +// 覆盖一些 elx 组件样式 + +// attachments 图片组件的 1.2.0 版本样式 bug +.image-preview-container { + flex: none !important; +} + +.elx-files-card-content { + gap: 8px; + .elx-files-card-description { + line-height: 1.35; + } +} + +.prev-next-btn { + position: absolute; + top: calc(50% + 3px); + transform: translateY(-50%); + z-index: 10; + cursor: pointer; +} + +.elx-attachments-file-card-wrap { + padding-top: 6px; +} + +.elx-attachments-card { + user-select: none; +} + +// 隐藏 elx-sender-header 组件的底部边框 +.el-sender-header { + border-bottom-color: transparent !important; +} + + diff --git a/src/styles/index.scss b/src/styles/index.scss index 3161d21..d833ce6 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -2,6 +2,7 @@ @use './btn-style.scss'; @use 'reset-css'; @use './element-plus.scss'; +@use './elx.scss'; body{ overflow: hidden; diff --git a/types/components.d.ts b/types/components.d.ts index d7e0aeb..17c9a86 100644 --- a/types/components.d.ts +++ b/types/components.d.ts @@ -24,6 +24,7 @@ declare module 'vue' { ElInput: typeof import('element-plus/es')['ElInput'] ElMain: typeof import('element-plus/es')['ElMain'] ElTooltip: typeof import('element-plus/es')['ElTooltip'] + FilesSelect: typeof import('./../src/components/FilesSelect/index.vue')['default'] IconSelect: typeof import('./../src/components/IconSelect/index.vue')['default'] 'Index copy': typeof import('./../src/components/Popover/index copy.vue')['default'] LoginDialog: typeof import('./../src/components/LoginDialog/index.vue')['default'] diff --git a/types/import_meta.d.ts b/types/import_meta.d.ts new file mode 100644 index 0000000..7ac8836 --- /dev/null +++ b/types/import_meta.d.ts @@ -0,0 +1,13 @@ +/// + +interface ImportMetaEnv { + readonly VITE_WEB_TITLE: string; + readonly VITE_WEB_TITLE_EN: string; + readonly VITE_WEB_ENV: string; + readonly VITE_WEB_BASE_API: string; + readonly VITE_API_URL: string; +} + +declare interface ImportMeta { + readonly env: ImportMetaEnv; +}