Commit 0f560d06 by 梁建民

首页

parent 6b1a42df
......@@ -13,19 +13,18 @@
<include file="public/top" />
<div class="right_content home_content">
<div class="content">
<div class="user_info clr">
<div class="user_info clr user_home">
<div class="fl info_detail boxsiz">
<img src="__PUBLIC__/images/test.jpg" alt="IC" class="fl info_logo">
<div class="info_desc fl">
<p>Hi,上午好</p>
<h3 class="ellipsis">深圳市猎芯科技有限公司</h3>
<p>Hi,</p>
<h3 class="ellipsis company">--</h3>
<div class="clr login_info">
<div class="fl phone">
账号:
<span>15012479484</span>
账号:<span class="tel">--</span>
</div>
<div class="fl time ellipsis">
<span>上次登录时间:2019-05-27 17:27</span>
<span>上次登录时间:<em class="last_login_time">--</em></span>
</div>
</div>
</div>
......
......@@ -7,11 +7,14 @@
//是否启动loadin效果
if (isload == undefined) {
var index = layer.load(1, {
offset: ['50%', "50%"],
shade: false
});
}
var platform = {
source: 2
};
......@@ -59,9 +62,13 @@
return false;
},
error: function () {
layer.close(index);
layer.msg('网络出现问题,请重试!');
return false;
}
});
},
......@@ -71,6 +78,7 @@
//获取用户信息
this.getData(apis.userInfo, 'GET', {token: Util.getCookie('token') || ''}, function (res) {
if (res.errcode === 0) {
//消息数量
......@@ -83,6 +91,19 @@
}
//首页
if ($(".user_home").length > 0) {
$(".user_home").find(".company").empty().html(res.data['company_name']);
$(".user_home").find(".tel").empty().html(res.data['mobile']);
$(".user_home").find(".last_login_time").empty().html(res.data['last_login_time']);
$(".user_home").find(".info_desc").children('p').empty().html('Hi,'+Util.getTimeState());
}
}
});
......@@ -171,11 +192,17 @@
* @returns {boolean}
*/
setCookie: function (name, value, time, domain) {
domain = domain ? ";domain=" + domain : "";
var Days = time;
var exp = new Date();
exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
document.cookie = name + "=" + value + ";expires=" + exp.toGMTString() + ";path=/" + domain;
return true;
},
/**
......@@ -184,12 +211,19 @@
* @returns {*}
*/
getCookie: function (name) {
var strCookie = document.cookie;
var arrCookie = strCookie.split("; ");
for (var i = 0; i < arrCookie.length; i++) {
var arr = arrCookie[i].split("=");
if (name == arr[0]) {
return arr[1];
}
}
return "";
......@@ -199,11 +233,17 @@
* @param name
*/
delCookie: function (name, domain) {
domain = domain ? ";domain=" + domain : "";
var exp = new Date();
exp.setTime(exp.getTime() - 10000);
document.cookie = name + "=" + '' + ";expires=" + exp.toGMTString() + ";path=/" + domain;
return true;
},
/**
* 获取参数
......@@ -211,17 +251,28 @@
* @returns {*}
*/
getRequest: function (value) {
if (window.location.pathname == "/s/") {
var url = unescape(location.search);
} else {
var url = decodeURI(location.search);
}
var object = {};
if (url.indexOf("?") != -1) {
var str = url.substr(1);
var strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
object[strs[i].split("=")[0]] = strs[i].split("=")[1]
object[strs[i].split("=")[0]] = strs[i].split("=")[1];
}
}
return object[value];
......@@ -232,36 +283,91 @@
* @returns {string}
*/
getDateStr: function (val) {
var dd = new Date();
dd.setDate(dd.getDate() + val);
var y = dd.getFullYear();
var m = (dd.getMonth() + 1) < 10 ? "0" + (dd.getMonth() + 1) : (dd.getMonth() + 1);
var d = dd.getDate() < 10 ? "0" + dd.getDate() : dd.getDate();
return y + "-" + m + "-" + d;
},
/**
* 时间问候语
*/
getTimeState: function () {
var timeNow = new Date();
// 获取当前小时
var hours = timeNow.getHours();
// 设置默认文字
var text = '';
// 判断当前时间段
if (hours >= 0 && hours <= 10) {
text = '早上好';
} else if (hours > 10 && hours <= 14) {
text = '中午好';
} else if (hours > 14 && hours <= 18) {
text = '下午好';
} else if (hours > 18 && hours <= 24) {
text = '晚上好';
}
return text;
}
};
if (typeof define === "function" && define.amd) {
return Util;
} else {
window.Util = Util;
}
})(window);
//form序列化json
$.fn.serializeJson = function () {
var serializeObj = {};
var array = this.serializeArray();
var str = this.serialize();
$(array).each(function () {
if (serializeObj[this.name]) {
if ($.isArray(serializeObj[this.name])) {
serializeObj[this.name].push(this.value);
} else {
serializeObj[this.name] = [serializeObj[this.name], this.value];
}
} else {
serializeObj[this.name] = this.value;
}
});
return serializeObj;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment