feat: 申请试用权限调整
This commit is contained in:
@ -2,17 +2,25 @@
|
|||||||
import { Input } from 'ant-design-vue';
|
import { Input } from 'ant-design-vue';
|
||||||
// import { handleUserHome } from '@/utils/user.ts';
|
// import { handleUserHome } from '@/utils/user.ts';
|
||||||
import { useChatStore } from '@/stores/modules/chat';
|
import { useChatStore } from '@/stores/modules/chat';
|
||||||
|
import { useUserStore } from '@/stores';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup(props, { emit, expose }) {
|
setup(props, { emit, expose }) {
|
||||||
const chatStore = useChatStore();
|
const chatStore = useChatStore();
|
||||||
|
const userStore = useUserStore();
|
||||||
|
|
||||||
const keyWord = ref('');
|
const keyWord = ref('');
|
||||||
|
|
||||||
|
const hasOpenEnterprise = computed(() => userStore.isOpenEnterprise);
|
||||||
|
|
||||||
const handleSearch = () => {
|
const handleSearch = () => {
|
||||||
chatStore.setSearchValue(keyWord.value);
|
chatStore.setSearchValue(keyWord.value);
|
||||||
chatStore.onCreateSession();
|
chatStore.onCreateSession();
|
||||||
keyWord.value = '';
|
keyWord.value = '';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!hasOpenEnterprise.value) return null;
|
||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
<div class="middle-wrap h-100% flex items-center justify-center">
|
<div class="middle-wrap h-100% flex items-center justify-center">
|
||||||
<Input
|
<Input
|
||||||
@ -35,6 +43,6 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style lang="scss" scoped>
|
||||||
@import './style.scss';
|
@import './style.scss';
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="right-wrap">
|
<div class="right-wrap">
|
||||||
<!-- 任务中心 -->
|
<!-- 任务中心 -->
|
||||||
<div class="relative p-6px rounded-30px flex items-center justify-center task-icon" @click="setUnread">
|
<div class="relative p-6px rounded-30px flex items-center justify-center task-icon" @click="setUnread" v-if="hasOpenEnterprise">
|
||||||
<SvgIcon name="svg-taskCenter" size="20" class="color-#737478" @click="openDownloadCenter" />
|
<SvgIcon name="svg-taskCenter" size="20" class="color-#737478" @click="openDownloadCenter" />
|
||||||
<div class="w-6px h-6px rounded-50% bg-#F64B31 absolute top-6px right-6px" v-if="hasUnreadInfo"></div>
|
<div class="w-6px h-6px rounded-50% bg-#F64B31 absolute top-6px right-6px" v-if="hasUnreadInfo"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 灵机空间入口 -->
|
<!-- 灵机空间入口 -->
|
||||||
<div class="agent-entry mx-16px" :class="isAgentRoute ? 'agent' : ''" @click="handleAgentClick"></div>
|
<div class="agent-entry mx-16px" :class="isAgentRoute ? 'agent' : ''" @click="handleAgentClick" v-if="hasOpenEnterprise"></div>
|
||||||
|
|
||||||
<!-- 头像设置 -->
|
<!-- 头像设置 -->
|
||||||
<Dropdown trigger="click" overlayClassName="layout-avatar-dropdown">
|
<Dropdown trigger="click" overlayClassName="layout-avatar-dropdown">
|
||||||
@ -23,7 +23,7 @@
|
|||||||
<icon-right size="12" />
|
<icon-right size="12" />
|
||||||
</div>
|
</div>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem>
|
<MenuItem v-if="hasOpenEnterprise">
|
||||||
<SubMenu value="option-1" position="lt" trigger="hover" popupClassName="enterprises-dsubmenu">
|
<SubMenu value="option-1" position="lt" trigger="hover" popupClassName="enterprises-dsubmenu">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="flex justify-between w-100% h-full items-center">
|
<div class="flex justify-between w-100% h-full items-center">
|
||||||
@ -70,7 +70,8 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { Dropdown, Menu, MenuItem, SubMenu } from 'ant-design-vue';
|
import { Dropdown, Menu, MenuItem, SubMenu } from 'ant-design-vue';
|
||||||
import router from '@/router';
|
import { useRouter } from "vue-router";
|
||||||
|
// import router from '@/router';
|
||||||
import { useEnterpriseStore } from '@/stores/modules/enterprise';
|
import { useEnterpriseStore } from '@/stores/modules/enterprise';
|
||||||
import { useSidebarStore } from '@/stores/modules/side-bar';
|
import { useSidebarStore } from '@/stores/modules/side-bar';
|
||||||
import { useUserStore } from '@/stores';
|
import { useUserStore } from '@/stores';
|
||||||
@ -94,8 +95,10 @@ const enterpriseStore = useEnterpriseStore();
|
|||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const sideBarStore = useSidebarStore();
|
const sideBarStore = useSidebarStore();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const hasUnreadInfo = computed(() => sideBarStore.unreadInfo.length);
|
const hasUnreadInfo = computed(() => sideBarStore.unreadInfo.length);
|
||||||
|
const hasOpenEnterprise = computed(() => userStore.isOpenEnterprise);
|
||||||
|
|
||||||
const exitAccountModalRef = ref(null);
|
const exitAccountModalRef = ref(null);
|
||||||
const downloadCenterModalRef = ref(null);
|
const downloadCenterModalRef = ref(null);
|
||||||
|
|||||||
@ -2,14 +2,14 @@
|
|||||||
<div class="navbar-wrap px-24px">
|
<div class="navbar-wrap px-24px">
|
||||||
<div class="w-full h-full relative flex justify-between">
|
<div class="w-full h-full relative flex justify-between">
|
||||||
|
|
||||||
<div class="left-wrap flex items-center cursor-pointer" @click="handleUserHome">
|
<div class="left-wrap flex items-center cursor-pointer" @click="onLogoClick">
|
||||||
<img src="@/assets/img/icon-logo.png" alt="" width="96" height="24" />
|
<img src="@/assets/img/icon-logo.png" alt="" width="96" height="24"/>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="flex-1"> -->
|
||||||
|
<MiddleSide v-if="!isHomeRoute"/>
|
||||||
|
<!-- </div> -->
|
||||||
|
<RightSide :isAgentRoute="isAgentRoute" v-if="userStore.isLogin"/>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="flex-1"> -->
|
|
||||||
<MiddleSide v-if="!isHomeRoute" />
|
|
||||||
<!-- </div> -->
|
|
||||||
<RightSide :isAgentRoute="isAgentRoute" v-if="userStore.isLogin" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -25,6 +25,7 @@ import router from '@/router';
|
|||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
|
||||||
|
const hasOpenEnterprise = computed(() => userStore.isOpenEnterprise);
|
||||||
const isAgentRoute = computed(() => {
|
const isAgentRoute = computed(() => {
|
||||||
return route.meta?.isAgentRoute;
|
return route.meta?.isAgentRoute;
|
||||||
});
|
});
|
||||||
@ -32,6 +33,16 @@ const isAgentRoute = computed(() => {
|
|||||||
const isHomeRoute = computed(() => {
|
const isHomeRoute = computed(() => {
|
||||||
return route.name === 'Home';
|
return route.name === 'Home';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const onLogoClick = () => {
|
||||||
|
if (hasOpenEnterprise.value) {
|
||||||
|
handleUserHome();
|
||||||
|
} else {
|
||||||
|
router.push({
|
||||||
|
name: 'Trial'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.navbar-wrap {
|
.navbar-wrap {
|
||||||
@ -58,16 +69,20 @@ const isHomeRoute = computed(() => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.arco-dropdown-option-suffix {
|
.arco-dropdown-option-suffix {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.enterprises-doption {
|
.enterprises-doption {
|
||||||
.arco-dropdown-option-content {
|
.arco-dropdown-option-content {
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not(.arco-dropdown-option-disabled):hover {
|
&:not(.arco-dropdown-option-disabled):hover {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
|
||||||
.arco-dropdown-option-content {
|
.arco-dropdown-option-content {
|
||||||
background: var(--BG-200, #f2f3f5);
|
background: var(--BG-200, #f2f3f5);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,12 @@
|
|||||||
<script lang="tsx">
|
<script lang="tsx">
|
||||||
import { Dropdown, Menu, Layout } from 'ant-design-vue';
|
import { Dropdown, Layout, Menu } from 'ant-design-vue';
|
||||||
import type { RouteMeta, RouteRecordRaw } from 'vue-router';
|
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import SvgIcon from '@/components/svg-icon/index.vue';
|
import SvgIcon from '@/components/svg-icon/index.vue';
|
||||||
|
|
||||||
import { useAppStore } from '@/stores';
|
import { useAppStore, useUserStore } from '@/stores';
|
||||||
import { useSidebarStore } from '@/stores/modules/side-bar';
|
import { useSidebarStore } from '@/stores/modules/side-bar';
|
||||||
import { MENU_LIST } from './menu-list';
|
|
||||||
import type { typeMenuItem } from './menu-list';
|
import type { typeMenuItem } from './menu-list';
|
||||||
|
import { MENU_LIST } from './menu-list';
|
||||||
import { handleUserHome } from '@/utils/user';
|
import { handleUserHome } from '@/utils/user';
|
||||||
|
|
||||||
import icon1 from '@/assets/img/agent/icon1.png';
|
import icon1 from '@/assets/img/agent/icon1.png';
|
||||||
@ -21,14 +20,17 @@ export default defineComponent({
|
|||||||
|
|
||||||
const sidebarStore = useSidebarStore();
|
const sidebarStore = useSidebarStore();
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
const userStore = useUserStore();
|
||||||
|
|
||||||
const currentMenuList = ref<typeMenuItem[]>([]);
|
// const currentMenuList = ref<typeMenuItem[]>([]);
|
||||||
const currentMenuModInfo = ref<typeMenuItem>({});
|
const currentMenuModInfo = ref<typeMenuItem>({});
|
||||||
|
|
||||||
const currentRouteName = computed(() => route.name as string);
|
const currentRouteName = computed(() => route.name as string);
|
||||||
const currentRouteGroup = computed(() => route.meta?.group ?? 'GroupMain');
|
const currentRouteGroup = computed(() => route.meta?.group ?? 'GroupMain');
|
||||||
const isHomeRoute = computed(() => currentRouteName.value === 'Home');
|
const isHomeRoute = computed(() => currentRouteName.value === 'Home');
|
||||||
const showAiSearch = computed(() => !route.meta?.hideAiSearch);
|
const showAiSearch = computed(() => !route.meta?.hideAiSearch);
|
||||||
|
const currentMenuList = computed(() => sidebarStore.currentMenuList);
|
||||||
|
const hasOpenEnterprise = computed(() => userStore.isOpenEnterprise);
|
||||||
|
|
||||||
const collapsed = computed(() => {
|
const collapsed = computed(() => {
|
||||||
return sidebarStore.menuCollapse;
|
return sidebarStore.menuCollapse;
|
||||||
@ -134,8 +136,27 @@ export default defineComponent({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const initMenuList = () => {
|
const initMenuList = () => {
|
||||||
const groupMenuList = MENU_LIST?.[currentRouteGroup.value as string] ?? [];
|
let groupMenuList = MENU_LIST?.[currentRouteGroup.value as string] ?? [];
|
||||||
currentMenuList.value = cloneDeep(groupMenuList);
|
|
||||||
|
// 如果企业未开通,过滤掉 requireAuth 为 true 的菜单项
|
||||||
|
if (!hasOpenEnterprise.value) {
|
||||||
|
groupMenuList = groupMenuList.filter((item) => {
|
||||||
|
if (item.requireAuth === true) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.children && item.children.length > 0) {
|
||||||
|
const filteredChildren = item.children.filter((child) => !child.requireAuth);
|
||||||
|
if (filteredChildren.length === 0 && !item.routeName) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
item.children = filteredChildren;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
sidebarStore.setCurrentMenuList(groupMenuList);
|
sidebarStore.setCurrentMenuList(groupMenuList);
|
||||||
};
|
};
|
||||||
const initCollapse = () => {
|
const initCollapse = () => {
|
||||||
@ -217,17 +238,21 @@ export default defineComponent({
|
|||||||
</style>
|
</style>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import './style.scss';
|
@import './style.scss';
|
||||||
|
|
||||||
.layout-sider-dropdown-xt {
|
.layout-sider-dropdown-xt {
|
||||||
.container {
|
.container {
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
background: var(--BG-White, #fff);
|
background: var(--BG-White, #fff);
|
||||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
|
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
|
||||||
|
|
||||||
.menu-item {
|
.menu-item {
|
||||||
@include menu-item;
|
@include menu-item;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: rgba(109, 76, 254, 0.08) !important;
|
background-color: rgba(109, 76, 254, 0.08) !important;
|
||||||
color: #6d4cfe !important;
|
color: #6d4cfe !important;
|
||||||
|
|
||||||
.svg-icon {
|
.svg-icon {
|
||||||
color: #6d4cfe !important;
|
color: #6d4cfe !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
|||||||
label: '账号管理',
|
label: '账号管理',
|
||||||
routeName: 'MediaAccountAccountManagement',
|
routeName: 'MediaAccountAccountManagement',
|
||||||
requireLogin: true,
|
requireLogin: true,
|
||||||
|
requireAuth: true,
|
||||||
activeMatch: ['MediaAccountAccountManagement'],
|
activeMatch: ['MediaAccountAccountManagement'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -34,6 +35,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
|||||||
label: '账号数据',
|
label: '账号数据',
|
||||||
routeName: 'MediaAccountAccountDashboard',
|
routeName: 'MediaAccountAccountDashboard',
|
||||||
requireLogin: true,
|
requireLogin: true,
|
||||||
|
requireAuth: true,
|
||||||
activeMatch: ['MediaAccountAccountDashboard', 'MediaAccountAccountDetails'],
|
activeMatch: ['MediaAccountAccountDashboard', 'MediaAccountAccountDetails'],
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
@ -42,6 +44,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
|||||||
// label: '账户管理',
|
// label: '账户管理',
|
||||||
// routeName: 'PutAccountAccountManagement',
|
// routeName: 'PutAccountAccountManagement',
|
||||||
// requireLogin: true,
|
// requireLogin: true,
|
||||||
|
// requireAuth: true,
|
||||||
// activeMatch: ['PutAccountAccountManagement'],
|
// activeMatch: ['PutAccountAccountManagement'],
|
||||||
// },
|
// },
|
||||||
// {
|
// {
|
||||||
@ -50,6 +53,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
|||||||
// label: '账户数据',
|
// label: '账户数据',
|
||||||
// routeName: 'PutAccountAccountData',
|
// routeName: 'PutAccountAccountData',
|
||||||
// requireLogin: true,
|
// requireLogin: true,
|
||||||
|
// requireAuth: true,
|
||||||
// activeMatch: ['PutAccountAccountData'],
|
// activeMatch: ['PutAccountAccountData'],
|
||||||
// },
|
// },
|
||||||
// {
|
// {
|
||||||
@ -58,6 +62,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
|||||||
// label: '投放表现分析',
|
// label: '投放表现分析',
|
||||||
// routeName: 'PutAccountAccountDashboard',
|
// routeName: 'PutAccountAccountDashboard',
|
||||||
// requireLogin: true,
|
// requireLogin: true,
|
||||||
|
// requireAuth: true,
|
||||||
// activeMatch: ['PutAccountAccountDashboard'],
|
// activeMatch: ['PutAccountAccountDashboard'],
|
||||||
// },
|
// },
|
||||||
// {
|
// {
|
||||||
@ -66,6 +71,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
|||||||
// label: '投放指南',
|
// label: '投放指南',
|
||||||
// routeName: 'PutAccountInvestmentGuidelines',
|
// routeName: 'PutAccountInvestmentGuidelines',
|
||||||
// requireLogin: true,
|
// requireLogin: true,
|
||||||
|
// requireAuth: true,
|
||||||
// activeMatch: ['PutAccountInvestmentGuidelines', 'PutAccountInvestmentGuidelinesDetail'],
|
// activeMatch: ['PutAccountInvestmentGuidelines', 'PutAccountInvestmentGuidelinesDetail'],
|
||||||
// },
|
// },
|
||||||
],
|
],
|
||||||
@ -81,6 +87,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
|||||||
label: '成品库',
|
label: '成品库',
|
||||||
routeName: 'MaterialCenterFinishedProducts',
|
routeName: 'MaterialCenterFinishedProducts',
|
||||||
requireLogin: true,
|
requireLogin: true,
|
||||||
|
requireAuth: true,
|
||||||
activeMatch: [
|
activeMatch: [
|
||||||
'MaterialCenterFinishedProducts',
|
'MaterialCenterFinishedProducts',
|
||||||
'ManuscriptUpload',
|
'ManuscriptUpload',
|
||||||
@ -96,6 +103,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
|||||||
label: '原料库',
|
label: '原料库',
|
||||||
routeName: 'MaterialCenterRawMaterial',
|
routeName: 'MaterialCenterRawMaterial',
|
||||||
requireLogin: true,
|
requireLogin: true,
|
||||||
|
requireAuth: true,
|
||||||
activeMatch: ['MaterialCenterRawMaterial'],
|
activeMatch: ['MaterialCenterRawMaterial'],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -119,6 +127,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
|||||||
label: '成品库',
|
label: '成品库',
|
||||||
routeName: 'WriterMaterialCenterFinishedProducts',
|
routeName: 'WriterMaterialCenterFinishedProducts',
|
||||||
requireLogin: true,
|
requireLogin: true,
|
||||||
|
requireAuth: true,
|
||||||
activeMatch: [
|
activeMatch: [
|
||||||
'WriterMaterialCenterFinishedProducts',
|
'WriterMaterialCenterFinishedProducts',
|
||||||
'WriterManuscriptUpload',
|
'WriterManuscriptUpload',
|
||||||
@ -134,6 +143,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
|||||||
// label: '原料库',
|
// label: '原料库',
|
||||||
// routeName: 'WriterMaterialCenterRawMaterial',
|
// routeName: 'WriterMaterialCenterRawMaterial',
|
||||||
// requireLogin: true,
|
// requireLogin: true,
|
||||||
|
// requireAuth: true,
|
||||||
// activeMatch: ['WriterMaterialCenterRawMaterial'],
|
// activeMatch: ['WriterMaterialCenterRawMaterial'],
|
||||||
// },
|
// },
|
||||||
],
|
],
|
||||||
@ -156,6 +166,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
|||||||
label: '企业信息',
|
label: '企业信息',
|
||||||
routeName: 'ManagementEnterprise',
|
routeName: 'ManagementEnterprise',
|
||||||
requireLogin: true,
|
requireLogin: true,
|
||||||
|
requireAuth: true,
|
||||||
activeMatch: [
|
activeMatch: [
|
||||||
'ManagementEnterprise',
|
'ManagementEnterprise',
|
||||||
],
|
],
|
||||||
@ -166,6 +177,7 @@ export const MENU_LIST = <Record<string, typeMenuItem[]>>{
|
|||||||
label: '账号管理',
|
label: '账号管理',
|
||||||
routeName: 'ManagementAccount',
|
routeName: 'ManagementAccount',
|
||||||
requireLogin: true,
|
requireLogin: true,
|
||||||
|
requireAuth: true,
|
||||||
activeMatch: ['ManagementAccount'],
|
activeMatch: ['ManagementAccount'],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,62 +0,0 @@
|
|||||||
// /*
|
|
||||||
// * @Author: RenXiaoDong
|
|
||||||
// * @Date: 2025-06-19 01:45:53
|
|
||||||
// */
|
|
||||||
// import type { RouteRecordRaw, RouteRecordNormalized } from 'vue-router';
|
|
||||||
// import { useRouter } from 'vue-router';
|
|
||||||
// import { useSidebarStore } from '@/stores/modules/side-bar';
|
|
||||||
|
|
||||||
// export default function useMenuTree() {
|
|
||||||
// const router = useRouter();
|
|
||||||
// const appRoutes = router.options?.routes ?? [];
|
|
||||||
// const sidebarStore = useSidebarStore();
|
|
||||||
// const appRoute = computed(() => {
|
|
||||||
// const _filterRoutes = appRoutes.filter((v) => v.meta?.id === sidebarStore.activeMenuKey);
|
|
||||||
// return _filterRoutes;
|
|
||||||
// });
|
|
||||||
// const menuTree = computed(() => {
|
|
||||||
// const copyRouter = cloneDeep(appRoute.value) as RouteRecordNormalized[];
|
|
||||||
// copyRouter.sort((a: RouteRecordNormalized, b: RouteRecordNormalized) => {
|
|
||||||
// return (a.meta.order || 0) - (b.meta.order || 0);
|
|
||||||
// });
|
|
||||||
// function travel(_routes: RouteRecordRaw[], layer: number) {
|
|
||||||
// if (!_routes) return null;
|
|
||||||
|
|
||||||
// const collector: any = _routes.map((element) => {
|
|
||||||
// // leaf node
|
|
||||||
// if (element.meta?.hideChildrenInMenu || !element.children) {
|
|
||||||
// element.children = [];
|
|
||||||
// return element;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // route filter hideInMenu true
|
|
||||||
// element.children = element.children.filter((x) => x.meta?.hideInMenu !== true);
|
|
||||||
|
|
||||||
// // Associated child node
|
|
||||||
// const subItem = travel(element.children, layer + 1);
|
|
||||||
|
|
||||||
// if (subItem.length) {
|
|
||||||
// element.children = subItem;
|
|
||||||
// return element;
|
|
||||||
// }
|
|
||||||
// // the else logic
|
|
||||||
// if (layer > 1) {
|
|
||||||
// element.children = subItem;
|
|
||||||
// return element;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (element.meta?.hideInMenu === false) {
|
|
||||||
// return element;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return null;
|
|
||||||
// });
|
|
||||||
// return collector.filter(Boolean);
|
|
||||||
// }
|
|
||||||
// return travel(copyRouter, 0);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// return {
|
|
||||||
// menuTree,
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
@ -1,9 +1,14 @@
|
|||||||
// import { useUserStore } from '@/stores/modules/user';
|
import { useUserStore } from '@/stores/modules/user';
|
||||||
|
|
||||||
// export function checkRoutePermission(routeName: string) {
|
export function checkRoutePermission(routeName: string) {
|
||||||
// // const userStore = useUserStore();
|
|
||||||
// // const allowAccessRoutes = userStore.allowAccessRoutes;
|
|
||||||
|
|
||||||
// // if (!routeName) return false;
|
const userStore = useUserStore();
|
||||||
// // return allowAccessRoutes.includes(routeName);
|
|
||||||
// }
|
if (!routeName) return false;
|
||||||
|
|
||||||
|
if (!userStore.isOpenEnterprise) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { message } from 'ant-design-vue';
|
|||||||
import NProgress from 'nprogress';
|
import NProgress from 'nprogress';
|
||||||
import { goUserLogin } from '@/utils/user';
|
import { goUserLogin } from '@/utils/user';
|
||||||
// import router from '@/router';
|
// import router from '@/router';
|
||||||
// import { checkRoutePermission } from '@/permission/permission';
|
import { checkRoutePermission } from '@/permission/permission';
|
||||||
|
|
||||||
import { useUserStore } from '@/stores/modules/user';
|
import { useUserStore } from '@/stores/modules/user';
|
||||||
|
|
||||||
@ -27,16 +27,17 @@ export default function setupUserLoginInfoGuard(router: Router) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (requiresAuth) {
|
if (requiresAuth) {
|
||||||
// const hasPermission = checkRoutePermission(routeName);
|
const hasPermission = checkRoutePermission(routeName);
|
||||||
// if (!hasPermission) {
|
|
||||||
// message.error('您没有权限访问该页面');
|
if (!hasPermission) {
|
||||||
// next('/');
|
message.error('您没有权限访问该页面');
|
||||||
// return;
|
next('/trial');
|
||||||
// }
|
return;
|
||||||
// next();
|
}
|
||||||
// return;
|
next();
|
||||||
// }
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -48,7 +48,7 @@ export const router = createRouter({
|
|||||||
name: 'Trial',
|
name: 'Trial',
|
||||||
component: () => import('@/views/trial/index.vue'),
|
component: () => import('@/views/trial/index.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
requiresAuth: true,
|
requiresAuth: false,
|
||||||
requireLogin: true,
|
requireLogin: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -41,7 +41,7 @@ export const useUserStore = defineStore('user', {
|
|||||||
},
|
},
|
||||||
// 是否开通企业
|
// 是否开通企业
|
||||||
isOpenEnterprise(): boolean {
|
isOpenEnterprise(): boolean {
|
||||||
return this.userInfo?.primary_enterprise?.subscribe_status === 1;
|
return [1, 2].includes(this.userInfo?.primary_enterprise?.subscribe_status);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import { useChatStore } from '@/stores/modules/chat';
|
|||||||
|
|
||||||
// 登录
|
// 登录
|
||||||
export function goUserLogin(query?: any) {
|
export function goUserLogin(query?: any) {
|
||||||
|
// console.log('goUserLogin', router)
|
||||||
router.push({ name: 'UserLogin', query });
|
router.push({ name: 'UserLogin', query });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -95,9 +95,9 @@ import axios from 'axios';
|
|||||||
import { useUserStore } from '@/stores';
|
import { useUserStore } from '@/stores';
|
||||||
|
|
||||||
const store = useUserStore();
|
const store = useUserStore();
|
||||||
const userInfo = computed(() => {
|
// const userInfo = computed(() => {
|
||||||
return store.userInfo ?? {};
|
// return store.userInfo ?? {};
|
||||||
});
|
// });
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
@ -120,10 +120,13 @@ const formRef = ref();
|
|||||||
const isSendCaptcha = ref(false);
|
const isSendCaptcha = ref(false);
|
||||||
const uploadInputRef = ref();
|
const uploadInputRef = ref();
|
||||||
|
|
||||||
|
// console.log(userInfo.value)
|
||||||
const dataSource = computed(() => {
|
const dataSource = computed(() => {
|
||||||
return userInfo.value ? [userInfo.value] : [];
|
return !isEmpty(store.userInfo) ? [store.userInfo] : [];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log(dataSource.value)
|
||||||
|
|
||||||
// 表单校验规则
|
// 表单校验规则
|
||||||
const formRules = {
|
const formRules = {
|
||||||
mobile: [
|
mobile: [
|
||||||
|
|||||||
@ -98,37 +98,25 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {
|
import { Button, Checkbox, Form, FormItem, Input, message, Tabs, Typography } from 'ant-design-vue';
|
||||||
Checkbox,
|
|
||||||
Modal,
|
|
||||||
Button,
|
|
||||||
Form,
|
|
||||||
FormItem,
|
|
||||||
Input,
|
|
||||||
Space,
|
|
||||||
message,
|
|
||||||
Typography,
|
|
||||||
Card,
|
|
||||||
List,
|
|
||||||
Tabs,
|
|
||||||
} from 'ant-design-vue';
|
|
||||||
const { Link } = Typography;
|
|
||||||
const { TabPane } = Tabs;
|
|
||||||
import PuzzleVerification from '../PuzzleVerification.vue';
|
import PuzzleVerification from '../PuzzleVerification.vue';
|
||||||
import SelectAccountModal from '../select-account-modal/index.vue';
|
import SelectAccountModal from '../select-account-modal/index.vue';
|
||||||
import { fetchLoginCaptCha, fetchAuthorizationsCaptcha, fetchProfileInfo, postLoginPassword } from '@/api/all/login';
|
import { fetchAuthorizationsCaptcha, fetchLoginCaptCha, fetchProfileInfo, postLoginPassword } from '@/api/all/login';
|
||||||
import { postClearRateLimiter } from '@/api/all/common';
|
import { postClearRateLimiter } from '@/api/all/common';
|
||||||
import { joinEnterpriseByInviteCode } from '@/api/all';
|
import { joinEnterpriseByInviteCode } from '@/api/all';
|
||||||
import { ref, reactive, onUnmounted, computed } from 'vue';
|
import { computed, onUnmounted, reactive, ref } from 'vue';
|
||||||
import { useUserStore } from '@/stores';
|
import { useUserStore } from '@/stores';
|
||||||
import { useEnterpriseStore } from '@/stores/modules/enterprise';
|
import { useEnterpriseStore } from '@/stores/modules/enterprise';
|
||||||
import { handleUserLogin, goUserLogin } from '@/utils/user';
|
import { handleUserLogin } from '@/utils/user';
|
||||||
import router from '@/router';
|
import router from '@/router';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import icon1 from '@/assets/img/login/icon-close.png';
|
import icon1 from '@/assets/img/login/icon-close.png';
|
||||||
import icon2 from '@/assets/img/login/icon-open.png';
|
import icon2 from '@/assets/img/login/icon-open.png';
|
||||||
|
|
||||||
|
const { Link } = Typography;
|
||||||
|
const { TabPane } = Tabs;
|
||||||
|
|
||||||
const setPageType = inject('setPageType');
|
const setPageType = inject('setPageType');
|
||||||
|
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
@ -277,8 +265,9 @@ const onTabChange = () => {
|
|||||||
const getProfileInfo = async () => {
|
const getProfileInfo = async () => {
|
||||||
const { code, data } = await fetchProfileInfo();
|
const { code, data } = await fetchProfileInfo();
|
||||||
if (code === 200) {
|
if (code === 200) {
|
||||||
|
userStore.setUserInfo(data);
|
||||||
// 已开通
|
// 已开通
|
||||||
if (data.primary_enterprise?.subscribe_status === 1) {
|
if (userStore.isOpenEnterprise) {
|
||||||
const enterprises = data['enterprises'];
|
const enterprises = data['enterprises'];
|
||||||
mobileNumber.value = data['mobile'];
|
mobileNumber.value = data['mobile'];
|
||||||
accounts.value = enterprises;
|
accounts.value = enterprises;
|
||||||
@ -293,14 +282,13 @@ const getProfileInfo = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
router.push({name: 'Trial'})
|
router.push({ name: 'Trial' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 提交表单
|
// 提交表单
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
console.log('handleSubmit', disabledSubmitBtn.value);
|
|
||||||
if (disabledSubmitBtn.value) return;
|
if (disabledSubmitBtn.value) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -293,8 +293,10 @@ const handleVerificationSubmit = async () => {
|
|||||||
const getProfileInfo = async () => {
|
const getProfileInfo = async () => {
|
||||||
const { code, data } = await fetchProfileInfo();
|
const { code, data } = await fetchProfileInfo();
|
||||||
if (code === 200) {
|
if (code === 200) {
|
||||||
|
userStore.setUserInfo(data);
|
||||||
|
|
||||||
// 已开通
|
// 已开通
|
||||||
if (data.primary_enterprise?.subscribe_status === 1) {
|
if (userStore.isOpenEnterprise) {
|
||||||
const enterprises = data['enterprises'];
|
const enterprises = data['enterprises'];
|
||||||
mobileNumber.value = data['mobile'];
|
mobileNumber.value = data['mobile'];
|
||||||
accounts.value = enterprises;
|
accounts.value = enterprises;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<Layout class="flex justify-center items-center trial-wrap">
|
<Layout class="flex justify-center items-center trial-wrap">
|
||||||
<Layout.Header class="header-wrap">
|
<Layout.Header class="header-wrap cursor-pointer" @click="onLogoClick">
|
||||||
<div class="h-full px-24px">
|
<div class="h-full px-24px">
|
||||||
<div class="w-full h-full relative flex justify-between">
|
<div class="w-full h-full relative flex justify-between">
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
@ -65,7 +65,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- 建立商务联系中 -->
|
<!-- 建立商务联系中 -->
|
||||||
<section class="w-full" v-if="primary_enterprise.audit_status === 1">
|
<section class="w-full" v-if="primary_enterprise?.audit_status === 1">
|
||||||
<div class="rounded-16px bg-#fff px-36px pt-80px pb-60px flex flex-col items-center">
|
<div class="rounded-16px bg-#fff px-36px pt-80px pb-60px flex flex-col items-center">
|
||||||
<img :src="icon2" width="96" height="96" class="mb-8px" />
|
<img :src="icon2" width="96" height="96" class="mb-8px" />
|
||||||
<p class="cts !text-18px !lh-26px mb-8px">您的试用申请已提交</p>
|
<p class="cts !text-18px !lh-26px mb-8px">您的试用申请已提交</p>
|
||||||
@ -87,7 +87,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- 试用到期 -->
|
<!-- 试用到期 -->
|
||||||
<section class="w-full" v-if="primary_enterprise.subscribe_status === 4">
|
<section class="w-full" v-if="primary_enterprise?.subscribe_status === 4">
|
||||||
<div class="rounded-16px bg-#fff px-36px pt-80px pb-60px flex flex-col items-center">
|
<div class="rounded-16px bg-#fff px-36px pt-80px pb-60px flex flex-col items-center">
|
||||||
<img :src="icon1" width="96" height="96" class="mb-8px" />
|
<img :src="icon1" width="96" height="96" class="mb-8px" />
|
||||||
<p class="cts !text-18px !lh-26px mb-8px">试用已到期</p>
|
<p class="cts !text-18px !lh-26px mb-8px">试用已到期</p>
|
||||||
@ -113,8 +113,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Layout, Form, Button, FormItem, Input, Steps } from 'ant-design-vue';
|
import { Button, Form, FormItem, Input, Layout, Steps } from 'ant-design-vue';
|
||||||
import RightSide from '@/layouts/components/navbar/components/right-side/index.vue';
|
import RightSide from '@/layouts/components/navbar/components/right-side/index.vue';
|
||||||
|
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
import { postCreateEnterprises } from '@/api/all/login';
|
import { postCreateEnterprises } from '@/api/all/login';
|
||||||
import { exactFormatTime } from '@/utils/tools';
|
import { exactFormatTime } from '@/utils/tools';
|
||||||
import { handleUserHome } from '@/utils/user';
|
import { handleUserHome } from '@/utils/user';
|
||||||
@ -126,6 +128,7 @@ import icon2 from './img/icon-check.png';
|
|||||||
// 0-未开通,1-已开通,2-试用中,3-已到期,4-试用结束
|
// 0-未开通,1-已开通,2-试用中,3-已到期,4-试用结束
|
||||||
type Status = 0 | 1 | 2 | 3 | 4;
|
type Status = 0 | 1 | 2 | 3 | 4;
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
const submitting = ref(false);
|
const submitting = ref(false);
|
||||||
@ -175,7 +178,7 @@ const formRules = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const primary_enterprise = computed(() => userStore.userInfo?.primary_enterprise);
|
const primary_enterprise = computed(() => userStore.userInfo?.primary_enterprise);
|
||||||
|
const hasOpenEnterprise = computed(() => userStore.isOpenEnterprise);
|
||||||
const trialingStepsItems = computed(() => {
|
const trialingStepsItems = computed(() => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@ -209,6 +212,16 @@ const trialEndStepsItems = computed(() => {
|
|||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const onLogoClick = () => {
|
||||||
|
if (hasOpenEnterprise.value) {
|
||||||
|
handleUserHome();
|
||||||
|
} else {
|
||||||
|
router.push({
|
||||||
|
name: 'Trial',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
submitting.value = true;
|
submitting.value = true;
|
||||||
formRef.value
|
formRef.value
|
||||||
|
|||||||
Reference in New Issue
Block a user