1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import { Component } from 'react'
- import tool from './common/tool'
- import Taro, { getCurrentInstance } from '@tarojs/taro'
- // import 'taro-ui/dist/style/index.scss'
- import './app.less'
- class App extends Component {
- $instance = getCurrentInstance()
- componentDidMount () { }
- componentDidShow () {
- }
- onLaunch () {
-
-
- // 保持屏幕常亮
- Taro.setKeepScreenOn({
- keepScreenOn: true
- })
- // 获取路由参数
- let params = this.$instance.router.params
- if (params.scene) {
- let _scene = decodeURIComponent(params.scene)
- const arr = _scene.split("=");
- const result1 = arr[1].split("&")[0]; // 去掉第二个等号后面的"&"符号
- const result2 = arr[2]; // 第三个等号后面的内容
- Taro.setStorageSync('channel_name', result1)
- Taro.setStorageSync('source_name', result2)
- }
- let item = params
- if (params.c) {
- Taro.setStorageSync('channel_name', item.c)
- }
- if (params.s) {
- Taro.setStorageSync('source_name', item.s)
- }
- console.log('app启动');
- if (!Taro.getStorageSync('session_key')) {
- tool.toLogin();
- }else{
- tool.reportLogin()
- }
- Taro.setKeepScreenOn({
- keepScreenOn: true
- })
- }
- componentDidHide () { }
- render () {
- // this.props.children 是将要会渲染的页面
- return this.props.children
- }
- }
- export default App
|