peko
This commit is contained in:
124
view/peko/modules/game/js/register.js
Normal file
124
view/peko/modules/game/js/register.js
Normal file
@@ -0,0 +1,124 @@
|
||||
let urlPrefix = getUrlPrefix()
|
||||
let browser = checkVersion()
|
||||
let env = EnvCheck();
|
||||
if (env == 'test') {
|
||||
new VConsole();
|
||||
}
|
||||
|
||||
const productUrlNew = 'https://api.99park.cn'; // 正式环境
|
||||
const testUrlNew = 'http://beta.99park.cn'; // 测试环境
|
||||
//获取新域名前缀
|
||||
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)
|
||||
}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('夜莺')
|
||||
}
|
||||
}
|
||||
}
|
||||
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)
|
||||
})
|
Reference in New Issue
Block a user