Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-admin-consultation
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.education.frontend
pica-admin-consultation
提交
18fc33af
提交
18fc33af
编写于
12月 03, 2021
作者:
xiaoping.di
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hope
上级
bc118aa6
变更
1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
152 行增加
和
30 行删除
+152
-30
round.js
src/store/modules/round.js
+152
-30
未找到文件。
src/store/modules/round.js
浏览文件 @
18fc33af
const
roundCard
=
{
import
io
from
'socket.io-client'
;
const
socket
=
{
namespaced
:
true
,
namespaced
:
true
,
state
:
{
state
:
{
socketClient
:
null
,
socketClient
:
null
,
},
},
actions
:
{
actions
:
{
init
Card
(
context
,
payload
)
{
init
Socket
(
context
,
payload
)
{
const
{
rootState
}
=
context
;
const
{
rootState
}
=
context
;
console
.
log
(
context
,
payload
,
'context, payload111'
,
rootState
);
console
.
log
(
context
,
payload
,
'context, payload111'
);
// const { list, allSize, countRespList } = socket;
const
socketClient
=
io
.
connect
(
payload
.
url
,
{
// console.log('-rootState', rootState, socket);
query
:
{
// const { currentTabStatus } = rootState.main;
loginUserNum
:
`diagnose_list_socket_
${
payload
.
userId
}
`
,
// context.commit('main/updateCurrentCalList', countRespList, {
},
// root: true,
// reconnection: false,
// });
});
// context.commit('main/updateAllSize', allSize, { root: true });
context
.
commit
(
'SET_SOCKET'
,
socketClient
,
rootState
);
// if (list) {
socketClient
.
on
(
'connect'
,
(
socket
)
=>
{
// const l = list[0] || [];
console
.
log
(
'socket 链接成功'
,
socket
,
socketClient
);
// if (currentTabStatus == 99) {
});
// context.commit('main/updateCurrentDiagList', list, { root: true });
socketClient
.
on
(
'connect_error'
,
(
err
)
=>
{
// } else {
console
.
log
(
'socket connect_error'
,
err
);
// if (currentTabStatus == l.returnStatus) {
// state.socketClient.connect();
// context.commit('main/updateCurrentDiagList', list, {
});
// root: true,
socketClient
.
on
(
'disconnect'
,
(
socket
)
=>
{
// });
console
.
log
(
'socket disconnect----'
,
socket
);
// }
// state.socketClient.connect();
// if (l.length == 0) {
});
// context.commit('main/updateCurrentDiagList', list, {
socketClient
.
on
(
'diagnose_push_event'
,
(
socket
)
=>
{
// root: true,
const
{
list
,
allSize
,
countRespList
}
=
socket
;
// });
console
.
log
(
'-rootState'
,
rootState
,
socket
);
// }
const
{
currentTabStatus
}
=
rootState
.
main
;
// }
context
.
commit
(
'main/updateCurrentCalList'
,
countRespList
,
{
// } else {
root
:
true
,
// context.commit('main/updateCurrentDiagList', [], { root: true });
});
// }
context
.
commit
(
'main/updateAllSize'
,
allSize
,
{
root
:
true
});
if
(
list
)
{
const
l
=
list
[
0
]
||
[];
if
(
currentTabStatus
==
99
)
{
context
.
commit
(
'main/updateCurrentDiagList'
,
list
,
{
root
:
true
});
}
else
{
if
(
currentTabStatus
==
l
.
returnStatus
)
{
context
.
commit
(
'main/updateCurrentDiagList'
,
list
,
{
root
:
true
,
});
}
if
(
l
.
length
==
0
)
{
context
.
commit
(
'main/updateCurrentDiagList'
,
list
,
{
root
:
true
,
});
}
}
}
else
{
context
.
commit
(
'main/updateCurrentDiagList'
,
[],
{
root
:
true
});
}
});
socketClient
.
on
(
'diagnose_call_push_event'
,
(
socket
)
=>
{
console
.
log
(
socket
,
'socketsocket'
,
window
.
_VM
.
$store
.
state
.
main
.
soketQuest
);
const
l
=
window
.
_VM
.
$store
.
state
.
main
.
noticeList
;
if
(
l
.
length
>=
5
)
{
l
.
shift
();
}
l
.
push
(
socket
);
const
n
=
{
notifyIndex
:
l
.
length
,
...
socket
};
context
.
commit
(
'main/updateNoticeList'
,
l
,
{
root
:
true
});
const
{
path
}
=
window
.
_VM
.
$route
;
const
operateUserId
=
window
.
_VM
.
$store
.
state
.
main
.
soketQuest
.
operateUserId
?
window
.
_VM
.
$store
.
state
.
main
.
soketQuest
.
operateUserId
:
''
;
if
(
path
&&
String
(
path
).
indexOf
(
'workbench'
)
>
-
1
&&
n
.
operateUserId
==
operateUserId
)
{
const
ni
=
{
notifyInfo
:
n
,
rootState
:
rootState
};
context
.
commit
(
'SET_NOTIFY'
,
ni
);
}
});
socketClient
.
on
(
'ping'
,
function
()
{
console
.
log
(
'[E] 心跳请求已发出 →'
,
socketClient
);
});
// 收到
socketClient
.
on
(
'pong'
,
function
(
socket
)
{
console
.
log
(
'[E] 心跳响应已收到 ←'
,
socket
,
socketClient
);
});
socketClient
.
io
.
on
(
'reconnect_attempt'
,
(
socket
)
=>
{
console
.
log
(
'--reconnect_attempt'
,
socket
);
// ...
});
socketClient
.
on
(
'reconnect'
,
(
socket
)
=>
{
console
.
log
(
'--reconnect'
,
socket
);
// ...
});
socketClient
.
on
(
'reconnecting'
,
(
attemptNumber
)
=>
{
// ...
console
.
log
(
'--reconnecting'
,
attemptNumber
);
});
},
},
},
},
mutations
:
{
mutations
:
{
SET_SOCKET
:
(
state
,
payload
)
=>
{
window
.
socketClient
=
payload
;
state
.
socketClient
=
payload
;
},
SET_NOTIFY
:
(
state
,
payload
)
=>
{
const
doms
=
document
.
getElementsByClassName
(
'el-notification'
);
if
(
doms
.
length
>=
5
)
return
;
const
h
=
window
.
_VM
.
$createElement
;
const
{
notifyInfo
,
rootState
}
=
payload
;
const
t
=
notifyInfo
.
department
?
`问诊单
${
notifyInfo
.
diagnoseLogId
}
(
${
notifyInfo
.
department
}
)`
:
`问诊单
${
notifyInfo
.
diagnoseLogId
}
`
;
// userCallKfStatus 医助呼叫
// doctorCallKfStatus 医生呼叫
const
name
=
notifyInfo
.
userCallKfStatus
==
1
?
notifyInfo
.
userName
:
notifyInfo
.
doctorName
;
const
cn
=
window
.
_VM
.
$notify
({
title
:
t
,
message
:
h
(
'p'
,
[
h
(
'i'
,
{
style
:
'color: teal;'
},
`
${
name
}
正在呼叫你`
),
h
(
'el-button'
,
{
style
:
`float:right;margin-top:
${
30
}
px;`
,
on
:
{
click
:
function
()
{
console
.
log
(
'----state'
,
rootState
);
if
(
rootState
.
main
.
showChat
)
{
window
.
_VM
.
$message
({
message
:
'不可同时进入多个诊室,请先退出已进入的诊室,再试。'
,
type
:
'warning'
,
duration
:
1000
,
});
}
else
{
window
.
_VM
.
$store
.
dispatch
(
'main/gotoInquiry'
,
notifyInfo
);
}
cn
.
close
();
},
},
},
'进入诊室'
),
]),
onClose
:
function
()
{
console
.
log
(
'--onClose'
,
notifyInfo
);
},
duration
:
5000
,
position
:
'top-right'
,
});
},
},
},
};
};
export
default
roundCard
;
export
default
socket
;
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录