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
a53b0cc3
Commit
a53b0cc3
authored
Nov 07, 2024
by
songrui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
im文件下载修改
parent
318f12be
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
3 deletions
+46
-3
FileView.vue
src/residentWX/nim/FileView.vue
+15
-0
Index.vue
src/residentWX/nim/Index.vue
+2
-1
Session.vue
src/residentWX/nim/Session.vue
+9
-2
common.js
src/utils/common.js
+20
-0
No files found.
src/residentWX/nim/FileView.vue
View file @
a53b0cc3
...
...
@@ -14,6 +14,8 @@
</template>
<
script
>
import
{
showDialog
}
from
'vant'
import
{
copyToClip
}
from
'@/utils/common.js'
export
default
{
props
:
{
...
...
@@ -31,7 +33,20 @@ export default {
},
methods
:
{
onDown
()
{
console
.
log
(
this
.
file
)
let
wx
=
window
.
sessionStorage
.
getItem
(
'embed'
)
if
(
wx
==
'wx'
)
{
// 复制链接到浏览器下载
if
(
copyToClip
(
this
.
file
.
url
))
{
showDialog
({
message
:
'链接复制成功,请在浏览器中打开下载'
}).
then
(()
=>
{})
}
else
{
console
.
warn
(
'链接复制失败'
)
}
}
else
{
window
.
open
(
this
.
file
.
url
,
'_blank'
)
}
},
viewImage
()
{
this
.
$emit
(
'view-image'
,
this
.
file
)
...
...
src/residentWX/nim/Index.vue
View file @
a53b0cc3
...
...
@@ -98,7 +98,8 @@ export default {
this
.
$router
.
push
({
path
,
query
:
{
name
:
item
.
serviceDoctorName
name
:
item
.
serviceDoctorName
,
gender
:
this
.
userInfo
.
gender
||
0
}
})
}
...
...
src/residentWX/nim/Session.vue
View file @
a53b0cc3
...
...
@@ -26,7 +26,10 @@
@
viewImage=
"viewImage"
/>
</div>
<div
class=
"shrink-0 avatar"
>
<img
src=
"@/assets/image/residentWX/avatar-man.png"
alt=
""
v-show=
"item.from === accountId"
>
<div
v-show=
"item.from === accountId"
>
<img
src=
"@/assets/image/residentWX/avatar-woman.png"
alt=
""
v-if=
"targetGender == 2"
>
<img
src=
"@/assets/image/residentWX/avatar-man.png"
alt=
""
v-else
>
</div>
</div>
</div>
</van-list>
...
...
@@ -118,6 +121,10 @@ export default {
targetName
()
{
return
this
.
$route
.
query
.
name
},
// 聊天对象性别
targetGender
()
{
return
this
.
$route
.
query
.
gender
},
targetId
()
{
return
`doc_
${
this
.
$route
.
params
.
id
}
`
.
toLocaleLowerCase
()
}
...
...
@@ -399,7 +406,7 @@ export default {
}
.avatar {
width: 38px;
>
img {
img {
width: 100%;
height: 100%;
object-fit: cover;
...
...
src/utils/common.js
View file @
a53b0cc3
...
...
@@ -66,6 +66,26 @@ export function debounce(fu, wait = 300) {
}
}
// 复制文本
export
function
copyToClip
(
content
)
{
if
(
!
content
)
{
console
.
warn
(
'copyToClip content 为空'
)
}
if
(
navigator
.
clipboard
)
{
return
navigator
.
clipboard
.
writeText
(
content
)
}
if
(
document
.
execCommand
)
{
let
dom
=
document
.
createElement
(
'textarea'
)
dom
.
value
=
content
document
.
body
.
appendChild
(
dom
)
dom
.
select
()
document
.
execCommand
(
'copy'
)
document
.
body
.
removeChild
(
dom
)
return
true
}
return
}
/**
* 请求参数处理
* @param {Object} source 原数据
...
...
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