This commit is contained in:
qf
2022-09-08 18:22:18 +08:00
commit 3cf89feaa0
2375 changed files with 193430 additions and 0 deletions

View File

@@ -0,0 +1,123 @@
let browser = checkVersion()
let info = {}
// let betaUrl = 'https://yeying.api.shengxuanwangluo.com/peko/modules/inviteCode/share.html?uid=' + info.uid
// let realUrl = 'https://yeying.api.shengxuanwangluo.com/peko/modules/inviteCode/share.html?uid=' + info.uid
let betaUrl, realUrl
// let link = (EnvCheck() == 'test') ? betaUrl : realUrl
// console.log(6, link);
if (EnvCheck() === 'test') {
new VConsole()
}
let share = {
title: '玩游戏交朋友,来大鹅',
// link: link,
desc: '人美声甜小姐姐在线连麦陪玩,有趣的人正在等你~',
imgUrl: 'https://yeying.api.shengxuanwangluo.com/peko/modules/wxPubPay/images/logo.png'
}
let shareObj = {
type: 2,
data: {
msg: 'llllll',
// link: betaUrl,
title: share.title,
imgUrl: share.imgUrl,
desc: share.desc,
// showUrl: betaUrl
}
}
$(function () {
function getId() {
if (browser.app) {
if (browser.ios) {
var allcookies = document.cookie;
var $uid = allcookies.match(/\d+/);
info.uid = $uid[0]
window.webkit.messageHandlers.getTicket.postMessage(null);
// window.webkit.messageHandlers.getUid.postMessage(null);
} else if (browser.android) {
console.log(34, '安卓设备');
if (androidJsObj && typeof androidJsObj === 'object') {
console.log(36, '安卓设备');
info.uid = parseInt(window.androidJsObj.getUid());
info.ticket = window.androidJsObj.getTicket();
console.log(40, info.uid, info.ticket);
}
}
} else {
}
}
function getData() {
$.ajax({
type: 'GET',
url: '/inviteCode/getList?app=peko',
headers: {
pub_ticket: info.ticket,
pub_uid: info.uid
},
success(res) {
console.log(58, res);
let { inviteCode } = res.data
$('.code').html(inviteCode)
let list = res.data.inviteList
if (list.length) {
recordRender(list)
} else {
noRecordRender()
}
// noRecordRender()
betaUrl = 'https://yeying.api.shengxuanwangluo.com/peko/modules/inviteCode/share.html?inviteCode=' + res.data.inviteCode
realUrl = 'https://yeying.api.shengxuanwangluo.com/peko/modules/inviteCode/share.html?inviteCode=' + res.data.inviteCode
shareObj.data.link = shareObj.data.showUrl = (EnvCheck() == 'test') ? betaUrl : realUrl
$('.invite-btn').on('click', function () {
var browser = checkVersion();
if (browser.app) {
if (browser.android) {
window.androidJsObj.openSharePage(JSON.stringify(shareObj));
} else if (browser.ios) {
window.webkit.messageHandlers.openSharePage.postMessage(JSON.stringify(shareObj));
}
}
});
}
})
}
// 不用分页
function recordRender(arr) {
console.log(73, arr);
let liStr = arr.map((item, index) => {
if(!item.nick){
item.nick = '未知'
}
// item.nick.length > 8 ? (item.nick.slice(0,8)+'...') : item.nick
return `<li class="invite-record-item">
<image src=${item.avatar} class="item-avatar"></image>
<div class="item-nickName">${item.nick.length > 8 ? (item.nick.slice(0, 8) + '...') : item.nick}</div>
<div class="item-time"><span class="time">${dateFormat(item.createTime, "yyyy-MM-dd hh:mm")}</span>&nbsp;&nbsp;<span>注册</span></div>
</li>`
}).join('')
$('.invite-record-list').html(liStr)
}
function noRecordRender() {
let str = `
<img src="./images/blankpage.png" alt="">
<span>暂无邀请记录</span>
`
$('.no-record').html(str)
}
getId()
setTimeout(() => {
getData();
}, 50)
})
function getMessage(key, value) {
info[key] = value;
}

View File

@@ -0,0 +1,74 @@
// 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()
})