Warning: Cannot modify header information - headers already sent by (output started at /www/tufu/www.wenziyun.cn/public/static/pattern/php/common.php:1) in /www/tufu/www.wenziyun.cn/public/static/pattern/php/common.php on line 3
function isLogined(){
return false
}
function initUserInfo(){
if(localStorage.getItem("againLogin")) {
setTimeout(function(){
lg.loginBtnClick();
localStorage.removeItem("againLogin")
},1000)
}
}
initUserInfo()
function addSigninDialog(){
var bgdiv=document.createElement('div');
bgdiv.className='signin-bg';
bgdiv.id='signin-bg';
var div=document.createElement('div');
div.className='signin-dialog';
div.id="signin-dialog";
div.innerHTML=`
微信扫码登录
其他登录方式
`;
if(!document.getElementById("signin-bg")){
document.body.appendChild(bgdiv);
}
if(!document.getElementById("signin-dialog")){
document.body.appendChild(div);
}
}
var Ao = false;
$('#toolbar').on('mouseenter', '.user-info-area', function () {
$('.user-info').show()
})
$('#toolbar').on('mouseleave', '.user-info-area', function () {
toggleUserInfo();
})
$('#toolbar').on('mouseenter', '.user-info-area', function () {
Ao = true;
})
$('#toolbar').on('mouseleave', '.user-info-area', function () {
Ao = false;
})
function toggleUserInfo() {
setTimeout(() => {
if (Ao) {
$('.user-info').show();
} else {
$('.user-info').hide();
}
}, 200)
}
function updateZfCode () {
var radomNum=parseInt(Math.random()*10);
$('.zifucode img,.zifu-box img').attr('src',www+'common/checking?'+radomNum);
}
function getSmsCode (that) {
var telValue;
var phoneResult;
var zfCode;
if ($('.phone-dialog').is(":visible")) {
telValue = $('#tel').val();
phoneResult = testPhone('#tel');
zfCode=$('#zifu_code_login').val();
}
if ($('.signup-dialog').is(":visible")) {
telValue = $('#register-tel').val();
phoneResult = testPhone('#register-tel');
}
if ($('.return-password-dialog').is(":visible")) {
if ($('.inputphone-item').is(":visible")) {
telValue = $('#return_pwd').val();
phoneResult = testPhone('#return_pwd');
} else {
telValue = $('#changephone_number').val();
phoneResult = testPhone('#changephone_number');
}
}
if (phoneResult === false) {
$('.error-tips').html("请输入有效的手机号");
return false;
}
if(isEmpty(zfCode)){
$('.error-tips').html("请输入有效的字符校验码");
return false;
}
$('.error-tips').html('');
doPost(config.sendSms, {
'phoneNumbers': telValue,
'zfcode':zfCode,
}).then(function (res) {
if(res.code=='601'){
updateZfCode();
}
if (res.code != '200') {
$('.error-tips').html(res.msg);
return;
}
settime(that, 60, 60, 'disabled');
});
}
function checkUserLogin(){
var userLogin=$('#user_login').val();
if(userLogin==''){
addSigninDialog();
}else{
removeSigninDialog();
}
}
checkUserLogin();
function checkLogin() {
var user_islogin = $('#user_login').val();
if (user_islogin == '') {
return false;
}
return true;
}
function checkIsVip() {
var isVip = $('#user_unlock').val();
if (isVip ==0) {
return false;
}
return true;
}
function updateUserInfo(data) {
$('#user_login').val(1);
$('#user_token').val(data.token);
$('#user_type').val(data.type);
var url=window.location.href;
var curUrl=returnUrl(url);
switch (curUrl) {
case 'photoedit':
$('#user_unlock').val(data.vip_photo);
break;
case 'svg':
$('#user_unlock').val(data.vip_svg);
break;
case 'decor':
$('#user_unlock').val(data.vip_wall);
break;
case 'signature':
$('#user_unlock').val(data.vip_signature);
break;
default:
$('#user_unlock').val(data.vip_3d);
}
}
function updateLoginedBtn(data){
$('#regBtn').remove();
var div=document.createElement('div');
div.id='user-info-area';
div.className='user-info-area';
div.innerHTML=`
${data.name}
`;
if(!document.getElementById("user-info-area")){
$('#toolbar').append(div)
}
if(!isEmpty(data.jsData)){
$('#login_downloadBtn').replaceWith(data.jsData.data);
}
}
function settime(dom, endtime, origintime, className) {
if (endtime == 0) {
$(dom).attr("disabled", false);
$(dom).removeClass(className);
$(dom).html("获取验证码");
endtime = origintime;
return false;
} else {
$(dom).attr("disabled", true);
$(dom).addClass(className);
$(dom).html("重新发送(" + endtime + "s)");
endtime--;
}
sms_timer = setTimeout(function () {
settime(dom, endtime, origintime, className);
}, 1000);
}
function requestScript(key,src,callback) {
if(document.getElementById(key) && typeof callback=='function'){
return callback();
}
var script = document.createElement("script");
script.charset = "utf-8";
script.timeout = 120;
script.src = src;
script.id=key
script.onerror = script.onload = function(e){
if(e.type == "load" && typeof callback=='function'){
return callback();
}
// throw "Load "+src+" Fail";
}
if(!document.getElementById(key)){
document.head.appendChild(script);
}
};
function setUserInfoCrossDomain(data, isReload){
let messageObj = typeof data == "string" ? data : JSON.stringify(data);
let iframeHtml = $(``);
$("body").append(iframeHtml);
$("#messageIframe").on('load',function(){
$(this)[0].contentWindow.postMessage(messageObj,www_tufu_postmessage);
if(isReload){
window.location.reload();
}else{
setTimeout(function(){
$("#messageIframe").remove();
},1000)
}
})
}
function LoginedCallback(messageObj) {
//tufu同步登录
// setUserInfoCrossDomain(messageObj, false);
}