2023-09-20 17:00:55 +08:00
|
|
|
|
<template>
|
|
|
|
|
<view :style="viewColor">
|
|
|
|
|
<view class='copy-list-window' :class='isCopy==true?"on":""'>
|
|
|
|
|
<button class="iconfont icon-guanbi" @click='close'></button>
|
|
|
|
|
<view class="title">
|
|
|
|
|
<text class="iconfont icon-xuanzhong11"></text>
|
|
|
|
|
{{title}}
|
|
|
|
|
</view>
|
|
|
|
|
<view class="copy-url">
|
|
|
|
|
<!-- #ifdef H5 -->
|
|
|
|
|
<text class="copy copy-data" :data-clipboard-text="copyUrl">{{copyUrl}}</text>
|
|
|
|
|
<!-- #endif -->
|
|
|
|
|
<!-- #ifndef H5 -->
|
|
|
|
|
<text>{{copyUrl}}</text>
|
|
|
|
|
<!-- #endif -->
|
|
|
|
|
</view>
|
|
|
|
|
<!-- #ifdef H5 -->
|
|
|
|
|
<button class="button copy-data" :data-clipboard-text="copyUrl">点击复制口令</button>
|
|
|
|
|
<!-- #endif -->
|
|
|
|
|
<!-- #ifndef H5 -->
|
|
|
|
|
<button class="button" @click="copyText">点击复制口令</button>
|
|
|
|
|
<!-- #endif -->
|
|
|
|
|
</view>
|
|
|
|
|
<view class='mask' catchtouchmove="true" :hidden='isCopy==false' @click='close'></view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
// | Author: CRMEB Team <admin@crmeb.com>
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
// #ifdef H5
|
|
|
|
|
import ClipboardJS from "@/plugin/clipboard/clipboard.js";
|
|
|
|
|
// #endif
|
2024-04-30 18:57:01 +08:00
|
|
|
|
import {
|
|
|
|
|
mapGetters
|
|
|
|
|
} from "vuex";
|
2023-09-20 17:00:55 +08:00
|
|
|
|
export default {
|
|
|
|
|
props: {
|
|
|
|
|
isCopy: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false,
|
|
|
|
|
},
|
|
|
|
|
copyUrl: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: '',
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: mapGetters(['viewColor']),
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
title: '复制以下口令'
|
|
|
|
|
};
|
|
|
|
|
},
|
2024-04-30 18:57:01 +08:00
|
|
|
|
mounted() {
|
2023-09-20 17:00:55 +08:00
|
|
|
|
let that = this
|
|
|
|
|
// #ifdef H5
|
|
|
|
|
that.$nextTick(function() {
|
|
|
|
|
var clipboard = new ClipboardJS('.copy-data');
|
|
|
|
|
clipboard.on('success', function(e) {
|
|
|
|
|
that.$util.Tips({
|
2024-04-30 18:57:01 +08:00
|
|
|
|
title: '复制成功'
|
2023-09-20 17:00:55 +08:00
|
|
|
|
})
|
2024-04-30 18:57:01 +08:00
|
|
|
|
setTimeout(() => {
|
2023-09-20 17:00:55 +08:00
|
|
|
|
that.$emit('close');
|
2024-04-30 18:57:01 +08:00
|
|
|
|
}, 500)
|
2023-09-20 17:00:55 +08:00
|
|
|
|
});
|
|
|
|
|
clipboard.on('error', function(e) {
|
|
|
|
|
that.$util.Tips({
|
2024-04-30 18:57:01 +08:00
|
|
|
|
title: '复制失败'
|
2023-09-20 17:00:55 +08:00
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
// #endif
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
//#ifndef H5
|
2024-04-30 18:57:01 +08:00
|
|
|
|
copyText: function() {
|
2023-09-20 17:00:55 +08:00
|
|
|
|
let that = this;
|
2024-04-30 18:57:01 +08:00
|
|
|
|
uni.setClipboardData({
|
|
|
|
|
data: this.copyUrl
|
|
|
|
|
});
|
|
|
|
|
setTimeout(() => {
|
2023-09-20 17:00:55 +08:00
|
|
|
|
that.$emit('close');
|
2024-04-30 18:57:01 +08:00
|
|
|
|
}, 500)
|
2023-09-20 17:00:55 +08:00
|
|
|
|
},
|
|
|
|
|
// #endif
|
2024-04-30 18:57:01 +08:00
|
|
|
|
close: function() {
|
|
|
|
|
this.$emit('close');
|
2023-09-20 17:00:55 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.copy-list-window {
|
|
|
|
|
position: fixed;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
border-radius: 16rpx 16rpx 0 0;
|
|
|
|
|
z-index: 555;
|
|
|
|
|
transform: translate3d(0, 100%, 0);
|
|
|
|
|
transition: all .1s cubic-bezier(.25, .5, .5, .9);
|
|
|
|
|
padding: 50rpx 30rpx 30rpx;
|
2024-04-30 18:57:01 +08:00
|
|
|
|
|
|
|
|
|
.icon-guanbi {
|
2023-09-20 17:00:55 +08:00
|
|
|
|
position: absolute;
|
|
|
|
|
top: 20rpx;
|
|
|
|
|
right: 20rpx;
|
|
|
|
|
color: #8A8A8A;
|
|
|
|
|
}
|
2024-04-30 18:57:01 +08:00
|
|
|
|
|
|
|
|
|
.button {
|
2023-09-20 17:00:55 +08:00
|
|
|
|
height: 76rpx;
|
|
|
|
|
border-radius: 38rpx;
|
|
|
|
|
margin: 30rpx 30rpx 0;
|
|
|
|
|
background-color: var(--view-theme);
|
|
|
|
|
font-size: 30rpx;
|
|
|
|
|
line-height: 76rpx;
|
|
|
|
|
color: #FFFFFF;
|
2024-04-30 18:57:01 +08:00
|
|
|
|
}
|
2023-09-20 17:00:55 +08:00
|
|
|
|
}
|
2024-04-30 18:57:01 +08:00
|
|
|
|
|
2023-09-20 17:00:55 +08:00
|
|
|
|
.copy-list-window.on {
|
|
|
|
|
transform: translate3d(0, 0, 0);
|
|
|
|
|
}
|
2024-04-30 18:57:01 +08:00
|
|
|
|
|
2023-09-20 17:00:55 +08:00
|
|
|
|
.copy-list-window .title {
|
|
|
|
|
width: 100%;
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-size: 32rpx;
|
|
|
|
|
font-weight: bold;
|
2024-04-30 18:57:01 +08:00
|
|
|
|
|
2023-09-20 17:00:55 +08:00
|
|
|
|
.iconfont {
|
|
|
|
|
font-size: 30rpx;
|
|
|
|
|
color: #FBB324;
|
|
|
|
|
margin-right: 12rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-30 18:57:01 +08:00
|
|
|
|
|
|
|
|
|
.copy-url {
|
2023-09-20 17:00:55 +08:00
|
|
|
|
margin-top: 30rpx;
|
|
|
|
|
background: #F5F5F5;
|
|
|
|
|
padding: 20rpx 25rpx;
|
|
|
|
|
color: #BBBBBB;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
}
|
2024-04-30 18:57:01 +08:00
|
|
|
|
</style>
|