You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1000 B
39 lines
1000 B
<script>
|
|
import { mapActions, mapState } from 'vuex';
|
|
|
|
export default {
|
|
async onLaunch(options) {
|
|
options.query.url && (this.$t.domain = options.query.url);
|
|
if (!this.token) {
|
|
// 不论有没有token都直接从userId获取token
|
|
// token有过期时间 从本地获取可能是过期 干脆直接从userId获取
|
|
if (!options.query || !options.query.u) {
|
|
// 参数里没有u (userId)提示
|
|
this.$t.ui.showToast('缺少用户信息参数');
|
|
} else {
|
|
await this.getToken(options.query.u);
|
|
}
|
|
}
|
|
this.initSocket();
|
|
},
|
|
onShow: function () {
|
|
console.log('App Show');
|
|
},
|
|
onHide: function () {
|
|
console.log('App Hide');
|
|
},
|
|
|
|
computed: mapState('user', ['token']),
|
|
|
|
methods: {
|
|
...mapActions('user', ['getToken']),
|
|
...mapActions('socket', ['initSocket']),
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
@import './common/styles/iconfont.scss';
|
|
@import 'uview-ui/index.scss';
|
|
@import './common/styles/app.scss';
|
|
</style>
|
|
|