Explorar el Código

修复init初始化失败页面跳转到空白的错误
修复model模板string给予长度导致的初始化错误

pixel hace 3 años
padre
commit
a7bc86a431
Se han modificado 2 ficheros con 3 adiciones y 3 borrados
  1. 2 2
      server/resource/template/server/model.go.tpl
  2. 1 1
      web/src/view/init/index.vue

+ 2 - 2
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 }}
 }
 

+ 1 - 1
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