Brak opisu

queryHelp.js 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. var token = '';
  2. var city_name = '';
  3. var returnUrl = '';
  4. var code = '';
  5. var goUrl = "";
  6. var httpStr = "";
  7. var qs = parseQueryString(window.location.href);
  8. $().ready(function() {
  9. if (qs.returnUrl) {
  10. returnUrl = qs.returnUrl;
  11. }
  12. if (qs.httpStr) {
  13. httpStr = qs.httpStr;
  14. }
  15. if (qs.name) {
  16. city_name = qs.name;
  17. }
  18. if (qs.code) {
  19. code = qs.code;
  20. }
  21. if (qs.token) {
  22. token = qs.token;
  23. }
  24. goBack()
  25. cituInfoData()
  26. });
  27. //nav返回上一页
  28. function goBack () {
  29. $("nav i").click(function () {
  30. window.location.href = httpStr + "&name=" + city_name + "&code=" + code + "&token=" + token;
  31. })
  32. }
  33. //各城市对应注册地址
  34. function goZhuce () {
  35. tips.find(function(item,index) {
  36. if(item.region == city_name){
  37. if(item.URL.register){
  38. goUrl=item.URL.register;
  39. // window.location.href = goUrl;
  40. window.webkit.messageHandlers.OutPushMessageHandler.postMessage({'name':city_name,'url':goUrl});
  41. }else{
  42. goUrl=item.URL.web;
  43. // window.location.href = goUrl;
  44. window.webkit.messageHandlers.OutPushMessageHandler.postMessage({'name':city_name,'url':goUrl});
  45. }
  46. }
  47. })
  48. }
  49. //帮助文案
  50. function cituInfoData () {
  51. $.ajax({
  52. type:"POST",
  53. url: "/api/city/info",
  54. headers:{
  55. 'token': '5dac206be8b1f5736285fc03a08adb3c'
  56. },
  57. data:{
  58. 'region': qs.name
  59. },
  60. dataType:'json',
  61. success: function (res) {
  62. console.log(res)
  63. if(res.errno == 0 && res.rst.data && res.rst.data.city){
  64. var data = res.rst.data.city;
  65. if(data.help_info && data.help_info != ""){
  66. $(".container").html(data.help_info);
  67. $(".container").find("p").css({
  68. "line-height":0,
  69. "font-size":"0.16rem"
  70. }).find("span").css({
  71. "line-height":"0.26rem",
  72. "font-size":"0.14rem",
  73. "color":"#666666"
  74. })
  75. $(".container strong").find("span").css({"color":"#333333"})
  76. $(".goGjj").html(`<div class="ljqw">前往<em>${city_name}</em>公积金官网注册 <span onclick="goZhuce()">立即前往 >></span>
  77. </div>`)
  78. }else{
  79. $(".container").html(`<h3 class="title">如何获取查询密码/公积金帐号</h3>
  80. <p class="goOfficialNetwork">如果您还未在最新版,<i>${city_name}</i>公积金官网主注册并设置相关信息;<span onclick="goZhuce()">立即前往 >></span></p>
  81. <p class="goOfficialNetwork">注册完成后即可使用APP查询。</p>`)
  82. }
  83. }else{
  84. showMsg(res.err)
  85. }
  86. }
  87. });
  88. }
  89. /**
  90. * [showMsg 提示各种错误信息,3s后消失]
  91. */
  92. function showMsg(msg) {
  93. var msgBox = $('.alert-info');
  94. msgBox.children('p').text(msg);
  95. msgBox.show();
  96. setTimeout(function() {
  97. msgBox.hide();
  98. }, 3000);
  99. }