Procházet zdrojové kódy

添加获取激活码

ymm před 3 roky
rodič
revize
7381073482

+ 9 - 0
microserviceUserH5/static/js/vender/vue/api.js

@@ -68,4 +68,13 @@ function getStrategy() {
     method: 'get',
   
   })
+}
+//新用户使用激活码
+function getActivationCode(data) {
+  return service({
+    url: `/api/public/v4/actFissionAward/getActivationCode?username=${data}`,
+    method: 'get',
+
+  
+  })
 }

+ 11 - 10
microserviceUserH5/vcloud/actFission.html

@@ -362,7 +362,7 @@
 			},
 			mounted() {
 				this.getActDetailList();//获取活动上下架
-				this.getActDetail();
+			//	this.getActDetail();
 				this.getMarquee(); //跑马灯
 
 				//this.getList();
@@ -389,15 +389,15 @@
 				standarImg(id) {
 					return `${fileCenterApi}/file-center/fileOperate/getImage?id=${id}`;
 				},
-				getActDetail(){
-					getActDetail(this.token).then(res => {
-						if (res.status === 0) {
-							this.actStatus = res.data.actStatus;
-						} else {
-							this.$toast(res.msg);
-						}
-					})
-				},
+				// getActDetail(){
+				// 	getActDetail(this.token).then(res => {
+				// 		if (res.status === 0) {
+							
+				// 		} else {
+				// 			this.$toast(res.msg);
+				// 		}
+				// 	})
+				// },
 				getActDetailList(){ //获取活动状态
 					this.$toast.loading({
 						duration: 0,
@@ -408,6 +408,7 @@
 					getActDetailList(this.token).then(res => {
 						this.$toast.clear();
 						if (res.status === 0) {
+							this.actStatus = res.data.actStatus;
 							this.shareInfo = res.data;
 						} else {
 							this.$toast(res.msg);

+ 62 - 23
microserviceUserH5/vcloud/actFissionShare.html

@@ -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,