//鍦板潃-搴旂敤鍓嶇紑
var url_context_path = '/usercenter';
// 璺敱闈欐€佹枃浠跺湴鍧€鍓嶇紑
var basePath = 'xhtml/userCenter/';
//鍦板潃-鑾峰彇鐢ㄦ埛淇℃伅
var url_userInfo = '/web/user/loadInfo';
//鍦板潃-娣诲姞鎴戠殑瓒宠抗
var url_userTrack = '/usercenter/userTrack/add';
$.ajax({
url: "/consultfront" + url_userInfo,
type:"post",
async:false,
success:function (res) {
checkLogin(res);
$('.header').find('.hy').text(res.data.name);
},
error: function (res) {
console.log(res)
res.code = '9';
checkLogin(res);
}
})
var url_location = window.location.href.toString();
var url_logo = '/usercenter/xhtml/userCenter/images/sz_logo.png';
if(url_location.indexOf('www.zjg.gov.cn') >= 0){
// 寮犲娓
// logo
url_logo = '/usercenter/xhtml/userCenter/images/zjg_logo.png';
// 鑿滃崟-鎴戠殑棰勭害
$('#li_appointment').show();
}else if(url_location.indexOf('www.wujiang.gov.cn') >= 0){
// 鍚存睙
// logo
url_logo = '/usercenter/xhtml/userCenter/images/wujiang_logo.png';
$('#li_wjzcjd').show();
$('#li_policy').hide();
}
$('.logo img').attr('src', url_logo);
//鎵嬫満鐗堝ご閮ㄥ垏鎹㈣彍鍗
$("#header-btn-toggle").click(function(e){
$(".header").toggleClass("header-choose-opened");
$("#header-choose-toggle").toggleClass("header-choose-menu-m");
e.stopPropagation();
});
$("#header-choose-toggle").click(function(e){
// e.stopPropagation();
});
$(document).click(function(){
$(".header").removeClass("header-choose-opened");
$("#header-choose-toggle").removeClass("header-choose-menu-m");
});
//涓€鑸洿鎺ュ啓鍦ㄤ竴涓猨s鏂囦欢涓
layui.config({
base: 'xhtml/userCenter/layui/thrid_modules/' //鍋囪杩欐槸浣犲瓨鏀炬嫇灞曟ā鍧楃殑鏍圭洰褰
}).extend({ //璁惧畾妯″潡鍒悕
//dropdown: 'dropdown/dropdown' //鐩稿浜庝笂杩 base 鐩綍鐨勫瓙鐩綍
// ,
apirequest: 'apirequest/apirequest'
});
layui.use(['jquery', 'apirequest', 'layer'], function () {
var $ = layui.jquery;
var layer = layui.layer;
var apirequest = layui.apirequest;
$(function () {
var scorll = false;
function ckeckscroll() {
if ($(".body-container").css("display") == 'block') {
scorll = true;
var isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
var options_scroll = {};
if (isMobile) {
options_scroll = {
cursorcolor: "#ccc",//#CC0071 鍏夋爣棰滆壊
cursoropacitymax: 1, //鏀瑰彉涓嶉€忔槑搴﹂潪甯稿厜鏍囧浜庢椿鍔ㄧ姸鎬侊紙scrollabar鈥滃彲瑙佲€濈姸鎬侊級锛岃寖鍥翠粠1鍒?
emulatetouch: false, //浣垮厜鏍囨嫋鍔ㄦ粴鍔ㄥ儚鍦ㄥ彴寮忕數鑴戣Е鎽歌澶
cursorwidth: "5px", //鍍忕礌鍏夋爣鐨勫搴
cursorborder: "0", // 娓告爣杈规css瀹氫箟
cursorborderradius: "5px",//浠ュ儚绱犱负鍏夋爣杈圭晫鍗婂緞
autohidemode: true //鏄惁闅愯棌婊氬姩鏉
, touchbehavior: false
, preventmultitouchscrolling: false
, cursordragontouch: true
, autohidemode: 'hidden',
enablekeyboard: false,
horizrailenabled: true,
bouncescroll: true,
smoothscroll: false,
iframeautoresize: true,
hwacceleration: true,
disableoutline: true,
};
}
else {
options_scroll = {
cursorcolor: "#ccc",//#CC0071 鍏夋爣棰滆壊
cursoropacitymax: 1, //鏀瑰彉涓嶉€忔槑搴﹂潪甯稿厜鏍囧浜庢椿鍔ㄧ姸鎬侊紙scrollabar鈥滃彲瑙佲€濈姸鎬侊級锛岃寖鍥翠粠1鍒?
emulatetouch: false, //浣垮厜鏍囨嫋鍔ㄦ粴鍔ㄥ儚鍦ㄥ彴寮忕數鑴戣Е鎽歌澶
cursorwidth: "5px", //鍍忕礌鍏夋爣鐨勫搴
cursorborder: "0", // 娓告爣杈规css瀹氫箟
cursorborderradius: "5px",//浠ュ儚绱犱负鍏夋爣杈圭晫鍗婂緞
autohidemode: true //鏄惁闅愯棌婊氬姩鏉
, touchbehavior: true
, preventmultitouchscrolling: true
, cursordragontouch: false
, autohidemode: 'hidden',
enablekeyboard: false,
horizrailenabled: true,
bouncescroll: true,
smoothscroll: true,
iframeautoresize: true,
hwacceleration: true
};
}
$('.menu').niceScroll(options_scroll);
}
else {
if (scorll == true) {
$(".menu").getNiceScroll().hide();
scorll = false;
}
}
}
$(window).resize(function () {
ckeckscroll();
});
ckeckscroll();
});
/* 鏂规涓€ 鑿滃崟浜嬩欢
$('#site-tree-mobile').on('click', function () {
$('#site-tree-mobile').addClass('site-mobile');
$('.body-container').find('.left').css({ left: 0, width: '240px' });
});
$(document).bind("click", function (e) {
//id涓簃enu鐨勬槸鑿滃崟锛宨d涓簅pen鐨勬槸鎵撳紑鑿滃崟鐨勬寜閽
if ($(e.target).closest("#site-tree-mobile").length == 0 && $(e.target).closest(".left").length == 0) {
//鐐瑰嚮id涓簃enu涔嬪涓攊d涓嶆槸涓嶆槸open锛屽垯瑙﹀彂
$('#site-tree-mobile').removeClass('site-mobile');
$('.body-container').find('.left').css({ left: -240,width:'20%' });
}
})*/
//鑾峰彇鑿滃崟淇℃伅
// apirequest.request('/userCenter/index/menu/list', {}, function (menuRes) {
// var menus = "";
// $.each(menuRes.data, function (i, v) {
// var href = v.key;
// hasharr = href.split('_');
// menus += '
\
// ' + v.icon + '; ' + v.name + ' \
// ';
// });
// $('.menu').html(menus);
// menuactive();
// });
//鑿滃崟閫夋嫨鑹
function menuactive() {
var hashval = location.hash;
if (location.hash == '') {
hashval = '#personal_index';
}
hasharr = hashval.split('_');
$('.sideMenu').find('li').find('.aon').removeClass('aon');
controller = hasharr[0].replace('#', '');
$('.sideMenu').find('li').find('a[controller="' + controller + '"]').addClass('aon');
}
$(window).on('hashchange', function (e) {
menuactive();
});
menuactive();
//閫€鍑虹櫥褰
$('.logoutbtn').click(function () {
layer.confirm('鏄惁瑕侀€€鍑虹櫥褰?', { icon: 3, title: '鎻愮ず' }, function (index) {
location.href = apirequest.baseurl + '/ssoLogin/logout';
layer.close(index);
});
});
//璺敱
var now_str = '?v=20220524';
vipspa.start({
view: '.mainContent',// 瑁呰浇瑙嗗浘鐨刣om
router: {
'personal_index': {
templateUrl: basePath+'view/personal/personal.html' + now_str,
controller: [basePath+'js/personal/Bubble.js',basePath+'js/personal/yhzx.js', basePath+'js/personal/index.js'],
style: ['']
},
'mail': {
templateUrl: basePath+'view/mail/mail.html',
controller: [basePath+'js/mail/index.js'],
style: ['']
},
'mail_info': {
templateUrl: basePath+'view/mail/info.html',
controller: [basePath+'js/mail/info.js'],
style: ['']
},
'ysqgk_list': {
templateUrl: basePath+'view/ysqgk/ysq_list.html',
controller: [basePath+'js/ysqgk/index.js'],
style: ['']
},
'ysqgk_write': {
templateUrl: basePath+'view/ysqgk/ysq_write.html',
controller: [basePath+'js/ysqgk/ysqgk_write.js'],
style: [basePath+'css/ysqgk.css']
},
'ysqgk_bz': {
templateUrl: basePath+'view/ysqgk/ysq_bz.html',
controller: [basePath+'js/ysqgk/ysqgk_bz.js'],
style: [basePath+'css/ysqgk.css']
},
'myMatter': {
templateUrl: basePath+'view/myMatter/myMatter.html',
controller: [basePath+'js/myMatter/index.js'],
style: [basePath+'css/myMatter.css']
},
'collect': {
templateUrl: basePath+'view/collect/collect.html',
controller: [basePath+'js/collect/index.js'],
style: ['']
},
'appointment': {
templateUrl: basePath+'view/appointment/appointment.html',
controller: [basePath+'js/appointment/index.js'],
style: ['']
},
'appointment_sub': {
templateUrl: basePath+'view/appointment/sub.html',
controller: [basePath+'js/appointment/sub.js'],
style: ['']
},
'read': {
templateUrl: basePath+'view/read/read.html',
controller: [basePath+'js/read/index.js'],
style: ['']
},
'policy': {
templateUrl: basePath+'view/policy/policy.html',
controller: [basePath+'js/policy/index.js'],
style: ['']
},
'myfootprint': {
templateUrl: basePath+'view/myfootprint/myfootprint.html',
controller: [basePath+'js/myfootprint/index.js'],
style: ['']
},
'otherservice': {
templateUrl: basePath+'view/otherservice/index/menu.html',
controller: [basePath+'js/otherservice/info/index.js'],
style: ['']
},
'otherservice_shebao': {
templateUrl: basePath+'view/otherservice/shebao/shebao.html',
controller: [basePath+'js/otherservice/shebao/index.js'],
style: ['']
},
'otherservice_ylbxjfjlcx': {
templateUrl: basePath+'view/otherservice/serviceinfo/ylbxjfjlcx.html',
controller: [basePath+'js/otherservice/serviceinfo/ylbxjfjlcx.js'],
style: ['']
},
'otherservice_dsylbxjfxxcx': {
templateUrl: basePath+'view/otherservice/serviceinfo/dsylbxjfxxcx.html',
controller: [basePath+'js/otherservice/serviceinfo/dsylbxjfxxcx.js'],
style: ['']
},
'otherservice_dsybzhxfjl': {
templateUrl: basePath+'view/otherservice/serviceinfo/dsybzhxfjl.html',
controller: [basePath+'js/otherservice/serviceinfo/dsybzhxfjl.js'],
style: ['']
},
'otherservice_dssybxjfjl': {
templateUrl: basePath+'view/otherservice/serviceinfo/dssybxjfjl.html',
controller: [basePath+'js/otherservice/serviceinfo/dssybxjfjl.js'],
style: ['']
},
'otherservice_jysydylqxxjk': {
templateUrl: basePath+'view/otherservice/serviceinfo/jysydylqxxjk.html',
controller: [basePath+'js/otherservice/serviceinfo/jysydylqxxjk.js'],
style: ['']
},
'otherservice_water_cx': {
templateUrl: basePath+'view/otherservice/sdrq/water_cx.html',
controller: [basePath+'js/otherservice/sdrq/water_cx.js'],
style: ['']
},
'otherservice_gas_cx': {
templateUrl: basePath+'view/otherservice/sdrq/gas_cx.html',
controller: [basePath+'js/otherservice/sdrq/gas_cx.js'],
style: ['']
},
'mybj_list': {
templateUrl: basePath+'view/mybj/list.html',
controller: [basePath+'js/mybj/list.js'],
style: ['']
},
'defaults': 'personal_index'// 涓嶇鍚堜笂杩拌矾鐢辨椂锛岄粯璁よ烦鑷
}
});
});
//妫€鏌ユ槸鍚︾櫥褰
function checkLogin(res) {
if (res.code == "9") {
var paramUrl = encodeURIComponent(window.location.href);
var appLoginUrl = isEmpty(res.data) ? "/consultfront/ssoLogin/loginBtn?r_url=" : res.data;
var url = appLoginUrl
.replace("r_url=", "r_url=" + encodeURIComponent(paramUrl))
;
window.location.href = url;
}
}
function loadDefaultEmpty(str) {
if (isEmpty(str)) {
return "";
}
return str;
}
function isEmpty(str) {
if (typeof str == 'undefined' || !str || str == "" || str == '') {
return true;
}
return false;
}
//url 鍙傛暟鎴彇
function getQueryVariable(variable)
{
var query = window.location.toString();
var i = query.indexOf("?") + 1;
var vars = query.substring(i).split("&");
for (var i=0;i dateString 2021-07-06 14:23
return dateString;
}
/**
* 鎻愮ず妗嗚皟鐢ㄦ帴鍙o紙post锛宩son锛
* @param url URL
* @param type 绫诲瀷銆愭彁绀哄唴瀹广€
* @param title 鎻愮ず鏍囬
* @param param 鎺ュ彛鍙傛暟
* @param locationReload 鍒锋柊鐨刲ocation锛坙ocation锛氭湰椤甸潰鍒锋柊锛泈indow.parent.location锛氱埗绾ч〉闈㈠埛鏂帮紱true锛氭湰绾ч〉闈㈠埛鏂帮紱false锛氫笉鍒锋柊锛
*/
function openConfirm(layer, url, type, title, locationReload, param) {
if (isEmpty(title)) {
title = '鎻愮ず'
}
if (isEmpty(type)) {
type = "鎻愪氦";
}
try {
layer.confirm('纭畾瑕? + type + '鍚楋紵', {
icon : 3,
title : title
}, function() {
var option = {
url : url,
type : "POST",
dataType : "json",
traditional : true,
success : function(json) {
try {
if (!jQuery.isEmptyObject(json)) {
var code = json.code;
var msg = json.msg;
var data = json.data;
if (code == '0') {
layer.msg(msg, {
icon : 1,
time : 1000
}, function() {
if (typeof locationReload != 'undefined') {
try {
locationReload.reload();
} catch (e) {
if (locationReload) {
location.reload();
}
}
}
});
} else {
layer.alert(msg);
}
} else {
layer.alert("杩斿洖鏍煎紡閿欒");
console.log(json);
}
} catch (e) {
console.log(e)
}
},
error:function (json) {
console.log(json);
}
};
if (typeof param != 'undefined' && !$.isEmptyObject(param)) {
option.data = param;
}
$.ajax(option);
}, function() {
});
} catch (e) {
console.log(e)
}
}
/**
* 鍒涘缓涓€涓狿OST鎻愪氦
* @param url URL
* @param params 鍙傛暟
* @param target target
* @param isReturn 鏄惁杩斿洖鍒涘缓鐨勮〃鍗
* @returns {*}
*/
function openPost(url, params, target, isReturn) {
var tempForm = document.createElement("form");
tempForm.action = url;
tempForm.method = "post";
tempForm.style.display="none";
if(isEmpty(target)) {
target = "_blank";
}
if (!isEmpty(target)) {
tempForm.target = target;
}
for (var x in params) {
var opt = document.createElement("input");
opt.name = x;
opt.value = params[x];
tempForm.appendChild(opt);
}
var opt = document.createElement("input");
opt.type = "submit";
tempForm.appendChild(opt);
document.body.appendChild(tempForm);
tempForm.submit();
if (isEmpty(isReturn)) {
document.body.removeChild(tempForm);
tempForm = null;
}
return tempForm;
}
/**
* 鎵撳紑寮圭獥
* @param width 瀹
* @param height 楂
* @param title 鏍囬
* @param url URL
* @param isCloseReload 鍏抽棴鍚庢槸鍚﹀埛鏂
* @param subFormId 鍏抽棴鍚庨噸鏂版彁浜よ〃鍗旾D
* @returns layer index
*/
function openIframe(layer, width, height, title, url, isCloseReload, subFormId) {
if (isEmpty(width)) {
width = '100%';
}
if (isEmpty(height)) {
height = '100%';
}
var index;
try {
index = layer.open({
type : 2,
title : title,
content : url,
area : [ width, height ],
shade:0.3, //閬僵灞傞€忔槑搴
// btn : [ "鎻愪氦", "閲嶇疆", "鍏抽棴" ],
offset: '1%',
btnAlign: 'c',
success : function(layero, index){
//layer.setTop(layero); //閲嶇偣2
// var body = layui.layer.getChildFrame('body', index);
// body.find("#frame_layui_index").val(index);
setTimeout(function(){
layui.layer.tips('鐐瑰嚮姝ゅ鍏抽棴寮瑰嚭灞?, '.layui-layer-setwin .layui-layer-close', {
tips: 3
});
},300);
},
end: function () {
if (isCloseReload) {
location.reload();
}
try {
if (!isEmpty(subFormId)) {
$("#" + subFormId).submit();
}
} catch (e) {
}
}
});
} catch (e) {
console.log(e)
}
return index;
}
/**
* 鎵撳紑寮圭獥
* @param width 瀹
* @param height 楂
* @param title 鏍囬
* @param html 鍐呭
* @param isCloseReload 鍏抽棴鍚庢槸鍚﹀埛鏂
* @param subFormId 鍏抽棴鍚庨噸鏂版彁浜よ〃鍗旾D
* @returns layer index
*/
function openMsg(layer, width, height, title, html, isCloseReload, subFormId) {
if (isEmpty(width)) {
width = '100%';
}
if (isEmpty(height)) {
height = '100%';
}
var index;
try {
index = layer.open({
type : 0,
title : title,
content : html,
area : [ width, height ],
shade:0.3, //閬僵灞傞€忔槑搴
// btn : [ "鎻愪氦", "閲嶇疆", "鍏抽棴" ],
offset: '1%',
btnAlign: 'c',
success : function(layero, index){
//layer.setTop(layero); //閲嶇偣2
// var body = layui.layer.getChildFrame('body', index);
// body.find("#frame_layui_index").val(index);
setTimeout(function(){
layui.layer.tips('鐐瑰嚮姝ゅ鍏抽棴寮瑰嚭灞?, '.layui-layer-setwin .layui-layer-close', {
tips: 3
});
},300);
},
end: function () {
if (isCloseReload) {
location.reload();
}
try {
if (!isEmpty(subFormId)) {
$("#" + subFormId).submit();
}
} catch (e) {
}
}
});
} catch (e) {
console.log(e)
}
return index;
}