allow user to set default index page

This commit is contained in:
GeekMaster
2025-09-09 11:11:34 +08:00
parent c8eec6c97e
commit 3d8c37cb38
3 changed files with 66 additions and 14 deletions

View File

@@ -89,6 +89,7 @@ type BaseConfig struct {
MjMode string `json:"mj_mode"` // midjourney 默认的API模式relax, fast, turbo
IndexNavs []int `json:"index_navs"` // 首页显示的导航菜单
IndexPage string `json:"index_page"` // 首页显示的页面
Copyright string `json:"copyright"` // 版权信息
ICP string `json:"icp"` // ICP 备案号
GaBeian string `json:"ga_beian"` // 公安备案号

View File

@@ -123,20 +123,25 @@ const md = new MarkdownIt({
typographer: true,
}).use(emoji)
onMounted(() => {
if (isMobile()) {
router.push('/mobile/index')
return
}
getSystemInfo()
.then((res) => {
title.value = res.data.title
logo.value = res.data.logo
const data = res.data
title.value = data.title
logo.value = data.logo
console.log(data)
if (data.index_page) {
router.push(data.index_page)
}
})
.catch((e) => {
ElMessage.error('获取系统配置失败:' + e.message)
})
onMounted(() => {
getLicenseInfo()
.then((res) => {
license.value = res.data

View File

@@ -64,7 +64,53 @@
placeholder="请选择菜单,多选"
style="width: 100%"
>
<el-option v-for="item in menus" :key="item.id" :label="item.name" :value="item.id" />
<el-option v-for="item in menus" :key="item.id" :label="item.name" :value="item.id">
<div class="flex items-center">
<i :class="'iconfont mr-2 ' + item.icon" v-if="item.icon.startsWith('icon')"></i>
<el-image
:src="item.icon"
class="rounded-lg w-10 h-10 mr-2"
alt="Geek-AI"
v-else
/>
<div>{{ item.name }}</div>
</div>
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<template #label>
<div class="label-title">
首页默认页面
<span class="text-xs text-gray-500"
>设置后用户访问首页时会自动跳转到该页面</span
>
</div>
</template>
<el-select
v-model="system['index_page']"
:filterable="true"
placeholder="请选择页面"
style="width: 100%"
value-key="url"
clearable
>
<template #prefix>
<i class="iconfont icon-home"></i>
</template>
<el-option v-for="item in menus" :key="item.id" :label="item.name" :value="item.url">
<div class="flex items-center">
<i :class="'iconfont mr-2 ' + item.icon" v-if="item.icon.startsWith('icon')"></i>
<el-image
:src="item.icon"
class="rounded-lg w-10 h-10 mr-2"
alt="Geek-AI"
v-else
/>
<div>{{ item.name }}</div>
</div>
</el-option>
</el-select>
</el-form-item>