revert: restore authorization management behavior

This commit is contained in:
stefanfeng
2026-09-15 15:43:23 +08:00
parent ac5a332bce
commit f4389612d1
@@ -25,7 +25,7 @@
{{ getPermissionText(permission) }} {{ getPermissionText(permission) }}
</span> </span>
</div> </div>
<p class="scheduler-note">功能已开发,当前仍在验证中;执行时段、互动间隔及各操作触发概率由运营后台统一控制。</p> <p class="scheduler-note">执行时段、互动间隔及各操作触发概率由运营后台统一控制。</p>
</div> </div>
<div class="auth-actions"> <div class="auth-actions">
<span class="auth-status" :class="squareAuthorization.status"> <span class="auth-status" :class="squareAuthorization.status">
@@ -42,18 +42,6 @@
</div> </div>
</div> </div>
<div v-for="feature in unavailableFeatures" :key="feature.id" class="auth-card unavailable-card">
<div class="auth-icon application">{{ feature.icon }}</div>
<div class="auth-info">
<h3 class="auth-name">{{ feature.name }}</h3>
<p class="auth-type">{{ feature.description }}</p>
</div>
<div class="auth-actions">
<span class="auth-status inactive">未开启</span>
<button class="auth-toggle-btn unavailable-toggle" @click="showUnavailableNotice">开启</button>
</div>
</div>
<div class="auth-card" v-for="auth in otherAuthorizations" :key="auth.id"> <div class="auth-card" v-for="auth in otherAuthorizations" :key="auth.id">
<div class="auth-icon" :class="auth.targetType">{{ getAuthIcon(auth.targetType) }}</div> <div class="auth-icon" :class="auth.targetType">{{ getAuthIcon(auth.targetType) }}</div>
<div class="auth-info"> <div class="auth-info">
@@ -91,17 +79,9 @@ const router = useRouter()
const avatarStore = useAvatarStore() const avatarStore = useAvatarStore()
const authList = ref<Authorization[]>([]) const authList = ref<Authorization[]>([])
const saving = ref(false) const saving = ref(false)
const UNAVAILABLE_MESSAGE = '该功能尚未向公众用户开放,如需使用请联系会会运营团队'
const SQUARE_INTERACTION_TARGET_ID = 'huihui-square' const SQUARE_INTERACTION_TARGET_ID = 'huihui-square'
const SQUARE_INTERACTION_PERMISSIONS = ['like', 'collect', 'comment', 'reply'] as const const SQUARE_INTERACTION_PERMISSIONS = ['like', 'collect', 'comment', 'reply'] as const
const unavailableFeatures = [
{ id: 'make-friends', name: '交友与添加好友', description: '暂未开放', icon: '👥' },
{ id: 'start-chat', name: '主动发起聊天', description: '暂未开放', icon: '💬' },
{ id: 'publish-microblog', name: '发布微播内容', description: '暂未开放', icon: '📝' },
{ id: 'browse-square', name: '浏览会会广场', description: '暂未开放', icon: '🔎' }
]
const squareAuthorization = computed<Authorization>(() => { const squareAuthorization = computed<Authorization>(() => {
return authList.value.find((item) => item.targetId === SQUARE_INTERACTION_TARGET_ID) || { return authList.value.find((item) => item.targetId === SQUARE_INTERACTION_TARGET_ID) || {
id: '', id: '',
@@ -119,11 +99,7 @@ const squareAuthorization = computed<Authorization>(() => {
}) })
const otherAuthorizations = computed(() => const otherAuthorizations = computed(() =>
authList.value.filter((item) => item.targetId !== SQUARE_INTERACTION_TARGET_ID && !isUnavailableFeature(item.targetName)) authList.value.filter((item) => item.targetId !== SQUARE_INTERACTION_TARGET_ID)
)
const isUnavailableFeature = (name: string) => unavailableFeatures.some((feature) =>
name.replace(/发布微博内容/g, '发布微播内容') === feature.name
) )
const currentAvatarId = async () => { const currentAvatarId = async () => {
@@ -175,8 +151,6 @@ const toggleExistingAuthorization = async (auth: Authorization) => {
} }
} }
const showUnavailableNotice = () => alert(UNAVAILABLE_MESSAGE)
const getAuthIcon = (type: string) => ({ user: '👤', organization: '🏢', application: '📱' }[type] || '🔑') const getAuthIcon = (type: string) => ({ user: '👤', organization: '🏢', application: '📱' }[type] || '🔑')
const getAuthTypeText = (type: string) => ({ user: '用户', organization: '组织', application: '应用' }[type] || type) const getAuthTypeText = (type: string) => ({ user: '用户', organization: '组织', application: '应用' }[type] || type)
const getAuthTargetName = (name: string) => name.replace(/发布微博内容/g, '发布微播内容') const getAuthTargetName = (name: string) => name.replace(/发布微博内容/g, '发布微播内容')
@@ -202,7 +176,6 @@ onMounted(loadAuth)
.auth-list { padding: 16px 16px 20px; display: flex; flex-direction: column; gap: 12px; } .auth-list { padding: 16px 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.auth-card { display: flex; align-items: flex-start; gap: 12px; padding: 16px; background: white; border-radius: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, .05); } .auth-card { display: flex; align-items: flex-start; gap: 12px; padding: 16px; background: white; border-radius: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, .05); }
.square-card { border: 1px solid #ffedd5; } .square-card { border: 1px solid #ffedd5; }
.unavailable-card { opacity: .78; }
.auth-icon { font-size: 24px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: #fff0e6; flex-shrink: 0; } .auth-icon { font-size: 24px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: #fff0e6; flex-shrink: 0; }
.auth-info { flex: 1; min-width: 0; } .auth-info { flex: 1; min-width: 0; }
.auth-name { font-size: 15px; font-weight: 600; margin: 0 0 4px; color: #18191c; } .auth-name { font-size: 15px; font-weight: 600; margin: 0 0 4px; color: #18191c; }
@@ -216,6 +189,5 @@ onMounted(loadAuth)
.auth-status.inactive { color: #9398ae; } .auth-status.inactive { color: #9398ae; }
.auth-toggle-btn { padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 500; cursor: pointer; border: none; background: #f97316; color: white; } .auth-toggle-btn { padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 500; cursor: pointer; border: none; background: #f97316; color: white; }
.auth-toggle-btn.revoke { color: #6b7280; background: #f3f4f6; } .auth-toggle-btn.revoke { color: #6b7280; background: #f3f4f6; }
.unavailable-toggle { background: #d1d5db; color: #4b5563; }
.auth-toggle-btn:disabled { cursor: not-allowed; opacity: .6; } .auth-toggle-btn:disabled { cursor: not-allowed; opacity: .6; }
</style> </style>