123456789101112131415161718192021222324252627 |
- import { mapGetters } from 'vuex'
- export default {
- provide() {
- return {
- loginCheck: this.loginStatusCheck
- }
- },
- computed: {
- ...mapGetters(['currentUser', 'isLogin'])
- },
- methods: {
- loginStatusCheck() {
- // 首页统一注入登陆检测方法,未登陆时直接跳至登陆框
- if (this.isLogin) {
- if (!!this.currentUser?.isBind) return Promise.resolve(true)
- this.dialogVisible = true
- this.$message.error('请先完善信息!')
- return Promise.reject(false)
- }
- this.$refs.loginForm?.$el?.scrollIntoView({ behavior: 'smooth' })
- this.$message.error('请先登陆!')
- return Promise.reject(false)
- }
- }
- }
|