业务交流通
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

app.js 3.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. if (!!result.data && result.data.openid) {
  52. console.log(result, 'result');
  53. // this.globalData.openid = result.data.openid;
  54. this.globalData.appid = result.data.appid;
  55. // this.globalData.sessionKey = result.data.sessionKey;
  56. }
  57. }
  58. })
  59. } else {
  60. wx.showToast({
  61. title: '获取登录信息失败',
  62. icon: 'none',
  63. duration: 2000
  64. })
  65. }
  66. }
  67. })
  68. },
  69. globalData: {
  70. userInfo: null,
  71. openid: "oBkT7vu1Q8l-xsbux_i1FNmRWuJ4",
  72. appid: "",
  73. sessionKey: "",
  74. suiteCode: "",
  75. customerId: "666967",
  76. },
  77. // 跳转登录页
  78. goLogin(e) {
  79. wx.navigateTo({
  80. url: "/pages/login/login"
  81. })
  82. },
  83. // mangerUrl: 'http://test2.hhrchina.com',
  84. mangerUrl: "http://192.168.18.156",
  85. // mangerUrl: "https://www.hhrchina.com",
  86. // mangerUrlPath: "https://www.hhrchina.com",
  87. })