Browse Source

联调登录

Limengbo 6 years ago
parent
commit
83f7bdea30
1 changed files with 20 additions and 3 deletions
  1. 20 3
      view/question.html

+ 20 - 3
view/question.html

@@ -18,7 +18,7 @@
         <div class="subject">
             <img class="inset" src="../image/question/inset.png" alt="inset">
             <img class="bottom" src="../image/question/bottom.png" alt="bottom">
-            <audio class="play" src="https://efunbox.lingjiao.cn/activity/resource/201901005.mp3" autoplay="autoplay">
+            <audio id="play" src="https://efunbox.lingjiao.cn/activity/resource/201901011.mp3" autoplay="true" loop="loop" class="audioMusicBtn media-audio" controls="controls" preload>
                 您的浏览器不支持 audio 标签。
             </audio>
             <div class="question-box"></div>
@@ -71,8 +71,8 @@
      var jionData = {
         "code": GetQueryString('code')
      } 
-     ajaxData("https://readertest.lingjiao.cn/activity/wx/ucenter/wxlogin", '', jionData, function(data) {
-        alert(data);
+     ajaxData("https://readertest.lingjiao.cn/activity/wx/ucenter/wxlogin", '', jionData, function(userData) {
+        alert(userData.data);
      })  
     //获取Canvas对象(画布)
     var canvas = document.getElementById("myCanvas");
@@ -200,5 +200,22 @@
             ctx.drawImage(img, x, y, d, d);             
         };
     }
+    // 解决苹果不能播放
+    function audioAutoPlay(id){
+      var audio = document.getElementById(id),
+    play = function(){
+      audio.play();
+      document.removeEventListener("touchstart",play, false);
+    };
+      audio.play();
+      document.addEventListener("WeixinJSBridgeReady", function () {//微信
+        play();
+      }, false);
+      document.addEventListener('YixinJSBridgeReady', function() {//易信
+        play();
+      }, false);
+      document.addEventListener("touchstart",play, false);
+    }
+    audioAutoPlay('play');
 </script>
 </html>