12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <style lang="less">
- page {
- width: 100%;
- height: 100%;
- }
- .container {
- height: 100%;
- box-sizing: border-box;
- }
- </style>
- <script>
- import wepy from 'wepy'
- import 'wepy-async-function'
- import { setStore } from 'wepy-redux'
- import configStore from './store'
- const store = configStore()
- setStore(store)
- export default class extends wepy.app {
- config = {
- pages: [
- 'pages/index',
- 'pages/detail'
- ],
- window: {
- backgroundTextStyle: 'light',
- navigationBarBackgroundColor: '#8397FF',
- navigationBarTitleText: '智能共享白板',
- navigationBarTextStyle: '#fff'
- }
- }
- globalData = {
- userInfo: null
- }
- constructor () {
- super()
- this.use('requestfix')
- }
- onLaunch() {
- this.testAsync()
- }
- sleep (s) {
- return new Promise((resolve, reject) => {
- setTimeout(() => {
- resolve('promise resolved')
- }, s * 1000)
- })
- }
- async testAsync () {
- const data = await this.sleep(3)
- console.log(data)
- }
- getUserInfo(cb) {
- const that = this
- if (this.globalData.userInfo) {
- return this.globalData.userInfo
- }
- wepy.getUserInfo({
- success (res) {
- that.globalData.userInfo = res.userInfo
- cb && cb(res.userInfo)
- }
- })
- }
- }
- </script>
|