小程序农机手端

app.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { Component } from 'react'
  2. import Taro from '@tarojs/taro'
  3. // import preFetchData from '@/utils/preFetchData'
  4. import store, { StoreRoot } from './store'
  5. import './app.less'
  6. class App extends Component {
  7. // componentDidShow(options) {
  8. // if (options.path === 'pages/index/index' && options.query?.tab === '1') {
  9. // }
  10. // }
  11. onLaunch(options) {
  12. console.group('APP Launch')
  13. console.debug(options)
  14. console.groupEnd()
  15. const { login } = store.getModel('person').getState()
  16. Taro.login({
  17. success: (res) => {
  18. const { code } = res;
  19. login({ code })
  20. }
  21. })
  22. // const { login } = store.getModel('person').getState()
  23. // 预拉取数据
  24. // preFetchData().then((fetchData) => {
  25. // const { fromType, recommender, scene: qrCodeId, mpOpenId, ...leftParams } = options.query
  26. // Taro.setStorageSync({ key: 'scene', data: qrCodeId })
  27. // // // 登录获取人员信息
  28. // // Taro.login({
  29. // // success: (res) => {
  30. // // const { code } = res;
  31. // // login({ code, personId: fetchData.personId, fromType, recommender, qrCodeId, mpOpenId, ...leftParams })
  32. // // }
  33. // // })
  34. // }).catch(() => {
  35. // Taro.showToast({
  36. // title: '网络异常, 请退出重试',
  37. // icon: 'none',
  38. // })
  39. // })
  40. }
  41. // this.props.children 是将要会渲染的页面
  42. render() {
  43. return (
  44. <StoreRoot>
  45. {this.props.children}
  46. </StoreRoot>
  47. )
  48. }
  49. }
  50. export default App