74 lines
2.0 KiB
JavaScript
74 lines
2.0 KiB
JavaScript
// let browser = checkVersion()
|
||
let info = {}
|
||
|
||
if(EnvCheck() === 'test'){
|
||
var vConsole = new VConsole();
|
||
}
|
||
|
||
$(function() {
|
||
$('.code').on('click', function(){
|
||
$('input').val($(this).text())
|
||
let clipboard = new Clipboard('.code')
|
||
clipboard.on('success', function(e){
|
||
console.log(e);
|
||
alert('已复制邀请码')
|
||
e.clearSelection();
|
||
})
|
||
|
||
})
|
||
|
||
//获取用户uid和邀请码
|
||
let queryObj = getQueryString()
|
||
info.uid = queryObj.shareUid
|
||
info.inviteCode = queryObj.inviteCode
|
||
console.log(queryObj);
|
||
$('.wrap').find('.code').html(info.inviteCode)
|
||
// $('.wrap').find('.download').attr('href', 'https://a.app.qq.com/o/simple.jsp?pkgname=com.xuanyi.accompany')
|
||
|
||
// 创建深度链接
|
||
let linkedKey = '4f5ec8302c8a0a385c2e5dd196af9aff'
|
||
let paramsObj = {
|
||
inviteCode: info.inviteCode
|
||
}
|
||
let jsonStr = JSON.stringify(paramsObj)
|
||
let linkedObj = {
|
||
type: EnvCheck(),
|
||
params: jsonStr
|
||
}
|
||
if(queryObj.enterprise){
|
||
linkedKey = '42bb5d614d738885e67f4ba9dacb036a'
|
||
}
|
||
|
||
linkedme.init(linkedKey, { type: EnvCheck() }, null)
|
||
linkedme.link(linkedObj, function(err, response){
|
||
if(err){
|
||
// 生成深度链接失败,返回错误对象err
|
||
console.log('err:', err);
|
||
}else{
|
||
console.log('response:', response);
|
||
$('.wrap').find('.download').on('click', function(){
|
||
linkedme.trigger_deeplink(response.url);
|
||
})
|
||
$('.wrap').find('.download').attr('href', response.url)
|
||
}
|
||
}, false)
|
||
|
||
function getUserInfo() {
|
||
$.ajax({
|
||
type: 'GET',
|
||
url: '/user/get?uid=' + info.uid,
|
||
headers: {
|
||
pub_ticket: info.ticket,
|
||
pub_uid: info.uid
|
||
},
|
||
success(res) {
|
||
console.log(23, res);
|
||
$('.wrap').find('img').attr('src', res.data.avatar)
|
||
}
|
||
})
|
||
}
|
||
|
||
getUserInfo()
|
||
|
||
|
||
}) |