0元购项目,Web调用原生的demo

index.html 2.7KB

    <!doctype html> <html lang="zh-cn"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no" /> <meta name="format-detection" content="telephone=no" /> <link rel="stylesheet" href="./common.css"> <title>邀请好友点赞</title> </head> <body> <div class="up"> <img class="bg" src="bg.png"/> <div class="avatarP"> <img src="avatar.png"/> </div> <div class="center"> <p class="center_p">请在今日内邀请</p> <p class="center_p">10个微信好友为您点赞</p> <div class="peapleP"> <p class="peaple-other">已有</p> <p class="peaple">231</p> <p class="peaple-other">人点赞</p> </div> <div class="complete_tip"> <p >已完成任务</p> <p >请记得回到活动页提交打卡</p> </div> <button onclick="openDialog()">去邀请朋友点赞</button> </div> <div id="dialog" class="dialog"> <div class="dialog_left"> <img src="weixin_friend.png" onclick="onLeft()"/> <p>微信好友</p> </div> <div class="dialog_right"> <img src="weixin_moments.png" onclick="onRight()"/> <p>微信朋友圈</p> </div> <div onclick="closeDialog()" class="dialog_close">取消</div> </div> </div> <div class="bottom"> <button onclick="commitBtn()">提交任务</button> </div> </body> <script> let ready = (callback)=> { // 如果 jsbridge 已经注入则直接调用 if (window.AlipayJSBridge) { callback && callback(); } else { // 如果没有注入则监听注入的事件 document.addEventListener('AlipayJSBridgeReady', callback, false); } } /* * 初始化完成的回调 */ ready(()=>{ }); /* * 调用提交参数接口 */ function commitBtn(){ } /* * 打开分享微信弹窗 */ function openDialog () { visible = true; var dialogDom = document.getElementById('dialog') dialogDom.style.display = 'flex' dialogDom.style['animation'] = 'fromBottom 0.5s linear'; } /* * 关闭微信分享弹窗 */ var visible = true; function closeDialog () { visible = false; var dialogDom = document.getElementById('dialog') dialogDom.style['animation'] = 'toBottom 0.5s linear'; dialogDom.addEventListener("animationend",function(e){ if(!visible) dialogDom.style['display'] = 'none'; },false); } /* * 点击了分享微信好友 */ function onLeft () { } /* * 点击了分享微信朋友圈 */ function onRight () { } </script> </html>