app.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //app.js
  2. App({
  3. onLaunch: function () {
  4. if (!wx.cloud) {
  5. console.error('请使用 2.2.3 或以上的基础库以使用云能力')
  6. } else {
  7. wx.cloud.init({
  8. // env 参数说明:
  9. // env 参数决定接下来小程序发起的云开发调用(wx.cloud.xxx)会默认请求到哪个云环境的资源
  10. // 此处请填入环境 ID, 环境 ID 可打开云控制台查看
  11. // 如不填则使用默认环境(第一个创建的环境)
  12. env: 'test-nxy',
  13. traceUser: true,
  14. })
  15. }
  16. // 小程序自动更新
  17. // 获取更新管理器对象
  18. const updateManager=wx.getUpdateManager()
  19. updateManager.onCheckForUpdate(function(res){
  20. // 检测更新结果
  21. if(res.hasUpdate){
  22. updateManager.onUpdateReady(function(){
  23. wx.showModal({
  24. title:'更新提示',
  25. content:'新版本已经准备好,点击确定重新启动',
  26. showCancel:false,
  27. success:res=>{
  28. if(res.confirm){
  29. updateManager.applyUpdate();
  30. }
  31. }
  32. })
  33. })
  34. updateManager.onUpdateFailed(function(){
  35. wx.showModal({
  36. title:'提示',
  37. content:'检查到有新版本,但是下载失败,请检查网络设置',
  38. showCancel:false
  39. })
  40. })
  41. }
  42. })
  43. },
  44. globalData: {
  45. // globalUrl: 'http://192.168.1.173:50009', //地址
  46. globalUrl: 'https://app.taxbk.cn:9443', //地址
  47. imgUrl: '', //图片地址
  48. systemInfo: null, //系统信息
  49. userInfo: null //用户信息
  50. }
  51. })