Commit 1af82aca authored by duxinyuan's avatar duxinyuan

bug

parent 557449b3
{layout name="global/frame_tpl" /}
<!--{layout name="global/frame_tpl" /}-->
{include file="global/navigation" /}
<input type="hidden" class="page-load" id="mainIndex" />
<style>
......
......@@ -32,13 +32,67 @@ define(['doT', 'jquery', 'text!temp/menu_template_tpl.html', 'layer'], function
dataObj.init();
});
}
//是否有导航栏的标识
var haveMenu = !~location.href.indexOf('/userModalList');
haveMenu && menu_bar(function(){
//回调部分
//记录tab的点击状态,对应的标签内容展开,并高亮显示
var _hash = location.pathname.replace('/admin.php/', '/');
var _tempObj = $('[href="'+_hash+'"]');
_tempObj.addClass('active-a').siblings().removeClass('active-a');
_tempObj.closest('.dropdown-menu').prev().attr('aria-expanded', true).parents().addClass('open').siblings().removeClass('open');
});
function menu_bar(fn) {
var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存
console.log(user_info_obj);
//登录时间无效 直接跳转登录页面
if(!user_info_obj){
alert('登录失效,请您重新登录');
window.location.href="login.html";
}
$ ("#menu_bar").append (template);
if (user_info_obj) {
console.log(document.getElementById ('menu_tpl'))
var temp = document.getElementById ('menu_tpl').innerHTML;
var doTtmpl = doT.template (temp);
// alert(user_info_obj['name'])
// $ ("#dropdownMenu1").append(user_info_obj['name']);
$ ("#menu_bar").html (doTtmpl (user_info_obj['menu']));
//回调
fn && fn();
} else {
$.ajax ({
url: '/index/getMenu',
type: 'POST',
async: true,
data: "",
dataType: 'json',
success: function (data) {
var temp = document.getElementById ('menu_tpl').innerHTML;
var doTtmpl = doT.template (temp);
$ ("#menu_bar").html (doTtmpl (data.data.menu));
//回调
fn && fn();
}
});
}
}
$("#logout").click(function () {
localStorage.removeItem('pcUserInfo');
});
var _doc = $(document);
//显示 隐藏城市 默认显示 当前账号 所在城市
$.ajax({
haveMenu && $.ajax({
url: '/index/getSiteList',
type: 'GET',
async: true,
......@@ -286,7 +340,7 @@ function urlDeal(urlStr, httpStr) {
}
function dealPunctuation(str) {//处理跟进内容 多个标点符号 截取
return str.replace(/!!!!!/g, '').replace(/!!!!!/g, '').replace(/\?\?\?\?\?/g, '').replace(/?????/g, '').replace(/。。。。。/g, '');
return (str+'!!!!!').replace(/!!!!!/g, '').replace(/!!!!!/g, '').replace(/\?\?\?\?\?/g, '').replace(/?????/g, '').replace(/。。。。。/g, '');
}
/**
......@@ -324,3 +378,31 @@ function getFlatternDistance(lat1,lng1,lat2,lng2){
s = Math.round(s * 10000) / 10000;
return s;
}
//获取前n天的时间
function getBeforeDate(n){
var d = new Date();
var year = d.getFullYear();
var mon=d.getMonth()+1;
var day=d.getDate();
if(day <= n){
if(mon>1) {
mon=mon-1;
}
else {
year = year-1;
mon = 12;
}
}
d.setDate(d.getDate()-n);
year = d.getFullYear();
mon=d.getMonth()+1;
day=d.getDate();
s = year+"-"+(mon<10?('0'+mon):mon)+"-"+(day<10?('0'+day):day)
return s;
};
//年-月-日 转化为时间戳
function getTimeStamp(date){
var oDate = new Date(date);
var time_cha=oDate.getTime();
return time_cha;
};
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 to comment