diff --git a/.vscode/settings.json b/.vscode/settings.json
index f145f386a..d37c9a2d5 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,5 +1,7 @@
{
- "typescript.tsdk": "node_modules/typescript/lib",
+ "typescript.tsdk": "./node_modules/typescript/lib",
+ "volar.tsPlugin": true,
+ "volar.tsPluginStatus": false,
"npm.packageManager": "pnpm",
"editor.tabSize": 2,
"prettier.printWidth": 100, // 超过最大值换行
@@ -62,7 +64,7 @@
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
- "editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
@@ -83,53 +85,74 @@
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.codeActionsOnSave": {
- "source.fixAll.eslint": "explicit",
- "source.fixAll.stylelint": "explicit"
+ "source.fixAll.eslint": "explicit"
},
"[vue]": {
- "editor.defaultFormatter": "esbenp.prettier-vscode"
+ "editor.codeActionsOnSave": {
+ "source.fixAll.eslint": "explicit",
+ "source.fixAll.stylelint": "explicit"
+ }
},
"i18n-ally.localesPaths": ["src/locales"],
"i18n-ally.keystyle": "nested",
"i18n-ally.sortKeys": true,
- "i18n-ally.namespace": false,
+ "i18n-ally.namespace": true,
"i18n-ally.enabledParsers": ["ts"],
"i18n-ally.sourceLanguage": "en",
"i18n-ally.displayLanguage": "zh-CN",
"i18n-ally.enabledFrameworks": ["vue", "react"],
"cSpell.words": [
- "brotli",
- "browserslist",
- "codemirror",
- "commitlint",
- "cropperjs",
- "echart",
- "echarts",
- "esnext",
- "esno",
- "iconify",
- "INTLIFY",
- "lintstagedrc",
- "logicflow",
- "nprogress",
- "pinia",
- "pnpm",
- "qrcode",
- "sider",
- "sortablejs",
- "stylelint",
- "svgs",
- "unocss",
- "unplugin",
- "unref",
- "videojs",
- "VITE",
- "vitejs",
- "vueuse",
- "wangeditor",
"xingyu",
"yudao",
- "zxcvbn"
+ "unocss",
+ "browserslist",
+ "esnext",
+ "unplugin",
+ "qrcode",
+ "sider",
+ "pinia",
+ "sider",
+ "nprogress",
+ "INTLIFY",
+ "stylelint",
+ "esno",
+ "vitejs",
+ "sortablejs",
+ "codemirror",
+ "iconify",
+ "commitlint",
+ "videojs",
+ "echarts",
+ "wangeditor",
+ "cropperjs",
+ "logicflow",
+ "vueuse",
+ "zxcvbn",
+ "lintstagedrc",
+ "brotli",
+ "sider",
+ "pnpm"
+ ],
+ "vetur.format.scriptInitialIndent": true,
+ "vetur.format.styleInitialIndent": true,
+ "vetur.validation.script": false,
+ "MicroPython.executeButton": [
+ {
+ "text": "▶",
+ "tooltip": "运行",
+ "alignment": "left",
+ "command": "extension.executeFile",
+ "priority": 3.5
+ }
+ ],
+ "MicroPython.syncButton": [
+ {
+ "text": "$(sync)",
+ "tooltip": "同步",
+ "alignment": "left",
+ "command": "extension.execute",
+ "priority": 4
+ }
],
// 控制相关文件嵌套展示
"explorer.fileNesting.enabled": true,
@@ -138,8 +161,7 @@
"*.ts": "$(capture).test.ts, $(capture).test.tsx",
"*.tsx": "$(capture).test.ts, $(capture).test.tsx",
"*.env": "$(capture).env.*",
- "package.json": "pnpm-lock.yaml,yarn.lock,LICENSE,README*,CHANGELOG*,CNAME,.gitattributes,.eslintrc-auto-import.json,.gitignore,prettier.config.js,stylelint.config.js,commitlint.config.js,.stylelintignore,.prettierignore,.gitpod.yml,.eslintrc.js,.eslintignore"
+ "package.json": "pnpm-lock.yaml,yarn.lock,LICENSE,README*,CHANGELOG*,CNAME,.gitattributes,.gitignore,prettier.config.js,stylelint.config.js,commitlint.config.js,.stylelintignore,.prettierignore,.gitpod.yml,.eslintrc.js,.eslintignore"
},
- "terminal.integrated.scrollback": 10000,
- "nuxt.isNuxtApp": false
+ "terminal.integrated.scrollback": 10000
}
diff --git a/src/views/chat/ChatPage/Index.vue b/src/views/chat/ChatPage/Index.vue
index 47a4bc0c7..f801ec197 100644
--- a/src/views/chat/ChatPage/Index.vue
+++ b/src/views/chat/ChatPage/Index.vue
@@ -1,6 +1,6 @@
-
+
@@ -22,7 +22,7 @@ import Session from '../components/Session/Index.vue'
import Friends from '../components/Friends/Index.vue'
import ChatHeader from '../components/ChatHeader/Index.vue'
import ChatMessage from '../components/ChatMessage/Index.vue'
-import InputSection from '../components/InputSection/index.vue'
+import InputSection from '../components/InputSection/Index.vue'
import FriendDetail from '../components/FriendDetail/Index.vue'
import { MENU_LIST_ENUM } from '../types/index.d.ts'
diff --git a/src/views/chat/api/messageApi.ts b/src/views/chat/api/messageApi.ts
index cbab90cdf..c882f9ca4 100644
--- a/src/views/chat/api/messageApi.ts
+++ b/src/views/chat/api/messageApi.ts
@@ -17,8 +17,7 @@ export interface SendMsg {
}
export interface SessionMsgReq {
- receiverId: number
- conversationType: number
+ conversationNo: string
sendTime: Date
}
@@ -41,7 +40,7 @@ export default class MessageApi {
* @returns Promise>
*/
static getSessionMsg(params: SessionMsgReq): Promise> {
- return request.get({ url: '/im/message/list', params })
+ return request.get({ url: '/im/message/listByNo', params })
}
/**
diff --git a/src/views/chat/components/ChatMessage/Index.vue b/src/views/chat/components/ChatMessage/Index.vue
index c528fdbde..345d49087 100644
--- a/src/views/chat/components/ChatMessage/Index.vue
+++ b/src/views/chat/components/ChatMessage/Index.vue
@@ -1,18 +1,12 @@
+ ref="listBoxRef">
-
+
+v-if="item.contentType === ContentType.IMAGE" :key="item.clientMessageId" :message="item"
+ class="py-1" />
@@ -26,4 +20,31 @@ import { ContentType } from '../../types/index.d.ts'
defineOptions({ name: 'ChatMessage' })
const chatStore = useChatStore()
+const listBoxRef = ref(null)
+
+const msgListLength = computed(() => {
+ return chatStore.currentSession ? chatStore.currentSession.msgList.length : 0
+})
+
+const scrollToBottom = () => {
+ nextTick(() => {
+ if (listBoxRef.value) {
+ console.log("scrollToBottom");
+ listBoxRef.value.scrollTop = listBoxRef.value.scrollHeight;
+ }
+ });
+};
+
+
+watch(msgListLength, (newLength, oldLength) => {
+ if (newLength > oldLength) {
+ scrollToBottom()
+ }
+})
+
+
+watch(() => chatStore.currentSessionIndex, () => {
+ scrollToBottom()
+})
+
diff --git a/src/views/chat/components/InputSection/Index.vue b/src/views/chat/components/InputSection/Index.vue
index 1c7813f35..62f282c58 100644
--- a/src/views/chat/components/InputSection/Index.vue
+++ b/src/views/chat/components/InputSection/Index.vue
@@ -3,7 +3,7 @@
class="flex flex-col items-center w-full border-b-1 border-b-gray border-b-solid"
style="height: 248px; min-height: 248px"
>
-
+
@@ -26,6 +26,7 @@ import TextMessage from '../../model/TextMessage'
import { useChatStoreWithOut } from '../../store/chatstore'
import { CONVERSATION_TYPE } from '../../types/index.d.ts'
import { SendStatus, MessageRole, ContentType } from '../../types/index.d.ts'
+import { useUserStoreWithOut } from '../../../../store/modules/user';
defineOptions({ name: 'InputSection' })
@@ -38,20 +39,23 @@ const onEnter = () => {
}
const createTextMessage = (content: string): TextMessage => {
- console.log('====>>>>', content)
+
+ const userStore = useUserStoreWithOut()
+
// 部分信息从account信息里面获取
const msg = new TextMessage(
'',
- '',
- '',
+ userStore.user.avatar,
+ userStore.user.nickname,
new Date().getTime(),
false,
content,
MessageRole.SELF,
SendStatus.SENDING,
chatStore.currentSession?.id || '',
- chatStore.currentSession?.targetId,
- chatStore.currentSession?.type || CONVERSATION_TYPE.SINGLE
+ chatStore.currentSession ? chatStore.currentSession.targetId : 0,
+ chatStore.currentSession?.type || CONVERSATION_TYPE.SINGLE,
+ chatStore.currentSession?.conversationNo || ''
)
return msg
diff --git a/src/views/chat/components/Message/BaseMsg.vue b/src/views/chat/components/Message/BaseMsg.vue
index 686d173a6..78c5e2508 100644
--- a/src/views/chat/components/Message/BaseMsg.vue
+++ b/src/views/chat/components/Message/BaseMsg.vue
@@ -4,7 +4,7 @@
:class="props.message.role === MessageRole.SELF ? 'flex-row-reverse' : 'flex-row'"
>
-
+
-
+
-
- {{ props.conversation.name || '' }}
-
+
+
-
-
+
+
+ formatPast(new Date(props.conversation.updateTime), 'YYYY/MM/DD')
+ }}