Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
standalone-anyremote
Overview
Overview
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
qlintonger xeno
standalone-anyremote
Commits
3f345fb5
Commit
3f345fb5
authored
Apr 30, 2024
by
pangchong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 优化
parent
aaa4ad49
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
38 deletions
+38
-38
src/store/contacts/index.ts
+17
-17
src/store/contacts/types.ts
+4
-4
src/views/layout/index.vue
+2
-2
src/views/remote/contacts/contactsInfo.vue
+2
-2
src/views/remote/contacts/contactsList.vue
+7
-7
src/views/remote/contacts/contactsListChoose.vue
+2
-2
src/views/remote/contacts/eventList.vue
+4
-4
No files found.
src/store/contacts/index.ts
View file @
3f345fb5
import
{
defineStore
}
from
'pinia'
import
{
ContactsState
,
User
ItemDto
}
from
'./types'
import
{
ContactsState
,
Contacts
ItemDto
}
from
'./types'
import
{
userStates
}
from
'AnyR/states/wsStates'
const
useContactsStore
=
defineStore
(
'contacts'
,
{
state
:
():
ContactsState
=>
{
return
{
showWait
:
false
,
//是否等待接通
choose
User
:
undefined
,
//当前选中的联系人
user
List
:
[]
//所有联系人
show
Contacts
Wait
:
false
,
//是否等待接通
choose
ContactsItem
:
undefined
,
//当前选中的联系人
allContacts
List
:
[]
//所有联系人
}
},
getters
:
{
//获取合并ws后的所有用户列表
getAllOnlineContacts
(
state
)
{
const
userList
=
[]
as
User
ItemDto
[]
state
.
user
List
.
forEach
((
item1
)
=>
{
const
allContactsList
=
[]
as
Contacts
ItemDto
[]
state
.
allContacts
List
.
forEach
((
item1
)
=>
{
userStates
.
value
.
onlineContacts
.
forEach
((
item2
:
any
)
=>
{
if
(
item1
.
id
==
item2
.
fromID
)
{
Object
.
assign
(
item1
,
item2
)
}
})
user
List
.
push
(
item1
)
allContacts
List
.
push
(
item1
)
})
return
user
List
return
allContacts
List
},
//获取ws的用户列表
getOnlineContacts
(
state
)
{
const
userList
=
[]
as
User
ItemDto
[]
const
allContactsList
=
[]
as
Contacts
ItemDto
[]
userStates
.
value
.
onlineContacts
.
forEach
((
item1
:
any
)
=>
{
state
.
user
List
.
forEach
((
item2
)
=>
{
state
.
allContacts
List
.
forEach
((
item2
)
=>
{
if
(
item1
.
fromID
==
item2
.
id
)
{
Object
.
assign
(
item1
,
item2
)
}
})
user
List
.
push
(
item1
)
allContacts
List
.
push
(
item1
)
})
return
user
List
return
allContacts
List
}
},
actions
:
{
//设置当前选中联系人
setChooseUser
(
info
:
User
ItemDto
|
undefined
)
{
this
.
choose
User
=
info
setChooseUser
(
info
:
Contacts
ItemDto
|
undefined
)
{
this
.
choose
ContactsItem
=
info
},
//修改通话状态
changeWait
(
val
:
boolean
)
{
this
.
showWait
=
val
this
.
show
Contacts
Wait
=
val
},
//获取全部联系人
setUserList
(
info
:
User
ItemDto
[])
{
this
.
user
List
=
info
setUserList
(
info
:
Contacts
ItemDto
[])
{
this
.
allContacts
List
=
info
}
},
...
...
src/store/contacts/types.ts
View file @
3f345fb5
export
interface
User
ItemDto
{
export
interface
Contacts
ItemDto
{
id
:
string
nickname
:
string
remark
:
string
...
...
@@ -7,7 +7,7 @@ export interface UserItemDto {
[
propName
:
string
]:
any
}
export
interface
ContactsState
{
showWait
:
boolean
choose
User
?:
User
ItemDto
userList
:
User
ItemDto
[]
show
Contacts
Wait
:
boolean
choose
ContactsItem
?:
Contacts
ItemDto
allContactsList
:
Contacts
ItemDto
[]
}
src/views/layout/index.vue
View file @
3f345fb5
...
...
@@ -6,7 +6,7 @@
<!-- 内容区域 -->
<a-layout
class=
"h-[calc(100%-60px)]"
>
<!-- 视频等待遮罩 -->
<contacts-wait
v-if=
"showWait"
></contacts-wait>
<contacts-wait
v-if=
"show
Contacts
Wait"
></contacts-wait>
<!-- 侧边栏 -->
<g-aside
v-if=
"getShowMenu"
></g-aside>
<!-- 路由内容 -->
...
...
@@ -29,7 +29,7 @@ import { activedTheme } from '../../../project.ui.config'
//显示通话等待
const
contactsStore
=
useContactsStore
()
const
{
showWait
}
=
storeToRefs
(
contactsStore
)
const
{
show
Contacts
Wait
}
=
storeToRefs
(
contactsStore
)
//是否展示菜单
const
route
=
useRoute
()
const
getShowMenu
=
computed
(()
=>
{
...
...
src/views/remote/contacts/contactsInfo.vue
View file @
3f345fb5
...
...
@@ -33,7 +33,7 @@
import
contactsList
from
'./contactsList.vue'
import
multiCallModel
from
'./multiCallModel.vue'
import
{
alova
}
from
'@/api/alova-instance'
import
type
{
User
ItemDto
}
from
'@/store/contacts/types'
import
type
{
Contacts
ItemDto
}
from
'@/store/contacts/types'
import
useContactsStore
from
'@/store/contacts/index'
import
{
useRequest
}
from
'alova'
import
{
videoGroup
}
from
'@/constants/common/user'
...
...
@@ -58,7 +58,7 @@ const { loading, data, onSuccess } = useRequest(
pageSize
:
99999
},
{
transformData
:
(
res
:
any
)
=>
res
.
data
as
User
ItemDto
[]
transformData
:
(
res
:
any
)
=>
res
.
data
as
Contacts
ItemDto
[]
}
),
{
...
...
src/views/remote/contacts/contactsList.vue
View file @
3f345fb5
<
template
>
<template
v-for=
"(item, index) in data"
:key=
"item.id"
>
<div
class=
"item flex items-center px-4 py-3 rounded cursor-pointer"
:class=
"
{ active: choose
User
?.id == item.id }" @click="handleClick(item)">
<div
class=
"item flex items-center px-4 py-3 rounded cursor-pointer"
:class=
"
{ active: choose
ContactsItem
?.id == item.id }" @click="handleClick(item)">
<global-avatar></global-avatar>
<div
class=
"ml-[9px] inline-block"
>
{{
item
.
nickname
}}
</div>
<div
class=
"flex items-center ml-6"
>
<global-icon
icon=
"camera"
:size=
"14"
class=
"mr-2"
></global-icon>
<global-icon
icon=
"mic"
:size=
"14"
></global-icon>
<global-icon
icon=
"camera"
:size=
"14"
class=
"mr-2"
v-if=
"item.hasCamera == 1"
></global-icon>
<global-icon
icon=
"mic"
:size=
"14"
v-if=
"item.hasMike == 1"
></global-icon>
</div>
<div
class=
"flex-auto text-right"
>
<a-button
type=
"primary"
shape=
"circle"
@
click
.
stop=
"changeWait(true)"
:disabled=
"!(item.callState == 'callState' && item.hasCamera == 1 && item.hasMike == 1)"
>
...
...
@@ -18,11 +18,11 @@
<
script
setup
lang=
"ts"
>
import
useContactsStore
from
'@/store/contacts/index'
import
{
User
ItemDto
}
from
'@/store/contacts/types'
import
{
Contacts
ItemDto
}
from
'@/store/contacts/types'
import
{
storeToRefs
}
from
'pinia'
interface
Props
{
data
?:
Array
<
User
ItemDto
>
data
?:
Array
<
Contacts
ItemDto
>
}
const
ps
=
withDefaults
(
defineProps
<
Props
>
(),
{
data
:
()
=>
[]
...
...
@@ -30,9 +30,9 @@ const ps = withDefaults(defineProps<Props>(), {
//拨打视频
const
{
changeWait
,
setChooseUser
}
=
useContactsStore
()
//当前联系人
const
{
choose
User
}
=
storeToRefs
(
useContactsStore
())
const
{
choose
ContactsItem
}
=
storeToRefs
(
useContactsStore
())
//点击联系人
const
handleClick
=
(
item
:
User
ItemDto
)
=>
{
const
handleClick
=
(
item
:
Contacts
ItemDto
)
=>
{
setChooseUser
(
item
)
}
onBeforeUnmount
(()
=>
{
...
...
src/views/remote/contacts/contactsListChoose.vue
View file @
3f345fb5
...
...
@@ -13,10 +13,10 @@
</template>
<
script
setup
lang=
"ts"
>
import
{
User
ItemDto
}
from
'@/store/contacts/types'
import
{
Contacts
ItemDto
}
from
'@/store/contacts/types'
interface
Props
{
data
?:
Array
<
User
ItemDto
>
data
?:
Array
<
Contacts
ItemDto
>
}
const
ps
=
withDefaults
(
defineProps
<
Props
>
(),
{
data
:
()
=>
[]
...
...
src/views/remote/contacts/eventList.vue
View file @
3f345fb5
...
...
@@ -36,11 +36,11 @@ const beginTime = ref('')
const
endTime
=
ref
(
''
)
const
keyword
=
ref
(
''
)
//当前联系人
const
{
choose
User
}
=
storeToRefs
(
useContactsStore
())
const
{
choose
ContactsItem
}
=
storeToRefs
(
useContactsStore
())
//表格搜索
const
getEventList
=
(
pageIndex
:
number
,
pageSize
:
number
)
=>
{
const
params
=
{
userId
:
choose
User
?.
value
?.
id
,
userId
:
choose
ContactsItem
?.
value
?.
id
,
pageIndex
,
pageSize
,
uid
:
2
,
...
...
@@ -77,7 +77,7 @@ const {
// Method实例获取函数,它将接收page和pageSize,并返回一个Method实例
(
pageIndex
:
number
,
pageSize
:
number
)
=>
getEventList
(
pageIndex
,
pageSize
),
{
watchingStates
:
[
beginTime
,
endTime
,
()
=>
choose
User
?.
value
?.
id
,
keyword
],
watchingStates
:
[
beginTime
,
endTime
,
()
=>
choose
ContactsItem
?.
value
?.
id
,
keyword
],
// 请求前的初始数据(接口返回的数据格式)
initialData
:
{
total
:
0
,
...
...
@@ -90,7 +90,7 @@ const {
total
:
(
res
)
=>
parseInt
(
res
.
data
.
total
),
data
:
(
res
)
=>
res
.
data
.
list
,
sendable
:
()
=>
{
return
choose
User
?.
value
?.
id
?
true
:
false
return
choose
ContactsItem
?.
value
?.
id
?
true
:
false
}
}
)
...
...
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