mirror of https://github.com/halo-dev/halo-admin
feat: support developer mode.
parent
7ecdd1d074
commit
39afb3d127
|
@ -1,20 +1,54 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="logo">
|
<div class="logo">
|
||||||
<router-link :to="{ name:'Dashboard' }">
|
<a
|
||||||
|
href="javascript:void(0);"
|
||||||
|
@click="onLogoClick()"
|
||||||
|
>
|
||||||
<h1 class="logo-title">Halo</h1>
|
<h1 class="logo-title">Halo</h1>
|
||||||
<h1 class="logo-sub-title">Dashboard</h1>
|
<h1
|
||||||
</router-link>
|
class="logo-sub-title"
|
||||||
|
style="padding-left: 10px;"
|
||||||
|
>Dashboard</h1>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapActions, mapGetters } from 'vuex'
|
||||||
|
import optionApi from '@/api/option'
|
||||||
export default {
|
export default {
|
||||||
name: 'Logo'
|
name: 'Logo',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
clickCount: 0,
|
||||||
|
optionsToCreate: {
|
||||||
|
developer_mode: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(['options'])
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(['loadOptions']),
|
||||||
|
onLogoClick() {
|
||||||
|
this.clickCount++
|
||||||
|
if (this.clickCount === 10) {
|
||||||
|
optionApi.save(this.optionsToCreate).then(response => {
|
||||||
|
this.loadOptions()
|
||||||
|
this.$message.success(`开发者选项已启用!`)
|
||||||
|
this.clickCount = 0
|
||||||
|
this.$router.push({ name: 'ToolList' })
|
||||||
|
})
|
||||||
|
} else if (this.clickCount >= 5) {
|
||||||
|
if (this.options.developer_mode) {
|
||||||
|
this.$message.info(`当前已启用开发者选项!`)
|
||||||
|
this.clickCount = 0
|
||||||
|
} else {
|
||||||
|
this.$message.info(`再点击 ${10 - this.clickCount} 次即可启用开发者选项!`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scope>
|
|
||||||
.logo-sub-title{
|
|
||||||
padding-left: 10px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -166,6 +166,13 @@ export const asyncRouterMap = [
|
||||||
redirect: '/system/options',
|
redirect: '/system/options',
|
||||||
meta: { title: '系统', icon: 'setting' },
|
meta: { title: '系统', icon: 'setting' },
|
||||||
children: [
|
children: [
|
||||||
|
{
|
||||||
|
path: '/system/developer/options',
|
||||||
|
name: 'DeveloperOptions',
|
||||||
|
hidden: true,
|
||||||
|
component: () => import('@/views/system/developer/DeveloperOptions'),
|
||||||
|
meta: { title: '开发者选项', hiddenHeaderContent: false }
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/system/options',
|
path: '/system/options',
|
||||||
name: 'OptionForm',
|
name: 'OptionForm',
|
||||||
|
@ -195,10 +202,6 @@ export const asyncRouterMap = [
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
/**
|
|
||||||
* 基础路由
|
|
||||||
* @type { *[] }
|
|
||||||
*/
|
|
||||||
export const constantRouterMap = [
|
export const constantRouterMap = [
|
||||||
{
|
{
|
||||||
path: '/login',
|
path: '/login',
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
import optionApi from '@/api/option'
|
import optionApi from '@/api/option'
|
||||||
const keys = [
|
const keys = [
|
||||||
'blog_url',
|
'blog_url',
|
||||||
|
'developer_mode',
|
||||||
'attachment_upload_image_preview_enable',
|
'attachment_upload_image_preview_enable',
|
||||||
'attachment_upload_max_parallel_uploads',
|
'attachment_upload_max_parallel_uploads',
|
||||||
'attachment_upload_max_files'
|
'attachment_upload_max_files'
|
||||||
|
|
|
@ -2,6 +2,30 @@
|
||||||
<div class="page-header-index-wide">
|
<div class="page-header-index-wide">
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<a-row :gutter="12">
|
<a-row :gutter="12">
|
||||||
|
<a-col
|
||||||
|
v-if="options.developer_mode"
|
||||||
|
:xl="6"
|
||||||
|
:lg="6"
|
||||||
|
:md="12"
|
||||||
|
:sm="24"
|
||||||
|
:xs="24"
|
||||||
|
:style="{ marginBottom: '12px' }"
|
||||||
|
>
|
||||||
|
<a-card
|
||||||
|
:bordered="false"
|
||||||
|
:bodyStyle="{ padding: '16px' }"
|
||||||
|
>
|
||||||
|
<div slot="title">
|
||||||
|
<a-icon type="experiment" /> 开发者选项
|
||||||
|
</div>
|
||||||
|
<p>点击进入开发者选项页面</p>
|
||||||
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
style="float:right"
|
||||||
|
@click="handleToDeveloperOptions()"
|
||||||
|
>进入</a-button>
|
||||||
|
</a-card>
|
||||||
|
</a-col>
|
||||||
<a-col
|
<a-col
|
||||||
:xl="6"
|
:xl="6"
|
||||||
:lg="6"
|
:lg="6"
|
||||||
|
@ -70,6 +94,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapGetters } from 'vuex'
|
||||||
import backupApi from '@/api/backup'
|
import backupApi from '@/api/backup'
|
||||||
import BackupDrawer from './components/BackupDrawer'
|
import BackupDrawer from './components/BackupDrawer'
|
||||||
|
|
||||||
|
@ -82,6 +107,9 @@ export default {
|
||||||
uploadHandler: backupApi.importMarkdown
|
uploadHandler: backupApi.importMarkdown
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(['options'])
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleImportMarkdown() {
|
handleImportMarkdown() {
|
||||||
this.markdownUpload = true
|
this.markdownUpload = true
|
||||||
|
@ -97,6 +125,9 @@ export default {
|
||||||
this.$message.error(`${info.file.name} 导入失败!`)
|
this.$message.error(`${info.file.name} 导入失败!`)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
handleToDeveloperOptions() {
|
||||||
|
this.$router.push({ name: 'DeveloperOptions' })
|
||||||
|
},
|
||||||
onUploadClose() {
|
onUploadClose() {
|
||||||
this.$refs.upload.handleClearFileList()
|
this.$refs.upload.handleClearFileList()
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<template>
|
||||||
|
<div class="page-header-index-wide">
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="24">
|
||||||
|
<div class="card-container">
|
||||||
|
<a-tabs type="card">
|
||||||
|
<a-tab-pane key="general">
|
||||||
|
<span slot="tab">
|
||||||
|
<a-icon type="tool" />请求追踪
|
||||||
|
</span>
|
||||||
|
请求追踪
|
||||||
|
</a-tab-pane>
|
||||||
|
</a-tabs>
|
||||||
|
</div>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in New Issue