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