|
@@ -7,15 +7,9 @@
|
|
|
<span>{{ webInfo.zhTitle }}</span>
|
|
|
</el-col>
|
|
|
<el-col :span="16" class="two">
|
|
|
- <el-button
|
|
|
- size="small"
|
|
|
- plain
|
|
|
- v-for="(item, index) in moduleList"
|
|
|
- :key="index"
|
|
|
- @click="modulePath(item)"
|
|
|
- :class="[active == item.active ? 'active' : '']"
|
|
|
- >{{ item.name }}</el-button
|
|
|
- >
|
|
|
+ <el-button plain v-for="(item, index) in moduleList" :key="index" @click="modulePath(item)" :class="[active == item.active ? 'active' : '']">{{
|
|
|
+ item.name
|
|
|
+ }}</el-button>
|
|
|
<el-dropdown @command="toDrop">
|
|
|
<el-button type="danger" plain>
|
|
|
{{ user && user._id ? user.name || user.unit_name || user.nick_name : '暂无昵称' }}
|
|
@@ -40,13 +34,13 @@ import { ArrowDown, User, SwitchButton } from '@element-plus/icons-vue';
|
|
|
import store from '@/stores/counter';
|
|
|
import { ref, onMounted } from 'vue';
|
|
|
import type { Ref } from 'vue';
|
|
|
-import { studio_style_Info } from '../../../layout/site';
|
|
|
-// import { studio_style_Info } from '@common/src/layout/site';
|
|
|
+import { studio_style_Info, project_module_menus } from '../../../layout/site';
|
|
|
const router = useRouter();
|
|
|
let webInfo = studio_style_Info.webInfo;
|
|
|
-let active: 3;
|
|
|
+let active: Ref<number> = ref(3);
|
|
|
let moduleList: Ref<any[]> = ref([]);
|
|
|
-let user: Ref<{ _id: string; name: string; unit_name: string; nick_name: string }> = ref({ _id: '', name: '', unit_name: '', nick_name: '' });
|
|
|
+let user = store.state.user as { _id: string; name: string; unit_name: string; nick_name: string; role_type: string };
|
|
|
+
|
|
|
const toDrop = (e: string) => {
|
|
|
if (e == 'logout') {
|
|
|
localStorage.removeItem('token');
|
|
@@ -55,13 +49,25 @@ const toDrop = (e: string) => {
|
|
|
router.push({ path: '/userInfo/center' });
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
// 模块跳转
|
|
|
const modulePath = (e: { path: string }) => {
|
|
|
window.location.href = `${e.path}`;
|
|
|
};
|
|
|
-onMounted(async () => {
|
|
|
- user.value = store.state.user;
|
|
|
+onMounted(() => {
|
|
|
+ search();
|
|
|
});
|
|
|
+const search = () => {
|
|
|
+ let menu = project_module_menus.filter((i: any) => i.role_type.includes(user.role_type));
|
|
|
+ if (user.role_type == '0' || user.role_type == '1') {
|
|
|
+ console.log('');
|
|
|
+ } else if (user.role_type == '2') {
|
|
|
+ if (user._id != '6417cbe06da906b0e7b19d66') menu = menu.filter((i) => i.path != '/basic');
|
|
|
+ } else if (user.role_type == '3') {
|
|
|
+ if (user._id != '6417cba86da906b0e7b19b5a') menu = menu.filter((i) => i.path != '/basic');
|
|
|
+ }
|
|
|
+ if (menu) moduleList.value = menu;
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
@@ -91,9 +97,9 @@ onMounted(async () => {
|
|
|
.el-button {
|
|
|
margin: 0 0 0 10px;
|
|
|
}
|
|
|
- .active {
|
|
|
- color: #07c4a8;
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
+.active {
|
|
|
+ color: #07c4a8;
|
|
|
+}
|
|
|
</style>
|