Last active
October 22, 2019 08:21
-
-
Save southill/d4b67f770de319ae6af0935b11684c1f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include "app/config.php"; | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="format-detection"content="telephone=no, email=no" /> | |
<meta itemprop="name" content="<?=$wxData['title']?>"/> | |
<meta itemprop="image" content="<?=$wxData['imgUrl']?>" /> | |
<meta itemprop="description" name="description" content="<?=$wxData['singleDesc']?>" /> | |
<title><?=$websiteTitle?></title> | |
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,shrink-to-fit=no"> | |
<style> .hide { display:none; } </style> | |
<link rel="stylesheet" href="<?=$cdnUrl?>app.css<?=$version?>"> | |
<!-- <link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/2.0.0/weui.min.css"> --> | |
<!-- <script src="https://res.wx.qq.com/open/libs/weuijs/1.1.4/weui.min.js"></script> --> | |
<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script> | |
<script src="<?=$cdnUrl?>base.js<?=$version?>"></script> | |
<script src="https://cdn.jsdelivr.net/npm/vconsole@3.3.4/dist/vconsole.min.js"></script> | |
<script> | |
// 初始化 | |
var vConsole = new VConsole(); | |
console.log('Hello world'); | |
</script> | |
<script> | |
var __cdnurl = "<?=$cdnUrl?>"; | |
var __mediaurl = "<?=$mediaUrl?>"; | |
var __version = "<?=$version?>"; | |
var __defaultWxData = { | |
imgUrl : "<?=$wxData['imgUrl']?>", | |
link : "<?=$wxData['link']?>", | |
desc : "<?=$wxData['desc']?>", | |
title : "<?=$wxData['title']?>", | |
singleDesc : "<?=$wxData['singleDesc']?>" | |
}; | |
//设置默认分享及JSSDK | |
gm.wxData.setDefault(__defaultWxData); | |
gm.wxData.getConfig('wx27cab28ef198a2dd',function(_data){ | |
wx.config({ | |
debug: false, | |
appId: _data.appId, | |
timestamp: _data.timestamp, | |
nonceStr: _data.nonceStr, | |
signature: _data.signature, | |
jsApiList: [ | |
'onMenuShareTimeline', | |
'onMenuShareAppMessage', | |
'hideMenuItems', | |
'hideAllNonBaseMenuItem' | |
] | |
}); | |
}); | |
wx.ready(function(){ | |
gm.wxData.share(); | |
}); | |
</script> | |
</head> | |
<body> | |
<div id="app" class="container"></div> | |
<script src="<?=$cdnUrl?>app.js<?=$version?>"></script> | |
<script src="https://game.gtimg.cn/images/js/su/TGLogin.min.js"></script> | |
<script> | |
TGLogin.init({ | |
wxAppId: 'wx9cd281ab1f4fbae2' //游戏在微信平台的appId | |
}, function(TGLoginManager) { | |
//打印API列表 | |
console.log(TGLoginManager.apiList); | |
//获取当前平台类型(wx/qq/other) | |
var platform = TGLoginManager.mGetPlatformType(); | |
if (platform === 'wx') { | |
//微信平台 | |
//拉起手QAPP打开页面 | |
TGLoginManager.mOpenQQ(); | |
} else if (platform === 'qq') { | |
//QQ平台 - 进行手Q登录 | |
TGLoginManager.mQQLogin(function(uinfo) { | |
setInfo('qq_uin', uinfo.uin); | |
setInfo('qq_nickname', uinfo.nickname); | |
$('#qq_headimgurl').attr('src', uinfo.headimgurl); | |
setInfo('qq_logintype', uinfo.logintype); | |
setInfo('qq_logintime', uinfo.logintime); | |
showInfo('qq'); | |
}); | |
} else { | |
//非微信、QQ平台 | |
//调用手Q登录 | |
TGLoginManager.mOpenQQ(); | |
} | |
}); | |
</script> | |
<script> | |
initAPP(function(app){ | |
app.loadStart(); | |
//分享成功事件 | |
gm.ems.on('share_success',function(_app,_channel){ | |
}) | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment