1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import 'taro-ui/dist/style/index.scss'
- import React, {
- Component
- } from 'react'
- import Taro from '@tarojs/taro'
- import {
- Provider,connect
- } from 'react-redux'
-
- import configStore from './store'
- import {asyncLogin} from './reducers/user'
-
- import './app.scss'
- import request from './util/request'
-
- const store = configStore()
-
- class App extends Component {
- componentDidMount() {}
-
- onLaunch () {
- wx.login({
- success (res) {
- if (res.code) {
-
-
- request({url:`/login?code=${res.code}`,method:"post"}).then((res)=>{
- try {
- Taro.setStorageSync('token', res.data.data.token)
- store.dispatch({type:'LOGIN',user:res.data.data})
- } catch (e) { }
-
-
- })
- } else {
- console.log('登录失败!' + res.errMsg)
- }
- }
- })
- }
-
- componentDidShow() {}
-
- componentDidHide() {}
-
- componentDidCatchError() {}
-
-
-
-
- render() {
- return ( <Provider store = {store} >
- {this.props.children}
- </Provider>
- )
- }
- }
-
- export default App
|