2021-12-14 10:51:07 +08:00
|
|
|
|
<script lang="ts">
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: "permissionPage"
|
|
|
|
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
2021-10-16 21:17:18 +08:00
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
import { ref, unref } from "vue";
|
|
|
|
|
|
import { storageSession } from "/@/utils/storage";
|
2021-11-10 22:12:47 +08:00
|
|
|
|
|
2021-10-16 21:17:18 +08:00
|
|
|
|
let purview = ref<string>(storageSession.getItem("info").username);
|
2021-11-10 22:12:47 +08:00
|
|
|
|
|
2021-10-16 21:17:18 +08:00
|
|
|
|
function changRole() {
|
|
|
|
|
|
if (unref(purview) === "admin") {
|
|
|
|
|
|
storageSession.setItem("info", {
|
|
|
|
|
|
username: "test",
|
|
|
|
|
|
accessToken: "eyJhbGciOiJIUzUxMiJ9.test"
|
|
|
|
|
|
});
|
|
|
|
|
|
window.location.reload();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
storageSession.setItem("info", {
|
|
|
|
|
|
username: "admin",
|
|
|
|
|
|
accessToken: "eyJhbGciOiJIUzUxMiJ9.admin"
|
|
|
|
|
|
});
|
|
|
|
|
|
window.location.reload();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
2021-11-10 22:12:47 +08:00
|
|
|
|
<div>
|
2021-10-16 21:17:18 +08:00
|
|
|
|
<h4>
|
|
|
|
|
|
当前角色:
|
|
|
|
|
|
<span style="font-size: 26px">{{ purview }}</span>
|
|
|
|
|
|
<p style="color: #ffa500">
|
|
|
|
|
|
查看左侧菜单变化(系统管理),模拟后台根据不同角色返回对应路由
|
|
|
|
|
|
</p>
|
|
|
|
|
|
</h4>
|
|
|
|
|
|
<el-button type="primary" @click="changRole">切换角色</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|