feat: 用户入口改用自有账号,管理入口只从应用托管进入

This commit is contained in:
2026-11-06 12:06:37 +08:00
parent 1eccaa0fe2
commit 1c20a9e85b
15 changed files with 170 additions and 174 deletions
+3 -3
View File
@@ -15,7 +15,7 @@ const concurrency = ref(4);
const saving = ref(false);
const loaded = ref(false);
const modeHint = hosted
? "自有账号由平台管理,用户用平台账号直接进入。大数据平台登录会显示图形验证码,失败后换一张。管理员始终从平台进入。"
? "自有账号由本系统管理。大数据平台登录会显示图形验证码,失败后换一张。管理页面从应用托管进入。"
: "自有账号登录不显示验证码。大数据平台登录会显示图形验证码,失败后换一张。管理员始终只校验本系统密码。";
function askMode(next: string) {
@@ -23,8 +23,8 @@ function askMode(next: string) {
const toPlatform = next === "nqi";
const content = hosted
? toPlatform
? "换成大数据平台账号后,用户在登录页用大数据平台账号登录,会显示图形验证码。管理员仍从平台进入。"
: "换成自有账号后,用户用平台账号直接进入,账号由平台管理。"
? "换成大数据平台账号后,用户在登录页用大数据平台账号登录,会显示图形验证码。"
: "换成自有账号后,用户用本系统账号登录。管理员可以在这里维护这些账号。"
: toPlatform
? "换成大数据平台账号后,登录页会显示图形验证码,登录失败会换一张。管理员仍只校验本系统密码。"
: "换成自有账号后,登录页不再显示验证码。";
+2 -1
View File
@@ -5,6 +5,7 @@ import type { DropdownOption } from "naive-ui";
import { EllipsisVerticalOutline } from "@vicons/ionicons5";
import Shell from "../../shell/Shell.vue";
import { api, sessionInfo } from "../../shared/http";
import { hosted } from "../../shared/installState";
import { useToast } from "../../shared/toast";
interface User { id: number; username: string; role: string }
@@ -149,7 +150,7 @@ onMounted(load);
<n-modal v-model:show="show" class="app-dialog" preset="dialog" :show-icon="false" title="添加用户" positive-text="保存" negative-text="取消" @positive-click="create">
<div class="form-row"><label>账号</label><n-input v-model:value="username" /></div>
<div class="form-row"><label>密码</label><n-input v-model:value="password" type="password" /></div>
<div class="form-row"><label>角色</label><n-select v-model:value="role" :options="[{ label: '用户', value: 'user' }, { label: '管理员', value: 'admin' }]" /></div>
<div v-if="!hosted" class="form-row"><label>角色</label><n-select v-model:value="role" :options="[{ label: '用户', value: 'user' }, { label: '管理员', value: 'admin' }]" /></div>
</n-modal>
<n-modal v-model:show="pwdShow" class="app-dialog" preset="dialog" :show-icon="false" :title="pwdUser ? `修改密码 · ${pwdUser.username}` : '修改密码'" positive-text="保存" negative-text="取消" @positive-click="savePassword">
<div class="form-row"><label>新密码</label><n-input v-model:value="pwdNext" type="password" /></div>
+3 -6
View File
@@ -1,7 +1,5 @@
<script setup lang="ts">
import { NButton } from "naive-ui";
import { basePath, platformHome } from "../../shared/base";
import { goPlatformLogin } from "../../shared/platform";
import ThemeButton from "../../shell/ThemeButton.vue";
</script>
@@ -13,11 +11,10 @@ import ThemeButton from "../../shell/ThemeButton.vue";
<div class="brand-mark" aria-hidden="true">D</div>
<h1>DecomEval</h1>
</div>
<h2 id="denied-title" class="gate-title">无权使用</h2>
<p class="gate-text">当前平台账号没有使用 DecomEval 的权限。请联系平台管理员开通,或换一个有权限的账号登录。</p>
<h2 id="denied-title" class="gate-title">请从应用托管进入管理</h2>
<p class="gate-text">管理页面不在这里登录。请回到应用托管,使用「管理」进入。</p>
<div class="gate-actions">
<n-button @click="goPlatformLogin(basePath, true)">重新登录</n-button>
<n-button type="primary" tag="a" :href="platformHome">返回平台</n-button>
<n-button type="primary" tag="a" href="/hosting">返回应用托管</n-button>
</div>
</section>
</div>
-4
View File
@@ -2,9 +2,7 @@
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from "vue";
import { useRoute, useRouter } from "vue-router";
import { NButton, NInput, NModal, NSpin } from "naive-ui";
import { basePath, platformLoginUrl } from "../../shared/base";
import { api, saveSession } from "../../shared/http";
import { hosted } from "../../shared/installState";
import { useToast } from "../../shared/toast";
import ThemeButton from "../../shell/ThemeButton.vue";
import "./login-gate.css";
@@ -15,7 +13,6 @@ const emit = defineEmits<{ done: [] }>();
const route = useRoute();
const router = useRouter();
const toast = useToast();
const adminLoginUrl = platformLoginUrl(basePath, true);
const mode = ref("local");
const username = ref("");
const password = ref("");
@@ -375,7 +372,6 @@ async function finishNqi() {
</template>
<button class="lv-go" type="submit" :disabled="busy">{{ busy ? "登录中" : "登录" }}</button>
</form>
<a v-if="hosted && mode === 'nqi'" class="lv-admin" :href="adminLoginUrl">管理员登录</a>
</section>
<n-modal v-model:show="smsRequired" :mask-closable="false" :auto-focus="false">
<div class="lv-sms-sheet" role="dialog" aria-modal="true" aria-labelledby="sms-title">