Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
anyremote-miniapp
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
wxl
anyremote-miniapp
Commits
c33b7955
Commit
c33b7955
authored
Apr 13, 2021
by
wxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
1679c991
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
43 additions
and
35 deletions
+43
-35
any-hooks/auth/useAuthData.ts
+0
-1
any-hooks/communication/useCallCenter.ts
+6
-9
any-hooks/communication/useChannelStore.ts
+0
-1
any-hooks/communication/useMeetingCenter.ts
+1
-5
any-hooks/contacts/useContacts.ts
+11
-1
src/hooks/call/useCallerListener.ts
+9
-4
src/hooks/http/useCustomeRequest.ts
+0
-1
src/hooks/http/useHttpIntercept.ts
+8
-7
src/pages/calling/index.vue
+2
-2
src/pages/index/work-groups-list.vue
+1
-1
src/pages/meeting/invite.vue
+5
-3
No files found.
any-hooks/auth/useAuthData.ts
View file @
c33b7955
...
...
@@ -5,7 +5,6 @@ import { useState } from "vue-vulcan";
export
function
useAuthData
()
{
const
[
authData
,
setAuth
]
=
useState
<
UserData
>
(
null
,
{
storage
:
'custome'
,
key
:
'auth'
});
return
{
authData
,
setAuth
...
...
any-hooks/communication/useCallCenter.ts
View file @
c33b7955
...
...
@@ -6,7 +6,7 @@ import { useInjector, useRequest, useState } from "vue-vulcan";
import
{
useChannelStore
}
from
"./useChannelStore"
;
import
{
useNetSocketStore
}
from
"./useNetSocketStore"
;
type
CallingState
=
'net_error'
|
'calling'
|
'call_successed'
|
'
being_called
'
|
'call_accepted'
|
'connecting'
|
'free'
;
type
CallingState
=
'net_error'
|
'calling'
|
'call_successed'
|
'
callin
'
|
'call_accepted'
|
'connecting'
|
'free'
;
interface
Caller
extends
UserData
{
action
:
AnyRemoteSubFlag
|
'none'
;
...
...
@@ -72,10 +72,10 @@ export function useCallCenter() {
if
(
msg
.
msgMainFlag
!==
'CallOffer'
)
return
;
switch
(
msg
.
msgSubFlag
)
{
case
'Request'
:
// 本地呼叫状态为free时,变更为
being_called
;不为free,则发送繁忙的回应。
// 本地呼叫状态为free时,变更为
callin
;不为free,则发送繁忙的回应。
console
.
log
(
`
${
currentMsg
.
value
.
fromName
}
呼叫,我目前的状态
${
myCallState
.
value
}
`
)
if
(
myCallState
.
value
===
'free'
)
{
setCallState
(
'
being_called
'
);
setCallState
(
'
callin
'
);
setCaller
({
id
:
msg
.
fromID
,
nickname
:
msg
.
fromName
,
...
...
@@ -88,7 +88,7 @@ export function useCallCenter() {
}
//15S秒后若本地用户仍然处于被呼叫状态,则自动发出繁忙恢复,且将状态恢复为free
timer
=
setTimeout
(
()
=>
{
if
(
myCallState
.
value
===
'
being_called
'
){
if
(
myCallState
.
value
===
'
callin
'
){
answerCaller
(
'Busying'
,
{
id
:
currentMsg
.
value
.
fromID
,
nickname
:
currentMsg
.
value
.
fromName
});
setCallState
(
'free'
);
}
...
...
@@ -106,8 +106,6 @@ export function useCallCenter() {
})
break
;
}
})
// 监听呼叫目标的回应
watch
(
currentMsg
,
msg
=>
{
...
...
@@ -126,7 +124,6 @@ export function useCallCenter() {
})
/** 呼叫挂断功能 */
const
hangup
=
(
type
?:
'leave'
|
'cancel'
)
=>
{
let
flag
:
AnyRemoteMainFlag
,
toID
:
string
;
switch
(
myCallState
.
value
)
{
...
...
@@ -138,7 +135,7 @@ export function useCallCenter() {
flag
=
'CallOffer'
;
toID
=
target
.
value
?.
id
;
break
;
case
'
being_called
'
:
case
'
callin
'
:
flag
=
'CallAnswer'
;
toID
=
caller
.
value
?.
id
;
break
;
...
...
@@ -169,7 +166,7 @@ export function useCallCenter() {
})
}
changeCallingState
({
channel_id
:
currentChannel
.
value
?.
channel_id
,
userIDs
:
JSON
.
stringify
([
{
userID
:
authData
.
value
.
id
,
callState
:
state
===
'free'
?
'idle'
:
'callout
'
},
{
userID
:
authData
.
value
.
id
,
callState
:
state
===
'free'
?
'idle'
:
state
===
'calling'
?
'callout'
:
'callin
'
},
{
userID
:
target
.
value
?.
id
||
caller
.
value
?.
id
,
callState
:
state
===
'free'
?
'idle'
:
'callin'
}
])});
})
...
...
any-hooks/communication/useChannelStore.ts
View file @
c33b7955
...
...
@@ -32,7 +32,6 @@ export function useChannelStore() {
return
request
({
channel_id
:
cid
});
}
const
updateMembers
=
(
ids
:
string
[],
type
:
'join'
|
'leave'
)
=>
{
const
current
=
channelMembers
.
value
;
if
(
type
===
'join'
)
{
...
...
any-hooks/communication/useMeetingCenter.ts
View file @
c33b7955
import
{
setKeepScreenOn
}
from
"@tarojs/taro
"
;
import
{
watch
}
from
"vue
"
;
import
{
useContacts
}
from
"any-hooks/contacts/useContacts"
;
import
{
UserData
}
from
"any-hooks/types/user"
;
import
{
onMounted
,
watch
}
from
"vue"
;
import
{
useInjector
,
useState
}
from
"vue-vulcan"
;
import
{
useCallCenter
}
from
"./useCallCenter"
;
import
{
useChannelStore
}
from
"./useChannelStore"
;
...
...
@@ -31,9 +30,6 @@ export function useMeetingCenter() {
stopVideoConference
();
}
/** 保持屏幕常亮 */
onMounted
(()
=>
setKeepScreenOn
({
keepScreenOn
:
true
}));
/** 监听频道成员信息 */
const
{
channelMembers
}
=
useInjector
(
useChannelStore
);
const
[
meetingMembers
,
setMembers
]
=
useState
<
MeetingMember
[]
>
([]);
...
...
any-hooks/contacts/useContacts.ts
View file @
c33b7955
...
...
@@ -33,7 +33,17 @@ export function useContacts() {
return
contactHome
})
const
freeContacts
=
computed
(
()
=>
contacts
.
value
.
filter
(
item
=>
item
.
is_calling
===
'0'
&&
item
.
is_signin
===
'1'
))
const
freeContacts
=
computed
(
()
=>
{
const
list
=
contacts
.
value
.
filter
(
item
=>
item
.
is_calling
===
'0'
&&
item
.
is_signin
===
'1'
);
const
frees
=
{}
as
{[
props
:
string
]:
UserData
[]}
list
?.
forEach
(
item
=>
{
if
([
'3'
,
'4'
].
includes
(
item
.
permission
)
)
{
if
(
!
frees
[
item
.
group_name
])
frees
[
item
.
group_name
]
=
[];
frees
[
item
.
group_name
].
push
(
item
);
};
})
return
frees
})
const
getContactById
=
(
pid
:
string
,
type
?:
'uid'
|
'pid'
)
=>
{
...
...
src/hooks/call/useCallerListener.ts
View file @
c33b7955
import
{
navigateTo
,
redirectTo
,
showToast
}
from
"@tarojs/taro"
;
import
{
navigateTo
,
redirectTo
,
s
etKeepScreenOn
,
s
howToast
}
from
"@tarojs/taro"
;
import
{
useCallCenter
}
from
"any-hooks/communication/useCallCenter"
;
import
{
watch
}
from
"vue"
;
import
{
onMounted
,
watch
}
from
"vue"
;
import
{
useInjector
}
from
"vue-vulcan"
;
import
{
useAppInitInfo
}
from
"../common/useAppInitInfo"
;
...
...
@@ -8,7 +8,12 @@ import { useAppInitInfo } from "../common/useAppInitInfo";
/** 在小程序平台监听远程联系人的呼叫动作 */
export
function
useCallerListener
()
{
const
{
caller
,
target
,
myCallState
,
answerCaller
}
=
useInjector
(
useCallCenter
);
const
{
checkCamearSetting
}
=
useInjector
(
useAppInitInfo
)
const
{
checkCamearSetting
}
=
useInjector
(
useAppInitInfo
);
onMounted
(()
=>
{
/** 保持屏幕常亮 */
onMounted
(()
=>
setKeepScreenOn
({
keepScreenOn
:
true
}));
})
watch
(
caller
,
current
=>
{
if
(
!
current
)
return
;
...
...
@@ -42,7 +47,7 @@ export function useCallerListener() {
navigateTo
({
url
:
'/pages/calling/index'
});
}
break
;
case
'
being_called
'
:
case
'
callin
'
:
checkCamearSetting
().
then
(
r
=>
{
r
?
navigateTo
({
url
:
'/pages/calling/index'
})
:
answerCaller
(
'NoDevice'
)
})
...
...
src/hooks/http/useCustomeRequest.ts
View file @
c33b7955
...
...
@@ -3,7 +3,6 @@ import { request, showToast } from '@tarojs/taro';
export
function
useCustomeRequest
():
RequesterFunc
{
return
function
(
url
:
string
,
reqs
:
RequestOptions
)
{
console
.
log
(
'my url'
,
url
)
return
request
({
...
reqs
,
url
,
...
...
src/hooks/http/useHttpIntercept.ts
View file @
c33b7955
import
{
useAuthData
}
from
"
../../../
any-hooks/auth/useAuthData"
;
import
{
useAuthData
}
from
"any-hooks/auth/useAuthData"
;
import
{
HttpIntercept
,
HttpResponse
,
HTTP_INTERCEPT
,
RequestOptions
,
useInjector
}
from
"vue-vulcan"
;
import
{
showToast
}
from
"@tarojs/taro"
;
...
...
@@ -21,12 +21,6 @@ export function useHttpIntercept(): HttpIntercept {
})
}
const
checkResData
=
(
data
:
any
)
=>
{
if
(
data
.
success
)
return
true
;
showToast
({
title
:
data
.
msg
,
icon
:
'none'
});
return
false
;
}
const
responseIntercept
=
(
res
:
HttpResponse
)
=>
{
switch
(
res
.
status
)
{
case
404
:
...
...
@@ -43,6 +37,13 @@ export function useHttpIntercept(): HttpIntercept {
})
}
const
checkResData
=
(
data
:
any
)
=>
{
if
(
data
.
success
)
return
true
;
showToast
({
title
:
data
.
msg
,
icon
:
'none'
});
return
false
;
}
return
{
requestIntercept
,
responseIntercept
...
...
src/pages/calling/index.vue
View file @
c33b7955
...
...
@@ -24,7 +24,7 @@
<
template
>
<view
class=
"page call-container"
>
<view
class=
"call-box caller"
v-if=
"myCallState==='
being_called
'"
>
<view
class=
"call-box caller"
v-if=
"myCallState==='
callin
'"
>
<image
class=
"avatar"
:src=
"caller?.avatar"
></image>
<text
class=
"tips"
>
{{
caller
?.
nickname
}}
向您发起呼叫
</text>
</view>
...
...
@@ -35,7 +35,7 @@
</view>
<view
class=
"operators"
v-if=
"myCallState!=='free'"
>
<image
v-if=
"myCallState==='
being_called
'"
@
tap=
"answerCaller('Connect')"
class=
"op-icon"
src=
"../../assets/answer3x.png"
></image>
<image
v-if=
"myCallState==='
callin
'"
@
tap=
"answerCaller('Connect')"
class=
"op-icon"
src=
"../../assets/answer3x.png"
></image>
<image
@
tap=
"onTapHangup()"
class=
"op-icon"
src=
"../../assets/hangup.png"
></image>
</view>
</view>
...
...
src/pages/index/work-groups-list.vue
View file @
c33b7955
...
...
@@ -5,7 +5,7 @@
const
{
filterGroups
}
=
useInjector
(
useContacts
);
const
gotoGroupContacts
=
(
id
:
string
)
=>
{
navigateTo
({
url
:
`/pages/group-contacts/index?id=
${
id
}
`
})
navigateTo
({
url
:
`/pages/group-contacts/index?id=
${
id
}
`
})
;
}
</
script
>
...
...
src/pages/meeting/invite.vue
View file @
c33b7955
...
...
@@ -27,7 +27,7 @@
<
template
>
<scroll-view
:scrollY=
"true"
class=
"invite-container page"
:style=
"
{top: topDistance+'px'}" >
<view
class=
"contact-role-group"
v-for=
"(group, key, index) in
rol
eContacts"
:key=
"index"
>
<view
class=
"contact-role-group"
v-for=
"(group, key, index) in
fre
eContacts"
:key=
"index"
>
<view
class=
"role-name pd-2"
:class=
"
{hide: hideConfig[index]}" @tap="toggleHideByIndex(index)">
{{
key
}}
</view>
<view
class=
"white-box"
:style=
"
{display: hideConfig[index] ? 'none' : 'block'}">
<view
class=
"contact-item"
v-for=
"(item, i) in group"
:key=
"i"
>
...
...
@@ -47,13 +47,15 @@
<
style
lang=
"less"
>
.invite-container
{
position
:
absolute
;
border-top-left-radius
:
20px
;
border-top-right-radius
:
20px
;
z-index
:
1000
;
top
:
0
;
left
:
0
;
bottom
:
0
;
width
:
100%
;
height
:
100%
;
background-color
:
rgba
(
0
,
0
,
0
,
0.65
)
;
background-color
:
#fff
;
z-index
:
10000
;
.contact-role-group{
background-color
:
#fff
;
...
...
@@ -100,7 +102,7 @@
display
:
inline-block
;
background
:
#2b91e2
;
color
:
#fff
;
padding
:
6px
12
px
;
padding
:
2px
15
px
;
}
}
}
...
...
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