业务交流通
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. console.log(`初始化拿到的缓存`,this.globalData)
  67. }
  68. }
  69. })
  70. } else {
  71. wx.showToast({
  72. title: '获取登录信息失败',
  73. icon: 'none',
  74. duration: 2000
  75. })
  76. }
  77. }
  78. })
  79. },
  80. globalData: {
  81. userInfo: null,
  82. // openid: "oBkT7vu1Q8l-xsbux_i1FNmRWuJ4",
  83. openid: "",
  84. appid: "",
  85. sessionKey: "",
  86. suiteCode: "",
  87. customerId: null,
  88. businessCommunicationCustomer:null,
  89. },
  90. // 跳转登录页
  91. goLogin(e) {
  92. wx.navigateTo({
  93. url: "/pages/login/login"
  94. })
  95. },
  96. // mangerUrl: 'http://test2.hhrchina.com',
  97. mangerUrl: "http://192.168.18.138",
  98. // mangerUrl: "https://www.hhrchina.com",
  99. // mangerUrlPath: "https://www.hhrchina.com",
  100. })