diff --git a/server/api/v1/system/sys_captcha.go b/server/api/v1/system/sys_captcha.go index f07587d560a702ffe3c9150399f344fa95ced162..8ca800e9be44c22fa03fede11c56b544537d6f1d 100644 --- a/server/api/v1/system/sys_captcha.go +++ b/server/api/v1/system/sys_captcha.go @@ -34,8 +34,9 @@ func (b *BaseApi) Captcha(c *gin.Context) { response.FailWithMessage("验证码获取失败", c) } else { response.OkWithDetailed(systemRes.SysCaptchaResponse{ - CaptchaId: id, - PicPath: b64s, + CaptchaId: id, + PicPath: b64s, + CaptchaLength: global.GVA_CONFIG.Captcha.KeyLong, }, "验证码获取成功", c) } } diff --git a/server/model/system/response/sys_captcha.go b/server/model/system/response/sys_captcha.go index 9e78035ac13dbd27d2018f350697d78cda1c254d..4d482f9cd1ce4725cb0e16f417c6d1dbca490689 100644 --- a/server/model/system/response/sys_captcha.go +++ b/server/model/system/response/sys_captcha.go @@ -1,6 +1,7 @@ package response type SysCaptchaResponse struct { - CaptchaId string `json:"captchaId"` - PicPath string `json:"picPath"` + CaptchaId string `json:"captchaId"` + PicPath string `json:"picPath"` + CaptchaLength int `json:"captchaLength""` } diff --git a/server/resource/template/web/form.vue.tpl b/server/resource/template/web/form.vue.tpl index 10fc5e39a188a0ba25763a468519cdc7c7709fda..17e31158236703057a9622d4b7085dc7d7e27302 100644 --- a/server/resource/template/web/form.vue.tpl +++ b/server/resource/template/web/form.vue.tpl @@ -61,7 +61,7 @@ export default { {{.FieldJson}}: '', {{- end }} {{- if eq .FieldType "int" }} - {{.FieldJson}}: 0, + {{.FieldJson}}: {{- if .DictType }} undefined{{ else }} 0{{- end }}, {{- end }} {{- if eq .FieldType "time.Time" }} {{.FieldJson}}: new Date(), diff --git a/server/resource/template/web/table.vue.tpl b/server/resource/template/web/table.vue.tpl index fff1db96a35a741260c41d4dd5cd10e694aff44f..2c2dde47342e2aa1e22bad93029e72abf73fe280 100644 --- a/server/resource/template/web/table.vue.tpl +++ b/server/resource/template/web/table.vue.tpl @@ -156,7 +156,7 @@ export default { {{.FieldJson}}: '', {{- end }} {{- if eq .FieldType "int" }} - {{.FieldJson}}: 0, + {{.FieldJson}}: {{- if .DictType}} undefined{{ else }} 0{{- end }}, {{- end }} {{- if eq .FieldType "time.Time" }} {{.FieldJson}}: new Date(), @@ -245,7 +245,7 @@ export default { {{.FieldJson}}: '', {{- end }} {{- if eq .FieldType "int" }} - {{.FieldJson}}: 0, + {{.FieldJson}}: {{- if .DictType }} undefined{{ else }} 0{{- end }}, {{- end }} {{- if eq .FieldType "time.Time" }} {{.FieldJson}}: new Date(), diff --git a/server/service/system/sys_dictionary.go b/server/service/system/sys_dictionary.go index 4dfc960156f55d27e470c5064cc4c701aa7d6ca1..d2be5bfefc15c2e96dd85c4f3dfbe144eb549b40 100644 --- a/server/service/system/sys_dictionary.go +++ b/server/service/system/sys_dictionary.go @@ -68,7 +68,7 @@ func (dictionaryService *DictionaryService) UpdateSysDictionary(sysDictionary *s //@return: err error, sysDictionary model.SysDictionary func (dictionaryService *DictionaryService) GetSysDictionary(Type string, Id uint) (err error, sysDictionary system.SysDictionary) { - err = global.GVA_DB.Where("type = ? OR id = ?", Type, Id).Preload("SysDictionaryDetails").First(&sysDictionary).Error + err = global.GVA_DB.Where("type = ? OR id = ? and status = ?", Type, Id, true).Preload("SysDictionaryDetails", "status = ?", true).First(&sysDictionary).Error return } diff --git a/server/source/dictionary_details.go b/server/source/dictionary_details.go index 96066a32ff1a1a7574b43f3ace061f1c1094e09c..254fbe5e03d867c7bae72b1fd01e864413c60281 100644 --- a/server/source/dictionary_details.go +++ b/server/source/dictionary_details.go @@ -41,6 +41,8 @@ func (d *dictionaryDetail) Init() error { {global.GVA_MODEL{ID: 21, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "longblob", 8, status, 8, 5}, {global.GVA_MODEL{ID: 22, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "longtext", 9, status, 9, 5}, {global.GVA_MODEL{ID: 23, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "tinyint", 0, status, 0, 6}, + {global.GVA_MODEL{ID: 24, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "男", 0, status, 0, 1}, + {global.GVA_MODEL{ID: 25, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "女", 1, status, 1, 1}, } return global.GVA_DB.Transaction(func(tx *gorm.DB) error { if tx.Where("id IN ?", []int{1, 23}).Find(&[]system.SysDictionaryDetail{}).RowsAffected == 2 { diff --git a/web/src/components/customPic/index.vue b/web/src/components/customPic/index.vue index 7463e3e4fae4ce52c6bb3c0015f135ce9bbd0134..3c052241cfa41f2def976dfae6e3148188ec9263 100644 --- a/web/src/components/customPic/index.vue +++ b/web/src/components/customPic/index.vue @@ -1,12 +1,12 @@