app.js 685B

1234567891011121314151617181920212223242526272829303132
  1. //app.js
  2. import utils from './utils/util.js'
  3. import constant from './constant'
  4. App({
  5. onLaunch: function () {
  6. // 登录
  7. wx.login({
  8. success: res => {
  9. const { appid, secret, baseURL } = this.globalData;
  10. utils.$httpServer({
  11. url: '/wechat/mini/login?code='+res.code,
  12. method: 'POST'
  13. }).then(data => {
  14. this.globalData.appConfig = data.result
  15. }).catch(error => {
  16. wx.showToast({
  17. title: '签到失败',
  18. duration: 1000,
  19. mask: true
  20. })
  21. })
  22. }
  23. })
  24. },
  25. globalData: {
  26. userInfo: null,
  27. appConfig: null,
  28. fieldId: '',
  29. ...constant
  30. }
  31. })