Limengbo %!s(int64=5) %!d(string=hai) anos
pai
achega
011cfc6b77

+ 16 - 27
css/question.css

@@ -140,7 +140,7 @@ body {
     top: 0;
     width: 100%;
     height: 100%;
-    background: rgba(0, 0, 0, .8);
+    background: url('../image/question/popupBg.png');
     z-index: 999;
     display: none;
 }
@@ -150,9 +150,9 @@ body {
 }
 .popup-content .bg {
     position: absolute;
-    left: 15%;
-    top: .6rem;
-    width: 70%;
+    left: 5%;
+    top: 1.2rem;
+    width: 90%;
 }
 
 canvas {
@@ -164,36 +164,25 @@ canvas {
 .baocun {
     position: absolute;
     left: 50%;
-    bottom: 1.6rem;
+    bottom: 2.48rem;
     transform: translateX(-50%);
+    width: 100%;
     color: #fff;
-    font-size: .28rem;
+    font-size: .34rem;
+    text-align: center;
 }
 
-.code {
+.lingqu {
     position: absolute;
-    left: 0;
-    bottom: 0;
-    width: 100%;
-    height: 1.4rem;
-    background: #fff;
-    display: flex;
-    align-items: center;
-}
-
-.code img {
-    width: 1.32rem;
-    height: 1.32rem;
-    margin: 0 .45rem;
-}
-
-.code .text {
-    display: flex;
-    flex-direction: column;
-    font-size: .28rem;
+    left: 1.45rem;
+    bottom: 1.02rem;
+    width: 4.6rem;
+    height: .98rem;
+    background: url('../image/question/lingqu.png');
+    background-size: 100% 100%;
+    display: block;
 }
 
-
 /*卷边效果 需要完善已经注释*/
 /*
 box-shadow: 0 4px 8px 0 #A691D3;

BIN=BIN
image/index/indexbg.jpg


BIN=BIN
image/question/2.jpg


BIN=BIN
image/question/a.jpg


BIN=BIN
image/question/audiobtn.png


BIN=BIN
image/question/lingqu.png


BIN=BIN
image/question/popupBg.png


BIN=BIN
image/question/questionbg.jpg


BIN=BIN
image/question/xx_02.png


+ 1 - 1
index.html

@@ -53,7 +53,7 @@
             "code": GetQueryString('code')
         } 
         $.ajax({
-                url: "https://readertest.lingjiao.cn/activity/wx/ucenter/wxlogin",
+                url: "https://activity.lingjiao.cn/activity/wx/ucenter/wxlogin",
                 type: 'GEt',
                 contentType:'application/json;charset=utf-8',
                 data: jionData,

+ 7 - 1
view/awards.html

@@ -10,7 +10,13 @@
 </head>
 <body>
     <div class="anards">
-        <img src="../image/awards/1.jpg" alt="">
+        <img src="../image/awards/1.jpg" alt="" class="prize">
     </div>
+    <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
+    <script>
+        console.log(localStorage.getItem('prize'))
+        var  prize = localStorage.getItem('prize');
+        $('.prize').attr('src','../image/awards/'+ prize +'.jpg')
+    </script>
 </body>
 </html>

+ 34 - 39
view/question.html

@@ -43,18 +43,18 @@
     </div>
     <div class="popup">
         <div class="popup-content">
-            <canvas id="myCanvas" width="750px" height="1334px">
+            <canvas id="myCanvas" width="661px" height="812px">
                 您的浏览器不支持canvas标签。
             </canvas>
-            <img class="bg" src="../image/question/2.jpg" alt=""  crossorigin="anonymous">
+            <img class="bg" src="" alt=""  crossorigin="anonymous">
+            <div class="baocun">
+                <p>长按图片保存并分享朋友圈</p>
+                <p>作为领奖凭证</p>
+            </div>
+            <a href="./awards.html" class="lingqu"></a>
             <!--
-            <div class="baocun">长按保存,并分享至朋友圈</div>
-            <div class="code">
-                <img src="../image/question/code.jpg" alt="">
-                <div class="text">
-                    <span>长按识别二维码</span>
-                    <span>即可获得小学课文朗读配音奖品</span>
-                </div>
+            <div class="lingqu">
+                <img src="../image/question/lingqu.png" alt="">
             </div>
             -->
             <!--
@@ -66,19 +66,17 @@
 </body>
 <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
 <script> 
-alert(localStorage.getItem('userData'))
 window.onload=function(){
     if(localStorage.getItem('userData') == 'undefined') {
         alert('请重新扫码登陆')
         window.location.href = '../index.html'
         return false;
     }
-    alert(localStorage.getItem('userData'))
     var user = JSON.parse(localStorage.getItem('userData'));
-    alert(user)
     var uid = user.uid;
     var avatar = user.avatar ? user.avatar : '';
     var name = user.wechatName ? user.wechatName : '小朋友';
+    // var uid = 56;
     //获取Canvas对象(画布)
     var canvas = document.getElementById("myCanvas");
     var data = {
@@ -89,7 +87,7 @@ window.onload=function(){
     }
     var ind = 0;
     function recursion() {
-        ajaxData("https://readertest.lingjiao.cn/activity/activity/xx", uid, data, function(result){
+        ajaxData("https://activity.lingjiao.cn/activity/activity/xx", uid, data, function(result){
             if(result.code != 200) {
                 alert('题目已经答完了')
                 return false;
@@ -98,32 +96,29 @@ window.onload=function(){
             var page = result.data.currentNum;
             var length = result.data.questionNum;
             if( page >= length && result.data.isEnd === 0) {
-                alert(result.data.prize)
-                // $('.popup').show();
-                // //简单地检测当前浏览器是否支持Canvas对象,以免在一些不支持html5的浏览器中提示语法错误
-                // if(canvas.getContext){  
-                //     //获取对应的CanvasRenderingContext2D对象(画笔)
-                //     var ctx = canvas.getContext("2d");
-                //     //回调地狱,可优化,暂时这样写
-                //     alert(result.data.poster)
-                //     canvasImg(ctx, result.data.poster, 0, 0, '750', '1334', function() {
-                //         ctx.moveTo(365,20);
-                //         ctx.lineTo(365,170);
-                //         ctx.fillStyle = '#fff';
-                //         ctx.font="36px Arial";
-                //         ctx.textAlign="center";
-                //         alert(name)
-                //         ctx.fillText(name + "学前测评报告",365,370);
-                //         alert(avatar)
-                //         circleImg(ctx, avatar, 328, 836, 41)
-                //     })
-                //     ctx.restore();
-                // }
-                // // 2.5s后生成图片
-                // setTimeout(function() {
-                //     var dataURL = canvas.toDataURL("image/jpeg",1.0);
-                //     $('.bg').attr('src', dataURL)
-                // }, 2500)
+                console.log('奖品', result.data.prize)
+                localStorage.setItem('prize', result.data.prize);
+                $('.popup').show();
+                //简单地检测当前浏览器是否支持Canvas对象,以免在一些不支持html5的浏览器中提示语法错误
+                if(canvas.getContext){  
+                    //获取对应的CanvasRenderingContext2D对象(画笔)
+                    var ctx = canvas.getContext("2d");
+                    //回调地狱,可优化,暂时这样写
+                    ctx.fillStyle = '#fff';
+                    ctx.fillRect(0,0,661,812);
+                    canvasImg(ctx, '../image/question/xx_02.png', 0, 0, '661', '812', function() {
+                        ctx.fillStyle = '#000';
+                        ctx.font = "bold 18px Arial";
+                        ctx.fillText(name,150,206);
+                        ctx.fillText(result.data.prizeName + "等奖",200,258);
+                    })
+                    ctx.restore();
+                }
+                // 0.5s后生成图片
+                setTimeout(function() {
+                    var dataURL = canvas.toDataURL("image/jpeg",1.0);
+                    $('.bg').attr('src', dataURL)
+                }, 500)
                 return false;
             }
             data.questionId = result.data.question.id;