123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <script>
- import Cache from './utils/cache'
- export default {
- globalData: {
- isLogin: false
- },
- async onLaunch(options) {
- console.log('-->data', options)
- console.log('App Launch')
- const path = options.path ? '/' + options.path : '/pages/index/index'
- const query = options.query
- // 直接传递user_id
- if (typeof query.user_id !== 'undefined' && query.user_id) {
- Cache.set('parent_id', query.user_id)
- }
- // 微信小程序 对应的二维码是 scene_code
- if (typeof query.scene !== 'undefined' && query.scene) {
- Cache.set('parent_id', query.scene)
- }
- if (this.$api.user.isLogin()) {
- await this.$api.user.info().then(res => {
- this.$store.dispatch('user/info', res.data)
- })
- } else {
- uni.reLaunch({
- url: '/pages/login?path=' + path + '&query=' + encodeURI(JSON.stringify(query))
- })
- }
- },
- 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>
|