123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- var ac_filename = window.location.pathname;
- ac_filename = ac_filename.split('/').pop();
- ac_filename = ac_filename && ac_filename!='index' ? '_'+ac_filename : '';
- var ac_val = parseInt($.fn.cookie('ac_val')) || 0;
- $(function () {
- //菜单
- $('.pop_up_menu_box > i, .head_menu_but, .pum_tit_box a').click(function () {
- $('.pop_up_menu_box').toggleClass('pop_up_menu_show');
- });
- });
- var commont = {
- /**
- * 切割参数
- * @param sname string 要获取的参数
- * @param str string 被切割的字符
- * @param smark string 用于切割字符
- * @returns {string}
- */
- getQueryString: function (sname, str, smark) {
- str = str ? str : window.location.search;
- smark = smark ? smark : '&';
- if (sname) {
- var c_start = str.indexOf(sname + "=");
- if (c_start != -1) {
- c_start = c_start + sname.length + 1;
- var c_end = str.indexOf(smark, c_start);
- if (c_end == -1) c_end = str.length;
- return decodeURIComponent(str.substring(c_start, c_end));
- }
- }
- return "";
- }
- };
- //关闭APP弹窗
- $(document).on('click', '.popup-close', function(){
- if (window.cps !== undefined) {
- window.cps.dismissDialogWebView();
- }
- });
- //调用APP方法打开url
- $(document).on('click','.client-url',function(){
- try {
- var url = decodeURIComponent($(this).attr('href'));
- console.log(url);
- if (window.cps !== undefined) {
- var urlJsonStr = JSON.stringify({"uri":url});
- window.cps.toAppPage(urlJsonStr);
- return false;
- }
- } catch (e) {
- }
- return false;
- });
- //关闭窗口
- $(document).on('click', 'close-window', function () {
- if (window.cps !== undefined) {
- window.cps.finsh();
- return false;
- }
- return false;
- });
- //回退按钮
- $(document).on("click", ".head_return_page_but, .new_search_return", function () {
- if (window.cps !== undefined) {
- window.cps.goBack();
- }
- });
- /**
- * H5登录
- * @param commonHeader
- */
- function h5JsLogin(commonHeader, sign) {
- //window.cps.showMsg('{"msg":"h5登录"}');
- $.ajax({
- type: "POST",
- url: "/clientwebapi/index/getJsLoginToken",
- beforeSend: function (request) {
- request.setRequestHeader("common", commonHeader);
- request.setRequestHeader("sign", sign);
- },
- success: function (result) {
- if (result.code == 1) {
- $.fn.cookie('uid',result.data.uid,{expires: 365, path: '/'});
- $.fn.cookie('token',result.data.token,{expires: 365, path: '/'});
- $.fn.cookie('sign',result.data.sign,{expires: 365, path: '/'});
- }
- }
- });
- }
|