1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- //index.js
- import api from '../../utils/api'
- //获取应用实例
- const app = getApp()
- Page({
- data: {
- splash: '',
- miniAppId: '',
- miniAppPath: '',
- second: 3
- },
- //事件处理函数
- onLoad: function() {
- api.getStartup().then(res => {
- this.setData({
- splash: res.data.splash_image,
- miniAppId: res.data.mini_app_id || ''
- })
- this.bindload(res.data.splash_image ? 3000 : 0)
- setInterval(() => {
- this.setData({
- second: --this.data.second
- })
- }, 1000)
- }, err => {
- console.log(err)
- this.bindload(0)
- })
- },
- bindload (time) {
- setTimeout(() => {
- wx.switchTab({
- url: '/pages/game/game'
- })
- }, time)
- },
- routeTo (e) {
- wx.switchTab({
- url: e.currentTarget.dataset.to
- })
- }
- })
|