168 lines
5.8 KiB
JavaScript
168 lines
5.8 KiB
JavaScript
/* eslint-disable no-unused-vars */
|
||
/* eslint-disable dot-notation */
|
||
/* eslint-disable eqeqeq */
|
||
/* eslint-disable no-undef */
|
||
var share = {
|
||
title: 'peko,带你进入声优的世界',
|
||
link: window.location.href,
|
||
imgUrl: '',
|
||
desc: ''
|
||
};
|
||
let roomuid;
|
||
let uid; //90413321
|
||
let mobid;
|
||
let ROOM_UID;
|
||
let fromType;
|
||
let enterType;
|
||
let workAuthor;
|
||
let workAuthorId;
|
||
//获取房主uid的信息
|
||
$(function () {
|
||
var EnvType = EnvCheck();
|
||
if (EnvType == 'test') {
|
||
// var vConsole = new VConsole();
|
||
}
|
||
var EnvType = EnvCheck();
|
||
//根据浏览器窗口高度背景图片高度
|
||
let user = $('.user-detail');
|
||
var locateObj = getQueryString();
|
||
$('.avatar img').attr('src', decodeURIComponent(locateObj.room_avatar));
|
||
user.find('.user-name').html(decodeURIComponent(locateObj.share_name));
|
||
user.find('.user-room span').html(decodeURIComponent(locateObj.room_name));
|
||
user.find('.user-id span').html(locateObj.room_id);
|
||
var share_room = {};
|
||
|
||
share_room["roomuid"] = locateObj.uid;
|
||
share_room["uid"] = locateObj.shareUid;
|
||
share_room["type"] = "2";
|
||
var jsonStr = JSON.stringify(share_room);
|
||
// var linkData = {
|
||
// type: EnvType, //"live"表示使用线上模式,"test"表示测试模式.【可选】
|
||
// channel: "share_room2",
|
||
// tags: "share_room2",
|
||
// ios_custom_url: "",// 自定义iOS平台下App的下载地址,如果是AppStore的下载地址可以不用填写,【可选】
|
||
// // data.android_custom_url = "";// 自定义安卓平台下App的下载地址,【可选】
|
||
// // 下面是自定义深度链接参数,用户点击深度链接打开app之后,params的参数会通过LinkedME服务器透传给app,由app根据参数进行相关跳转
|
||
// // 例如:详情页面的参数,写入到params中,这样在唤起app并获取参数后app根据参数跳转到详情页面
|
||
// params: jsonStr
|
||
// };
|
||
// linkedme.init("6ba9e9d9760b8acc50b2b499cfd557da", { type: EnvType }, null);
|
||
// // 978cd79c98264f836450afda1228762e
|
||
// // 4f5ec8302c8a0a385c2e5dd196af9aff
|
||
// //414571f0698afaa1c194f345f0dcc328
|
||
|
||
// linkedme.link(linkData, function (err, response) {
|
||
// if (err) {
|
||
// // 生成深度链接失败,返回错误对象err
|
||
// console.log('err:', err);
|
||
// } else {
|
||
// console.log(response, 9999999)
|
||
// $('.linkedme').on('click', function(){
|
||
// linkedme.trigger_deeplink(response.url);
|
||
// })
|
||
// $('.linkedme').attr("href", response.url);
|
||
// }
|
||
// }, false);
|
||
|
||
/*
|
||
* MobLink 支持数组=>MobLink([...]) 和对象=>MobLink({...}) 两种初始化形式
|
||
* 页面上有多个元素需要跳转时使用数组方式,仅单个元素需要跳转时可以使用对象的方式进行初始化
|
||
* el: 表示网页上Element的id值,该字段为空或者不写,则表示MobLink **默认浮层** 上的打开按钮(注意:该字段支持selector方式: 1.'.class' 2.'#id1' 3.['#id1','#id2'])
|
||
* path: 对应App里需要恢复页面的路径
|
||
* default: 指定分享页默认场景参数(最多只能指定一项作为默认场景参数)
|
||
* params: 网页需要带给客户端的参数
|
||
*/
|
||
// 页面上有多个元素需要跳转时要使用数组方式进行初始化
|
||
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('roomuid')
|
||
MobLink([{
|
||
el: '#bomlinkdomload',
|
||
path: '',
|
||
params: { mobLinkType: 1, roomuid, uid, mobid, ROOM_UID, fromType, enterType, workAuthor, workAuthorId, type: 2 }
|
||
}
|
||
]);
|
||
// var url = encodeURIComponent(location.href.split('#')[0]);
|
||
// var data = "url=" + url;
|
||
// console.log(data);
|
||
// $.ajax({
|
||
// type: 'GET',
|
||
// url: '/wx/config',
|
||
// data: data,
|
||
// asyc: true,
|
||
// success: function (data) {
|
||
// if (data.code = 200) {
|
||
// wx.config({
|
||
// debug: false,
|
||
// appId: 'wx009d793f92c24eec',
|
||
// timestamp: data.data.timestamp,
|
||
// nonceStr: data.data.nonceStr,
|
||
// signature: data.data.signature,
|
||
// jsApiList: data.data.jsApiList
|
||
// });
|
||
// wx.error(function (res) {
|
||
// console.log('config error,msg:' + res);
|
||
// });
|
||
// }
|
||
// },
|
||
// error: function (res) {
|
||
// console.log('config error,msg:' + res);
|
||
// }
|
||
// })
|
||
});
|
||
|
||
wx.ready(function () {
|
||
//分享到朋友圈
|
||
wx.onMenuShareTimeline({
|
||
title: share.title,
|
||
link: share.link,
|
||
imgUrl: share.imgUrl,
|
||
success: function () {
|
||
// 用户确认分享后执行的回调函数
|
||
},
|
||
cancel: function () {
|
||
// 用户取消分享后执行的回调函数
|
||
}
|
||
});
|
||
//分享给朋友
|
||
wx.onMenuShareAppMessage({
|
||
title: share.title,
|
||
desc: share.desc,
|
||
link: share.link,
|
||
imgUrl: share.imgUrl,
|
||
type: 'link',
|
||
dataUrl: '',
|
||
success: function () {
|
||
},
|
||
cancel: function () {
|
||
}
|
||
});
|
||
//分享到QQ
|
||
wx.onMenuShareQQ({
|
||
title: share.title,
|
||
desc: share.desc,
|
||
link: share.link,
|
||
imgUrl: share.imgUrl,
|
||
success: function () {
|
||
},
|
||
cancel: function () {
|
||
}
|
||
});
|
||
});
|