Browse Source

Merge branch 'gva_gormv2_dev' of https://github.com/flipped-aurora/gin-vue-admin into gva_gormv2_dev

main
SliverHorn 4 years ago
parent
commit
aac4997238
  1. 2
      server/api/v1/sys_user.go
  2. 13
      server/cmd/datas/authority_menus.go
  3. 46
      server/cmd/datas/menus.go
  4. 2
      server/config.yaml
  5. 2
      server/config/gorm.go
  6. 48
      server/initialize/gorm.go
  7. 23
      server/initialize/logger.go
  8. 2
      server/utils/verify.go
  9. 242
      web/package-lock.json
  10. 2
      web/package.json
  11. 19
      web/src/main.js
  12. 3
      web/src/permission.js
  13. 8
      web/src/utils/page.js
  14. 187
      web/src/view/example/form/form.vue
  15. 53
      web/src/view/example/rte/rte.vue
  16. 115
      web/src/view/example/table/table.vue
  17. 40
      web/src/view/person/person.vue

2
server/api/v1/sys_user.go

@ -240,7 +240,7 @@ func DeleteUser(c *gin.Context) {
func SetUserInfo(c *gin.Context) { func SetUserInfo(c *gin.Context) {
var user model.SysUser var user model.SysUser
_ = c.ShouldBindJSON(&user) _ = c.ShouldBindJSON(&user)
if err := utils.Verify(user, utils.SetUserVerify); err != nil {
if err := utils.Verify(user, utils.IdVerify); err != nil {
response.FailWithMessage(err.Error(), c) response.FailWithMessage(err.Error(), c)
return return
} }

13
server/cmd/datas/authority_menus.go

@ -41,17 +41,9 @@ var AuthorityMenus = []SysAuthorityMenus{
{"888", 27}, {"888", 27},
{"888", 28}, {"888", 28},
{"888", 29}, {"888", 29},
{"888", 30},
{"888", 31},
{"888", 32},
{"888", 33},
{"8881", 1}, {"8881", 1},
{"8881", 2}, {"8881", 2},
{"8881", 8}, {"8881", 8},
{"8881", 17},
{"8881", 18},
{"8881", 19},
{"8881", 20},
{"9528", 1}, {"9528", 1},
{"9528", 2}, {"9528", 2},
{"9528", 3}, {"9528", 3},
@ -64,13 +56,10 @@ var AuthorityMenus = []SysAuthorityMenus{
{"9528", 10}, {"9528", 10},
{"9528", 11}, {"9528", 11},
{"9528", 12}, {"9528", 12},
{"9528", 13},
{"9528", 14}, {"9528", 14},
{"9528", 15}, {"9528", 15},
{"9528", 16},
{"9528", 17}, {"9528", 17},
{"9528", 18},
{"9528", 19},
{"9528", 20},
} }
func InitSysAuthorityMenus(db *gorm.DB) { func InitSysAuthorityMenus(db *gorm.DB) {

46
server/cmd/datas/menus.go

@ -20,35 +20,31 @@ var BaseMenus = []model.SysBaseMenu{
{GVA_MODEL: global.GVA_MODEL{ID: 7, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "user", Name: "user", Component: "view/superAdmin/user/user.vue", Sort: 4, Meta: model.Meta{Title: "用户管理", Icon: "coordinate"}}, {GVA_MODEL: global.GVA_MODEL{ID: 7, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "user", Name: "user", Component: "view/superAdmin/user/user.vue", Sort: 4, Meta: model.Meta{Title: "用户管理", Icon: "coordinate"}},
{GVA_MODEL: global.GVA_MODEL{ID: 8, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: true, ParentId: "0", Path: "person", Name: "person", Component: "view/person/person.vue", Sort: 4, Meta: model.Meta{Title: "个人信息", Icon: "message-solid"}}, {GVA_MODEL: global.GVA_MODEL{ID: 8, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: true, ParentId: "0", Path: "person", Name: "person", Component: "view/person/person.vue", Sort: 4, Meta: model.Meta{Title: "个人信息", Icon: "message-solid"}},
{GVA_MODEL: global.GVA_MODEL{ID: 9, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "0", Path: "example", Name: "example", Component: "view/example/index.vue", Sort: 6, Meta: model.Meta{Title: "示例文件", Icon: "s-management"}}, {GVA_MODEL: global.GVA_MODEL{ID: 9, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "0", Path: "example", Name: "example", Component: "view/example/index.vue", Sort: 6, Meta: model.Meta{Title: "示例文件", Icon: "s-management"}},
{GVA_MODEL: global.GVA_MODEL{ID: 10, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "table", Name: "table", Component: "view/example/table/table.vue", Sort: 1, Meta: model.Meta{Title: "表格示例", Icon: "s-order"}},
{GVA_MODEL: global.GVA_MODEL{ID: 11, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "form", Name: "form", Component: "view/example/form/form.vue", Sort: 2, Meta: model.Meta{Title: "表单示例", Icon: "document"}},
{GVA_MODEL: global.GVA_MODEL{ID: 12, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "rte", Name: "rte", Component: "view/example/rte/rte.vue", Sort: 3, Meta: model.Meta{Title: "富文本编辑器", Icon: "reading"}},
{GVA_MODEL: global.GVA_MODEL{ID: 13, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "excel", Name: "excel", Component: "view/example/excel/excel.vue", Sort: 4, Meta: model.Meta{Title: "excel导入导出", Icon: "s-marketing"}},
{GVA_MODEL: global.GVA_MODEL{ID: 14, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "upload", Name: "upload", Component: "view/example/upload/upload.vue", Sort: 5, Meta: model.Meta{Title: "上传下载", Icon: "upload"}},
{GVA_MODEL: global.GVA_MODEL{ID: 15, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "breakpoint", Name: "breakpoint", Component: "view/example/breakpoint/breakpoint.vue", Sort: 6, Meta: model.Meta{Title: "断点续传", Icon: "upload"}},
{GVA_MODEL: global.GVA_MODEL{ID: 16, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "customer", Name: "customer", Component: "view/example/customer/customer.vue", Sort: 7, Meta: model.Meta{Title: "客户列表(资源示例)", Icon: "s-custom"}},
{GVA_MODEL: global.GVA_MODEL{ID: 17, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "0", Path: "systemTools", Name: "systemTools", Component: "view/systemTools/index.vue", Sort: 5, Meta: model.Meta{Title: "系统工具", Icon: "s-cooperation"}},
{GVA_MODEL: global.GVA_MODEL{ID: 18, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "17", Path: "autoCode", Name: "autoCode", Component: "view/systemTools/autoCode/index.vue", Sort: 1, Meta: model.Meta{Title: "代码生成器", Icon: "cpu", KeepAlive: true}},
{GVA_MODEL: global.GVA_MODEL{ID: 19, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "17", Path: "formCreate", Name: "formCreate", Component: "view/systemTools/formCreate/index.vue", Sort: 2, Meta: model.Meta{Title: "表单生成器", Icon: "magic-stick", KeepAlive: true}},
{GVA_MODEL: global.GVA_MODEL{ID: 20, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "17", Path: "system", Name: "system", Component: "view/systemTools/system/system.vue", Sort: 3, Meta: model.Meta{Title: "系统配置", Icon: "s-operation"}},
{GVA_MODEL: global.GVA_MODEL{ID: 21, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "0", Path: "iconList", Name: "iconList", Component: "view/iconList/index.vue", Sort: 2, Meta: model.Meta{Title: "图标集合", Icon: "star-on"}},
{GVA_MODEL: global.GVA_MODEL{ID: 22, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "dictionary", Name: "dictionary", Component: "view/superAdmin/dictionary/sysDictionary.vue", Sort: 5, Meta: model.Meta{Title: "字典管理", Icon: "notebook-2"}},
{GVA_MODEL: global.GVA_MODEL{ID: 23, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: true, ParentId: "3", Path: "dictionaryDetail/:id", Name: "dictionaryDetail", Component: "view/superAdmin/dictionary/sysDictionaryDetail.vue", Sort: 1, Meta: model.Meta{Title: "字典详情", Icon: "s-order"}},
{GVA_MODEL: global.GVA_MODEL{ID: 24, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "operation", Name: "operation", Component: "view/superAdmin/operation/sysOperationRecord.vue", Sort: 6, Meta: model.Meta{Title: "操作历史", Icon: "time"}},
{GVA_MODEL: global.GVA_MODEL{ID: 25, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "simpleUploader", Name: "simpleUploader", Component: "view/example/simpleUploader/simpleUploader", Sort: 6, Meta: model.Meta{Title: "断点续传(插件版)", Icon: "upload"}},
{GVA_MODEL: global.GVA_MODEL{ID: 26, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "0", Path: "https://www.gin-vue-admin.com", Name: "https://www.gin-vue-admin.com", Hidden: false, Component: "/", Sort: 0, Meta: model.Meta{Title: "官方网站", Icon: "s-home"}},
{GVA_MODEL: global.GVA_MODEL{ID: 27, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "0", Path: "state", Name: "state", Hidden: false, Component: "view/system/state.vue", Sort: 6, Meta: model.Meta{Title: "服务器状态", Icon: "cloudy"}},
{GVA_MODEL: global.GVA_MODEL{ID: 28, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "0", Path: "workflow", Name: "workflow", Hidden: false, Component: "view/workflow/index.vue", Sort: 5, Meta: model.Meta{Title: "工作流功能", Icon: "phone"}},
{GVA_MODEL: global.GVA_MODEL{ID: 29, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "28", Path: "workflowCreate", Name: "workflowCreate", Hidden: false, Component: "view/workflow/workflowCreate/workflowCreate.vue", Sort: 0, Meta: model.Meta{Title: "工作流绘制", Icon: "circle-plus"}},
{GVA_MODEL: global.GVA_MODEL{ID: 30, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "28", Path: "workflowProcess", Name: "workflowProcess", Hidden: false, Component: "view/workflow/workflowProcess/workflowProcess.vue", Sort: 0, Meta: model.Meta{Title: "工作流列表", Icon: "s-cooperation"}},
{GVA_MODEL: global.GVA_MODEL{ID: 31, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "28", Path: "workflowUse", Name: "workflowUse", Hidden: true, Component: "view/workflow/workflowUse/workflowUse.vue", Sort: 0, Meta: model.Meta{Title: "使用工作流", Icon: "video-play"}},
{GVA_MODEL: global.GVA_MODEL{ID: 32, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "28", Path: "started", Name: "started", Hidden: false, Component: "view/workflow/userList/started.vue", Sort: 0, Meta: model.Meta{Title: "我发起的", Icon: "s-order"}},
{GVA_MODEL: global.GVA_MODEL{ID: 33, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "28", Path: "need", Name: "need", Hidden: false, Component: "view/workflow/userList/need.vue", Sort: 0, Meta: model.Meta{Title: "我的待办", Icon: "s-platform"}},
{GVA_MODEL: global.GVA_MODEL{ID: 10, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "excel", Name: "excel", Component: "view/example/excel/excel.vue", Sort: 4, Meta: model.Meta{Title: "excel导入导出", Icon: "s-marketing"}},
{GVA_MODEL: global.GVA_MODEL{ID: 11, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "upload", Name: "upload", Component: "view/example/upload/upload.vue", Sort: 5, Meta: model.Meta{Title: "上传下载", Icon: "upload"}},
{GVA_MODEL: global.GVA_MODEL{ID: 12, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "breakpoint", Name: "breakpoint", Component: "view/example/breakpoint/breakpoint.vue", Sort: 6, Meta: model.Meta{Title: "断点续传", Icon: "upload"}},
{GVA_MODEL: global.GVA_MODEL{ID: 13, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "customer", Name: "customer", Component: "view/example/customer/customer.vue", Sort: 7, Meta: model.Meta{Title: "客户列表(资源示例)", Icon: "s-custom"}},
{GVA_MODEL: global.GVA_MODEL{ID: 14, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "0", Path: "systemTools", Name: "systemTools", Component: "view/systemTools/index.vue", Sort: 5, Meta: model.Meta{Title: "系统工具", Icon: "s-cooperation"}},
{GVA_MODEL: global.GVA_MODEL{ID: 15, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "14", Path: "autoCode", Name: "autoCode", Component: "view/systemTools/autoCode/index.vue", Sort: 1, Meta: model.Meta{Title: "代码生成器", Icon: "cpu", KeepAlive: true}},
{GVA_MODEL: global.GVA_MODEL{ID: 16, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "14", Path: "formCreate", Name: "formCreate", Component: "view/systemTools/formCreate/index.vue", Sort: 2, Meta: model.Meta{Title: "表单生成器", Icon: "magic-stick", KeepAlive: true}},
{GVA_MODEL: global.GVA_MODEL{ID: 17, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "14", Path: "system", Name: "system", Component: "view/systemTools/system/system.vue", Sort: 3, Meta: model.Meta{Title: "系统配置", Icon: "s-operation"}},
{GVA_MODEL: global.GVA_MODEL{ID: 18, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "dictionary", Name: "dictionary", Component: "view/superAdmin/dictionary/sysDictionary.vue", Sort: 5, Meta: model.Meta{Title: "字典管理", Icon: "notebook-2"}},
{GVA_MODEL: global.GVA_MODEL{ID: 19, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: true, ParentId: "3", Path: "dictionaryDetail/:id", Name: "dictionaryDetail", Component: "view/superAdmin/dictionary/sysDictionaryDetail.vue", Sort: 1, Meta: model.Meta{Title: "字典详情", Icon: "s-order"}},
{GVA_MODEL: global.GVA_MODEL{ID: 20, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "operation", Name: "operation", Component: "view/superAdmin/operation/sysOperationRecord.vue", Sort: 6, Meta: model.Meta{Title: "操作历史", Icon: "time"}},
{GVA_MODEL: global.GVA_MODEL{ID: 21, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "simpleUploader", Name: "simpleUploader", Component: "view/example/simpleUploader/simpleUploader", Sort: 6, Meta: model.Meta{Title: "断点续传(插件版)", Icon: "upload"}},
{GVA_MODEL: global.GVA_MODEL{ID: 22, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "0", Path: "https://www.gin-vue-admin.com", Name: "https://www.gin-vue-admin.com", Hidden: false, Component: "/", Sort: 0, Meta: model.Meta{Title: "官方网站", Icon: "s-home"}},
{GVA_MODEL: global.GVA_MODEL{ID: 23, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "0", Path: "state", Name: "state", Hidden: false, Component: "view/system/state.vue", Sort: 6, Meta: model.Meta{Title: "服务器状态", Icon: "cloudy"}},
{GVA_MODEL: global.GVA_MODEL{ID: 24, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "0", Path: "workflow", Name: "workflow", Hidden: false, Component: "view/workflow/index.vue", Sort: 5, Meta: model.Meta{Title: "工作流功能", Icon: "phone"}},
{GVA_MODEL: global.GVA_MODEL{ID: 25, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "24", Path: "workflowCreate", Name: "workflowCreate", Hidden: false, Component: "view/workflow/workflowCreate/workflowCreate.vue", Sort: 0, Meta: model.Meta{Title: "工作流绘制", Icon: "circle-plus"}},
{GVA_MODEL: global.GVA_MODEL{ID: 26, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "24", Path: "workflowProcess", Name: "workflowProcess", Hidden: false, Component: "view/workflow/workflowProcess/workflowProcess.vue", Sort: 0, Meta: model.Meta{Title: "工作流列表", Icon: "s-cooperation"}},
{GVA_MODEL: global.GVA_MODEL{ID: 27, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "24", Path: "workflowUse", Name: "workflowUse", Hidden: true, Component: "view/workflow/workflowUse/workflowUse.vue", Sort: 0, Meta: model.Meta{Title: "使用工作流", Icon: "video-play"}},
{GVA_MODEL: global.GVA_MODEL{ID: 28, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "24", Path: "started", Name: "started", Hidden: false, Component: "view/workflow/userList/started.vue", Sort: 0, Meta: model.Meta{Title: "我发起的", Icon: "s-order"}},
{GVA_MODEL: global.GVA_MODEL{ID: 29, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "24", Path: "need", Name: "need", Hidden: false, Component: "view/workflow/userList/need.vue", Sort: 0, Meta: model.Meta{Title: "我的待办", Icon: "s-platform"}},
} }
func InitSysBaseMenus(db *gorm.DB) { func InitSysBaseMenus(db *gorm.DB) {
if err := db.Transaction(func(tx *gorm.DB) error { if err := db.Transaction(func(tx *gorm.DB) error {
if tx.Where("id IN ?", []int{1, 27}).Find(&[]model.SysBaseMenu{}).RowsAffected == 2 {
if tx.Where("id IN ?", []int{1, 23}).Find(&[]model.SysBaseMenu{}).RowsAffected == 2 {
color.Danger.Println("sys_base_menus表的初始数据已存在!") color.Danger.Println("sys_base_menus表的初始数据已存在!")
return nil return nil
} }

2
server/config.yaml

@ -60,7 +60,7 @@ mysql:
max-idle-conns: 10 max-idle-conns: 10
max-open-conns: 100 max-open-conns: 100
log-mode: false log-mode: false
log-zap: false
log-zap: ""
# local configuration # local configuration
local: local:

2
server/config/gorm.go

@ -9,5 +9,5 @@ type Mysql struct {
MaxIdleConns int `mapstructure:"max-idle-conns" json:"maxIdleConns" yaml:"max-idle-conns"` MaxIdleConns int `mapstructure:"max-idle-conns" json:"maxIdleConns" yaml:"max-idle-conns"`
MaxOpenConns int `mapstructure:"max-open-conns" json:"maxOpenConns" yaml:"max-open-conns"` MaxOpenConns int `mapstructure:"max-open-conns" json:"maxOpenConns" yaml:"max-open-conns"`
LogMode bool `mapstructure:"log-mode" json:"logMode" yaml:"log-mode"` LogMode bool `mapstructure:"log-mode" json:"logMode" yaml:"log-mode"`
LogZap bool `mapstructure:"log-zap" json:"logZap" yaml:"log-zap"`
LogZap string `mapstructure:"log-zap" json:"logZap" yaml:"log-zap"`
} }

48
server/initialize/gorm.go

@ -10,7 +10,11 @@ import (
"os" "os"
) )
// Gorm 初始化数据库并产生数据库全局变量
//@author: SliverHorn
//@function: Gorm
//@description: 初始化数据库并产生数据库全局变量
//@return: *gorm.DB
func Gorm() *gorm.DB { func Gorm() *gorm.DB {
switch global.GVA_CONFIG.System.DbType { switch global.GVA_CONFIG.System.DbType {
case "mysql": case "mysql":
@ -20,7 +24,12 @@ func Gorm() *gorm.DB {
} }
} }
// MysqlTables 注册数据库表专用
// MysqlTables
//@author: SliverHorn
//@function: MysqlTables
//@description: 注册数据库表专用
//@param: db *gorm.DB
func MysqlTables(db *gorm.DB) { func MysqlTables(db *gorm.DB) {
err := db.AutoMigrate( err := db.AutoMigrate(
model.SysUser{}, model.SysUser{},
@ -52,7 +61,12 @@ func MysqlTables(db *gorm.DB) {
global.GVA_LOG.Info("register table success") global.GVA_LOG.Info("register table success")
} }
// GormMysql 初始化Mysql数据库
//
//@author: SliverHorn
//@function: GormMysql
//@description: 初始化Mysql数据库
//@return: *gorm.DB
func GormMysql() *gorm.DB { func GormMysql() *gorm.DB {
m := global.GVA_CONFIG.Mysql m := global.GVA_CONFIG.Mysql
dsn := m.Username + ":" + m.Password + "@tcp(" + m.Path + ")/" + m.Dbname + "?" + m.Config dsn := m.Username + ":" + m.Password + "@tcp(" + m.Path + ")/" + m.Dbname + "?" + m.Config
@ -76,14 +90,35 @@ func GormMysql() *gorm.DB {
} }
} }
// gormConfig 根据配置决定是否开启日志
//@author: SliverHorn
//@function: gormConfig
//@description: 根据配置决定是否开启日志
//@param: mod bool
//@return: *gorm.Config
func gormConfig(mod bool) *gorm.Config { func gormConfig(mod bool) *gorm.Config {
if global.GVA_CONFIG.Mysql.LogZap {
switch global.GVA_CONFIG.Mysql.LogZap {
case "Silent":
return &gorm.Config{ return &gorm.Config{
Logger: Default.LogMode(logger.Info),
Logger: Default.LogMode(logger.Silent),
DisableForeignKeyConstraintWhenMigrating: true,
}
case "Error":
return &gorm.Config{
Logger: Default.LogMode(logger.Error),
DisableForeignKeyConstraintWhenMigrating: true, DisableForeignKeyConstraintWhenMigrating: true,
} }
case "Warn":
return &gorm.Config{
Logger: Default.LogMode(logger.Warn),
DisableForeignKeyConstraintWhenMigrating: true,
}
case "Info":
return &gorm.Config{
Logger: Default.LogMode(logger.Info),
DisableForeignKeyConstraintWhenMigrating: true,
} }
default:
if mod { if mod {
return &gorm.Config{ return &gorm.Config{
Logger: logger.Default.LogMode(logger.Info), Logger: logger.Default.LogMode(logger.Info),
@ -96,3 +131,4 @@ func gormConfig(mod bool) *gorm.Config {
} }
} }
} }
}

23
server/initialize/logger.go

@ -14,8 +14,8 @@ import (
) )
var ( var (
Discard = New(log.New(ioutil.Discard, "", log.LstdFlags), GormConfig{})
Default = New(log.New(os.Stdout, "\r\n", log.LstdFlags), GormConfig{
Discard = New(log.New(ioutil.Discard, "", log.LstdFlags), log.New(ioutil.Discard, "", log.LstdFlags), GormConfig{})
Default = New(log.New(os.Stdout, "\r\n", log.LstdFlags), log.New(os.Stdout, "\r\n", log.LstdFlags), GormConfig{
SlowThreshold: 200 * time.Millisecond, SlowThreshold: 200 * time.Millisecond,
LogLevel: logger.Warn, LogLevel: logger.Warn,
Colorful: true, Colorful: true,
@ -31,7 +31,7 @@ type traceRecorder struct {
Err error Err error
} }
func New(writer Writer, config GormConfig) logger.Interface {
func New(writer Writer, gormWriter logger.Writer, config GormConfig) logger.Interface {
var ( var (
infoStr = "%s\n[info] " infoStr = "%s\n[info] "
warnStr = "%s\n[warn] " warnStr = "%s\n[warn] "
@ -52,6 +52,7 @@ func New(writer Writer, config GormConfig) logger.Interface {
return &GormLogger{ return &GormLogger{
Writer: writer, Writer: writer,
gormWriter: gormWriter,
GormConfig: config, GormConfig: config,
infoStr: infoStr, infoStr: infoStr,
warnStr: warnStr, warnStr: warnStr,
@ -75,6 +76,7 @@ type GormConfig struct {
type GormLogger struct { type GormLogger struct {
Writer Writer
gormWriter logger.Writer
GormConfig GormConfig
infoStr, warnStr, errStr string infoStr, warnStr, errStr string
traceStr, traceErrStr, traceWarnStr string traceStr, traceErrStr, traceWarnStr string
@ -135,6 +137,7 @@ func (g *GormLogger) Trace(ctx context.Context, begin time.Time, fc func() (stri
} }
func (g *GormLogger) Printf(message string, data ...interface{}) { func (g *GormLogger) Printf(message string, data ...interface{}) {
if global.GVA_CONFIG.Mysql.LogZap == "Info" && !global.GVA_CONFIG.Mysql.LogMode {
switch len(data) { switch len(data) {
case 0: case 0:
global.GVA_LOG.Info(message) global.GVA_LOG.Info(message)
@ -147,4 +150,18 @@ func (g *GormLogger) Printf(message string, data ...interface{}) {
case 4: case 4:
global.GVA_LOG.Info("gorm", zap.Any("src", data[0]), zap.Any("duration", data[1]), zap.Any("rows", data[2]), zap.Any("sql", data[3])) global.GVA_LOG.Info("gorm", zap.Any("src", data[0]), zap.Any("duration", data[1]), zap.Any("rows", data[2]), zap.Any("sql", data[3]))
} }
return
}
switch len(data) {
case 0:
g.gormWriter.Printf(message, "")
case 1:
g.gormWriter.Printf(message, data[0].(string))
case 2:
g.gormWriter.Printf(message, data[0].(string), data[1].(float64))
case 3:
g.gormWriter.Printf(message, data[0].(string), data[1].(float64), data[2].(string))
case 4:
g.gormWriter.Printf(message, data[0].(string), data[1].(float64), data[2].(string), data[3].(string))
}
} }

2
server/utils/verify.go

@ -6,12 +6,10 @@ var (
MenuVerify = Rules{"Path": {NotEmpty()}, "ParentId": {NotEmpty()}, "Name": {NotEmpty()}, "Component": {NotEmpty()}, "Sort": {Ge("0")}} MenuVerify = Rules{"Path": {NotEmpty()}, "ParentId": {NotEmpty()}, "Name": {NotEmpty()}, "Component": {NotEmpty()}, "Sort": {Ge("0")}}
MenuMetaVerify = Rules{"Title": {NotEmpty()}} MenuMetaVerify = Rules{"Title": {NotEmpty()}}
LoginVerify = Rules{"CaptchaId": {NotEmpty()}, "Captcha": {NotEmpty()}, "Username": {NotEmpty()}, "Password": {NotEmpty()}} LoginVerify = Rules{"CaptchaId": {NotEmpty()}, "Captcha": {NotEmpty()}, "Username": {NotEmpty()}, "Password": {NotEmpty()}}
SetUserVerify = Rules{"ID": {NotEmpty()}, "Username": {NotEmpty()}, "NickName": {NotEmpty()}, "HeaderImg": {NotEmpty()}}
RegisterVerify = Rules{"Username": {NotEmpty()}, "NickName": {NotEmpty()}, "Password": {NotEmpty()}, "AuthorityId": {NotEmpty()}} RegisterVerify = Rules{"Username": {NotEmpty()}, "NickName": {NotEmpty()}, "Password": {NotEmpty()}, "AuthorityId": {NotEmpty()}}
PageInfoVerify = Rules{"Page": {NotEmpty()}, "PageSize": {NotEmpty()}} PageInfoVerify = Rules{"Page": {NotEmpty()}, "PageSize": {NotEmpty()}}
CustomerVerify = Rules{"CustomerName": {NotEmpty()}, "CustomerPhoneData": {NotEmpty()}} CustomerVerify = Rules{"CustomerName": {NotEmpty()}, "CustomerPhoneData": {NotEmpty()}}
AutoCodeVerify = Rules{"Abbreviation": {NotEmpty()}, "StructName": {NotEmpty()}, "PackageName": {NotEmpty()}, "Fields": {NotEmpty()}} AutoCodeVerify = Rules{"Abbreviation": {NotEmpty()}, "StructName": {NotEmpty()}, "PackageName": {NotEmpty()}, "Fields": {NotEmpty()}}
WorkFlowVerify = Rules{"WorkflowNickName": {NotEmpty()}, "WorkflowName": {NotEmpty()}, "WorkflowDescription": {NotEmpty()}, "WorkflowStepInfo": {NotEmpty()}}
AuthorityVerify = Rules{"AuthorityId": {NotEmpty()}, "AuthorityName": {NotEmpty()}, "ParentId": {NotEmpty()}} AuthorityVerify = Rules{"AuthorityId": {NotEmpty()}, "AuthorityName": {NotEmpty()}, "ParentId": {NotEmpty()}}
AuthorityIdVerify = Rules{"AuthorityId": {NotEmpty()}} AuthorityIdVerify = Rules{"AuthorityId": {NotEmpty()}}
OldAuthorityVerify = Rules{"OldAuthorityId": {NotEmpty()}} OldAuthorityVerify = Rules{"OldAuthorityId": {NotEmpty()}}

242
web/package-lock.json

@ -3449,6 +3449,13 @@
"integrity": "sha1-6Bj9ac5cz8tARZT4QpY79TFkzDc=", "integrity": "sha1-6Bj9ac5cz8tARZT4QpY79TFkzDc=",
"dev": true "dev": true
}, },
"emojis-list": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz",
"integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==",
"dev": true,
"optional": true
},
"fast-deep-equal": { "fast-deep-equal": {
"version": "3.1.3", "version": "3.1.3",
"resolved": "https://registry.npm.taobao.org/fast-deep-equal/download/fast-deep-equal-3.1.3.tgz?cache=0&sync_timestamp=1591599659970&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffast-deep-equal%2Fdownload%2Ffast-deep-equal-3.1.3.tgz", "resolved": "https://registry.npm.taobao.org/fast-deep-equal/download/fast-deep-equal-3.1.3.tgz?cache=0&sync_timestamp=1591599659970&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffast-deep-equal%2Fdownload%2Ffast-deep-equal-3.1.3.tgz",
@ -3476,12 +3483,31 @@
"path-exists": "^4.0.0" "path-exists": "^4.0.0"
} }
}, },
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/is-fullwidth-code-point/download/is-fullwidth-code-point-3.0.0.tgz", "resolved": "https://registry.npm.taobao.org/is-fullwidth-code-point/download/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0=", "integrity": "sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0=",
"dev": true "dev": true
}, },
"loader-utils": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
"integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
"dev": true,
"optional": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^2.1.2"
}
},
"locate-path": { "locate-path": {
"version": "5.0.0", "version": "5.0.0",
"resolved": "https://registry.npm.taobao.org/locate-path/download/locate-path-5.0.0.tgz", "resolved": "https://registry.npm.taobao.org/locate-path/download/locate-path-5.0.0.tgz",
@ -3647,6 +3673,16 @@
"ansi-regex": "^5.0.0" "ansi-regex": "^5.0.0"
} }
}, },
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
},
"terser": { "terser": {
"version": "4.8.0", "version": "4.8.0",
"resolved": "https://registry.npm.taobao.org/terser/download/terser-4.8.0.tgz?cache=0&sync_timestamp=1599751633316&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fterser%2Fdownload%2Fterser-4.8.0.tgz", "resolved": "https://registry.npm.taobao.org/terser/download/terser-4.8.0.tgz?cache=0&sync_timestamp=1599751633316&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fterser%2Fdownload%2Fterser-4.8.0.tgz",
@ -3685,6 +3721,31 @@
"punycode": "^2.1.1" "punycode": "^2.1.1"
} }
}, },
"vue-loader-v16": {
"version": "npm:vue-loader@16.1.1",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.1.1.tgz",
"integrity": "sha512-wz/+HFg/3SBayHWAlZXARcnDTl3VOChrfW9YnxvAweiuyKX/7IGx1ad/4yJHmwhgWlOVYMAbTiI7GV8G33PfGQ==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
},
"dependencies": {
"chalk": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
"integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
}
}
},
"wrap-ansi": { "wrap-ansi": {
"version": "6.2.0", "version": "6.2.0",
"resolved": "https://registry.npm.taobao.org/wrap-ansi/download/wrap-ansi-6.2.0.tgz", "resolved": "https://registry.npm.taobao.org/wrap-ansi/download/wrap-ansi-6.2.0.tgz",
@ -8846,12 +8907,8 @@
"highlight.js": { "highlight.js": {
"version": "9.15.10", "version": "9.15.10",
"resolved": "https://registry.npm.taobao.org/highlight.js/download/highlight.js-9.15.10.tgz", "resolved": "https://registry.npm.taobao.org/highlight.js/download/highlight.js-9.15.10.tgz",
"integrity": "sha1-exjtdckDSMBF7vntCMoTGaIhmtI="
},
"highlight.js-async-webpack": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/highlight.js-async-webpack/-/highlight.js-async-webpack-1.0.4.tgz",
"integrity": "sha1-wGtnv5nwSQRdYrdW5YVbCRLsYWw="
"integrity": "sha1-exjtdckDSMBF7vntCMoTGaIhmtI=",
"dev": true
}, },
"hmac-drbg": { "hmac-drbg": {
"version": "1.0.1", "version": "1.0.1",
@ -10230,15 +10287,6 @@
"object-visit": "^1.0.0" "object-visit": "^1.0.0"
} }
}, },
"mavon-editor": {
"version": "2.7.7",
"resolved": "https://registry.npmjs.org/mavon-editor/-/mavon-editor-2.7.7.tgz",
"integrity": "sha512-lXnYe+dztKepbv8bi2nedRqG/AwyUDF8gmkv9lHD3fpVJ1+pzAS6YILRIryKCvO9qPIOPEThHsda2DxtlzRsZA==",
"requires": {
"highlight.js": "^9.11.0",
"highlight.js-async-webpack": "^1.0.4"
}
},
"md5.js": { "md5.js": {
"version": "1.3.5", "version": "1.3.5",
"resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz",
@ -10929,6 +10977,12 @@
"resolved": "https://registry.npm.taobao.org/number-is-nan/download/number-is-nan-1.0.1.tgz", "resolved": "https://registry.npm.taobao.org/number-is-nan/download/number-is-nan-1.0.1.tgz",
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0="
}, },
"numericjs": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/numericjs/-/numericjs-1.2.6.tgz",
"integrity": "sha1-wNryXEvLIuBDv4NEP5856LM2eYs=",
"dev": true
},
"oauth-sign": { "oauth-sign": {
"version": "0.9.0", "version": "0.9.0",
"resolved": "https://registry.npm.taobao.org/oauth-sign/download/oauth-sign-0.9.0.tgz", "resolved": "https://registry.npm.taobao.org/oauth-sign/download/oauth-sign-0.9.0.tgz",
@ -12443,6 +12497,53 @@
"unpipe": "1.0.0" "unpipe": "1.0.0"
} }
}, },
"raw-loader": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/raw-loader/-/raw-loader-3.1.0.tgz",
"integrity": "sha512-lzUVMuJ06HF4rYveaz9Tv0WRlUMxJ0Y1hgSkkgg+50iEdaI0TthyEDe08KIHb0XsF6rn8WYTqPCaGTZg3sX+qA==",
"dev": true,
"requires": {
"loader-utils": "^1.1.0",
"schema-utils": "^2.0.1"
},
"dependencies": {
"ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
"dev": true,
"requires": {
"fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
}
},
"ajv-keywords": {
"version": "3.5.2",
"resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
"integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
"dev": true
},
"fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
"dev": true
},
"schema-utils": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz",
"integrity": "sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.5",
"ajv": "^6.12.4",
"ajv-keywords": "^3.5.2"
}
}
}
},
"read-pkg": { "read-pkg": {
"version": "5.2.0", "version": "5.2.0",
"resolved": "https://registry.npm.taobao.org/read-pkg/download/read-pkg-5.2.0.tgz", "resolved": "https://registry.npm.taobao.org/read-pkg/download/read-pkg-5.2.0.tgz",
@ -14897,94 +14998,6 @@
} }
} }
}, },
"vue-loader-v16": {
"version": "npm:vue-loader@16.0.0-beta.9",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.0.0-beta.9.tgz",
"integrity": "sha512-mu9pg6554GbXDSO8LlxkQM6qUJzUkb/A0FJc9LgRqnU9MCnhzEXwCt1Zx5NObvFpzs2mH2dH/uUCDwL8Qaz9sA==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
"integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"emojis-list": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz",
"integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"loader-utils": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
"integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
"dev": true,
"optional": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^2.1.2"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"vue-particle-line": { "vue-particle-line": {
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/vue-particle-line/-/vue-particle-line-0.1.4.tgz", "resolved": "https://registry.npmjs.org/vue-particle-line/-/vue-particle-line-0.1.4.tgz",
@ -14993,15 +15006,6 @@
"vue": "^2.5.21" "vue": "^2.5.21"
} }
}, },
"vue-quill-editor": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/vue-quill-editor/-/vue-quill-editor-3.0.6.tgz",
"integrity": "sha512-g20oSZNWg8Hbu41Kinjd55e235qVWPLfg4NvsLW6d+DhgBTFbEuMpcWlUdrD6qT3+Noim6DRu18VLM9lVShXOQ==",
"requires": {
"object-assign": "^4.1.1",
"quill": "^1.3.4"
}
},
"vue-router": { "vue-router": {
"version": "3.1.3", "version": "3.1.3",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.1.3.tgz", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.1.3.tgz",
@ -15532,20 +15536,6 @@
"integrity": "sha1-f4RzvIOd/YdgituV1+sHUhFXikI=", "integrity": "sha1-f4RzvIOd/YdgituV1+sHUhFXikI=",
"dev": true "dev": true
}, },
"wfd-gva": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/wfd-gva/-/wfd-gva-1.0.4.tgz",
"integrity": "sha512-m08qHdhUFUbj7IzJWOoxhN9VAJKzx/QbkTi+XXIHrX24UGovy4XvwmOrWrna+3rHkq60xszHMy1U/MQflNCPlA==",
"requires": {
"@antv/dom-util": "2.0.2",
"@antv/g-canvas": "^0.4.12",
"@antv/g6": "3.5.2",
"@antv/matrix-util": "2.0.7",
"@antv/util": "~2.0.9",
"element-ui": "2.12.0",
"vue": "^2.6.10"
}
},
"which": { "which": {
"version": "1.3.1", "version": "1.3.1",
"resolved": "https://registry.npm.taobao.org/which/download/which-1.3.1.tgz", "resolved": "https://registry.npm.taobao.org/which/download/which-1.3.1.tgz",

2
web/package.json

@ -13,7 +13,6 @@
"core-js": "^3.6.5", "core-js": "^3.6.5",
"echarts": "^4.7.0", "echarts": "^4.7.0",
"element-ui": "^2.12.0", "element-ui": "^2.12.0",
"mavon-editor": "^2.7.7",
"node-sass": "^4.14.1", "node-sass": "^4.14.1",
"path": "^0.12.7", "path": "^0.12.7",
"qs": "^6.8.0", "qs": "^6.8.0",
@ -25,7 +24,6 @@
"timeline-vuejs": "1.1.1", "timeline-vuejs": "1.1.1",
"vue": "^2.6.10", "vue": "^2.6.10",
"vue-particle-line": "^0.1.4", "vue-particle-line": "^0.1.4",
"vue-quill-editor": "^3.0.6",
"vue-router": "^3.1.3", "vue-router": "^3.1.3",
"vue-simple-uploader": "^0.7.4", "vue-simple-uploader": "^0.7.4",
"vuescroll": "^4.14.4", "vuescroll": "^4.14.4",

19
web/src/main.js

@ -9,28 +9,9 @@ Vue.use(ElementUI);
// 引入封装的router // 引入封装的router
import router from '@/router/index' import router from '@/router/index'
// canvas背景插件
import vueParticleLine from 'vue-particle-line'
import 'vue-particle-line/dist/vue-particle-line.css'
Vue.use(vueParticleLine)
// time line css // time line css
import '../node_modules/timeline-vuejs/dist/timeline-vuejs.css' import '../node_modules/timeline-vuejs/dist/timeline-vuejs.css'
// 富文本插件
import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
Vue.use(VueQuillEditor)
// markdown插件
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
Vue.use(mavonEditor)
import '@/permission' import '@/permission'
import { store } from '@/store/index' import { store } from '@/store/index'
Vue.config.productionTip = false Vue.config.productionTip = false

3
web/src/permission.js

@ -1,5 +1,6 @@
import router from './router' import router from './router'
import { store } from '@/store/index' import { store } from '@/store/index'
import getPageTitle from '@/utils/page'
let asyncRouterFlag = 0 let asyncRouterFlag = 0
@ -8,6 +9,8 @@ const whiteList = ['login']
router.beforeEach(async(to, from, next) => { router.beforeEach(async(to, from, next) => {
const token = store.getters['user/token'] const token = store.getters['user/token']
// 在白名单中的判断情况 // 在白名单中的判断情况
//修改网页标签名称
document.title = getPageTitle(to.meta.title)
if (whiteList.indexOf(to.name) > -1) { if (whiteList.indexOf(to.name) > -1) {
if (token) { if (token) {
next({ path: '/layout/dashboard' }) next({ path: '/layout/dashboard' })

8
web/src/utils/page.js

@ -0,0 +1,8 @@
const title = 'GIN-VUE-ADMIN'
export default function getPageTitle(pageTitle) {
if (pageTitle) {
return `${pageTitle} - ${title}`
}
return `${title}`
}

187
web/src/view/example/form/form.vue

@ -1,187 +0,0 @@
<template>
<div>
<el-form :model="form" label-width="80px" ref="form">
<el-row>
<el-col :span="3" :xs="6"><label for="">活动名称</label></el-col>
<el-col :span="10" :xs="14"><el-input v-model="form.name"></el-input></el-col>
</el-row>
<el-row>
<el-col :span="3" :xs="6"><label for="">活动区域</label></el-col>
<el-col :span="10" :xs="14">
<el-select placeholder="请选择活动区域" v-model="form.region">
<el-option label="上海" value="shanghai"></el-option>
<el-option label="北京" value="beijing"></el-option>
</el-select>
</el-col>
</el-row>
<el-row>
<el-col :span="3" :xs="6"><label for="">活动时间</label></el-col>
<el-col :span="10" :xs="18">
<el-col :span="11">
<el-date-picker placeholder="选择日期" style="width: 100%;" type="date" v-model="form.date1"></el-date-picker>
</el-col>
<el-col :span="2" class="line"></el-col>
<el-col :span="11">
<el-time-picker placeholder="选择时间" style="width: 100%;" v-model="form.date2"></el-time-picker>
</el-col>
</el-col>
</el-row>
<el-row>
<el-col :span="3" :xs="6"><label for="">即时配送</label></el-col>
<el-col :span="10" :xs="14"><el-switch v-model="form.delivery"></el-switch></el-col>
</el-row>
<el-row>
<el-col :span="3" :xs="6"><label for="">活动性质</label></el-col>
<el-col :span="10" :xs="14">
<el-checkbox-group v-model="form.type">
<el-checkbox label="美食/餐厅线上活动" name="type"></el-checkbox>
<el-checkbox label="地推活动" name="type"></el-checkbox>
<el-checkbox label="线下主题活动" name="type"></el-checkbox>
<el-checkbox label="单纯品牌曝光" name="type"></el-checkbox>
</el-checkbox-group>
</el-col>
</el-row>
<el-row>
<el-col :span="3" :xs="6"><label for="">特殊资源</label></el-col>
<el-col :span="10" :xs="14">
<el-radio-group v-model="form.resource">
<el-radio label="线上品牌商赞助"></el-radio>
<el-radio label="线下场地免费"></el-radio>
</el-radio-group>
</el-col>
</el-row>
<el-row>
<el-col :span="3" :xs="6"><label for="">活动形式</label></el-col>
<el-col :span="10" :xs="14"><el-input type="textarea" v-model="form.desc"></el-input></el-col>
</el-row>
<el-row>
<el-col :span="3" :xs="6"><label for="">穿梭框</label></el-col>
<el-col :span="20" :xs="24">
<el-transfer
:data="data"
:filter-method="filterMethod"
filter-placeholder="请输入城市拼音"
filterable
v-model="value"
></el-transfer>
</el-col>
</el-row>
<el-row>
<el-col :span="3" :xs="6"><label for="">活动时间</label></el-col>
<el-col :span="10"><el-input v-model="form.name"></el-input></el-col>
</el-row>
<el-row type="flex" justify="center">
<el-col :span="13">
<el-button @click="onSubmit" type="primary">立即创建</el-button>
<el-button>取消</el-button>
</el-col>
</el-row>
<!-- <el-form-item label="活动名称">
<el-input v-model="form.name"></el-input>
</el-form-item>
<el-form-item>
<el-select label="活动区域" placeholder="请选择活动区域" v-model="form.region">
<el-option label="上海" value="shanghai"></el-option>
<el-option label="北京" value="beijing"></el-option>
</el-select>
</el-form-item>
<el-form-item label="活动时间">
<el-col :span="11">
<el-date-picker placeholder="选择日期" style="width: 100%;" type="date" v-model="form.date1"></el-date-picker>
</el-col>
<el-col :span="2" class="line" style="text-align: center"></el-col>
<el-col :span="11">
<el-time-picker placeholder="选择时间" style="width: 100%;" v-model="form.date2"></el-time-picker>
</el-col>
</el-form-item>
<el-form-item label="即时配送">
<el-switch v-model="form.delivery"></el-switch>
</el-form-item>
<el-form-item label="活动性质">
<el-checkbox-group v-model="form.type">
<el-checkbox label="美食/餐厅线上活动" name="type"></el-checkbox>
<el-checkbox label="地推活动" name="type"></el-checkbox>
<el-checkbox label="线下主题活动" name="type"></el-checkbox>
<el-checkbox label="单纯品牌曝光" name="type"></el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="特殊资源">
<el-radio-group v-model="form.resource">
<el-radio label="线上品牌商赞助"></el-radio>
<el-radio label="线下场地免费"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="活动形式">
<el-input type="textarea" v-model="form.desc"></el-input>
</el-form-item>
<el-form-item label="穿梭框">
<el-transfer
:data="data"
:filter-method="filterMethod"
filter-placeholder="请输入城市拼音"
filterable
v-model="value"
></el-transfer>
</el-form-item>
<el-form-item>
<el-button @click="onSubmit" type="primary">立即创建</el-button>
<el-button>取消</el-button>
</el-form-item> -->
</el-form>
</div>
</template>
<script>
export default {
data() {
const generateData = () => {
const data = []
const cities = ['上海', '北京', '广州', '深圳', '南京', '西安', '成都']
const pinyin = [
'shanghai',
'beijing',
'guangzhou',
'shenzhen',
'nanjing',
'xian',
'chengdu'
]
cities.forEach((city, index) => {
data.push({
label: city,
key: index,
pinyin: pinyin[index]
})
})
return data
}
return {
form: {
name: '',
region: '',
date1: '',
date2: '',
delivery: false,
type: [],
resource: '',
desc: ''
},
data: generateData(),
value: [],
}
},
methods: {
filterMethod(query, item) {
return item.pinyin.indexOf(query) > -1
},
onSubmit() {
this.$message({
message: '创建成功',
type: 'success'
})
}
}
}
</script>

53
web/src/view/example/rte/rte.vue

@ -1,53 +0,0 @@
<template>
<div>
<h1>富文本编辑器</h1>
<div class="edit_container">
<quill-editor
:options="editorOption"
@blur="onEditorBlur($event)"
@change="onEditorChange($event)"
@focus="onEditorFocus($event)"
ref="myQuillEditor"
v-model="content"
></quill-editor>
<el-button plain @click="saveHtml">保存</el-button>
</div>
<h1>markdown编辑器</h1>
<div class="edit">
<mavon-editor v-model="model.content"></mavon-editor>
<el-button type="primary" size="small" @click="submit">发表</el-button>
</div>
</div>
</template>
<script>
export default {
name: 'App',
data() {
return {
content: `<p>hello world</p>`,
editorOption: {},
model:{
content:''
}
}
},
computed: {
editor() {
return this.$refs.myQuillEditor.quill
}
},
methods: {
// onEditorReady(editor) { //
// },
onEditorBlur() {}, //
onEditorFocus() {}, //
onEditorChange() {}, //
saveHtml() {
console.log(this.content)
}, //
submit(){}
}
}
</script>

115
web/src/view/example/table/table.vue

@ -1,115 +0,0 @@
// table
<template>
<div>
<el-table
:data="tableData"
@selection-change="handleSelectionChange"
border
ref="multipleTable"
stripe
style="width: 100%"
tooltip-effect="dark"
>
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="日期" width="120">
<template slot-scope="scope">{{ scope.row.date }}</template>
</el-table-column>
<el-table-column label="姓名" prop="name" width="120"></el-table-column>
<el-table-column label="年龄" prop="age" width="120"></el-table-column>
<el-table-column label="住址" prop="address" min-width="200" show-overflow-tooltip></el-table-column>
<el-table-column label="是否禁用" prop="switch" width="180">
<template slot-scope="scope">
<el-switch active-text="开启" inactive-text="禁用" v-model="scope.row.switch"></el-switch>
</template>
</el-table-column>
<el-table-column label="按钮组" width="200">
<template slot-scope="scope" >
<el-button type="text" size="small" @click="toggleSelection([scope.row])">按钮1</el-button>
<el-button type="text" size="small" @click="toggleSelection([scope.row])">按钮2</el-button>
<el-button type="text" size="small" @click="toggleSelection([scope.row])">按钮3</el-button>
</template>
</el-table-column>
</el-table>
<div style="margin-top: 20px">
<el-button @click="toggleSelection([tableData[1], tableData[2]])">切换第二第三行的选中状态</el-button>
<el-button @click="toggleSelection()">取消选择</el-button>
</div>
</div>
</template>
<script>
export default {
name: 'Table',
data() {
return {
tableData: [
{
date: '2016-05-03',
name: '王小虎',
age: 12,
address: '上海市普陀区金沙江路 1518 弄',
switch:true
},
{
date: '2016-05-02',
name: '王小虎',
age: 12,
address: '上海市普陀区金沙江路 1518 弄',
switch:true
},
{
date: '2016-05-04',
name: '王小虎',
age: 12,
address: '上海市普陀区金沙江路 1518 弄',
switch:true
},
{
date: '2016-05-01',
name: '王小虎',
age: 12,
address: '上海市普陀区金沙江路 1518 弄',
switch:false
},
{
date: '2016-05-08',
name: '王小虎',
age: 12,
address: '上海市普陀区金沙江路 1518 弄',
switch:true
},
{
date: '2016-05-06',
name: '王小虎',
age: 12,
address: '上海市普陀区金沙江路 1518 弄',
switch:true
},
{
date: '2016-05-07',
name: '王小虎',
age: 12,
address: '上海市普陀区金沙江路 1518 弄',
switch:false
}
],
multipleSelection: []
}
},
methods: {
toggleSelection(rows) {
if (rows) {
rows.forEach(row => {
this.$refs.multipleTable.toggleRowSelection(row)
})
} else {
this.$refs.multipleTable.clearSelection()
}
},
handleSelectionChange(val) {
this.multipleSelection = val
}
}
}
</script>

40
web/src/view/person/person.vue

@ -4,13 +4,11 @@
<el-col :span="6"> <el-col :span="6">
<div class="fl-left avatar-box"> <div class="fl-left avatar-box">
<div class="user-card"> <div class="user-card">
<el-avatar
class="user-avatar"
:size="160"
:src="userInfo.headerImg"
shape="square"
@click.native="openChooseImg"
></el-avatar>
<div class="user-headpic-update" :style="{ 'background-image': 'url(' + userInfo.headerImg + ')','background-repeat':'no-repeat','background-size':'cover' }" >
<span class="update" @click="openChooseImg">
<i class="el-icon-edit"></i>
重新上传</span>
</div>
<div class="user-personality"> <div class="user-personality">
<p class="nickname">{{userInfo.nickName}}</p> <p class="nickname">{{userInfo.nickName}}</p>
<p class="person-info">这个家伙很懒什么都没有留下</p> <p class="person-info">这个家伙很懒什么都没有留下</p>
@ -18,7 +16,7 @@
<div class="user-information"> <div class="user-information">
<ul> <ul>
<li> <li>
<i class="el-icon-user"></i>资深前端工程师
<i class="el-icon-user"></i>{{userInfo.nickName}}
</li> </li>
<li> <li>
<i class="el-icon-data-analysis"></i>北京反转极光科技有限公司-技术部-前端事业群 <i class="el-icon-data-analysis"></i>北京反转极光科技有限公司-技术部-前端事业群
@ -216,9 +214,6 @@ export default {
box-shadow: -2px 0 20px -16px; box-shadow: -2px 0 20px -16px;
width: 80%; width: 80%;
height: 100%; height: 100%;
.user-avatar{
cursor: pointer;
}
.user-card { .user-card {
min-height: calc(90vh - 200px); min-height: calc(90vh - 200px);
padding: 30px 20px; padding: 30px 20px;
@ -282,4 +277,27 @@ export default {
} }
} }
} }
.user-headpic-update{
width: 120px;
height: 120px;
line-height: 120px;
margin: 0 auto;
display: flex;
justify-content: center;
border-radius: 20px;
&:hover{
color: #fff;
background: linear-gradient(to bottom, rgba(255,255,255,0.15) 0%, rgba(0,0,0,0.15) 100%), radial-gradient(at top center, rgba(255,255,255,0.40) 0%, rgba(0,0,0,0.40) 120%) #989898;
background-blend-mode: multiply,multiply;
.update{
color:#fff ;
}
}
.update{
height: 120px;
width: 120px;
text-align: center;
color:transparent;
}
}
</style> </style>
Loading…
Cancel
Save