HANYANG_REACT/www/ksvc/inc/js/common.js

89 lines
1.9 KiB
JavaScript

/*
* 로그아웃
* */
const logout = function(){
ajax_json({
url: "/inc/common.ajax.php",
type: "POST",
data: {mode: 'memberLogout'},
success: function (data) {
if ( data.code ) {
kuls_alert("로그아웃 되었습니다.",function(){
location.href="/ksvc/";
});
}
},
error: function (request, status, error) {
kuls_alert(error.message);
}
});
};
const side_menu_load = function( menu_code ){
ajax_json({
url: "/inc/common.ajax.php",
type: "POST",
data: {
mode:'getSiteMenuList',
menu_code:menu_code
},
success: function(data){
if( data.code ){
jQuery('#side-nav').treeview({
nodeIcon: '',
showTags: true,
enableLinks: true,
data: data.data
});
}
},
error: function(request, status, error) {
},
complete: function(request, status){
jQuery("#side-nav").on("click","a",function(e){
e.preventDefault();
});
jQuery("#side-nav").on("click",".node-side-nav",function(e){
if( jQuery(this).find(".expand-icon").length == 0 ){
let href = jQuery(this).find("> a").attr("href");
href && (location.href = href);
}
});
}
});
};
const cont_hfix = function(){
jQuery(".cont_hfix").css('height',0);
let win_h = jQuery(window).outerHeight();
jQuery(".cont_hfix").toArray().forEach( tgt => {
let cont_y = jQuery(tgt).offset().top;
let cont_height = win_h - cont_y - 20;
jQuery(tgt).css('height',cont_height);
});
}
jQuery(document).ready(function(){
if( jQuery("#side-nav").length ){
side_menu_load(menu_code);
}
cont_hfix();
});
jQuery(window).on("resize",function(){
cont_hfix();
});
jQuery(".btnHamburger").on("click",function(){
jQuery("#frame_side_panel").toggleClass("show_side_panel");
});
jQuery("#btnLogout").on("click",function(){
logout();
});