1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <script>
- import Cache from './utils/cache'
- export default {
- globalData: {
- },
- async onLaunch(options) {
- console.log('App Launch')
- const whitelist = [
- '/pages/login',
- '/pages/forget'
- ]
- const path = options.path ? '/' + options.path : '/pages/index'
- if (this.$api.user.isLogin()) {
- await this.$api.user.info().then(res => {
- this.$store.dispatch('user/info', res.data)
- })
- } else {
- if (whitelist.indexOf(path) === -1) {
- Cache.set('path', path)
- uni.reLaunch({
- url: '/pages/index'
- })
- }
- }
- },
- onShow() {
- console.log('App Show')
- },
- onHide() {
- console.log('App Hide')
- }
- }
- </script>
- <style lang="scss">
- /*每个页面公共css */
- @import "@/uni_modules/uview-ui/index.scss";
- @import '@/static/css/flex.scss';
- @import '@/static/css/common.scss';
- @import '@/static/css/iconfont.css';
- </style>
|