| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- import Taro, { Component } from '@tarojs/taro'
- import { Provider } from '@tarojs/redux'
- import Index from './pages/index'
- import configStore from './store'
- import 'taro-ui/dist/style/index.scss'
- import './app.scss'
- import api from './api'
- Taro.api = api
- import * as tools from './utils/tool'
- Taro.$msg = tools.msgBase
- Taro.$CR = tools.configRight
- Taro.$msgConfirm = tools.confirmMsgFn
- // 如果需要在 h5 环境中开启 React Devtools
- // 取消以下注释:
- // if (process.env.NODE_ENV !== 'production' && process.env.TARO_ENV === 'h5') {
- // require('nerv-devtools')
- // }
- const store = configStore()
- class App extends Component {
- config = {
- pages: [
- 'pages/index/index',
- ],
- subPackages: [
- {
- root: 'pagesHouse/',
- pages: [
- 'index',
- 'list',
- 'indexDtl',
- 'indexDtlMore',
- 'indexDtlAround',
- 'indexDtlMap',
- 'produceType',
- 'photo',
- 'news',
- 'follow',
- 'history',
- 'search',
- 'pkList',
- 'pkDtl',
- 'pkAdd',
- 'price',
- 'discountGroup',
- 'roomPrice',
- 'roomPriceImg',
- 'roomPriceList',
- ]
- },
- {
- root: 'pagesMore/',
- pages: [
- 'news/index',
- 'news/list',
- 'news/indexDtl',
- 'news/tpDtl',
- 'center/index',
- 'center/group',
- 'center/queryBuyHouse',
- 'center/feedback',
- 'center/loanCalc',
- 'center/webViews',
- 'center/message',
- 'center/coupon',
- 'center/sxf',
- 'comment/add',
- 'comment/list',
- 'comment/dtl',
- // 'qa/list',
- // 'qa/add',
- // 'qa/dtl',
- ]
- },
- {
- root: 'pagesPlan/',
- pages: [
- 'apply'
- ]
- },
- {
- root: 'pagesSchool/',
- pages: [
- 'index',
- 'indexDtl',
- 'houseList',
- 'class',
- 'theme',
- 'area',
- ]
- },
- {
- root: 'pagesQa/',
- pages: [
- 'index',
- 'add',
- 'dtl',
- 'dtlSub',
- ]
- },
- ],
- window: {
- backgroundTextStyle: 'light',
- navigationBarBackgroundColor: '#fff',
- navigationBarTitleText: 'WeChat',
- navigationBarTextStyle: 'black'
- },
- plugins: {
- "chooseLocation": {
- "version": "1.0.6",
- "provider": "wx76a9a06e5b4e693e"
- }
- },
- permission: {
- "scope.userLocation": {
- "desc": "你的位置信息将用于小程序定位"
- }
- }
- }
- componentWillMount () {
- // Taro.loadFontFace({
- // global: true,
- // family: 'pf',
- // source: 'url("http://h5.honglounews.com/PF.TTF")',
- // })
- Taro.api.base.admdicttree().then(res =>{
- const cObj = res || {}
- let newDict = {}
- for (let k in cObj) {
- const cArr = cObj[k].map(item => {
- return {
- ...item,
- key: item.dict_label,
- val: item.dict_value
- }
- })
- newDict[k] = cArr
- }
- Taro.$dictData = newDict
- Taro.setStorageSync('dictData', newDict)
- })
- Taro.removeStorageSync('APP_indexOpen')
- Taro.setStorageSync('APP_newsDot', 'yes')
- let that = this
- let uiObj = Taro.getStorageSync('APP_userInfo')
- if (uiObj && uiObj.phone === '15625261123') {
- return
- }
- Taro.login({
- success: function (res) {
- if (res.code) {
- Taro.api.base.apiwxautologin({code: res.code}).then(data => {
- if (data.token === 'error') {
- Taro.removeStorageSync('APP_token')
- } else {
- const userInfo = {
- nickName: data.nickname,
- avatarUrl: data.avatar,
- phone: data.phone,
- }
- Taro.setStorageSync('APP_userInfo', userInfo)
- that.setState({
- userInfo
- })
- Taro.setStorageSync('APP_token', data.token)
- }
- })
- }
- }
- })
- }
- componentDidMount () {}
- componentDidShow () {}
- componentDidHide () {}
- componentDidCatchError () {}
- // 在 App 类中的 render() 函数没有实际作用
- // 请勿修改此函数
- render () {
- return (
- <Provider store={store}>
- <Index />
- </Provider>
- )
- }
- }
- Taro.render(<App />, document.getElementById('app'))
|