diff --git a/server/Dockerfile b/server/Dockerfile index b7f4b3a4c37b6838bcbf719aa0a5bfa1fc315bd5..0e03cd50c7101d60a5f413266484b095bddbf99d 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -5,6 +5,7 @@ COPY . . RUN go env -w GO111MODULE=on RUN go env -w GOPROXY=https://goproxy.cn,direct +RUN go env -w CGO_ENABLED=0 RUN go env RUN go mod tidy RUN go build -o server . diff --git a/server/model/system/request/sys_user.go b/server/model/system/request/sys_user.go index 84ab1ef47cec8b6429aea173961d0e646cfbb4e3..c03807e166036af93749c56069d494d76d05e1de 100644 --- a/server/model/system/request/sys_user.go +++ b/server/model/system/request/sys_user.go @@ -5,7 +5,7 @@ type Register struct { Username string `json:"userName"` Password string `json:"passWord"` NickName string `json:"nickName" gorm:"default:'QMPlusUser'"` - HeaderImg string `json:"headerImg" gorm:"default:'http://www.henrongyi.top/avatar/lufu.jpg'"` + HeaderImg string `json:"headerImg" gorm:"default:'https://qmplusimg.henrongyi.top/gva_header.jpg'"` AuthorityId string `json:"authorityId" gorm:"default:888"` AuthorityIds []string `json:"authorityIds"` } diff --git a/server/model/system/sys_user.go b/server/model/system/sys_user.go index c7fbf90e60c122deccc81c76a70f37a206f18d27..40678cd42c37c12f00ccc8867199c455c91da1af 100644 --- a/server/model/system/sys_user.go +++ b/server/model/system/sys_user.go @@ -7,15 +7,15 @@ import ( type SysUser struct { global.GVA_MODEL - UUID uuid.UUID `json:"uuid" gorm:"comment:用户UUID"` // 用户UUID - Username string `json:"userName" gorm:"comment:用户登录名"` // 用户登录名 - Password string `json:"-" gorm:"comment:用户登录密码"` // 用户登录密码 - NickName string `json:"nickName" gorm:"default:系统用户;comment:用户昵称"` // 用户昵称 - SideMode string `json:"sideMode" gorm:"default:dark;comment:用户侧边主题"` // 用户侧边主题 - HeaderImg string `json:"headerImg" gorm:"default:http://qmplusimg.henrongyi.top/head.png;comment:用户头像"` // 用户头像 - BaseColor string `json:"baseColor" gorm:"default:#fff;comment:基础颜色"` // 基础颜色 - ActiveColor string `json:"activeColor" gorm:"default:#1890ff;comment:活跃颜色"` // 活跃颜色 - AuthorityId string `json:"authorityId" gorm:"default:888;comment:用户角色ID"` // 用户角色ID + UUID uuid.UUID `json:"uuid" gorm:"comment:用户UUID"` // 用户UUID + Username string `json:"userName" gorm:"comment:用户登录名"` // 用户登录名 + Password string `json:"-" gorm:"comment:用户登录密码"` // 用户登录密码 + NickName string `json:"nickName" gorm:"default:系统用户;comment:用户昵称"` // 用户昵称 + SideMode string `json:"sideMode" gorm:"default:dark;comment:用户侧边主题"` // 用户侧边主题 + HeaderImg string `json:"headerImg" gorm:"default:https://qmplusimg.henrongyi.top/gva_header.jpg;comment:用户头像"` // 用户头像 + BaseColor string `json:"baseColor" gorm:"default:#fff;comment:基础颜色"` // 基础颜色 + ActiveColor string `json:"activeColor" gorm:"default:#1890ff;comment:活跃颜色"` // 活跃颜色 + AuthorityId string `json:"authorityId" gorm:"default:888;comment:用户角色ID"` // 用户角色ID Authority SysAuthority `json:"authority" gorm:"foreignKey:AuthorityId;references:AuthorityId;comment:用户角色"` Authorities []SysAuthority `json:"authorities" gorm:"many2many:sys_user_authority;"` } diff --git a/server/resource/template/web/table.vue.tpl b/server/resource/template/web/table.vue.tpl index 6fd337c034354b8108fb1adbd00043e9787fed82..878830c36369c2ea637638ca74b8661490cc6409 100644 --- a/server/resource/template/web/table.vue.tpl +++ b/server/resource/template/web/table.vue.tpl @@ -21,21 +21,21 @@ {{ end }}{{ end }}{{ end }} - - 查询 - 新增 - -

确定要删除吗?

-
- 取消 - 确定 -
- -
-
+
+ 查询 + 新增 + +

确定要删除吗?

+
+ 取消 + 确定 +
+ +
+
0 +} + // CreateAutoCodeHistory RouterPath : RouterPath@RouterString;RouterPath2@RouterString2 func (autoCodeHistoryService *AutoCodeHistoryService) CreateAutoCodeHistory(meta, structName, structCNName, autoCodePath string, injectionMeta string, tableName string, apiIds string) error { return global.GVA_DB.Create(&system.SysAutoCodeHistory{ diff --git a/server/service/system/sys_initdb.go b/server/service/system/sys_initdb.go index a0a768e5e2f156763a39fc48aa3766b8bf506112..45d3b7477b7e5f725f0837c4fb20d8d8821a06e0 100644 --- a/server/service/system/sys_initdb.go +++ b/server/service/system/sys_initdb.go @@ -5,6 +5,8 @@ import ( "fmt" "path/filepath" + uuid "github.com/satori/go.uuid" + "github.com/flipped-aurora/gin-vue-admin/server/config" "github.com/flipped-aurora/gin-vue-admin/server/global" "github.com/flipped-aurora/gin-vue-admin/server/model/example" @@ -33,6 +35,7 @@ func (initDBService *InitDBService) writeConfig(viper *viper.Viper, mysql config for k, v := range cs { viper.Set(k, v) } + viper.Set("jwt.signing-key", uuid.NewV4()) return viper.WriteConfig() } @@ -159,6 +162,7 @@ func (initDBService *InitDBService) InitDB(conf request.InitDB) error { global.GVA_DB = nil return err } + if err = initDBService.writeConfig(global.GVA_VP, MysqlConfig); err != nil { return err } diff --git a/server/source/admin.go b/server/source/admin.go index 3128acb05c81745e875cc3237eada25d6a21a12b..713035a1c6fec62ccec81358147e9381036b9109 100644 --- a/server/source/admin.go +++ b/server/source/admin.go @@ -16,8 +16,8 @@ var Admin = new(admin) type admin struct{} var admins = []system.SysUser{ - {GVA_MODEL: global.GVA_MODEL{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, UUID: uuid.NewV4(), Username: "admin", Password: "e10adc3949ba59abbe56e057f20f883e", NickName: "超级管理员", HeaderImg: "http://qmplusimg.henrongyi.top/gva_header.jpg", AuthorityId: "888"}, - {GVA_MODEL: global.GVA_MODEL{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, UUID: uuid.NewV4(), Username: "a303176530", Password: "3ec063004a6f31642261936a379fde3d", NickName: "QMPlusUser", HeaderImg: "http://qmplusimg.henrongyi.top/1572075907logo.png", AuthorityId: "9528"}, + {GVA_MODEL: global.GVA_MODEL{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, UUID: uuid.NewV4(), Username: "admin", Password: "e10adc3949ba59abbe56e057f20f883e", NickName: "超级管理员", HeaderImg: "https:///qmplusimg.henrongyi.top/gva_header.jpg", AuthorityId: "888"}, + {GVA_MODEL: global.GVA_MODEL{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, UUID: uuid.NewV4(), Username: "a303176530", Password: "3ec063004a6f31642261936a379fde3d", NickName: "QMPlusUser", HeaderImg: "https:///qmplusimg.henrongyi.top/1572075907logo.png", AuthorityId: "9528"}, } //@author: [SliverHorn](https://github.com/SliverHorn) diff --git a/server/source/file.go b/server/source/file.go index 59b2db14e29086500edfe114d57d4e3cd5dbb95d..964383c636041eff128f9872f04efc50814895ed 100644 --- a/server/source/file.go +++ b/server/source/file.go @@ -14,8 +14,8 @@ var File = new(file) type file struct{} var files = []example.ExaFileUploadAndDownload{ - {global.GVA_MODEL{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "10.png", "http://qmplusimg.henrongyi.top/gvalogo.png", "png", "158787308910.png"}, - {global.GVA_MODEL{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "logo.png", "http://qmplusimg.henrongyi.top/1576554439myAvatar.png", "png", "1587973709logo.png"}, + {global.GVA_MODEL{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "10.png", "https://qmplusimg.henrongyi.top/gvalogo.png", "png", "158787308910.png"}, + {global.GVA_MODEL{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "logo.png", "https://qmplusimg.henrongyi.top/1576554439myAvatar.png", "png", "1587973709logo.png"}, } //@author: [SliverHorn](https://github.com/SliverHorn) diff --git a/web/src/components/upload/image.vue b/web/src/components/upload/image.vue index fc9f6870c0e8b43fac3013f9bf1698e492408190..2283e632d6b77639d550eeaeb47bb75a7a1c5159 100644 --- a/web/src/components/upload/image.vue +++ b/web/src/components/upload/image.vue @@ -2,7 +2,6 @@ @@ -53,6 +51,13 @@ export default { }, methods: { beforeImageUpload(file) { + const isJPG = file.type === 'image/jpeg' + const isPng = file.type === 'image/png' + if (!isJPG && !isPng) { + this.$message.error('上传头像图片只能是 jpg或png 格式!') + return false + } + const isRightSize = file.size / 1024 < this.fileSize if (!isRightSize) { // 压缩 diff --git a/web/src/style/main.scss b/web/src/style/main.scss index f5da1cb469a5d6ef4ce1620976cba7cd14294e23..e3418976274df91b21ae193b12930a1f66349a0d 100644 --- a/web/src/style/main.scss +++ b/web/src/style/main.scss @@ -653,7 +653,7 @@ li { color: #fff; } .el-menu--inline { - border-left: 5px solid #2c3b41; + // border-left: 5px solid #2c3b41; } } .hideside { @@ -810,9 +810,6 @@ li { padding: 0 15px; border-left: 1px solid #ebeef5; border-right: 1px solid #ebeef5; - .demo-form-inline { - margin-bottom: 10px; - } } // table @@ -892,6 +889,14 @@ li { // upload-demo .upload-demo, .upload { + .upload-box{ + margin-bottom: 12px; + display: flex; + justify-content: flex-end; + .upload-btn{ + margin-left: 12px; + } + } background-color: $white-bg; padding: 15px; .el-upload-list__item-status-label { @@ -1019,6 +1024,7 @@ li { .main-cont.el-main { background-color: $bg-main; .menu-total { + cursor: pointer; font-size: 22px; color: #838383; margin-top: 16px; @@ -1042,7 +1048,12 @@ li { height: $height-nav-scroll; border: none; border-left: 1px solid $border-color; + border-right: 1px solid $border-color; + +.el-tabs__item{ + border-left: 0px solid $border-color; + } } + .el-tabs__item.is-active { background-color: rgba(64, 158, 255, .08); } @@ -1145,10 +1156,6 @@ $mainHight: 100vh; } } -.el-scrollbar__wrap { - padding-bottom: 17px; -} - .layout-cont { .right-box { height: $height-header; @@ -1174,10 +1181,6 @@ $mainHight: 100vh; background-color: #fff; padding: 0; } - .fl-right { - // height: $height-header; - // line-height: $height-header; - } &.el-main { overflow: auto; background: #fff; @@ -1186,6 +1189,8 @@ $mainHight: 100vh; overflow: visible; position: relative; .menu-total { + margin-left:6px; + cursor: pointer; float: left; margin-top: 10px; width: 30px; @@ -1201,7 +1206,7 @@ $mainHight: 100vh; } } .el-menu-vertical { - height: calc(100vh - 64px) !important; + height: calc(100vh - 60px) !important; visibility: auto; &:not(.el-menu--collapse) { width: 220px; @@ -1397,6 +1402,15 @@ $mainHight: 100vh; } } +.gva-btn-list{ + margin-bottom: 12px; + display: flex; + justify-content: flex-end; + .el-button+.el-button{ + margin-left: 12px; + } +} + ::-webkit-scrollbar-track-piece { background-color: #f8f8f8; } diff --git a/web/src/view/example/customer/customer.vue b/web/src/view/example/customer/customer.vue index c1043d892c205bd1e6883050d66c750d0e407b2a..942e59eba0772f552628416991e2dc6e715247e7 100644 --- a/web/src/view/example/customer/customer.vue +++ b/web/src/view/example/customer/customer.vue @@ -1,11 +1,9 @@