feat: 添加管理员实验板管理界面
This commit is contained in:
@@ -9,25 +9,40 @@
|
||||
<li id="2" @click="setActivePage">
|
||||
<a :class="{ 'menu-active': activePage === 2 }">Item 2</a>
|
||||
</li>
|
||||
<li id="100" @click="setActivePage">
|
||||
<li v-if="isAdmin" id="100" @click="setActivePage">
|
||||
<a :class="{ 'menu-active': activePage === 100 }">实验板控制台</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="divider divider-horizontal h-full"></div>
|
||||
<div class="card bg-base-200 w-300"></div>
|
||||
<div class="card bg-base-200 w-300 rounded-2xl p-7">
|
||||
<div v-if="activePage === 1">
|
||||
<h2 class="card-title">用户信息</h2>
|
||||
<p>这里是用户信息页面的内容。</p>
|
||||
</div>
|
||||
<div v-else-if="activePage === 100">
|
||||
<BoardControl />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import BoardControl from "./BoardControl.vue";
|
||||
import { toNumber } from "lodash";
|
||||
import { ref } from "vue";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { AuthManager } from "@/utils/AuthManager";
|
||||
|
||||
const activePage = ref(1);
|
||||
const isAdmin = ref(false);
|
||||
|
||||
function setActivePage(event: Event) {
|
||||
const target = event.currentTarget as HTMLLinkElement;
|
||||
activePage.value = toNumber(target.id);
|
||||
}
|
||||
|
||||
onMounted(async ()=>{
|
||||
isAdmin.value = await AuthManager.verifyAdminAuth();
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user