Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
frontend-h5
Project
Project
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
songrui
frontend-h5
Commits
953c1652
Commit
953c1652
authored
Oct 18, 2024
by
songrui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
专家在线咨询
parent
eaabfc4b
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
203 additions
and
33 deletions
+203
-33
nim.js
src/api/residentWX/nim.js
+11
-0
avatar-doctor.svg
src/assets/image/residentWX/avatar-doctor.svg
+0
-0
avatar-man.png
src/assets/image/residentWX/avatar-man.png
+0
-0
avatar-woman.png
src/assets/image/residentWX/avatar-woman.png
+0
-0
banner.png
src/assets/image/residentWX/banner.png
+0
-0
FileView.vue
src/residentWX/nim/FileView.vue
+0
-0
Index.vue
src/residentWX/nim/Index.vue
+136
-0
Session.vue
src/residentWX/nim/Session.vue
+47
-24
Test.vue
src/residentWX/nim/Test.vue
+0
-0
index.js
src/router/index.js
+8
-8
vue.config.js
vue.config.js
+1
-1
No files found.
src/api/residentWX/nim.js
0 → 100644
View file @
953c1652
import
{
fetchBase
}
from
'../fetch.js'
// 根据居民ID查询服务医生
export
function
getServiceDoc
(
params
)
{
return
fetchBase
({
url
:
`/chronic-resident/v1/chronic-visit-record/service-doctor`
,
body
:
params
,
loading
:
true
})
}
// 获取IM账号信息
export
function
getAccount
(
idCard
)
{
return
fetchBase
({
url
:
`/chronic-resident/v1/chronic-resident-im/refresh-token/
${
idCard
}
`
,
loading
:
true
})
}
src/assets/image/
nim
/avatar-doctor.svg
→
src/assets/image/
residentWX
/avatar-doctor.svg
View file @
953c1652
File moved
src/assets/image/
nim
/avatar-man.png
→
src/assets/image/
residentWX
/avatar-man.png
View file @
953c1652
File moved
src/assets/image/
nim
/avatar-woman.png
→
src/assets/image/
residentWX
/avatar-woman.png
View file @
953c1652
File moved
src/assets/image/residentWX/banner.png
0 → 100644
View file @
953c1652
37.3 KB
src/nim/FileView.vue
→
src/
residentWX/
nim/FileView.vue
View file @
953c1652
File moved
src/residentWX/nim/Index.vue
0 → 100644
View file @
953c1652
<
template
>
<div
class=
"flex flex-col nim-index"
style=
"height: 100vh"
>
<div
class=
"py-2 px-3 text-black text-center shrink-0 doc-nav-bar"
>
<span>
专家在线咨询
</span>
</div>
<img
src=
"@/assets/image/residentWX/banner.png"
alt=
""
class=
"shrink-0 w-full"
>
<div
style=
"color: #8C8C8C;"
class=
"py-2 px-3"
>
以下为您提供慢病筛查的专家,可向其进行慢病咨询
</div>
<div
class=
"grow flex"
>
<div
class=
"h-full list-l"
>
<div
class=
"p-3 active"
>
咨询过的专家
</div>
<div
v-for=
"item in orgList"
:key=
"item.unitId"
:class=
"['p-3',
{ 'active': item.unitId === activeOrg.unitId }]"
@click="onOrgChange(item)">
<span>
{{
item
.
unitName
||
'-'
}}
</span>
</div>
</div>
<div
class=
"h-full p-3 list-r"
>
<div
class=
"mb-3 p-4 card"
v-for=
"item in innerDoctorList"
:key=
"item.identityCard"
>
<div
class=
"mb-3"
>
<span
class=
"text-16 mr-2 font-semibold"
>
{{
item
.
staffName
}}
</span>
<span>
{{
item
.
officeName
||
'-'
}}
</span>
</div>
<div
class=
"mb-3"
>
{{
item
.
unitName
||
'-'
}}
</div>
<div>
<van-button
plain
round
type=
"primary"
@
click=
"toSession(item)"
>
咨询医生
</van-button>
</div>
</div>
</div>
</div>
</div>
</
template
>
<
script
>
import
{
useStore
}
from
'@/residentWX/store'
import
{
getServiceDoc
}
from
'@/api/residentWX/nim.js'
import
{
showFailToast
}
from
'vant'
export
default
{
data
()
{
return
{
store
:
useStore
(),
orgList
:
[],
doctorList
:
[],
activeOrg
:
{}
}
},
computed
:
{
userInfo
()
{
return
this
.
store
.
userInfo
},
innerDoctorList
()
{
return
this
.
doctorList
.
filter
(
e
=>
e
.
unitId
===
this
.
activeOrg
.
unitId
)
}
},
created
()
{
this
.
init
()
},
methods
:
{
init
()
{
console
.
log
(
this
.
userInfo
)
this
.
load
()
},
load
()
{
getServiceDoc
({
residentInfoId
:
this
.
userInfo
.
residentInfoId
}).
then
(
res
=>
{
const
list
=
res
.
data
||
[]
const
orgList
=
[]
this
.
doctorList
=
list
list
.
forEach
(
e
=>
{
if
(
orgList
.
some
(
e
=>
e
.
unitId
===
e
.
unitId
))
return
orgList
.
push
({
unitId
:
e
.
unitId
,
unitName
:
e
.
unitName
})
})
this
.
orgList
=
orgList
if
(
orgList
.
length
)
{
this
.
activeOrg
=
orgList
[
0
]
}
})
},
onOrgChange
(
item
)
{
this
.
activeOrg
=
item
||
{}
},
// 聊天页面
toSession
(
item
=
{})
{
if
(
!
item
.
identityCard
)
{
showFailToast
(
'缺失医生信息'
)
return
}
const
path
=
`/residentWX/nim/
${
item
.
identityCard
}
`
this
.
$router
.
push
({
path
,
query
:
{
name
:
item
.
staffName
}
})
}
},
}
</
script
>
<
style
lang=
"less"
scoped
>
@import url('../utils/common.less');
.nim-index {
background: #f8fafc;
}
.list-l {
width: 35%;
background: transparent;
>div {
line-height: 1.5;
}
.active {
background-color: #fff;
}
}
.list-r {
width: 65%;
background: #fff;
.card {
background-color: #E4E8EE;
background: linear-gradient(to bottom, #E5F3FF 0%, #E9FAFC 100%);
border-radius: 8px;
border: 1px solid #E4E8EE;
.van-button {
height: 26px;
line-height: 26px;
font-size: 14px;
}
}
}
</
style
>
src/nim/Session.vue
→
src/
residentWX/
nim/Session.vue
View file @
953c1652
<
template
>
<
template
>
<div
class=
"flex flex-col session"
style=
"height: 100vh"
>
<div
class=
"flex flex-col session"
style=
"height: 100vh"
>
<div
class=
"py-2 px-3 text-black text-center shrink-0
head
"
>
<div
class=
"py-2 px-3 text-black text-center shrink-0
doc-nav-bar
"
>
<span
@
click=
"onBack"
class=
"text-12 back-bt"
>
<span
@
click=
"onBack"
class=
"text-12 back-bt"
>
<doc-icon
type=
"doc-left2"
/>
<doc-icon
type=
"doc-left2"
/>
</span>
</span>
<span>
{{
target
Id
}}
</span>
<span>
{{
target
Name
}}
</span>
</div>
</div>
<div
class=
"p-3 grow overflow-y-auto content"
>
<div
class=
"p-3 grow overflow-y-auto content"
>
<van-list
<van-list
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
<div
v-for=
"item in msgs"
:key=
"item.time"
<div
v-for=
"item in msgs"
:key=
"item.time"
:class=
"['flex msg-row', item.from === accountId ? 'self' : 'target']"
>
:class=
"['flex msg-row', item.from === accountId ? 'self' : 'target']"
>
<div
class=
"shrink-0 avatar"
>
<div
class=
"shrink-0 avatar"
>
<img
src=
"@/assets/image/
nim
/avatar-doctor.svg"
alt=
""
v-show=
"item.from !== accountId"
>
<img
src=
"@/assets/image/
residentWX
/avatar-doctor.svg"
alt=
""
v-show=
"item.from !== accountId"
>
</div>
</div>
<div
class=
"msg-cont"
>
<div
class=
"msg-cont"
>
<span
v-if=
"item.type === 'text'"
>
{{
item
.
text
}}
</span>
<span
v-if=
"item.type === 'text'"
>
{{
item
.
text
}}
</span>
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
@
viewImage=
"viewImage"
/>
@
viewImage=
"viewImage"
/>
</div>
</div>
<div
class=
"shrink-0 avatar"
>
<div
class=
"shrink-0 avatar"
>
<img
src=
"@/assets/image/
nim
/avatar-man.png"
alt=
""
v-show=
"item.from === accountId"
>
<img
src=
"@/assets/image/
residentWX
/avatar-man.png"
alt=
""
v-show=
"item.from === accountId"
>
</div>
</div>
</div>
</div>
</van-list>
</van-list>
...
@@ -69,16 +69,24 @@
...
@@ -69,16 +69,24 @@
</template>
</template>
<
script
>
<
script
>
import
{
useStore
}
from
'@/residentWX/store'
import
NIM
from
'@yxim/nim-web-sdk/dist/SDK/NIM_Web_NIM.js'
import
NIM
from
'@yxim/nim-web-sdk/dist/SDK/NIM_Web_NIM.js'
import
{
showNotify
,
showToast
,
showImagePreview
,
showSuccessToast
,
showFailToast
}
from
'vant'
import
{
showNotify
,
showToast
,
showImagePreview
,
showSuccessToast
,
showFailToast
}
from
'vant'
import
{
getAccount
}
from
'@/api/residentWX/nim.js'
import
FileView
from
'./FileView.vue'
import
FileView
from
'./FileView.vue'
// 6c51376a55f54b2fa586d7b4c85757f8
const
APPKEY
=
'8cee1ccf8ab46779976091db68a67955'
export
default
{
export
default
{
components
:
{
components
:
{
FileView
FileView
},
},
data
()
{
data
()
{
return
{
return
{
store
:
useStore
(),
accountId
:
''
,
token
:
''
,
msgs
:
[],
msgs
:
[],
nim
:
null
,
nim
:
null
,
// 输入的信息
// 输入的信息
...
@@ -102,13 +110,15 @@ export default {
...
@@ -102,13 +110,15 @@ export default {
}
}
},
},
computed
:
{
computed
:
{
accountId
()
{
userInfo
()
{
return
this
.
$route
.
query
.
accountId
return
this
.
store
.
userInfo
},
},
// 聊天对象
// 聊天对象
targetName
()
{
return
this
.
$route
.
query
.
name
},
targetId
()
{
targetId
()
{
return
'2000050903'
return
`doc_
${
this
.
$route
.
params
.
id
}
`
.
toLocaleLowerCase
()
return
this
.
accountId
===
'18487350810'
?
'18987175004'
:
'18487350810'
}
}
},
},
created
()
{
created
()
{
...
@@ -116,13 +126,27 @@ export default {
...
@@ -116,13 +126,27 @@ export default {
},
},
methods
:
{
methods
:
{
init
()
{
init
()
{
getAccount
(
this
.
userInfo
.
idCard
).
then
(
res
=>
{
console
.
log
(
'getAccount ===========>'
,
res
)
const
result
=
res
.
data
||
{}
this
.
accountId
=
result
.
accountId
this
.
token
=
result
.
yunxinToken
this
.
connect
()
})
},
// 连接到im服务
connect
()
{
if
(
!
this
.
accountId
||
!
this
.
token
)
{
showNotify
({
type
:
'warning'
,
message
:
'聊天服务连接失败'
,
duration
:
0
})
return
}
this
.
isConnect
=
false
this
.
isConnect
=
false
this
.
finished
=
false
this
.
finished
=
false
this
.
nim
=
NIM
.
getInstance
({
this
.
nim
=
NIM
.
getInstance
({
debug
:
tru
e
,
debug
:
fals
e
,
appKey
:
'6c51376a55f54b2fa586d7b4c85757f8'
,
appKey
:
APPKEY
,
account
:
this
.
accountId
,
account
:
this
.
accountId
,
token
:
'123456'
,
token
:
this
.
token
,
onconnect
:
()
=>
{
onconnect
:
()
=>
{
console
.
log
(
'连接成功 ================>'
)
console
.
log
(
'连接成功 ================>'
)
this
.
isConnect
=
true
this
.
isConnect
=
true
...
@@ -139,12 +163,18 @@ export default {
...
@@ -139,12 +163,18 @@ export default {
console
.
log
(
obj
.
duration
)
console
.
log
(
obj
.
duration
)
},
},
ondisconnect
:
(
error
)
=>
{
ondisconnect
:
(
error
)
=>
{
showNotify
({
type
:
'warning'
,
message
:
'连接失败'
,
duration
:
0
})
// showNotify({ type: 'warning', message: '连接失败', duration: 0 })
console
.
warn
(
'连接失败 ===============>'
)
},
},
onmsg
:
(
msg
)
=>
{
onmsg
:
(
msg
)
=>
{
console
.
log
(
'收到新消息===========>'
,
msg
);
console
.
log
(
'收到新消息===========>'
,
msg
);
this
.
msgs
.
push
(
msg
)
this
.
msgs
.
push
(
msg
)
this
.
toBottom
()
this
.
toBottom
()
},
onofflinemsgs
:
(
obj
)
=>
{
console
.
log
(
'收到离线消息===========>'
,
obj
);
this
.
msgs
.
push
(...
obj
.
msgs
)
this
.
toBottom
()
}
}
})
})
},
},
...
@@ -154,6 +184,7 @@ export default {
...
@@ -154,6 +184,7 @@ export default {
showToast
(
'不能发送空消息'
)
showToast
(
'不能发送空消息'
)
return
return
}
}
if
(
!
this
.
nim
)
return
let
msg
=
this
.
nim
.
sendText
({
let
msg
=
this
.
nim
.
sendText
({
scene
:
'p2p'
,
scene
:
'p2p'
,
to
:
this
.
targetId
,
to
:
this
.
targetId
,
...
@@ -164,7 +195,6 @@ export default {
...
@@ -164,7 +195,6 @@ export default {
})
})
this
.
pushMsg
(
msg
)
this
.
pushMsg
(
msg
)
this
.
inputValue
=
''
this
.
inputValue
=
''
this
.
toBottom
()
},
},
pushMsg
(
msg
)
{
pushMsg
(
msg
)
{
this
.
msgs
.
push
(
msg
)
this
.
msgs
.
push
(
msg
)
...
@@ -215,6 +245,7 @@ export default {
...
@@ -215,6 +245,7 @@ export default {
this
.
upload
(
files
[
0
])
this
.
upload
(
files
[
0
])
},
},
upload
(
file
,
hash
)
{
upload
(
file
,
hash
)
{
if
(
!
this
.
nim
)
return
// 先上传再发送
// 先上传再发送
const
tempMsg
=
{
const
tempMsg
=
{
from
:
this
.
accountId
,
from
:
this
.
accountId
,
...
@@ -312,7 +343,7 @@ export default {
...
@@ -312,7 +343,7 @@ export default {
})
})
},
},
onBack
()
{
onBack
()
{
this
.
$router
.
replace
({
name
:
'residentWX-nim'
})
}
}
},
},
beforeUnmount
()
{
beforeUnmount
()
{
...
@@ -329,16 +360,8 @@ export default {
...
@@ -329,16 +360,8 @@ export default {
</
script
>
</
script
>
<
style
lang=
"less"
scoped
>
<
style
lang=
"less"
scoped
>
.head {
@import url('../utils/common.less');
position: relative;
border-bottom: 1px solid #3C3C435C;
.back-bt {
position: absolute;
left: .16rem;
top: 50%;
transform: translateY(-50%);
}
}
.footer {
.footer {
border-top: 1px solid #3C3C431C;
border-top: 1px solid #3C3C431C;
background-color: #eeeeee66;
background-color: #eeeeee66;
...
...
src/nim/Test.vue
→
src/
residentWX/
nim/Test.vue
View file @
953c1652
File moved
src/router/index.js
View file @
953c1652
...
@@ -130,17 +130,17 @@ const routes = [
...
@@ -130,17 +130,17 @@ const routes = [
name
:
'residentWX-guide-list'
,
name
:
'residentWX-guide-list'
,
component
:
()
=>
import
(
/* webpackChunkName: "residentWX-guide" */
'@/residentWX/guide/List.vue'
)
component
:
()
=>
import
(
/* webpackChunkName: "residentWX-guide" */
'@/residentWX/guide/List.vue'
)
},
},
]
},
{
{
path
:
'/
nim'
,
path
:
'
nim'
,
name
:
'
nim'
,
name
:
'residentWX-
nim'
,
component
:
()
=>
import
(
/* webpackChunkName: "nim" */
'@/nim/Session
.vue'
),
component
:
()
=>
import
(
/* webpackChunkName: "nim" */
'@/residentWX/nim/Index
.vue'
),
},
},
{
{
path
:
'/nimTest'
,
path
:
'nim/:id'
,
name
:
'nimTest'
,
name
:
'residentWX-nim-session'
,
component
:
()
=>
import
(
/* webpackChunkName: "nim" */
'@/nim/Test.vue'
),
component
:
()
=>
import
(
/* webpackChunkName: "nim" */
'@/residentWX/nim/Session.vue'
),
}
]
}
}
]
]
...
...
vue.config.js
View file @
953c1652
...
@@ -39,7 +39,7 @@ module.exports = defineConfig({
...
@@ -39,7 +39,7 @@ module.exports = defineConfig({
}
}
},
},
'/chronic-resident'
:
{
'/chronic-resident'
:
{
target
:
'http://192.168.1.1
74
:8903'
,
target
:
'http://192.168.1.1
45
:8903'
,
// target: 'https://beta-tumour.zmnyjk.com',
// target: 'https://beta-tumour.zmnyjk.com',
changOrigin
:
true
,
changOrigin
:
true
,
pathRewrite
:
{
pathRewrite
:
{
...
...
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