|
|
import Taro, { Component } from '@tarojs/taro'
|
|
|
import { Provider, connect } from '@tarojs/redux'
|
|
|
import { bindActionCreators } from 'redux';
|
|
|
import Index from './pages/index'
|
|
|
import configStore from './store'
|
|
|
import user from './utils/user';
|
|
|
import createStore from './store'
|
|
|
import userUtil from './utils/user';
|
|
|
import {common as commonModel} from './models';
|
|
|
import './app.scss'
|
|
|
|
|
|
const store = configStore()
|
|
|
|
|
|
import globalData from './actions/globalData';
|
|
|
import { bindActionCreators } from 'redux';
|
|
|
import * as user from './actions/user';
|
|
|
|
|
|
import './app.scss'
|
|
|
|
|
|
const store = createStore();
|
|
|
|
|
|
@connect(({ globalData }) => ({
|
|
|
globalData
|
|
|
@connect(({ globalData, user }) => ({
|
|
|
globalData,
|
|
|
user
|
|
|
}), (dispatch) => {
|
|
|
return bindActionCreators(globalData, dispatch);
|
|
|
return {
|
|
|
globalData: bindActionCreators(globalData, dispatch),
|
|
|
user: bindActionCreators(user, dispatch),
|
|
|
};
|
|
|
})
|
|
|
|
|
|
class App extends Component {
|
...
|
...
|
@@ -138,7 +144,11 @@ class App extends Component { |
|
|
// // this.mtainit(options);
|
|
|
// }
|
|
|
|
|
|
componentDidShow () {}
|
|
|
async componentDidShow () {
|
|
|
const a = await this.props.user.wechatLogin()
|
|
|
|
|
|
console.log('-----------', this.props.user.openID)
|
|
|
}
|
|
|
|
|
|
componentDidHide () {}
|
|
|
|
...
|
...
|
@@ -164,11 +174,11 @@ class App extends Component { |
|
|
getWechatThirdSession() {
|
|
|
let value = this.globalData.WXThird_session;
|
|
|
|
|
|
return !value ? user.getYHStorageSync('WXThird_session','app') : value;
|
|
|
return !value ? userUtil.getYHStorageSync('WXThird_session','app') : value;
|
|
|
}
|
|
|
|
|
|
getUserInfo() {
|
|
|
let value = user.getYHStorageSync('userInfo','app');
|
|
|
let value = userUtil.getYHStorageSync('userInfo','app');
|
|
|
|
|
|
if (value) {
|
|
|
this.props.userInfo(value);
|
...
|
...
|
@@ -177,7 +187,7 @@ class App extends Component { |
|
|
}
|
|
|
|
|
|
getUnionID() {
|
|
|
let value = user.getYHStorageSync('unionID','app');
|
|
|
let value = userUtil.getYHStorageSync('unionID','app');
|
|
|
|
|
|
if (value) {
|
|
|
this.props.setWxUnionId(value);
|
...
|
...
|
@@ -202,7 +212,7 @@ class App extends Component { |
|
|
|
|
|
getSessionkey () {
|
|
|
if (this.isLogin) {
|
|
|
var value = user.getYHStorageSync('sessionkey','app')
|
|
|
var value = userUtil.getYHStorageSync('sessionkey','app')
|
|
|
if (value) {
|
|
|
// console.log(value)
|
|
|
this.globalData.sessionkey = value;
|
...
|
...
|
|