Commit a53b0cc3 authored by songrui's avatar songrui

im文件下载修改

parent 318f12be
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
</template> </template>
<script> <script>
import { showDialog } from 'vant'
import { copyToClip } from '@/utils/common.js'
export default { export default {
props: { props: {
...@@ -31,7 +33,20 @@ export default { ...@@ -31,7 +33,20 @@ export default {
}, },
methods: { methods: {
onDown() { 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') window.open(this.file.url, '_blank')
}
}, },
viewImage() { viewImage() {
this.$emit('view-image', this.file) this.$emit('view-image', this.file)
......
...@@ -98,7 +98,8 @@ export default { ...@@ -98,7 +98,8 @@ export default {
this.$router.push({ this.$router.push({
path, path,
query: { query: {
name: item.serviceDoctorName name: item.serviceDoctorName,
gender: this.userInfo.gender || 0
} }
}) })
} }
......
...@@ -26,7 +26,10 @@ ...@@ -26,7 +26,10 @@
@viewImage="viewImage"/> @viewImage="viewImage"/>
</div> </div>
<div class="shrink-0 avatar"> <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>
</div> </div>
</van-list> </van-list>
...@@ -118,6 +121,10 @@ export default { ...@@ -118,6 +121,10 @@ export default {
targetName() { targetName() {
return this.$route.query.name return this.$route.query.name
}, },
// 聊天对象性别
targetGender() {
return this.$route.query.gender
},
targetId() { targetId() {
return `doc_${this.$route.params.id}`.toLocaleLowerCase() return `doc_${this.$route.params.id}`.toLocaleLowerCase()
} }
...@@ -399,7 +406,7 @@ export default { ...@@ -399,7 +406,7 @@ export default {
} }
.avatar { .avatar {
width: 38px; width: 38px;
>img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
......
...@@ -66,6 +66,26 @@ export function debounce(fu, wait = 300) { ...@@ -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 原数据 * @param {Object} source 原数据
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment