123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import { Component } from 'react'
- import Taro from '@tarojs/taro'
- import preFetchData from '@/utils/preFetchData'
- import store, { StoreRoot } from './store'
- import './app.less'
-
- class App extends Component {
-
- onLaunch(options) {
- console.group('APP Launch')
- console.debug(options)
- console.groupEnd()
-
- const { login} = store.getModel('person').getState()
-
- // 预拉取数据
- preFetchData().then((fetchData) => {
- const { fromType, recommender, scene : qrCodeId } = options.query
-
- // 登录获取人员信息
- Taro.login({
- success: (res) => {
- const { code } = res;
- login({ code, personId: fetchData.personId, fromType, recommender, qrCodeId })
- }
- })
- }).catch(() => {
- Taro.showToast({
- title: '网络异常, 请退出重试',
- icon: 'none',
- })
- })
- }
-
- // this.props.children 是将要会渲染的页面
- render () {
- return (
- <StoreRoot>
- {this.props.children}
- </StoreRoot>
- )
- }
- }
-
- export default App
|