Browse Source

复制文件链接

xiaowang-12345
mk 10 months ago
parent
commit
16f1dc58cb
  1. 6
      src/plugins/vant.js
  2. 80
      src/views/HotlineDetail/index.vue

6
src/plugins/vant.js

@ -31,7 +31,8 @@ import {
Rate,
Search,
DropdownMenu,
DropdownItem
DropdownItem,
ImagePreview
} from 'vant'
import 'vant/lib/index.css'
Vue.use(Button)
@ -64,4 +65,5 @@ Vue.use(Button)
.use(Rate)
.use(Search)
.use(DropdownMenu)
.use(DropdownItem)
.use(DropdownItem)
.use(ImagePreview)

80
src/views/HotlineDetail/index.vue

@ -157,10 +157,21 @@
<div class="Processhandling-left-left">不合规诉求申请说明:</div>
<div class="Dispatch-right">{{ item.nonComplianceNote }}</div>
</div>
<div v-if="item.internalFile.length>0">
<div v-for="(file,indexC) in item.internalFile" :key="indexC">
<div style="display: flex;" v-if="file.attachmentType === 'image'">
<span style="color: #999999;">图片</span>
<div style="display: flex;">
<img :src="file.attachmentUrl" class="img-responsive" alt="Image" style="width: 50px;height: 50px;" @click="previewImg(file.attachmentUrl)">
</div>
</div>
<div v-else>
<span style="color: #999999;">{{file.attachmentType === 'voice'?'音频':'附件'}} </span>
<span style="color: #1989fa;" @click="handelClickDownFile(file.attachmentUrl)">{{file.attachmentName}}</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@ -322,8 +333,7 @@ import { getUserInfo } from '@/api/user'
import throttle from 'lodash/debounce'
import { icEventList,agencyGridDepttree,process,reply,refund,multiReply } from '@/api/service'
import { uploadvariedfile } from '@/api/basic'
import { Dialog } from 'vant';
import { ImagePreview } from 'vant';
export default {
data() {
return {
@ -480,6 +490,66 @@ export default {
},
methods: {
handelClickDownFile(message) {
if (this.iosAgent()) {
console.log("input 复制方式 " + message);
let inputObj = document.createElement("input");
inputObj.value = message;
document.body.appendChild(inputObj);
inputObj.select();
inputObj.setSelectionRange(0, inputObj.value.length);
this._execCommand('Copy');
document.body.removeChild(inputObj);
} else {
console.log("document 复制方式 " + message);
let domObj = document.createElement("span");
domObj.innerHTML = message;
document.body.appendChild(domObj);
let selection = window.getSelection();
let range = document.createRange();
range.selectNodeContents(domObj);
selection.removeAllRanges();
selection.addRange(range);
this._execCommand('Copy');
document.body.removeChild(domObj);
}
},
_execCommand(action) {
let is = document.execCommand(action);
if (is) {
this.$toast("复制成功,请打开浏览器预览")
} else {
// this.$toast("")
}
},
iosAgent() {
return navigator.userAgent.match(/(iPhone|iPod|iPad);?/i);
},
previewImg(url){
ImagePreview({
images:[url]
});
},
// handelClickDownFile(url){
// this.$wx.setClipboardData({
// data: url,
// success: function (res) {
// this.$wx.getClipboardData({
// success: function (res) {
// wx.showToast({
// title: ''
// })
// }
// })
// },
// fail:function(err){
// console.log(err);
// wx.showToast({
// title: ''
// })
// }
// })
// },
async getUserInfo() {
let { data, code, msg } = await getUserInfo()
if (code == 0) {

Loading…
Cancel
Save