一分钟后复制
This commit is contained in:
@@ -180,7 +180,7 @@
|
||||
:visible.sync="userinfo_fall"
|
||||
width="30%">
|
||||
<el-card class="box-card">
|
||||
<p oncopy="return false;">电话:{{user_info.UserName}}</p>
|
||||
<p oncopy="return false;">电话:{{user_info.UserName}} <span style="color:#409EFF;cursor:pointer;" @click="copy_op(user_info.UserName)">复制</span></p>
|
||||
<p>微信:{{user_info.Wx}}</p>
|
||||
<p>QQ:{{user_info.QQ}}</p>
|
||||
</el-card>
|
||||
@@ -424,6 +424,31 @@ export default {
|
||||
},
|
||||
dataExport () {
|
||||
this.$api.getDownloadFile('/course/v1/order/ExportUserConsumeStatistics', this.searchModel)
|
||||
},
|
||||
copy_op(str) {
|
||||
let copy = localStorage.getItem('copy');
|
||||
let now = parseInt(new Date().getTime()/1000);
|
||||
let time = (now - copy);
|
||||
if (time<60) {
|
||||
this.$message({
|
||||
message: time+'秒后再复制',
|
||||
type: 'warning'
|
||||
})
|
||||
return false
|
||||
} else {
|
||||
const save = (e) => {
|
||||
e.clipboardData.setData('text/plain', str)
|
||||
e.preventDefault()
|
||||
}
|
||||
document.addEventListener('copy', save)
|
||||
document.execCommand('copy')
|
||||
document.removeEventListener('copy', save)
|
||||
localStorage.setItem('copy', now);
|
||||
this.$message({
|
||||
message: '复制成功',
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user