/**
* Created by mac on 18/7/24.
*/
if(fn.getRoleId == 3){
$('#nav-bar-container').append('
工时填报 工时查询 工时统计 员工管理')
}else{
$('#nav-bar-container').append('工时填报 工时查询 工时统计')
}
function Router(){
this.routes = {};
this.curUrl = '';
this.route = function(path, callback){
this.routes[path] = callback || function(){};
};
this.refresh = function(){
this.curUrl = location.hash.slice(1) || '/workfill';
console.log(this.curUrl)
this.routes[this.curUrl]();
};
this.init = function(){
window.addEventListener('load', this.refresh.bind(this), false);
window.addEventListener('hashchange', this.refresh.bind(this), false);
}
}
var R = new Router();
R.init();
var res = $('#main-con');
//工时查询
R.route('/workfill', function() {
$("#pageCssLink").attr("href",'../topages/workfill/workfill.css?a=1');
res.load('../topages/workfill/workfill.html');
$('.nav-bar-container li').removeClass('navbar-active');
$('#button-workfill').addClass('navbar-active');
});
//工时填报
R.route('/workquery', function() {
$("#pageCssLink").attr("href",'../topages/workquery/workquery.css?a=1');
res.load('../topages/workquery/workquery.html');
$('.nav-bar-container li').removeClass('navbar-active');
$('#button-workquery').addClass('navbar-active');
});
//员工管理
R.route('/staffmanage', function() {
$("#pageCssLink").attr("href",'../topages/staffmanage/staffmanage.css');
res.load('../topages/staffmanage/staffmanage.html');
$('.nav-bar-container li').removeClass('navbar-active');
$('#button-staffmanage').addClass('navbar-active');
});
//工时统计
R.route('/hourscount', function() {
$("#pageCssLink").attr("href",'../topages/hourscount/hourscount.css');
res.load('../topages/hourscount/hourscount.html');
$('.nav-bar-container li').removeClass('navbar-active');
$('#button-hourscount').addClass('navbar-active');
});