my-detail.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. var d = dialog({
  2. contentType: 'load',
  3. skin: 'bk-popup'
  4. });
  5. var d1 = dialog({
  6. contentType: 'load',
  7. skin: 'bk-popup',
  8. content: '退出中..'
  9. });
  10. var pagetype = 4;
  11. var openid = null;
  12. var userAgent = window.localStorage.getItem(agentName);
  13. $(function() {
  14. checkUserAgent();
  15. })
  16. function queryInit() {
  17. d.show();
  18. var jsonstr = $.parseJSON(userAgent);
  19. openid = jsonstr.openid;
  20. if(openid) {
  21. $(".weixing-icon").show();
  22. }
  23. var firstUid = window.localStorage.getItem("firstUid");
  24. if(firstUid == null || firstUid == undefined){
  25. $('.qiehuan-jiaren').hide()
  26. }
  27. queryUserInfo(); //查询用户信息
  28. // getWeixinSign(); //获取微信签名
  29. }
  30. //获得微信sdk信息
  31. function getWeixinSign() {
  32. var params1 = {};
  33. params1.pageUrl = server + "wx/html/grzx/html/my-detail.html&state=STATE";
  34. $.ajax(server + "weixin/getSign", {
  35. data: params1,
  36. dataType: "json",
  37. type: "post",
  38. success: function(res) {
  39. if(res.status == 200) {
  40. var t = res.data.timestamp;
  41. var noncestr = res.data.noncestr;
  42. var signature = res.data.signature;
  43. wx.config({
  44. //debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  45. appId: appId, // 必填,公众号的唯一标识
  46. timestamp: t, // 必填,生成签名的时间戳
  47. nonceStr: noncestr, // 必填,生成签名的随机串
  48. signature: signature, // 必填,签名,见附录1
  49. jsApiList: [
  50. 'chooseImage',
  51. 'uploadImage'
  52. ] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
  53. });
  54. }
  55. }
  56. });
  57. }
  58. //查询用户信息
  59. function queryUserInfo() {
  60. var reqParams = [{
  61. url: "patient/baseinfo",
  62. data: {},
  63. reqType: 'post'
  64. }]
  65. getReqPromises(reqParams).then(function(ress) {
  66. var res = ress[0];
  67. d.close();
  68. if(res.status == 200) {
  69. var data = res.data;
  70. $("#photo").attr("src", getImgUrl(data.photo))
  71. $("#name").html(data.name)
  72. }
  73. });
  74. }
  75. function goPage(url){
  76. window.location.href = url;
  77. }