feat: 用户管理直接开通/撤销商业认证
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 4s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 16s
Test / e2e-test (push) Successful in 48s
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 4s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 16s
Test / e2e-test (push) Successful in 48s
- 用户列表每行加💼按钮,未认证点击开通,已认证点击撤销 - 新增 /api/business-grant/{id} 端点 - 开通/撤销时通知用户 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -102,6 +102,8 @@
|
||||
<option value="editor">编辑</option>
|
||||
<option value="senior_editor">高级编辑</option>
|
||||
</select>
|
||||
<button v-if="!u.business_verified" class="btn-sm btn-outline" @click="grantBusiness(u)" title="开通商业认证">💼</button>
|
||||
<button v-else class="btn-sm btn-outline" @click="revokeBusiness(u)" title="撤销商业认证" style="opacity:0.5">💼✕</button>
|
||||
<button class="btn-sm btn-delete" @click="removeUser(u)" title="删除用户">🗑️</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -240,6 +242,36 @@ async function removeUser(user) {
|
||||
}
|
||||
}
|
||||
|
||||
async function grantBusiness(user) {
|
||||
const ok = await showConfirm(`直接为「${user.display_name || user.username}」开通商业认证?`)
|
||||
if (!ok) return
|
||||
const id = user._id || user.id
|
||||
try {
|
||||
const res = await api(`/api/business-grant/${id}`, { method: 'POST' })
|
||||
if (res.ok) {
|
||||
user.business_verified = 1
|
||||
ui.showToast('已开通商业认证')
|
||||
}
|
||||
} catch {
|
||||
ui.showToast('操作失败')
|
||||
}
|
||||
}
|
||||
|
||||
async function revokeBusiness(user) {
|
||||
const ok = await showConfirm(`撤销「${user.display_name || user.username}」的商业认证?`)
|
||||
if (!ok) return
|
||||
const id = user._id || user.id
|
||||
try {
|
||||
const res = await api(`/api/business-revoke/${id}`, { method: 'POST' })
|
||||
if (res.ok) {
|
||||
user.business_verified = 0
|
||||
ui.showToast('已撤销商业认证')
|
||||
}
|
||||
} catch {
|
||||
ui.showToast('操作失败')
|
||||
}
|
||||
}
|
||||
|
||||
async function approveTranslation(t) {
|
||||
const id = t._id || t.id
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user