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

154 lines
4.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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'; // 测试环境
//获取新域名前缀
function getUrlPrefixNew () {
if (!EnvCheck()) return undefined;
return EnvCheck() === 'live' ? productUrlNew : testUrlNew;
}
const urlPrefixNew = getUrlPrefixNew()
// 封装layer消息提醒框
let layerIndex
const showLoading = (content = '加載中...') => {
layer.open({
type: 2,
shadeClose: false,
content,
success (e) {
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) {
// $('.avatar').find('img').attr('src', res.data.avatar)
$('.avatar img').attr('src',res.data.avatar)
} else {
toastMsg(res.message)
}
},
error () {
toastMsg('網絡錯誤')
}
})
}
$(function () {
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')
// }
// }
// }
setTimeout(() => {
$('body').show()
}, 0)
$('.invite-code').html(`${queryObj.inviteCode}`)
$('.verify-btn').on('click', function () {
$('#int').val(`${queryObj.inviteCode}`)
let clipboard = new Clipboard('.verify-btn')
clipboard.on('success', function (e) {
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)
// }
// }, 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];
}
}
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 }
}
]);
})