heyang пре 3 година
родитељ
комит
b468e62499

+ 3 - 2
microserviceUserH5/static/js/vender/vue/api.js

@@ -70,9 +70,10 @@ function getStrategy(id) {
   })
 }
 //新用户使用激活码
-function getActivationCode(data,tagId,deviceId) {
+function getActivationCode(data,tagId,deviceId,captchaVerification) {
+  captchaVerification = encodeURIComponent(captchaVerification);
   return service({
-    url: `/api/public/v4/actFissionAward/getActivationCode?username=${data}&tagId=${tagId}&deviceId=${deviceId}`,
+    url: `/api/public/v4/actFissionAward/getActivationCode?username=${data}&tagId=${tagId}&deviceId=${deviceId}&captchaVerification=${captchaVerification}`,
     method: 'get',
 
   

+ 60 - 14
microserviceUserH5/vcloud/actFissionShare.html

@@ -9,6 +9,19 @@
     <link rel="stylesheet" href="../static/css/index.css">
     <link rel="stylesheet" href="../static/css/vant.css" />
     <script src="../static/js/vender/jquery-3.4.1.min.js"></script>
+    <link rel="stylesheet" href="../static/css/verify.css">
+	<link rel="stylesheet" href="../static/js/vender/toastr/toastr.min.css">
+	<script>
+		(function () {
+			if (!window.Promise) {
+				document.writeln('<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-promise/4.1.1/es6-promise.min.js"><' + '/' + 'script>');
+			}
+		})();
+	</script>
+	<script src="../static/js/vender/toastr/toastr.min.js"></script>
+	<script src="../static/js/vender/config.js"></script>
+	<script src="../static/js/vender/crypto-js.js"></script>
+	<script src="../static/js/vender/ase.js"></script>
     <!-- <script src="../static/js/vender/vue/vue.min.js"></script>
     <script src="../static/js/vender/vue/vant.min.js"></script>
     <script src="../static/js/vender/config.js"></script>
@@ -253,7 +266,10 @@
 </head>
 
 <body>
-    <div class="ipt"></div>
+    <div id="mpanel2"></div>
+    <!-- <input id="foo" value="hello,clipboard."> -->
+    <button id="wewewe" style="display: none">复制到剪贴板</button>
+    <!-- <div class="ipt"></div> -->
     <div id="app" v-cloak class="container ">
 
         <div v-if='isshow&&topic!=null' style="margin: 0 auto;">
@@ -263,7 +279,8 @@
                         <p>激活码:</p>
                         <p>AS4*********SD3</p>
                     </div>
-                    <div class="button-download " @click='createCopy()'>点击复制并下载</div>
+                    <!-- @click='createCopy()' -->
+                    <div class="button-download " id="form-btn">点击复制并下载</div>
                 </div>
             </div>
             <div class="top-banner">
@@ -292,6 +309,8 @@
             </div>
         </div>
     </div>
+	<script src="../static/js/vender/verify.js"></script>
+	<script src="../static/js/vender/clipboard.min.js"></script>
     <script src="../static/js/vender/vue/vue.min.js"></script>
     <script src="../static/js/vender/vue/vue-clipboard.min.js"></script>
     <script src="../static/js/vender/vue/vant.min.js"></script>
@@ -305,13 +324,17 @@
         // var meta_description = document.getElementsByTagName('meta')['description']
         // document.title = '更新标题'
         // meta_description.content = '更新描述'; // Android iOS
-        var oInput = document.createElement('input'); //创建一个input
-        oInput.setAttribute("readonly", "readonly"); //设置只读,否则移动端使用复制功能时可能会造成软件盘弹出
+        // var oInput = document.createElement('input'); //创建一个input
+        // oInput.setAttribute("readonly", "readonly"); //设置只读,否则移动端使用复制功能时可能会造成软件盘弹出
         var u = navigator.userAgent,
             app = navigator.appVersion;
         var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //g
         var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
         var clipboard = new ClipboardJS('.copybtn') //此处为点击的dom的类名
+        var html = document.documentElement;
+		var imgWidth = html.getBoundingClientRect().width / 750 * 400 + 'px';
+		var imgHeight = html.getBoundingClientRect().width / 750 * 200 + 'px';
+		var barHeight = html.getBoundingClientRect().width / 750 * 70 + 'px';
         new Vue({
             el: '#app',
             data: {
@@ -332,6 +355,9 @@
             },
             created() {
                 // window.location.href = 'investigate.html'
+                setTimeout(() => {
+                    this.validate(); // 生成验证码
+                },500)
             },
             mounted() {
                 // this.$dialog.alert({
@@ -373,7 +399,7 @@
                         console.log(res)
                     })
                 },
-                createCopy() {
+                createCopy(captchaVerification) {
                     // this.$toast.loading({
                     //     duration: 0,
                     //     message: '加载中...',
@@ -385,20 +411,19 @@
                         }).then(res => {
 
                         })
-                        getActivationCode(this.username, this.tagId, this.uuid).then(res => {
+                        getActivationCode(this.username, this.tagId, this.uuid, captchaVerification).then(res => {
                             this.$toast.clear();
                             if (res.status === 0) {
                                 //此处为点击的dom的类名
                                 this.code = res.data;
-                                console.log(this.code);
-                                this.copyUrl(this.code);
+                                this.copyUrl();
                             } else {
                                 this.$dialog.alert({
                                     message: res.msg
                                 });
                                 setTimeout(() => {
                                     this.$dialog.close();
-                                    //this.download();
+                                    this.download();
                                 }, 2000)
                             }
 
@@ -414,8 +439,6 @@
                 },
                 download() {
                     if (isAndroid) {
-                        console.log(isAndroid);
-                        console.log(baseUrl)
                         if (baseUrl == 'https://per.cs.se.androidscloud.com') {
                             window.location.href = 'http://per.cs.se.androidscloud.com:8888/suanchou'
                         } else {
@@ -469,7 +492,31 @@
                         this.$toast('网络异常');
                     });
                 },
-                copyUrl(actStatus) {
+                validate() {
+                    $('#mpanel2').slideVerify({
+                        baseUrl: baseUrl + '/api/user',  //服务器请求地址, 默认地址为安吉服务器;
+                        mode: 'pop',     //展示模式
+                        containerId: 'form-btn', //pop模式 必填 被点击之后出现行为验证码的元素id
+                        imgSize: { //图片的大小对象,有默认值{ width: '310px',height: '155px'},可省略
+                            width: imgWidth,
+                            height: imgHeight
+                        },
+                        vm: this,
+                        barSize: {//下方滑块的大小对象,有默认值{ width: '310px',height: '50px'},可省略
+                            width: imgWidth,
+                            height: barHeight
+                        },
+                        beforeCheck: function () {
+                            return true
+                        },
+                        ready: function () { },  //加载完毕的回调
+                        success: (params) => { //成功的回调
+                            this.createCopy(params.captchaVerification);
+                        },
+                        error: function () {}
+                    });
+                },
+                copyUrl() {
                     var oInput = document.createElement('input'); //创建一个input
                     oInput.setAttribute("readonly", "readonly"); //设置只读,否则移动端使用复制功能时可能会造成软件盘弹出
                     setTimeout(() => {
@@ -487,11 +534,10 @@
                         oInput.remove(); // 将input销毁
                         setTimeout(() => {
                             this.$dialog.close();
-                            this.download();
+                            // this.download();
                         }, 2000)
                     }, 400)
 
-
                 },
                 selectText(textbox, startIndex, stopIndex) {
                     if (textbox.createTextRange) { //ie