123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <template>
- <router-view class="bg-white" />
- </template>
- <script lang="ts" setup>
- import { defineComponent, provide } from 'vue'
- import { useRoute, useRouter } from 'vue-router'
- import Cookie from 'js-cookie'
- defineComponent({
- name: 'IndentManageIndex',
- })
- provide('mediaRegExp', /^(https?:)?\/\/.+(.com.au\/|.com\/)/)
- const $route = useRoute()
- const token = Cookie.get('indent-token')
- const originQuery = $route.query as {
- [key: string]: string
- }
- if (originQuery.id) {
- Cookie.set('indent-crm-id', originQuery.id || '')
- }
- if (originQuery.full_name) {
- Cookie.set('indent-crm-fullname', originQuery.full_name || '')
- }
- const $router = useRouter()
- // 访问非登录页, 未登录状态调整登录页
- if (!token && $route.path !== '/indent-manage/login') {
- const params: any = {
- origin: encodeURIComponent($route.path),
- }
- if (originQuery.u?.length && originQuery.p?.length) {
- params.action = 'autoLogin'
- params.p = originQuery.p.trim()
- params.u = originQuery.u.trim()
- }
- console.log('未登录重定向')
- $router.replace({
- path: '/indent-manage/login',
- query: params,
- })
- } else if (originQuery.u) {
- console.log('已登录')
- $router.replace({ path: $route.path })
- }
- </script>
- <style>
- .bg-white {
- background-color: #fefefe;
- }
- </style>
|