Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-admin-IM
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.education.frontend
pica-admin-IM
提交
7bf4fce6
提交
7bf4fce6
编写于
1月 19, 2021
作者:
guangjun.yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
发图片与文件
上级
8df2616a
变更
3
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
167 行增加
和
134 行删除
+167
-134
env-config.js
src/utils/env-config.js
+5
-0
index.js
src/utils/index.js
+6
-0
index.vue
src/views/IM/current-session/index.vue
+156
-134
未找到文件。
src/utils/env-config.js
浏览文件 @
7bf4fce6
...
...
@@ -17,6 +17,7 @@ export const envConfig = {
//innerLoginUrl: 'http://localhost:8090/PICA_SSO_FE/html/pica_index.html',
innerLoginUrl
:
'https://dev-sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html'
,
yuequeyiIndexUrl
:
'https://dev-saas.yunqueyi.com/pica_index.html'
,
phomeDemain
:
'https://dev-phome.yunqueyi.com'
,
picakfAccId
:
'picakf_dev'
,
},
dev
:
{
...
...
@@ -27,6 +28,7 @@ export const envConfig = {
loginUrl
:
'https://dev-saas.yunqueyi.com/pica-login/work_station.html'
,
innerLoginUrl
:
'https://dev-sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html'
,
yuequeyiIndexUrl
:
'https://dev-saas.yunqueyi.com/pica_index.html'
,
phomeDemain
:
'https://dev-phome.yunqueyi.com'
,
picakfAccId
:
'picakf_dev'
,
},
test
:
{
...
...
@@ -37,6 +39,7 @@ export const envConfig = {
loginUrl
:
'https://test1.yunqueyi.com/pica-login/work_station.html'
,
innerLoginUrl
:
'https://test1-sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html'
,
yuequeyiIndexUrl
:
'https://test1.yunqueyi.com/pica_index.html'
,
phomeDemain
:
'https://test1-phome.yunqueyi.com'
,
picakfAccId
:
'picakf_test'
,
},
uat
:
{
...
...
@@ -49,6 +52,7 @@ export const envConfig = {
loginUrl
:
'https://uat.yunqueyi.com/pica-login/work_station.html'
,
innerLoginUrl
:
'https://uat-sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html'
,
yuequeyiIndexUrl
:
'https://uat.yunqueyi.com/pica_index.html'
,
phomeDemain
:
'https://uat-phome.yunqueyi.com'
,
picakfAccId
:
'picakf_uat'
,
},
pro
:
{
...
...
@@ -59,6 +63,7 @@ export const envConfig = {
loginUrl
:
'https://yunqueyi.com/pica-login/work_station.html'
,
innerLoginUrl
:
'https://sso.yunqueyi.com/PICA_SSO_FE/html/pica_index.html'
,
yuequeyiIndexUrl
:
'https://www.yunqueyi.com/pica_index.html'
,
phomeDemain
:
'https://phome.yunqueyi.com'
,
picakfAccId
:
'picakf'
,
}
}
src/utils/index.js
浏览文件 @
7bf4fce6
...
...
@@ -182,3 +182,9 @@ function getConfigByEnvType(urlType) {
export
function
getPicaKFAccid
()
{
return
getConfigByEnvType
(
'picakfAccId'
)
}
// 获取客服的云信ID
export
function
getPhomeDemain
()
{
return
getConfigByEnvType
(
'phomeDemain'
)
}
src/views/IM/current-session/index.vue
浏览文件 @
7bf4fce6
...
...
@@ -92,24 +92,21 @@
</article>
</section>
<section
class=
"c-bottom"
>
<el-input
placeholder=
"请输入内容"
v-model=
"
t
ext"
>
<el-input
placeholder=
"请输入内容"
v-model=
"
sendT
ext"
>
<div
slot=
"suffix"
class=
"cb-icon-wrapper"
>
<el-upload
class=
"bg-uploader"
action=
"#"
accept=
".jpg,.png,.pdf"
:show-file-list=
"false"
:before-upload=
"beforeUploadFile"
>
<img
src=
"../../../assets/image/IM/icon-folder-open.png"
alt
/>
</el-upload>
<img
src=
"../../../assets/image/IM/icon-link.png"
@
click=
"showSelectDialog = true"
alt
/>
<img
src=
"../../../assets/image/IM/icon-link.png"
@
click=
"preSendLinkMsg"
alt
/>
</div>
</el-input>
<div
class=
"send-btn"
:class=
"
{'active': canSend}" @click="send
Common
Msg">
<div
class=
"send-btn"
:class=
"
{'active': canSend}" @click="send
Text
Msg">
<img
v-show=
"canSend"
src=
"../../../assets/image/IM/send-yes.png"
alt
/>
<img
v-show=
"!canSend"
src=
"../../../assets/image/IM/send-no.png"
alt
/>
</div>
...
...
@@ -132,12 +129,12 @@
<el-form
ref=
"linkFormRef"
:model=
"linkForm"
label-width=
"100px"
>
<el-form-item
label=
"普通文本"
>
<el-col
:span=
"20"
>
<el-input
v-model=
"linkForm.
subject
"
size=
"small"
maxlength=
"20"
></el-input>
<el-input
v-model=
"linkForm.
remark
"
size=
"small"
maxlength=
"20"
></el-input>
</el-col>
</el-form-item>
<el-form-item
label=
"链接文案"
required
>
<el-col
:span=
"20"
>
<el-input
v-model=
"linkForm.
subject
"
size=
"small"
maxlength=
"20"
></el-input>
<el-input
v-model=
"linkForm.
info
"
size=
"small"
maxlength=
"20"
></el-input>
</el-col>
</el-form-item>
<el-form-item
label=
"链接地址"
required
>
...
...
@@ -147,14 +144,14 @@
style=
"width: 300px"
clearable
filterable
v-model=
"linkForm.
linkName
"
v-model=
"linkForm.
url
"
placeholder=
"请选择"
>
<el-option
v-for=
"item in linkList"
:key=
"item.
value
"
:label=
"item.
label
"
:value=
"item"
:key=
"item.
id
"
:label=
"item.
title
"
:value=
"item
.id
"
></el-option>
</el-select>
</el-col>
...
...
@@ -173,7 +170,7 @@ import { doUpload, getFilePath } from "@/utils/qiniu-util";
import
{
validateWord
}
from
"@/utils/validate.js"
;
import
{
openLoading
,
closeLoading
}
from
"@/utils/utils"
;
import
*
as
commonUtil
from
"@/utils/utils"
;
import
{
getPicaKFAccid
}
from
"@/utils"
;
import
{
getPicaKFAccid
,
getPhomeDemain
}
from
"@/utils"
;
import
UserInfo
from
"@/components/IM/user-info.vue"
;
const
CONTAINER_HEIGHT
=
700
;
let
forwardMsgIntervalId
=
null
;
...
...
@@ -188,6 +185,7 @@ export default {
return
{
curmbFirst
:
"云鹊客服"
,
curmbSecond
:
"当前会话"
,
sendText
:
""
,
sessionListData
:
{
myTaskCount
:
0
,
sessionList
:
[],
...
...
@@ -195,7 +193,7 @@ export default {
},
currentSessionIndex
:
0
,
// 当前会话序号
currentSession
:
{},
currentTaskLogId
:
0
,
// 当前会话ID
currentTaskLogId
:
""
,
// 当前会话ID
currentToAccId
:
""
,
picakfAccId
:
""
,
doctorInfo
:
{
...
...
@@ -203,40 +201,22 @@ export default {
mobilePhone
:
"138****7261"
,
isShowCopyBtn
:
true
},
text
:
""
,
containerHeight
:
CONTAINER_HEIGHT
,
showSelectDialog
:
false
,
linkForm
:
{
subject
:
""
,
deriverName
:
""
remark
:
""
,
info
:
""
,
url
:
""
},
qiniuUploadStatus
:
false
,
linkList
:
[
{
label
:
"五分钟医学院"
,
value
:
"https://www.baidu.com1"
},
{
label
:
"课程直播"
,
value
:
"https://www.baidu.com2"
},
{
label
:
"云鹊小圈"
,
value
:
"https://www.baidu.com3"
},
{
label
:
"精品课程"
,
value
:
"https://www.baidu.com4"
}
],
linkList
:
[],
// 消息列表 showType 1: 文本; 2: 图片; 3: PDF; 4: 链接; 5: 不支持类型;
messageList
:
[]
messageList
:
[]
,
};
},
computed
:
{
canSend
()
{
return
!!
this
.
t
ext
;
return
!!
this
.
sendT
ext
;
}
},
...
...
@@ -244,12 +224,109 @@ export default {
this
.
picakfAccId
=
getPicaKFAccid
();
this
.
kfAvatar
=
require
(
"../../../assets/image/IM/kf-avatar.png"
);
this
.
getSessionList
();
this
.
getFiveContentList
();
},
mounted
:
function
()
{},
methods
:
{
// 上传文件
beforeUploadFile
(
file
)
{
let
vm
=
this
;
console
.
log
(
'file'
,
file
);
const
isJPG
=
file
.
type
===
"image/jpeg"
;
const
isPNG
=
file
.
type
===
"image/png"
;
const
isPDF
=
file
.
type
===
"application/pdf"
;
doUpload
(
vm
,
file
,
getFilePath
(
file
,
null
),
"preview4"
,
"progress"
,
""
).
then
(
function
(
resData
)
{
let
params
=
{};
params
.
fileSize
=
resData
.
size
;
params
.
fileExt
=
resData
.
ext
;
params
.
url
=
resData
.
fullPath
;
params
.
info
=
resData
.
name
;
params
.
type
=
2
;
// 如果是图片,则要获取其宽与高
if
(
params
.
fileExt
.
toLowerCase
()
===
'.jpg'
||
params
.
fileExt
.
toLowerCase
()
===
'.png'
)
{
params
.
type
=
1
;
let
image
=
new
Image
();
image
.
src
=
params
.
url
;
image
.
onload
=
function
()
{
let
_this
=
this
;
params
.
width
=
_this
.
width
;
params
.
height
=
_this
.
height
;
vm
.
sendCommonMsg
(
params
);
};
}
else
{
vm
.
sendCommonMsg
(
params
);
}
});
},
// 打开发送链接弹框
preSendLinkMsg
()
{
this
.
linkForm
=
{
remark
:
""
,
info
:
""
,
url
:
""
};
this
.
showSelectDialog
=
true
;
},
// 发送带链接消息
sendLinkMsg
()
{
let
params
=
this
.
linkForm
;
params
.
url
=
getPhomeDemain
()
+
`/template_v2/?id=
${
params
.
url
}
`
;
params
.
type
=
3
;
this
.
sendCommonMsg
(
params
);
this
.
showSelectDialog
=
false
;
},
// 发送文本消息
sendTextMsg
()
{
if
(
!
this
.
canSend
)
return
;
this
.
sendCommonMsg
({
info
:
this
.
sendText
});
this
.
sendText
=
''
;
},
// 发送通用消息
sendCommonMsg
(
params
)
{
let
sendMsgParams
=
{
fromAccount
:
this
.
picakfAccId
,
toAccount
:
this
.
currentToAccId
,
fileExt
:
""
,
// 文件扩展名称图片或PDF文件)
fileSize
:
0
,
// 文件大小(图片或PDF文件)
height
:
0
,
// 图片高度(仅图片)
width
:
0
,
// 图片宽度(仅图片)
info
:
""
,
// 文本内容,图片的名称,pdf的名称,链接显示内容
md5
:
""
,
// 图片或文件MD5 暂时由后台生成
remark
:
""
,
// 其他信息(链接中的前缀文案)
type
:
0
,
// 类型 0文本 1图片 2pdf 3链接
url
:
""
// url地址(图片、pdf,链接)
}
params
=
Object
.
assign
(
sendMsgParams
,
params
);
console
.
log
(
"sendMsgParams"
,
params
);
this
.
POST
(
"/im/msg/sendMessage"
,
params
).
then
(
res
=>
{
if
(
res
.
code
===
"000000"
)
{
// 校验结果:1校验通过 2校验不通过
console
.
log
(
res
.
data
.
checkFlag
);
// this.getSessionList();
}
else
{
this
.
$message
({
message
:
res
.
message
,
type
:
"warning"
});
}
});
},
// 查询医生和居民的消息历史(下拉刷新时调用)
getOldMSGHistory
()
{
let
session
=
this
.
currentSession
;
...
...
@@ -328,9 +405,9 @@ export default {
// 转换消息格式
// 处理的消息类型只有5种:
// type == custom时,1 ~ 17: 不支持(showType:5); 18: PDF文件(showType:3); 19: 链接信息(showType:4);
// type == TEXT(showType:1)
// type == image 或 picture(showType:2)
// type == custom时,1 ~ 17: 不支持(showType:5); 18: PDF文件(showType:3); 19: 链接信息(showType:4);
// directFlag 1: 拼接历史消息(push); 2: 拼接实时消息(unshift)
convertMessageList
(
messageList
,
directFlag
=
1
)
{
messageList
.
sort
((
a
,
b
)
=>
{
...
...
@@ -338,18 +415,18 @@ export default {
});
let
msg
=
null
,
content
=
null
,
text
=
''
,
suffix
=
''
,
text
=
""
,
suffix
=
""
,
showType
=
1
,
size
=
0
,
url
=
''
,
url
=
""
,
cMessageList
=
[];
messageList
.
forEach
((
rawMsg
,
index
)
=>
{
text
=
''
;
suffix
=
''
;
text
=
""
;
suffix
=
""
;
showType
=
1
;
size
=
0
;
url
=
''
;
url
=
""
;
msg
=
Object
.
assign
({},
rawMsg
);
msg
.
sendOrReceive
=
rawMsg
.
fromAccId
!==
this
.
currentToAccId
;
msg
.
avatarImg
=
msg
.
sendOrReceive
...
...
@@ -363,13 +440,16 @@ export default {
text
=
content
.
name
;
size
=
content
.
size
;
url
=
content
.
url
;
}
else
if
(
content
.
bizType
==
19
)
{
}
else
if
(
content
.
bizType
==
19
)
{
showType
=
4
;
suffix
=
content
.
suffix
;
}
else
{
showType
=
5
;
}
}
else
if
(
msg
.
type
.
toLowerCase
()
==
"image"
||
msg
.
type
.
toLowerCase
()
==
"picture"
)
{
}
else
if
(
msg
.
type
.
toLowerCase
()
==
"image"
||
msg
.
type
.
toLowerCase
()
==
"picture"
)
{
content
=
JSON
.
parse
(
msg
.
content
);
url
=
content
.
url
;
showType
=
2
;
...
...
@@ -385,52 +465,13 @@ export default {
cMessageList
.
push
(
msg
);
});
if
(
directFlag
===
1
)
{
this
.
messageList
.
unshift
(...
cMessageList
);
if
(
directFlag
===
1
)
{
this
.
messageList
=
cMessageList
;
// this.messageList.unshift(...cMessageList);
}
else
{
this
.
messageList
.
push
(...
cMessageList
);
//
this.messageList.push(...cMessageList);
}
console
.
log
(
'this.messageList'
,
this
.
messageList
);
},
// 发送带链接消息
sendLinkMsg
()
{
this
.
sendCommonMsg
();
},
// 发送带文件消息(PDF文档)
sendFileMsg
()
{
this
.
sendCommonMsg
();
},
// 发送通用消息
sendCommonMsg
()
{
if
(
!
this
.
canSend
)
return
;
let
params
=
{
fileExt
:
""
,
fileSize
:
0
,
fromAccount
:
this
.
picakfAccId
,
height
:
0
,
info
:
"wefwef"
,
md5
:
""
,
remark
:
""
,
toAccount
:
this
.
currentToAccId
,
type
:
0
,
url
:
""
,
width
:
0
};
this
.
POST
(
"/im/msg/sendMessage"
,
params
).
then
(
res
=>
{
if
(
res
.
code
===
"000000"
)
{
// 校验结果:1校验通过 2校验不通过
console
.
log
(
res
.
data
.
checkFlag
);
this
.
getSessionList
();
}
else
{
this
.
$message
({
message
:
res
.
message
,
type
:
"warning"
});
}
});
console
.
log
(
"this.messageList"
,
this
.
messageList
);
},
// 选择一个会话
...
...
@@ -449,7 +490,6 @@ export default {
if
(
session
.
unreadCount
)
{
this
.
readAllMsg
(
this
.
currentToAccId
,
this
.
picakfAccId
);
}
},
// 打开PDF
...
...
@@ -457,42 +497,6 @@ export default {
window
.
open
(
item
.
url
,
"__blank"
);
},
// 上传文件
beforeUploadFile
(
file
)
{
let
vm
=
this
;
const
isJPG
=
file
.
type
===
"image/jpeg"
;
const
isPNG
=
file
.
type
===
"image/png"
;
// const isLt2M = file.size / 1024 / 1024
<
fileLimit
.
size
;
if
(
!
isJPG
&&
!
isPNG
)
{
vm
.
$message
.
error
(
"图片必须是jpeg或png格式,同时长宽尺寸和图片大小需符合要求"
);
return
;
}
// if (!isLt2M) {
// vm.$message.error("图片大小不符合规范,请根据规范上传图片 ");
// return;
// }
// 直接上传
// this.needShowUploadProcess = true;
// vm.uploadProgress = 0;
doUpload
(
vm
,
file
,
getFilePath
(
file
,
null
),
"preview4"
,
"progress"
,
""
).
then
(
function
(
path
)
{
console
.
log
(
path
);
let
cName
=
path
.
name
;
cName
=
cName
.
substr
(
0
,
cName
.
lastIndexOf
(
"."
));
cName
=
cName
.
substring
(
0
,
21
);
console
.
log
(
"@@@@upload successful@@@@"
);
});
},
// 给我一个任务吧,如果当前没有任务,则要提示
fetchOneTask
()
{
this
.
GET
(
"/im/session/kf/fetchOneTask"
).
then
(
res
=>
{
...
...
@@ -530,9 +534,9 @@ export default {
console
.
log
(
"this.currentSession"
,
this
.
currentSession
);
this
.
getMSGHistory
(
this
.
currentSession
);
this
.
getDoctorInfo
(
this
.
currentToAccId
);
forwardMsgIntervalId
=
setInterval
(
()
=>
{
forwardMsgIntervalId
=
setInterval
(()
=>
{
this
.
getMSGForward
();
},
10000
)
},
10000
)
;
}
}
else
{
this
.
$message
({
...
...
@@ -644,13 +648,31 @@ export default {
return
item
[
key
]
==
value
;
});
}
},
// 获取五分钟列表
getFiveContentList
()
{
this
.
GET
(
"/contents/admin/template/queryTemplate?publishFlag=5&pageNo=1&pageSize=99999"
).
then
(
res
=>
{
if
(
res
.
code
===
"000000"
)
{
console
.
log
(
"in getFiveContentList"
,
res
);
this
.
linkList
=
res
.
data
.
templateList
||
[];
}
else
{
this
.
$message
({
message
:
res
.
message
,
type
:
"warning"
});
}
});
}
},
beforeDestroy
()
{
console
.
log
(
'in beforeDestroy'
,
forwardMsgIntervalId
);
console
.
log
(
"in beforeDestroy"
,
forwardMsgIntervalId
);
forwardMsgIntervalId
&&
clearInterval
(
forwardMsgIntervalId
);
console
.
log
(
'in beforeDestroy'
,
forwardMsgIntervalId
);
}
,
console
.
log
(
"in beforeDestroy"
,
forwardMsgIntervalId
);
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录