Commit eef815bf authored by chenjiahao's avatar chenjiahao

权限设置

parent b7dfdd1a
......@@ -10,7 +10,9 @@
<!-- </div>-->
<div style="display: flex; align-items: center" @click="handleGoFont">
<img src="../../../assets/svg/logo.svg" alt="融创软通" />
<span style="margin-left: 10px; font-size: 20px; color: white">数据要素平台</span>
<span v-show="showTitle" style="margin-left: 10px; font-size: 20px; color: white"
>数据要素平台</span
>
</div>
</div>
</template>
......
......@@ -9,6 +9,7 @@
editColumnData,
editTableData,
} from '@/views/metaModel/standardModel/modelData';
import { getUserInfo } from '@/api/sys/user';
const { t } = useI18n();
const userStore = useUserStoreWithOut();
......@@ -26,7 +27,7 @@
// }
localStorage.setItem(localKey, String(Date.now()));
const value = ref('服务平台');
const value = ref('数据要素');
const data = ref([
{
payload: {
......@@ -60,16 +61,28 @@
},
]);
const roleKey = ref('');
onMounted(() => {
console.log(localStorage.getItem('segmentValue'));
if (userStore.getUserInfo.roles.length > 0) {
roleKey.value = '' + userStore.getUserInfo.roles[0].roleKey; // 获取当前用户权限
} else {
roleKey.value = '' + userStore.getUserInfo.user.roleNames;
}
if (localStorage.getItem('segmentValue') !== null) {
value.value = localStorage.getItem('segmentValue');
} else if (roleKey.value === 'test') {
value.value = '数据要素';
localStorage.setItem('type', 6);
localStorage.setItem('segmentValue', value.value);
router.replace('/');
// handleSelect(6, value.value);
}
});
function handleClick() {
window.open('https://www.vben.pro', '_blank');
}
// 跳转前台
async function handleGoFont() {
await router.replace('/aaaFont/font');
window.location.reload();
......@@ -100,7 +113,7 @@
<!-- t('layout.header.model5')-->
<!-- }}</a-button>-->
<Segmented v-model:value="value" :options="data" size="large">
<Segmented v-show="roleKey !== 'test'" v-model:value="value" :options="data" size="large">
<template #label="{ payload, value: segmentValue }">
<div
@click="handleSelect(payload.key, segmentValue)"
......@@ -118,7 +131,7 @@
</div>
</template>
</Segmented>
<!-- <a-button type="link" @click="handleGoFont"> 前台页面 </a-button>-->
<!-- <a-button type="link" @click="handleGoFont"> 前台页面 </a-button>-->
<!-- 前往体验新版-->
<!-- <a-button type="primary" @click="handleClick">{{-->
<!-- t('layout.header.upgrade-prompt.ok-text')-->
......
......@@ -17,7 +17,7 @@
:sider="false"
/>
<LayoutBreadcrumb v-if="getShowContent && getShowBread" :theme="getHeaderTheme" />
<!-- <UpgradePrompt class="mr-2 ml-4" />-->
<!-- <UpgradePrompt class="mr-2 ml-4" />-->
</div>
<!-- left end -->
......@@ -33,34 +33,33 @@
<!-- menu-end -->
<!-- action -->
<div :class="`${prefixCls}-action`">
<!-- 切换模块 按钮-->
<UpgradePrompt class="mr-2" />
<!-- 搜索 按钮-->
<!-- <AppSearch v-if="getShowSearch" :class="`${prefixCls}-action__item `" />-->
<div :class="`${prefixCls}-action`" style="display: flex; justify-content: end">
<!-- 切换模块 按钮-->
<UpgradePrompt />
<!-- 搜索 按钮-->
<!-- <AppSearch v-if="getShowSearch" :class="`${prefixCls}-action__item `" />-->
<ErrorAction v-if="getUseErrorHandle" :class="`${prefixCls}-action__item error-action`" />
<Notify v-if="getShowNotice" :class="`${prefixCls}-action__item notify-item`" />
<!-- 全屏 按钮-->
<!-- <FullScreen v-if="getShowFullScreen" :class="`${prefixCls}-action__item fullscreen-item`" />-->
<!-- 全屏 按钮-->
<!-- <FullScreen v-if="getShowFullScreen" :class="`${prefixCls}-action__item fullscreen-item`" />-->
<!-- 英汉翻译 按钮-->
<!-- <AppLocalePicker-->
<!-- v-if="getShowLocalePicker"-->
<!-- :reload="true"-->
<!-- :showText="false"-->
<!-- :class="`${prefixCls}-action__item`"-->
<!-- />-->
<!-- 英汉翻译 按钮-->
<!-- <AppLocalePicker-->
<!-- v-if="getShowLocalePicker"-->
<!-- :reload="true"-->
<!-- :showText="false"-->
<!-- :class="`${prefixCls}-action__item`"-->
<!-- />-->
<!-- 头像 按钮-->
<!-- 头像 按钮-->
<UserDropDown :theme="getHeaderTheme" />
<!-- 设置 按钮-->
<!-- <SettingDrawer v-if="getShowSetting" :class="`${prefixCls}-action__item`" />-->
<!-- 设置 按钮-->
<!-- <SettingDrawer v-if="getShowSetting" :class="`${prefixCls}-action__item`" />-->
</div>
</Layout.Header>
</template>
......
......@@ -105,7 +105,7 @@ export const useUserStore = defineStore({
if (!this.getToken) return null;
// 3、获取用户信息
const userInfo = await this.getUserInfoAction();
console.log('userInfo',userInfo)
console.log('userInfo', userInfo);
const sessionTimeout = this.sessionTimeout;
if (sessionTimeout) {
this.setSessionTimeout(false);
......@@ -129,8 +129,8 @@ export const useUserStore = defineStore({
async getUserInfoAction(): Promise<UserInfo | null> {
if (!this.getToken) return null;
var type = localStorage.getItem('type');
if (type === null){
type = '1'
if (type === null) {
type = '1';
}
const userInfo = await getUserInfo(type);
if (userInfo.data.roles && userInfo.data.roles.length > 0) {
......@@ -139,9 +139,9 @@ export const useUserStore = defineStore({
this.setRoleList(['ROLE_DEFAULT']);
}
// 获取动态路由下的第一个菜单路径
const firstChild = await this.getFirstChild(userInfo.data.menus[0])
const firstChild = await this.getFirstChild(userInfo.data.menus[0]);
// 登陆后进入的第一个页面
userInfo.data.homePath = firstChild
userInfo.data.homePath = firstChild;
// 设置用户信息,并存储本地缓存
this.setUserInfo(userInfo.data);
return userInfo.data;
......@@ -149,9 +149,9 @@ export const useUserStore = defineStore({
/** 获取动态路由下的第一个菜单路径*/
getFirstChild(item): Promise<any> {
if (item.children && item.children.length > 0) {
return this.getFirstChild(item.children[0])
return this.getFirstChild(item.children[0]);
} else {
return item.path
return item.path;
}
},
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment