Browse Source

Merge pull request #525 from flipped-aurora/gva_gormv2_dev

Gva gormv2 dev
main
奇淼(piexlmax 3 years ago
committed by GitHub
parent
commit
052f13a283
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      server/resource/template/server/model.go.tpl
  2. 8
      web/.env.development
  3. 8
      web/.env.production
  4. 15
      web/src/core/config.js
  5. 4
      web/src/core/gin-vue-admin.js
  6. 7
      web/src/utils/page.js
  7. 2
      web/src/view/init/index.vue
  8. 2
      web/src/view/layout/bottomInfo/bottomInfo.vue
  9. 6
      web/src/view/layout/index.vue
  10. 31
      web/src/view/layout/search/search.vue
  11. 2
      web/src/view/login/index.vue
  12. 9916
      web/yarn.lock

4
server/resource/template/server/model.go.tpl

@ -9,9 +9,9 @@ import (
type {{.StructName}} struct {
global.GVA_MODEL {{- range .Fields}}
{{- if eq .FieldType "bool" }}
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}}{{- if .DataType -}};type:{{.DataType}}{{- if eq .FieldType "string" -}}{{- if .DataTypeLong -}}({{.DataTypeLong}}){{- end -}}{{- end -}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}{{- end -}}"`
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}}{{- if .DataType -}};type:{{.DataType}}{{- end }}"`
{{- else }}
{{.FieldName}} {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}}{{- if .DataType -}};type:{{.DataType}}{{- if eq .FieldType "string" -}}{{- if .DataTypeLong -}}({{.DataTypeLong}}){{- end -}}{{- end -}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}{{- end -}}"`
{{.FieldName}} {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}}{{- if .DataType -}};type:{{.DataType}}{{- if eq .FieldType "string" -}}{{- if .DataTypeLong -}}({{.DataTypeLong}}){{- end -}}{{- end -}};{{- if ne .FieldType "string" -}}{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}{{- end -}}{{- end -}}"`
{{- end }} {{- end }}
}

8
web/.env.development

@ -1,6 +1,6 @@
ENV = 'development'
VUE_APP_CLI_PORT = '8080'
VUE_APP_SERVER_PORT = '8888'
VUE_APP_BASE_API = '/api'
VUE_APP_BASE_PATH = 'http://127.0.0.1'
VUE_APP_CLI_PORT = 8080
VUE_APP_SERVER_PORT = 8888
VUE_APP_BASE_API = /api
VUE_APP_BASE_PATH = http://127.0.0.1

8
web/.env.production

@ -1,7 +1,7 @@
ENV = 'production'
VUE_APP_CLI_PORT = '8080'
VUE_APP_SERVER_PORT = '8888'
VUE_APP_BASE_API = '/api'
VUE_APP_CLI_PORT = 8080
VUE_APP_SERVER_PORT = 8888
VUE_APP_BASE_API = /api
#下方修改为你的线上ip
VUE_APP_BASE_PATH = 'http://8.141.61.63'
VUE_APP_BASE_PATH = http://8.141.61.63

15
web/src/core/config.js

@ -0,0 +1,15 @@
/*
* 网站配置文件
* */
const config ={
appName : 'Gin-Vue-Admin',
appLogo : 'https://www.gin-vue-admin.com/img/logo.png'
}
export default config

4
web/src/core/gin-vue-admin.js

@ -10,6 +10,10 @@ import APlayer from '@moefe/vue-aplayer'
import '../../node_modules/timeline-vuejs/dist/timeline-vuejs.css'
// 路由守卫
import Bus from '@/utils/bus'
//加载网站配置文件夹
import config from './config'
Vue.prototype.$GIN_VUE_ADMIN = config
console.log(config)
Vue.use(Bus)
Vue.use(APlayer, {
defaultCover: 'https://github.com/u3u.png',

7
web/src/utils/page.js

@ -1,8 +1,7 @@
const title = 'GIN-VUE-ADMIN'
import config from '@/core/config'
export default function getPageTitle(pageTitle) {
if (pageTitle) {
return `${pageTitle} - ${title}`
return `${pageTitle} - ${config.appName}`
}
return `${title}`
return `${config.appName}`
}

2
web/src/view/init/index.vue

@ -74,7 +74,6 @@ export default {
console.log(this.hello)
},
async onSubmit() {
this.out = true
const loading = this.$loading({
lock: true,
text: '正在初始化数据库,请稍候',
@ -84,6 +83,7 @@ export default {
try {
const res = await initDB(this.form)
if (res.code === 0) {
this.out = true
this.$message({
type: 'success',
message: res.msg

2
web/src/view/layout/bottomInfo/bottomInfo.vue

@ -3,7 +3,7 @@
<div>
<span>Powered by</span>
<span>
<a href="https://github.com/flipped-aurora/gin-vue-admin">gin-vue-admin</a>
<a href="https://github.com/flipped-aurora/gin-vue-admin">{{$GIN_VUE_ADMIN.appName}}</a>
</span>
<el-divider direction="vertical" />
<span>Copyright</span>

6
web/src/view/layout/index.vue

@ -4,8 +4,8 @@
<el-row :class="[isShadowBg?'shadowBg':'']" @click.native="changeShadow()" />
<el-aside class="main-cont main-left">
<div class="tilte">
<img alt class="logoimg" src="~@/assets/nav_logo.png">
<h2 v-if="isSider" class="tit-text">Gin-Vue-Admin</h2>
<img alt class="logoimg" :src="$GIN_VUE_ADMIN.appLogo">
<h2 v-if="isSider" class="tit-text">{{ $GIN_VUE_ADMIN.appName }}</h2>
</div>
<Aside class="aside" />
</el-aside>
@ -38,7 +38,7 @@
<Search />
<Screenfull class="screenfull" :style="{cursor:'pointer'}" />
<el-dropdown>
<span class="header-avatar">
<span class="header-avatar" style="cursor: pointer">
<CustomPic />
<span style="margin-left: 5px">{{ userInfo.nickName }}</span>
<i class="el-icon-arrow-down" />

31
web/src/view/layout/search/search.vue

@ -23,7 +23,7 @@
:style="{display:'inline-block',float:'right',width:'31px',textAlign:'left',fontSize:'16px',paddingTop:'2px'}"
class="user-box"
>
<i :style="{cursor:'pointer'}" class="el-icon-refresh" @click="$bus.$emit('reload')" />
<i :style="{cursor:'pointer'}" class="el-icon-refresh reload" :class="[reload ? 'reloading' : '']" @click="handleReload" />
</div>
<div :style="{display:'inline-block',float:'right'}" class="user-box">
<i :style="{cursor:'pointer'}" class="el-icon-search search-icon" @click="showSearch()" />
@ -39,7 +39,8 @@ export default {
data() {
return {
value: '',
show: false
show: false,
reload: false
}
},
computed: {
@ -58,7 +59,33 @@ export default {
this.$nextTick(() => {
this.$refs['search-input'].focus()
})
},
handleReload() {
this.reload = true
this.$bus.$emit('reload')
setTimeout(() => {
this.reload = false
}, 500)
}
}
}
</script>
<style scoped lang="scss">
.reload{
font-size: 17px;
&:hover{
transform: scale(1.02)
}
}
.reloading{
animation:turn 0.5s linear infinite;
}
@keyframes turn {
0%{-webkit-transform:rotate(0deg);}
25%{-webkit-transform:rotate(90deg);}
50%{-webkit-transform:rotate(180deg);}
75%{-webkit-transform:rotate(270deg);}
100%{-webkit-transform:rotate(360deg);}
}
</style>

2
web/src/view/login/index.vue

@ -3,7 +3,7 @@
<div class="login_panle">
<div class="login_panle_form">
<div class="login_panle_form_title">
<img class="login_panle_form_title_logo" src="@/assets/logo_login.png" alt=""><p class="login_panle_form_title_p">GIN-VUE-ADMIN</p>
<img class="login_panle_form_title_logo" :src="$GIN_VUE_ADMIN.appLogo" alt=""><p class="login_panle_form_title_p">{{$GIN_VUE_ADMIN.appName}}</p>
</div>
<el-form
ref="loginForm"

9916
web/yarn.lock
File diff suppressed because it is too large
View File

Loading…
Cancel
Save