Commit 0f560d06 by 梁建民

首页

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