|
function exit(){
$.cookie('userid', null);
$.cookie('userAuth', null);
$.cookie('userEmail', null);
$.cookie('userMobilePhone', null);
$.cookie('userName', null);
$.cookie('userType', null);
location.href="index.html"
}
function valUser(){
var userid = $.cookie('userid');
var userAuth = $.cookie('userAuth');
if(userid == undefined || userid.length==0 || userid == "null" || userAuth == false){
location.href="login.html";
}
}
function GetQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg); //��ȡurl��"?"�����ַ�����ƥ��
var context = "";
if (r != null)
context = r[2];
reg = null;
r = null;
return context == null || context == "" || context == "undefined" ? "" : decodeURI(context);
}
/* function GetQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg); //��ȡurl��"?"�����ַ�����ƥ��
var context = "";
if (r != null)
context = r[2];
reg = null;
r = null;
return context == null || context == "" || context == "undefined" ? "" : context;
}*/
var userid;
function loginStatus(){
userid = $.cookie('userid');
if(userid){
$(".head-portrait").show();
$(".unlogin").hide();
$(".portrait-p").attr("src","/images/head/"+userid+"_m.jpg");
$(".portrait-p").load(function(){
})
.error(function(){
$(".portrait-p").attr("src","/images/default-photo.jpg");
});
// if(userid && userid != "null" && userid!=null ){
// $(".head-portrait").show();
// $(".unlogin").hide();
// }else{
// $(".head-portrait").hide();
// $(".unlogin").show();
// }
}
//转换格式
function changeTime(dealtime){
var s = dealtime;
if(dealtime.length==8){
var y = s.substr(0,4);
var m = s.substr(4,2);
var d = s.substr(6,2);
var formatTime = y+"-"+m+"-"+d;
return formatTime;
}
else
{
var y = s.substr(0,4);
var m = s.substr(4,2);
var d = s.substr(6,2);
var h = s.substr(8,2);
var minute = s.substr(10,2);
var formatTime = y+"-"+m+"-"+d+" "+h+":"+minute;
return formatTime;
}
}
//******过滤特殊字符*******//
function replaceStr(s)
{
var pattern = new RegExp("-");
var rs = "";
for (var i = 0; i < s.length; i++) {
rs = rs+s.substr(i, 1).replace(pattern, '');
}
return rs;
}
//**********************//
|