forked from b2894lxlx/tuanwei-admin
feat(ai): 取消 AI 团宝页对纯学生隐藏「进入后台」入口
This commit is contained in:
@@ -66,21 +66,6 @@ export function hasAnyRole(value: string | string[]): boolean {
|
|||||||
return arrayHasAny(userStore?.roles, value);
|
return arrayHasAny(userStore?.roles, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 学生角色标识 */
|
|
||||||
export const STUDENT_ROLE_CODE = 'student';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否仅为学生身份(角色恰好只有 student)
|
|
||||||
*
|
|
||||||
* 与后端 BaseController#hasOnlyStudentRole 保持一致:拥有任意其他角色
|
|
||||||
* (学生干部、教师、管理员等)即视为非纯学生,不在此列。
|
|
||||||
*/
|
|
||||||
export function isOnlyStudent(): boolean {
|
|
||||||
const userStore = useUserStore();
|
|
||||||
const roles = (userStore?.roles ?? []).filter((d) => !!d);
|
|
||||||
return roles.length === 1 && roles[0] === STUDENT_ROLE_CODE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否有某些权限
|
* 是否有某些权限
|
||||||
* @param value 权限字符或字符数组
|
* @param value 权限字符或字符数组
|
||||||
|
|||||||
@@ -80,7 +80,6 @@
|
|||||||
<p class="user-name">{{ userName }}</p>
|
<p class="user-name">{{ userName }}</p>
|
||||||
<div class="footer-actions">
|
<div class="footer-actions">
|
||||||
<button
|
<button
|
||||||
v-if="showAdminEntry"
|
|
||||||
class="admin-btn"
|
class="admin-btn"
|
||||||
type="button"
|
type="button"
|
||||||
@click="goAdmin"
|
@click="goAdmin"
|
||||||
@@ -403,7 +402,6 @@ import { logout } from "@/utils/page-tab-util";
|
|||||||
import { copyText } from "@/utils/common";
|
import { copyText } from "@/utils/common";
|
||||||
import { resolveDisplayText, isFailedPayload, pickDisplayable, FAILED_TEXT } from "@/utils/ai-result";
|
import { resolveDisplayText, isFailedPayload, pickDisplayable, FAILED_TEXT } from "@/utils/ai-result";
|
||||||
import { getToken } from "@/utils/token-util";
|
import { getToken } from "@/utils/token-util";
|
||||||
import { isOnlyStudent } from "@/utils/permission";
|
|
||||||
|
|
||||||
type ChatRole = "user" | "assistant";
|
type ChatRole = "user" | "assistant";
|
||||||
type ChatMode = "chat" | "writing" | "image";
|
type ChatMode = "chat" | "writing" | "image";
|
||||||
@@ -475,11 +473,6 @@ const userName = computed(
|
|||||||
(loginUser.value.userId ? `用户${loginUser.value.userId}` : "未登录")
|
(loginUser.value.userId ? `用户${loginUser.value.userId}` : "未登录")
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否展示「进入后台」入口:纯学生身份隐藏
|
|
||||||
*/
|
|
||||||
const showAdminEntry = computed(() => !isOnlyStudent());
|
|
||||||
|
|
||||||
const canSend = computed(() => {
|
const canSend = computed(() => {
|
||||||
if (loading.value) {
|
if (loading.value) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user