业务交流通
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // app.js
  2. App({
  3. onLaunch() {
  4. // 版本更新
  5. const updateManager = wx.getUpdateManager()
  6. updateManager.onCheckForUpdate(function (res) {
  7. // 请求完新版本信息的回调
  8. if (res.hasUpdate) {
  9. //准备更新
  10. updateManager.onUpdateReady(function () {
  11. wx.showModal({
  12. title: '业务交流通更新啦~',
  13. content: '新版本已经准备好,请重启应用',
  14. showCancel: false,
  15. success: function (res) {
  16. if (res.confirm) {
  17. // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  18. updateManager.applyUpdate()
  19. }
  20. }
  21. })
  22. })
  23. //更新失败
  24. updateManager.onUpdateFailed(function () {
  25. wx.showModal({
  26. title: '出错啦',
  27. content: '更新失败,请检查您的网络状况',
  28. showCancel: false,
  29. success: function (res) {
  30. if (res.confirm) {
  31. // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  32. updateManager.applyUpdate()
  33. }
  34. }
  35. })
  36. })
  37. }
  38. })
  39. // 登录
  40. wx.login({
  41. success: (res) => {
  42. if (res.code) {
  43. //获取openid
  44. wx.request({
  45. url: this.mangerUrl + '/service/weixin/getWxOpenId',
  46. data: {
  47. appNum: 12,
  48. js_code: res.code
  49. },
  50. success: (result) => {
  51. console.log("微信LOGIN result")
  52. if (!!result.data && result.data.openid) {
  53. this.globalData.openid = result.data.openid;
  54. this.globalData.appid = result.data.appid;
  55. this.globalData.sessionKey = result.data.sessionKey;
  56. // 获取本地用户信息
  57. const userInfo = wx.getStorageSync('userInfo') || null;
  58. const businessCommunicationCustomer = wx.getStorageSync('businessCommunicationCustomer') || null;
  59. if(userInfo){
  60. this.globalData.userInfo = userInfo;
  61. }
  62. if(businessCommunicationCustomer){
  63. this.globalData.businessCommunicationCustomer = businessCommunicationCustomer;
  64. this.globalData.customerId = businessCommunicationCustomer.customerId;
  65. }
  66. }
  67. }
  68. })
  69. } else {
  70. wx.showToast({
  71. title: '获取登录信息失败',
  72. icon: 'none',
  73. duration: 2000
  74. })
  75. }
  76. }
  77. })
  78. },
  79. globalData: {
  80. userInfo: null,
  81. // openid: "oBkT7vu1Q8l-xsbux_i1FNmRWuJ4",
  82. openid: "",
  83. appid: "",
  84. sessionKey: "",
  85. suiteCode: "",
  86. customerId: null,
  87. businessCommunicationCustomer:null,
  88. },
  89. // 跳转登录页
  90. goLogin(e) {
  91. wx.navigateTo({
  92. url: "/pages/login/login"
  93. })
  94. },
  95. // mangerUrl: 'http://test2.hhrchina.com',
  96. mangerUrl: "http://192.168.18.156",
  97. // mangerUrl: "https://www.hhrchina.com",
  98. // mangerUrlPath: "https://www.hhrchina.com",
  99. })