Skip to content

Commit da0d5d2

Browse files
author
pixel
committed
更改初始化模式
1 parent cb85f1c commit da0d5d2

File tree

3 files changed

+41
-161
lines changed

3 files changed

+41
-161
lines changed

web/src/view/init/index.vue

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
<template>
22
<div class="init_page">
33
<div class="init_page_panle">
4-
<div v-if="hello < 2" id="hello" :class="[hello < 1 ? 'slide-in-fwd-top' : 'slide-out-right']" class="hello " @click="showNext">
4+
<div v-if="hello < 2" id="hello" :class="[hello < 1 ? 'slide-in-fwd-top' : 'slide-out-right']" class="hello ">
55
<div>
66
<div class="hello_title">GIN-VUE-ADMIN</div>
7-
<p class="in-two a-fadeinT">您需要初始化您的数据库并且填充初始数据</p>
8-
<p class="init_p">点击进入初始化</p>
7+
<p class="in-two a-fadeinT">初始化须知</p>
8+
<p class="init_p">1.您需有用一定的VUE和golang基础</p>
9+
<p class="init_p">2.请您确认是否已经阅读过官方文档</p>
10+
<p class="init_p">3.请您确认是否了解后续的配置流程</p>
11+
<p class="init_btn">
12+
<el-button type="primary" @click="goDoc">
13+
阅读文档
14+
</el-button>
15+
<el-button type="primary" @click="showNext">
16+
我已确认
17+
</el-button>
18+
</p>
919
</div>
1020
</div>
1121
<div v-if="hello > 0 " :class="[(hello > 0 && !out)? 'slide-in-left' : '' , out ? 'slide-out-right' : '']" class=" form">
@@ -73,6 +83,9 @@ export default {
7383
this.hello = this.hello + 1
7484
console.log(this.hello)
7585
},
86+
goDoc() {
87+
window.open('https://www.gin-vue-admin.com')
88+
},
7689
async onSubmit() {
7790
const loading = this.$loading({
7891
lock: true,
@@ -141,6 +154,9 @@ export default {
141154
margin-top: 20px;
142155
color: #777777;
143156
}
157+
.init_btn{
158+
margin-top: 20px;
159+
}
144160
}
145161
.form{
146162
position: absolute;

web/src/view/login/index.vue

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,16 @@
4747
>
4848
</div>
4949
</el-form-item>
50+
<div />
5051
<el-form-item>
5152
<el-button
5253
type="primary"
53-
style="width: 100%"
54+
style="width: 46%"
55+
@click="checkInit"
56+
>前往初始化</el-button>
57+
<el-button
58+
type="primary"
59+
style="width: 46%;margin-left:8%"
5460
@click="submitForm"
5561
>登 录</el-button>
5662
</el-form-item>
@@ -73,6 +79,7 @@
7379
<script>
7480
import { mapActions } from 'vuex'
7581
import { captcha } from '@/api/user'
82+
import { checkDB } from '@/api/initdb'
7683
export default {
7784
name: 'Login',
7885
data() {
@@ -113,6 +120,20 @@ export default {
113120
},
114121
methods: {
115122
...mapActions('user', ['LoginIn']),
123+
async checkInit() {
124+
const res = await checkDB()
125+
if (res.code === 0) {
126+
if (res.data?.needInit) {
127+
this.$store.commit('user/NeedInit')
128+
this.$router.push({ name: 'Init' })
129+
} else {
130+
this.$message({
131+
type: 'info',
132+
message: '已配置数据库信息,无法初始化'
133+
})
134+
}
135+
}
136+
},
116137
async login() {
117138
return await this.LoginIn(this.loginForm)
118139
},

web/src/view/login/login.vue

Lines changed: 0 additions & 157 deletions
This file was deleted.

0 commit comments

Comments
 (0)