yearning
21 小时以前 1d37c375fd114212ee1419c3bbdadc81d76666a4
src/views/h5/index.vue
@@ -5,8 +5,7 @@
</template>
<script>
import { useSessionStore } from '@/stores/session.js'
import { storeToRefs } from 'pinia';
import { tokenUtils } from '@/utils/axios.js'
import { storeToRefs } from 'pinia'
export default {
  setup() {
    const { setUserInfo } = useSessionStore()
@@ -17,11 +16,11 @@
    return {}
  },
  computed: {
  },
  created() {
    const path = this.$route.path
    const regionCode = this.$route.query.regionCode
    const path = this.$route.path
    const regionCode = this.$route.query.regionCode //未使用
    const fullPath = this.$route.fullPath
    let personType = null
    if (path == '/h5/addrVer') { //0==工作人员 2==考点核验员
@@ -32,10 +31,6 @@
    localStorage.setItem('_personType', personType)
    localStorage.setItem('_regionCode', regionCode)
    localStorage.setItem('_enterUrl', fullPath)
    // const lastPersonType = localStorage.getItem('_personType')
    // if (lastPersonType && lastPersonType !== personType) {
    //   tokenUtils.clearTokens()
    // }
    this.getUserInfo()
  },
  methods: {
@@ -43,9 +38,17 @@
      this.$axios.get('/system/auth/staff/profile').then(res => {
        if (res.data.code == 0) {
          this.setUserInfo(res.data.data || {})
        } else if (res.data.code != 401) {
          const tip = res.data.msg || '获取账号信息异常'
          this.$message.error(tip)
          this.$router.replace({ path: '/h5/noTask', query: { tip } })
        }
      }).catch(() => {
        const tip = '获取账号信息异常'
        this.$router.replace({ path: '/h5/noTask', query: { tip }})
        this.$message.error(tip)
      })
    },
  }
}
</script>
</script>