Skip to content

Commit

Permalink
Merge branch 'chatflow'
Browse files Browse the repository at this point in the history
  • Loading branch information
atorber committed Dec 2, 2023
2 parents 9254a9d + f6bbcb4 commit aa0d5ec
Show file tree
Hide file tree
Showing 19 changed files with 37 additions and 67 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ENV = 'development'

VITE_BASE=/
VUE_APP_PREVIEW=false
# VITE_BASE_API=https://chat.vlist.cc
VITE_BASE_API=http://127.0.0.1:9503
VITE_BASE_API=https://chat.vlist.cc
# VITE_BASE_API=http://127.0.0.1:9503
VITE_SOCKET_API=wss://broker.emqx.io:8084
VUE_APP_WEBSITE_NAME="ChatFlow"
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ makefile
*.njsproj
*.sln
*.sw?
makefile
1 change: 1 addition & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
10 changes: 0 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,6 @@
}
}
</style>
<script>
// 这里为了处理首屏加载慢,设置缓存的主题
let cache = localStorage.getItem('IM_DARKTHEME')
if (cache) {
cache = JSON.parse(cache).value || false
if (cache) {
document.querySelector('html').style = 'background:#202124'
}
}
</script>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ChatFlowConsole",
"private": true,
"version": "0.3.3",
"version": "0.4.0",
"main": "electron/main.js",
"scripts": {
"dev": "vite --mode development",
Expand Down
4 changes: 2 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from 'naive-ui'
import hljs from 'highlight.js/lib/core'
import { useUserStore, useTalkStore } from '@/store'
import socket from '@/socket'
import ws from '@/connect'
import { bus } from '@/utils/event-bus'
import { isLoggedIn } from '@/utils/auth'
import { NotificationApi, MessageApi, DialogApi } from '@/components/common'
Expand Down Expand Up @@ -52,7 +52,7 @@ const init = () => {
return
} else {
userStore.loadSetting()
socket.connect('App.vue init...')
ws.connect('App.vue init...')
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/components/editor/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,14 @@ const navs = reactive([
show: true,
click: () => {}
},
{
title: '群投票',
icon: markRaw(Ranking),
show: computed(() => props.vote),
click: () => {
isShowEditorVote.value = true
}
},
// {
// title: '群投票',
// icon: markRaw(Ranking),
// show: computed(() => props.vote),
// click: () => {
// isShowEditorVote.value = true
// }
// },
{
title: '历史记录',
icon: markRaw(History),
Expand Down
2 changes: 1 addition & 1 deletion src/components/talk/HistoryRecord.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const tabs = [
{ name: '会话', type: message.ChatMsgTypeForward, show: true },
{ name: '代码', type: message.ChatMsgTypeCode, show: true },
{ name: '位置', type: message.ChatMsgTypeLocation, show: true },
{ name: '群投票', type: message.ChatMsgTypeVote, show: props.talkType == 2 }
// { name: '群投票', type: message.ChatMsgTypeVote, show: props.talkType == 2 }
]
const onMaskClick = () => {
Expand Down
6 changes: 3 additions & 3 deletions src/socket.ts → src/connect.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { h } from 'vue'
import { NAvatar } from 'naive-ui'
import { useTalkStore, useUserStore, useDialogueStore } from '@/store'
import { notifyIcon } from '@/constant/default'

import { isLoggedIn } from './utils/auth'

import EventTalk from './event/socket/talk'
import EventKeyboard from './event/socket/keyboard'
import EventLogin from './event/socket/login'
import EventRevoke from './event/socket/revoke'

import { NAvatar, c } from 'naive-ui'
import { notifyIcon } from '@/constant/default'

import { Client } from 'paho-mqtt' // 从'mqtt-paho'库导入Client
import { v4 } from 'uuid'
import { storage } from '@/utils/storage'
Expand Down
4 changes: 2 additions & 2 deletions src/event/socket/talk.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Base from './base'
import { nextTick } from 'vue'
import socket from '@/socket'
import ws from '@/connect'
import { parseTime } from '@/utils/datetime'
import { WebNotify } from '@/utils/notification'
import * as message from '@/constant/message'
Expand Down Expand Up @@ -177,7 +177,7 @@ class Talk extends Base {
if (!this.isCurrSender()) {
// 推送已读消息
setTimeout(() => {
socket.emit('im.message.read', {
ws.emit('im.message.read', {
receiver_id: this.sender_id,
msg_id: [this.resource.id]
})
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useConnectStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { watchEffect } from 'vue'
import { useRouter } from 'vue-router'
import { useSettingsStore } from '@/store'
import { isLoggedIn } from '@/utils/auth'
import socket from '@/socket'
import ws from '@/connect'
import { useUserStore } from '@/store'

export const useConnectStatus = () => {
Expand All @@ -20,7 +20,7 @@ export const useConnectStatus = () => {

if (!paths.includes(pathname) && isLoggedIn()) {
userStore.loadSetting()
!socket.isConnect() && socket.connect('useConnectStatus...')
!ws.isConnect() && ws.connect('useConnectStatus...')
}
})

Expand Down
15 changes: 0 additions & 15 deletions src/hooks/useIconProvider.js

This file was deleted.

3 changes: 0 additions & 3 deletions src/hooks/useTalkRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@ export const useTalkRecord = (uid: number) => {
if (request.record_id == 0) {
el.scrollTop = el.scrollHeight

setTimeout(() => {
el && (el.scrollTop = el?.scrollHeight)
}, 100)
} else {
el.scrollTop = el.scrollHeight - scrollHeight
}
Expand Down
1 change: 0 additions & 1 deletion src/hooks/useThemeMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export function useThemeMode() {
const theme = settingsStore.darkTheme ? 'dark' : 'light'

document.getElementsByTagName('html')[0].dataset.theme = theme
document.getElementsByTagName('html')[0].style = ''

return settingsStore.darkTheme ? darkTheme : undefined
})
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/ws-socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class WsSocket {
*
* @var Websocket
*/
connect = null
connect

/**
* 配置信息
Expand Down
6 changes: 3 additions & 3 deletions src/views/auth/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { NDivider, NForm, NFormItem } from 'naive-ui'
import { ServeLogin } from '@/api/auth'
import { setAccessToken } from '@/utils/auth'
import { palyMusic } from '@/utils/talk'
import socket from '@/socket'
import ws from '@/connect'
import { useUserStore } from '@/store'
const userStore = useUserStore()
Expand Down Expand Up @@ -45,8 +45,8 @@ const onLogin = () => {
window['$message'].success('登录成功')
setAccessToken(res.data.access_token, res.data.expires_in)
userStore.loadSetting()
!socket.isConnect() && socket.connect('onLogin...')
// socket.connect()
!ws.isConnect() && ws.connect('onLogin...')
// ws.connect()
router.push(route.query.redirect || '/')
} else {
window['$message'].warning(res.message)
Expand Down
4 changes: 2 additions & 2 deletions src/views/message/inner/panel/PanelFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
useUploadsStore,
useEditorStore
} from '@/store'
import socket from '@/socket'
import ws from '@/connect'
import { ServePublishMessage, ServeSendVote } from '@/api/chat'
import { throttle, getVideoImage } from '@/utils/common'
import Editor from '@/components/editor/Editor.vue'
Expand Down Expand Up @@ -181,7 +181,7 @@ const onSendMixedEvent = ({ data, callBack }) => {
}
const onKeyboardPush = throttle(() => {
socket.emit('im.message.keyboard', {
ws.emit('im.message.keyboard', {
sender_id: props.uid,
receiver_id: props.receiver_id
})
Expand Down
9 changes: 8 additions & 1 deletion src/views/setting/config.vue
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ const onUploadAvatar = (avatar) => {
<div class="name">{{ key }}</div>

<!-- v-for 循环遍历 item 中的每个 subitem -->
<div class="desc">
<div class="desc text-ellipsis">
<!-- 显示 subitem 的 name 和 value -->
<text class="" selectable="false" space="false" decode="false" v-for="subitem in item" :key="subitem.id">
<block v-if="typeof subitem.value !== 'boolean'">{{ subitem.name }} : {{ subitem.value || '未设置' }} &nbsp;&nbsp;&nbsp;&nbsp;</block>
Expand Down Expand Up @@ -472,4 +472,11 @@ const onUploadAvatar = (avatar) => {
border-radius: 10px;
margin-bottom: 20px;
}
.text-ellipsis {
width: 750px; /* 调整这个宽度以适应大约10个字符 */
white-space: nowrap; /* 确保文本不会换行 */
overflow: hidden; /* 隐藏超出部分的文本 */
text-overflow: ellipsis; /* 当文本超出容器宽度时显示省略号 */
}
</style>
10 changes: 1 addition & 9 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,9 @@
"experimentalDecorators": true,
"noEmit": true,
"allowImportingTsExtensions": true,
"lib": [
"dom",
"esnext"
],
"types": [
"vite/client"
],
"typeRoots": [
"./node_modules/@types/",
"./types"
],
"noImplicitAny": false,
"skipLibCheck": true,
"paths": {
Expand All @@ -41,11 +33,11 @@
}
},
"include": [
"env.d.ts",
"src/**/*.ts",
"src/**/*.d.ts",
"src/**/*.tsx",
"src/**/*.vue",
"vite.config.ts",
"assets/**/*.jpg",
"vite-env.d.ts",
"src/vue-shim.d.ts"
Expand Down

0 comments on commit aa0d5ec

Please sign in to comment.