|
@@ -195,6 +195,10 @@
|
|
|
letter-spacing: 0.02rem;
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ .van-dialog__footer {
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
</style>
|
|
|
</head>
|
|
|
|
|
@@ -224,8 +228,7 @@
|
|
|
<p>激活码:</p>
|
|
|
<p>AS4*********SD3</p>
|
|
|
</div>
|
|
|
- <div class="button-download copybtn" :data-clipboard-text="key"
|
|
|
- @click='createCopy()'>点击复制并下载</div>
|
|
|
+ <div class="button-download copybtn" @click='createCopy()'>点击复制并下载</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -248,10 +251,11 @@
|
|
|
data: {
|
|
|
isshow: true,
|
|
|
id: GetRequest().id ? GetRequest().id : 404,
|
|
|
+ username: GetRequest().username ? GetRequest().username : 'admin',
|
|
|
topic: null,
|
|
|
defaultImg: 'this.src="' + "../static/offImg/tou.png" + '"',
|
|
|
marqueeList: [],
|
|
|
- key: '3333',
|
|
|
+ code: '',
|
|
|
|
|
|
},
|
|
|
created() {
|
|
@@ -288,26 +292,61 @@
|
|
|
console.log(res)
|
|
|
})
|
|
|
},
|
|
|
- createCopy(){
|
|
|
- this.$toast.loading({
|
|
|
- duration: 2000,
|
|
|
- message: '加载中...',
|
|
|
- forbidClick: true,
|
|
|
- loadingType: 'spinner',
|
|
|
- });
|
|
|
- var clipboard = new ClipboardJS('.copybtn') //此处为点击的dom的类名
|
|
|
-
|
|
|
- console.log(232);
|
|
|
- clipboard.on('success', (e)=>{
|
|
|
- this.$toast('复制成功');
|
|
|
-
|
|
|
- clipboard.destroy()
|
|
|
- })
|
|
|
- clipboard.on('error', (e)=>{
|
|
|
- this.$toast('复制失败');
|
|
|
- clipboard.destroy()
|
|
|
- })
|
|
|
- },
|
|
|
+ createCopy() {
|
|
|
+
|
|
|
+ // this.$toast.loading({
|
|
|
+ // duration: 0,
|
|
|
+ // message: '加载中...',
|
|
|
+ // forbidClick: true,
|
|
|
+ // loadingType: 'spinner',
|
|
|
+ // });
|
|
|
+ var clipboard = new ClipboardJS('.copybtn')
|
|
|
+
|
|
|
+ getActivationCode(this.username).then(res => {
|
|
|
+ this.$toast.clear();
|
|
|
+ if (res.status === 0) {
|
|
|
+ //此处为点击的dom的类名
|
|
|
+ this.code = res.data[0].code;
|
|
|
+ console.log(this.code);
|
|
|
+
|
|
|
+ try {
|
|
|
+ const input = document.createElement('textarea')
|
|
|
+ input.value = this.code;
|
|
|
+ document.body.appendChild(input)
|
|
|
+ input.select() // 选择对象
|
|
|
+ document.execCommand('Copy') // 执行浏览器复制命令
|
|
|
+ input.style.display = 'none'
|
|
|
+ input.remove()
|
|
|
+ this.$dialog.alert({
|
|
|
+ message: '复制成功'
|
|
|
+ });
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$dialog.close();
|
|
|
+ this.download();
|
|
|
+ }, 2000)
|
|
|
+ } catch (err) {
|
|
|
+ this.$dialog.alert({
|
|
|
+ message: '失败'
|
|
|
+ });
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$dialog.close();
|
|
|
+ }, 2000)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ } else {
|
|
|
+ this.$dialog.alert({
|
|
|
+ message: res.msg
|
|
|
+ });
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$dialog.close();
|
|
|
+ }, 2000)
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
download() {
|
|
|
|
|
|
var u = navigator.userAgent,
|