Files
peko-h5/view/peko/modules/game/js/register.js

154 lines
4.6 KiB
JavaScript
Raw Normal View History

2022-09-08 18:22:18 +08:00
let urlPrefix = getUrlPrefix()
let browser = checkVersion()
let env = EnvCheck();
if (env == 'test') {
new VConsole();
}
const productUrlNew = 'https://api.pekolive.com'; // 正式环境
const testUrlNew = 'https://beta.api.pekolive.com'; // 测试环境
2022-09-08 18:22:18 +08:00
//获取新域名前缀
function getUrlPrefixNew () {
if (!EnvCheck()) return undefined;
return EnvCheck() === 'live' ? productUrlNew : testUrlNew;
2022-09-08 18:22:18 +08:00
}
const urlPrefixNew = getUrlPrefixNew()
// 封装layer消息提醒框
let layerIndex
const showLoading = (content = '加載中...') => {
2022-09-08 18:22:18 +08:00
layer.open({
type: 2,
shadeClose: false,
content,
success (e) {
2022-09-08 18:22:18 +08:00
layerIndex = $(e).attr('index')
}
})
}
const hideLoading = (index) => {
layer.close(index)
}
const toastMsg = (content = '操作完成', time = 2) => {
layer.open({
content,
time,
skin: 'msg'
})
}
let queryObj = getQueryString()
// 获取用户信息
const getUserInfo = () => {
networkRequest({
type: 'GET',
url: urlPrefix + `/user/get?uid=${queryObj.shareUid}`,
success (res) {
if (res.code === 200) {
2022-09-08 18:22:18 +08:00
// $('.avatar').find('img').attr('src', res.data.avatar)
$('.avatar img').attr('src',res.data.avatar)
} else {
2022-09-08 18:22:18 +08:00
toastMsg(res.message)
}
},
error () {
toastMsg('網絡錯誤')
2022-09-08 18:22:18 +08:00
}
})
}
$(function () {
2022-09-08 18:22:18 +08:00
getInfoFromClient()
setTimeout(() => {
getUserInfo()
}, 50)
// if (browser.app) {
// if (browser.android) {
// let channel = JSON.parse(pubInfo.deviceInfo).channel
// if (channel.indexOf('toutiao') != -1 || channel.indexOf('kuaishou') != -1) {
// $('.avatar img').attr('src', './images/logo-yy.png')
// $('.bottom img').attr('src', './images/logo-yy.png')
// $('.appName').html('peko')
// }
// }
// }
2022-09-08 18:22:18 +08:00
setTimeout(() => {
$('body').show()
}, 0)
2022-09-08 18:22:18 +08:00
$('.invite-code').html(`${queryObj.inviteCode}`)
$('.verify-btn').on('click', function () {
2022-09-08 18:22:18 +08:00
$('#int').val(`${queryObj.inviteCode}`)
let clipboard = new Clipboard('.verify-btn')
clipboard.on('success', function (e) {
2022-09-08 18:22:18 +08:00
toastMsg('已复制邀请码')
e.clearSelection();
})
})
// // 创建深度链接
// let linkedKey = '6ba9e9d9760b8acc50b2b499cfd557da'
// let paramsObj = {
// inviteCode: queryObj.inviteCode
// }
// let jsonStr = JSON.stringify(paramsObj)
// let linkedObj = {
// type: EnvCheck(),
// params: jsonStr
// }
// if(queryObj.enterprise){
// linkedKey = 'af4f58541a86d5f6c4193349f675419a'
// }
// linkedme.init(linkedKey, { type: EnvCheck() }, null)
// linkedme.link(linkedObj, function(err, response){
// if(err){
// // 生成深度链接失败返回错误对象err
// console.log('err:', err);
// }else{
// $('.register-btn').on('click', function(){
// linkedme.trigger_deeplink(response.url);
// })
// $('.register-btn').attr('href', response.url)
// $('.download').on('click', function(){
// linkedme.trigger_deeplink(response.url);
// })
// $('.download').attr('href', response.url)
2022-09-08 18:22:18 +08:00
// }
// }, false)
function get_param (param) {
var query = location.search.substring(1).split('&');
for (var i = 0; i < query.length; i++) {
var kv = query[i].split('=');
if (kv[0] == param) {
return kv[1];
}
2022-09-08 18:22:18 +08:00
}
return null;
}
uid = get_param('uid');
mobid = get_param('mobid');
ROOM_UID = get_param('ROOM_UID')
fromType = get_param('fromType')
enterType = get_param('enterType')
workAuthor = get_param('workAuthor')
workAuthorId = get_param('workAuthorId')
roomuid = get_param('uid')
MobLink([{
el: '#bomlinkdomload',
path: '',
params: { mobLinkType: 1, inviteCode: queryObj.inviteCode, roomuid, uid, mobid, ROOM_UID, fromType, enterType, workAuthor, workAuthorId }
},
{
el: '#bomlinkdomload1',
path: '',
params: { mobLinkType: 2, inviteCode: queryObj.inviteCode, roomuid, uid, mobid, ROOM_UID, fromType, enterType, workAuthor, workAuthorId }
}
]);
2022-09-08 18:22:18 +08:00
})