mirror of https://github.com/mindoc-org/mindoc.git
feat:实现团队功能
parent
1d8d74afb1
commit
b897c87476
|
@ -73,7 +73,6 @@ func RegisterDataBase() {
|
|||
os.MkdirAll(dbPath, 0777)
|
||||
}
|
||||
|
||||
|
||||
err := orm.RegisterDataBase("default", "sqlite3", database)
|
||||
|
||||
if err != nil {
|
||||
|
@ -102,6 +101,9 @@ func RegisterModel() {
|
|||
new(models.Label),
|
||||
new(models.Blog),
|
||||
new(models.Template),
|
||||
new(models.Team),
|
||||
new(models.TeamMember),
|
||||
new(models.TeamRelationship),
|
||||
)
|
||||
gob.Register(models.Blog{})
|
||||
gob.Register(models.Document{})
|
||||
|
@ -155,21 +157,29 @@ func RegisterLogger(log string) {
|
|||
if level := beego.AppConfig.DefaultString("log_level", "Trace"); level != "" {
|
||||
switch level {
|
||||
case "Emergency":
|
||||
config["level"] = beego.LevelEmergency;break
|
||||
config["level"] = beego.LevelEmergency;
|
||||
break
|
||||
case "Alert":
|
||||
config["level"] = beego.LevelAlert;break
|
||||
config["level"] = beego.LevelAlert;
|
||||
break
|
||||
case "Critical":
|
||||
config["level"] = beego.LevelCritical;break
|
||||
config["level"] = beego.LevelCritical;
|
||||
break
|
||||
case "Error":
|
||||
config["level"] = beego.LevelError; break
|
||||
config["level"] = beego.LevelError;
|
||||
break
|
||||
case "Warning":
|
||||
config["level"] = beego.LevelWarning; break
|
||||
config["level"] = beego.LevelWarning;
|
||||
break
|
||||
case "Notice":
|
||||
config["level"] = beego.LevelNotice; break
|
||||
config["level"] = beego.LevelNotice;
|
||||
break
|
||||
case "Informational":
|
||||
config["level"] = beego.LevelInformational;break
|
||||
config["level"] = beego.LevelInformational;
|
||||
break
|
||||
case "Debug":
|
||||
config["level"] = beego.LevelDebug;break
|
||||
config["level"] = beego.LevelDebug;
|
||||
break
|
||||
}
|
||||
}
|
||||
b, err := json.Marshal(config);
|
||||
|
@ -180,8 +190,6 @@ func RegisterLogger(log string) {
|
|||
beego.SetLogger(logs.AdapterFile, string(b))
|
||||
}
|
||||
|
||||
|
||||
|
||||
beego.SetLogFuncCall(true)
|
||||
}
|
||||
|
||||
|
|
|
@ -27,24 +27,30 @@ const PageSize = 10
|
|||
// 用户权限
|
||||
const (
|
||||
// 超级管理员.
|
||||
MemberSuperRole = 0
|
||||
MemberSuperRole SystemRole = iota
|
||||
//普通管理员.
|
||||
MemberAdminRole = 1
|
||||
MemberAdminRole
|
||||
//普通用户.
|
||||
MemberGeneralRole = 2
|
||||
MemberGeneralRole
|
||||
)
|
||||
|
||||
//系统角色
|
||||
type SystemRole int
|
||||
|
||||
const (
|
||||
// 创始人.
|
||||
BookFounder = 0
|
||||
BookFounder BookRole = iota
|
||||
//管理者
|
||||
BookAdmin = 1
|
||||
BookAdmin
|
||||
//编辑者.
|
||||
BookEditor = 2
|
||||
BookEditor
|
||||
//观察者
|
||||
BookObserver = 3
|
||||
BookObserver
|
||||
)
|
||||
|
||||
//项目角色
|
||||
type BookRole int
|
||||
|
||||
const (
|
||||
LoggerOperate = "operate"
|
||||
LoggerSystem = "system"
|
||||
|
@ -139,10 +145,12 @@ func GetUploadFileSize() int64 {
|
|||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
//是否启用导出
|
||||
func GetEnableExport() bool {
|
||||
return beego.AppConfig.DefaultBool("enable_export", true)
|
||||
}
|
||||
|
||||
//同一项目导出线程的并发数
|
||||
func GetExportProcessNum() int {
|
||||
exportProcessNum := beego.AppConfig.DefaultInt("export_process_num", 1)
|
||||
|
@ -152,6 +160,7 @@ func GetExportProcessNum() int {
|
|||
}
|
||||
return exportProcessNum;
|
||||
}
|
||||
|
||||
//导出项目队列的并发数量
|
||||
func GetExportLimitNum() int {
|
||||
exportLimitNum := beego.AppConfig.DefaultInt("export_limit_num", 1)
|
||||
|
@ -161,6 +170,7 @@ func GetExportLimitNum() int {
|
|||
}
|
||||
return exportLimitNum;
|
||||
}
|
||||
|
||||
//等待导出队列的长度
|
||||
func GetExportQueueLimitNum() int {
|
||||
exportQueueLimitNum := beego.AppConfig.DefaultInt("export_queue_limit_num", 10)
|
||||
|
@ -170,6 +180,7 @@ func GetExportQueueLimitNum() int {
|
|||
}
|
||||
return exportQueueLimitNum
|
||||
}
|
||||
|
||||
//默认导出项目的缓存目录
|
||||
func GetExportOutputPath() string {
|
||||
exportOutputPath := filepath.Join(beego.AppConfig.DefaultString("export_output_path", filepath.Join(WorkingDirectory, "cache")), "books")
|
||||
|
|
|
@ -117,6 +117,30 @@ func (c *BaseController) JsonResult(errCode int, errMsg string, data ...interfac
|
|||
c.StopRun()
|
||||
}
|
||||
|
||||
//如果错误不为空,则响应错误信息到浏览器.
|
||||
func (c *BaseController) CheckJsonError(code int,err error) {
|
||||
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
jsonData := make(map[string]interface{}, 3)
|
||||
|
||||
jsonData["errcode"] = code
|
||||
jsonData["message"] = err.Error()
|
||||
|
||||
returnJSON, err := json.Marshal(jsonData)
|
||||
|
||||
if err != nil {
|
||||
beego.Error(err)
|
||||
}
|
||||
|
||||
c.Ctx.ResponseWriter.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
c.Ctx.ResponseWriter.Header().Set("Cache-Control", "no-cache, no-store")
|
||||
io.WriteString(c.Ctx.ResponseWriter, string(returnJSON))
|
||||
|
||||
c.StopRun()
|
||||
}
|
||||
|
||||
// ExecuteViewPathTemplate 执行指定的模板并返回执行结果.
|
||||
func (c *BaseController) ExecuteViewPathTemplate(tplName string, data interface{}) (string, error) {
|
||||
var buf bytes.Buffer
|
||||
|
@ -164,3 +188,9 @@ func (c *BaseController) ShowErrorPage(errCode int, errMsg string) {
|
|||
c.CustomAbort(500, buf.String())
|
||||
}
|
||||
}
|
||||
|
||||
func (c *BaseController) CheckErrorResult(code int,err error) {
|
||||
if err != nil {
|
||||
c.ShowErrorPage(code, err.Error())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ type BookMemberController struct {
|
|||
func (c *BookMemberController) AddMember() {
|
||||
identify := c.GetString("identify")
|
||||
account,_ := c.GetInt("account")
|
||||
role_id, _ := c.GetInt("role_id", 3)
|
||||
roleId, _ := c.GetInt("role_id", 3)
|
||||
beego.Info(account)
|
||||
if identify == "" || account <= 0 {
|
||||
c.JsonResult(6001, "参数错误")
|
||||
|
@ -46,11 +46,11 @@ func (c *BookMemberController) AddMember() {
|
|||
relationship := models.NewRelationship()
|
||||
relationship.BookId = book.BookId
|
||||
relationship.MemberId = member.MemberId
|
||||
relationship.RoleId = role_id
|
||||
relationship.RoleId = conf.BookRole(roleId)
|
||||
|
||||
if err := relationship.Insert(); err == nil {
|
||||
memberRelationshipResult := models.NewMemberRelationshipResult().FromMember(member)
|
||||
memberRelationshipResult.RoleId = role_id
|
||||
memberRelationshipResult.RoleId = conf.BookRole(roleId)
|
||||
memberRelationshipResult.RelationshipId = relationship.RelationshipId
|
||||
memberRelationshipResult.BookId = book.BookId
|
||||
memberRelationshipResult.ResolveRoleName()
|
||||
|
@ -63,13 +63,13 @@ func (c *BookMemberController) AddMember() {
|
|||
// 变更指定用户在指定项目中的权限
|
||||
func (c *BookMemberController) ChangeRole() {
|
||||
identify := c.GetString("identify")
|
||||
member_id, _ := c.GetInt("member_id", 0)
|
||||
memberId, _ := c.GetInt("member_id", 0)
|
||||
role, _ := c.GetInt("role_id", 0)
|
||||
|
||||
if identify == "" || member_id <= 0 {
|
||||
if identify == "" || memberId <= 0 {
|
||||
c.JsonResult(6001, "参数错误")
|
||||
}
|
||||
if member_id == c.Member.MemberId {
|
||||
if memberId == c.Member.MemberId {
|
||||
c.JsonResult(6006, "不能变更自己的权限")
|
||||
}
|
||||
book, err := models.NewBookResult().FindByIdentify(identify, c.Member.MemberId)
|
||||
|
@ -89,14 +89,14 @@ func (c *BookMemberController) ChangeRole() {
|
|||
|
||||
member := models.NewMember()
|
||||
|
||||
if _, err := member.Find(member_id); err != nil {
|
||||
if _, err := member.Find(memberId); err != nil {
|
||||
c.JsonResult(6003, "用户不存在")
|
||||
}
|
||||
if member.Status == 1 {
|
||||
c.JsonResult(6004, "用户已被禁用")
|
||||
}
|
||||
|
||||
relationship, err := models.NewRelationship().UpdateRoleId(book.BookId, member_id, role)
|
||||
relationship, err := models.NewRelationship().UpdateRoleId(book.BookId, memberId, conf.BookRole(role))
|
||||
|
||||
if err != nil {
|
||||
logs.Error("变更用户在项目中的权限 => ", err)
|
||||
|
|
|
@ -114,7 +114,7 @@ func (c *ManagerController) CreateMember() {
|
|||
|
||||
member.Account = account
|
||||
member.Password = password1
|
||||
member.Role = role
|
||||
member.Role = conf.SystemRole(role)
|
||||
member.Avatar = conf.GetDefaultAvatar()
|
||||
member.CreateAt = c.Member.MemberId
|
||||
member.Email = email
|
||||
|
@ -167,17 +167,17 @@ func (c *ManagerController) UpdateMemberStatus() {
|
|||
func (c *ManagerController) ChangeMemberRole() {
|
||||
c.Prepare()
|
||||
|
||||
member_id, _ := c.GetInt("member_id", 0)
|
||||
memberId, _ := c.GetInt("member_id", 0)
|
||||
role, _ := c.GetInt("role", 0)
|
||||
if member_id <= 0 {
|
||||
if memberId <= 0 {
|
||||
c.JsonResult(6001, "参数错误")
|
||||
}
|
||||
if role != conf.MemberAdminRole && role != conf.MemberGeneralRole {
|
||||
if role != int(conf.MemberAdminRole) && role != int(conf.MemberGeneralRole) {
|
||||
c.JsonResult(6001, "用户权限不正确")
|
||||
}
|
||||
member := models.NewMember()
|
||||
|
||||
if _, err := member.Find(member_id); err != nil {
|
||||
if _, err := member.Find(memberId); err != nil {
|
||||
c.JsonResult(6002, "用户不存在")
|
||||
}
|
||||
if member.MemberId == c.Member.MemberId {
|
||||
|
@ -186,7 +186,7 @@ func (c *ManagerController) ChangeMemberRole() {
|
|||
if member.Role == conf.MemberSuperRole {
|
||||
c.JsonResult(6005, "不能变更超级管理员的权限")
|
||||
}
|
||||
member.Role = role
|
||||
member.Role = conf.SystemRole(role)
|
||||
|
||||
if err := member.Update(); err != nil {
|
||||
c.JsonResult(6003, "用户权限设置失败")
|
||||
|
@ -762,3 +762,235 @@ func (c *ManagerController) Config() {
|
|||
c.Data["ConfigContent"] = string(b)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *ManagerController) Team() {
|
||||
c.Prepare()
|
||||
c.TplName = "manager/team.tpl"
|
||||
|
||||
pageIndex, _ := c.GetInt("page", 0)
|
||||
|
||||
teams, totalCount, err := models.NewTeam().FindToPager(pageIndex, conf.PageSize)
|
||||
|
||||
if err != nil && err != orm.ErrNoRows {
|
||||
c.ShowErrorPage(500, err.Error())
|
||||
}
|
||||
if err == orm.ErrNoRows || len(teams) <= 0 {
|
||||
c.Data["Result"] = template.JS("[]")
|
||||
c.Data["PageHtml"] = ""
|
||||
return
|
||||
}
|
||||
|
||||
if totalCount > 0 {
|
||||
pager := pagination.NewPagination(c.Ctx.Request, totalCount, conf.PageSize, c.BaseUrl())
|
||||
c.Data["PageHtml"] = pager.HtmlPages()
|
||||
} else {
|
||||
c.Data["PageHtml"] = ""
|
||||
}
|
||||
|
||||
b, err := json.Marshal(teams)
|
||||
|
||||
if err != nil {
|
||||
c.Data["Result"] = template.JS("[]")
|
||||
} else {
|
||||
c.Data["Result"] = template.JS(string(b))
|
||||
}
|
||||
}
|
||||
|
||||
func (c *ManagerController) TeamCreate() {
|
||||
c.Prepare()
|
||||
|
||||
teamName := c.GetString("teamName")
|
||||
|
||||
if teamName == "" {
|
||||
c.JsonResult(5001, "团队名称不能为空")
|
||||
}
|
||||
team := models.NewTeam()
|
||||
|
||||
team.MemberId = c.Member.MemberId
|
||||
team.TeamName = teamName
|
||||
|
||||
if err := team.Save(); err == nil {
|
||||
c.JsonResult(0, "OK", team)
|
||||
} else {
|
||||
c.JsonResult(5002, err.Error())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (c *ManagerController) TeamEdit() {
|
||||
c.Prepare()
|
||||
teamName := c.GetString("teamName")
|
||||
teamId, _ := c.GetInt("teamId")
|
||||
|
||||
if teamName == "" {
|
||||
c.JsonResult(5001, "团队名称不能为空")
|
||||
}
|
||||
if teamId <= 0 {
|
||||
c.JsonResult(5002, "团队标识不能为空")
|
||||
}
|
||||
team, err := models.NewTeam().First(teamId)
|
||||
|
||||
c.CheckJsonError(5003, err)
|
||||
|
||||
team.TeamName = teamName
|
||||
|
||||
err = team.Save()
|
||||
|
||||
c.CheckJsonError(5004, err)
|
||||
|
||||
c.JsonResult(0, "OK", team)
|
||||
|
||||
}
|
||||
|
||||
func (c *ManagerController) TeamDelete() {
|
||||
c.Prepare()
|
||||
|
||||
teamId, _ := c.GetInt("teamId")
|
||||
|
||||
if teamId <= 0 {
|
||||
c.JsonResult(5002, "团队标识不能为空")
|
||||
}
|
||||
err := models.NewTeam().Delete(teamId)
|
||||
|
||||
c.CheckJsonError(5001, err)
|
||||
|
||||
c.JsonResult(0, "")
|
||||
}
|
||||
|
||||
func (c *ManagerController) TeamMemberList() {
|
||||
c.Prepare()
|
||||
c.TplName = "manager/team_member_list.tpl"
|
||||
teamId, _ := strconv.Atoi(c.Ctx.Input.Param(":id"))
|
||||
pageIndex, _ := c.GetInt("page", 0)
|
||||
|
||||
if teamId <= 0 {
|
||||
c.ShowErrorPage(500, "参数错误")
|
||||
}
|
||||
|
||||
team, err := models.NewTeam().First(teamId)
|
||||
|
||||
if err == orm.ErrNoRows {
|
||||
c.ShowErrorPage(404, "团队不存在")
|
||||
}
|
||||
c.CheckErrorResult(500, err)
|
||||
c.Data["Model"] = team
|
||||
|
||||
teams, totalCount, err := models.NewTeamMember().FindToPager(teamId, pageIndex, conf.PageSize)
|
||||
|
||||
if err != nil && err != orm.ErrNoRows {
|
||||
c.ShowErrorPage(500, err.Error())
|
||||
}
|
||||
if err == orm.ErrNoRows || len(teams) <= 0 {
|
||||
c.Data["Result"] = template.JS("[]")
|
||||
c.Data["PageHtml"] = ""
|
||||
return
|
||||
}
|
||||
|
||||
if totalCount > 0 {
|
||||
pager := pagination.NewPagination(c.Ctx.Request, totalCount, conf.PageSize, c.BaseUrl())
|
||||
c.Data["PageHtml"] = pager.HtmlPages()
|
||||
} else {
|
||||
c.Data["PageHtml"] = ""
|
||||
}
|
||||
|
||||
b, err := json.Marshal(teams)
|
||||
|
||||
if err != nil {
|
||||
beego.Error("编码 JSON 结果失败 ->", err)
|
||||
c.Data["Result"] = template.JS("[]")
|
||||
} else {
|
||||
c.Data["Result"] = template.JS(string(b))
|
||||
}
|
||||
}
|
||||
|
||||
//搜索团队用户.
|
||||
func (c *ManagerController) TeamSearchMember() {
|
||||
c.Prepare()
|
||||
|
||||
teamId, _ := c.GetInt("teamId")
|
||||
keyword := strings.TrimSpace(c.GetString("q"))
|
||||
|
||||
if teamId <= 0 {
|
||||
c.JsonResult(500, "参数错误")
|
||||
}
|
||||
|
||||
searchResult, err := models.NewTeamMember().FindNotJoinMemberByAccount(teamId, keyword, 10)
|
||||
|
||||
if err != nil {
|
||||
c.JsonResult(500, err.Error())
|
||||
}
|
||||
c.JsonResult(0, "OK", searchResult)
|
||||
}
|
||||
|
||||
func (c *ManagerController) TeamMemberAdd() {
|
||||
c.Prepare()
|
||||
teamId, _ := c.GetInt("teamId")
|
||||
memberId, _ := c.GetInt("memberId")
|
||||
roleId, _ := c.GetInt("roleId")
|
||||
|
||||
if teamId <= 0 || memberId <= 0 || roleId <= 0 || roleId > int(conf.BookObserver) {
|
||||
c.JsonResult(5001, "参数不正确")
|
||||
}
|
||||
|
||||
teamMember := models.NewTeamMember()
|
||||
teamMember.MemberId = memberId
|
||||
teamMember.TeamId = teamId
|
||||
teamMember.RoleId = conf.BookRole(roleId)
|
||||
|
||||
if err := teamMember.Save(); err != nil {
|
||||
c.CheckJsonError(5001, err)
|
||||
}
|
||||
|
||||
teamMember.Include()
|
||||
|
||||
c.JsonResult(0, "OK", teamMember)
|
||||
}
|
||||
|
||||
func (c *ManagerController) TeamMemberDelete() {
|
||||
c.Prepare()
|
||||
memberId, _ := c.GetInt("memberId")
|
||||
teamId, _ := c.GetInt("teamId")
|
||||
|
||||
teamMember, err := models.NewTeamMember().FindFirst(teamId, memberId)
|
||||
|
||||
if err != nil {
|
||||
c.JsonResult(5001, "用户不存在或已禁用")
|
||||
}
|
||||
err = teamMember.Delete(teamMember.TeamMemberId)
|
||||
if err != nil {
|
||||
c.JsonResult(5002, "删除失败")
|
||||
}
|
||||
c.JsonResult(0, "ok")
|
||||
}
|
||||
|
||||
func (c *ManagerController) TeamChangeMemberRole() {
|
||||
c.Prepare()
|
||||
memberId, _ := c.GetInt("memberId")
|
||||
roleId, _ := c.GetInt("roleId")
|
||||
teamId, _ := c.GetInt("teamId")
|
||||
if memberId <= 0 || roleId <= 0 || teamId <= 0 || roleId > int(conf.BookObserver) {
|
||||
c.JsonResult(5001, "参数错误")
|
||||
}
|
||||
|
||||
teamMember, err := models.NewTeamMember().ChangeRoleId(teamId, memberId, conf.BookRole(roleId))
|
||||
|
||||
if err != nil {
|
||||
c.JsonResult(5002, err.Error())
|
||||
} else {
|
||||
c.JsonResult(0, "OK", teamMember)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (c *ManagerController) TeamBookList() {
|
||||
c.Prepare()
|
||||
c.TplName = "manager/team_book_list.tpl"
|
||||
|
||||
}
|
||||
func (c *ManagerController) TeamBookAdd() {
|
||||
c.Prepare()
|
||||
}
|
||||
|
||||
func (c *ManagerController) TeamBookDelete() {
|
||||
c.Prepare()
|
||||
}
|
||||
|
|
|
@ -279,7 +279,7 @@ func (b *Blog) FindToPager(pageIndex, pageSize int,memberId int,status string) (
|
|||
|
||||
offset := (pageIndex - 1) * pageSize
|
||||
|
||||
query := o.QueryTable(b.TableNameWithPrefix());
|
||||
query := o.QueryTable(b.TableNameWithPrefix())
|
||||
|
||||
if memberId > 0 {
|
||||
query = query.Filter("member_id",memberId)
|
||||
|
|
|
@ -55,7 +55,7 @@ type BookResult struct {
|
|||
HistoryCount int `json:"history_count"`
|
||||
|
||||
RelationshipId int `json:"relationship_id"`
|
||||
RoleId int `json:"role_id"`
|
||||
RoleId conf.BookRole `json:"role_id"`
|
||||
RoleName string `json:"role_name"`
|
||||
Status int `json:"status"`
|
||||
IsEnableShare bool `json:"is_enable_share"`
|
||||
|
|
|
@ -39,3 +39,20 @@ var (
|
|||
ErrCommentClosed = errors.New("评论已关闭")
|
||||
ErrCommentContentNotEmpty = errors.New("评论内容不能为空")
|
||||
)
|
||||
|
||||
type Error struct {
|
||||
code int
|
||||
message string
|
||||
}
|
||||
|
||||
func (e Error) Error() string {
|
||||
return e.message
|
||||
}
|
||||
|
||||
func (e Error) Code() int {
|
||||
return e.code
|
||||
}
|
||||
|
||||
func NewError(code int, message string) Error {
|
||||
return Error{code: code, message: message}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ type Member struct {
|
|||
Phone string `orm:"size(255);column(phone);null;default(null)" json:"phone"`
|
||||
Avatar string `orm:"size(1000);column(avatar)" json:"avatar"`
|
||||
//用户角色:0 超级管理员 /1 管理员/ 2 普通用户 .
|
||||
Role int `orm:"column(role);type(int);default(1);index" json:"role"`
|
||||
Role conf.SystemRole `orm:"column(role);type(int);default(1);index" json:"role"`
|
||||
RoleName string `orm:"-" json:"role_name"`
|
||||
Status int `orm:"column(status);type(int);default(0)" json:"status"` //用户状态:0 正常/1 禁用
|
||||
CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add" json:"create_time"`
|
||||
|
@ -136,7 +136,7 @@ func (m *Member) ldapLogin(account string, password string) (*Member, error) {
|
|||
m.Email = searchResult.Entries[0].GetAttributeValue("mail")
|
||||
m.AuthMethod = "ldap"
|
||||
m.Avatar = "/static/images/headimgurl.jpg"
|
||||
m.Role = beego.AppConfig.DefaultInt("ldap_user_role", 2)
|
||||
m.Role = conf.SystemRole(beego.AppConfig.DefaultInt("ldap_user_role", 2))
|
||||
m.CreateTime = time.Now()
|
||||
|
||||
err = m.Add()
|
||||
|
@ -219,6 +219,7 @@ func (m *Member) Find(id int,cols ...string) (*Member, error) {
|
|||
return m, nil
|
||||
}
|
||||
|
||||
|
||||
func (m *Member) ResolveRoleName() {
|
||||
if m.Role == conf.MemberSuperRole {
|
||||
m.RoleName = "超级管理员"
|
||||
|
@ -240,6 +241,7 @@ func (m *Member) FindByAccount(account string) (*Member, error) {
|
|||
}
|
||||
return m, err
|
||||
}
|
||||
|
||||
//批量查询用户
|
||||
func (m *Member) FindByAccountList(accounts ...string) ([]*Member, error) {
|
||||
o := orm.NewOrm()
|
||||
|
@ -354,7 +356,6 @@ func (m *Member) Valid(is_hash_password bool) error {
|
|||
}
|
||||
|
||||
//删除一个用户.
|
||||
|
||||
func (m *Member) Delete(oldId int, newId int) error {
|
||||
o := orm.NewOrm()
|
||||
|
||||
|
@ -424,6 +425,13 @@ func (m *Member) Delete(oldId int, newId int) error {
|
|||
o.Rollback()
|
||||
return err
|
||||
}
|
||||
_,err = o.QueryTable(NewTeamMember()).Filter("member_id",oldId).Delete()
|
||||
|
||||
if err != nil {
|
||||
o.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
//_,err = o.Raw("UPDATE md_relationship SET member_id = ? WHERE member_id = ?",newId,oldId).Exec()
|
||||
//if err != nil {
|
||||
//
|
||||
|
|
|
@ -14,14 +14,14 @@ type MemberRelationshipResult struct {
|
|||
Email string `json:"email"`
|
||||
Phone string `json:"phone"`
|
||||
Avatar string `json:"avatar"`
|
||||
Role int `json:"role"` //用户角色:0 管理员/ 1 普通用户
|
||||
Role conf.SystemRole `json:"role"` //用户角色:0 管理员/ 1 普通用户
|
||||
Status int `json:"status"` //用户状态:0 正常/1 禁用
|
||||
CreateTime time.Time `json:"create_time"`
|
||||
CreateAt int `json:"create_at"`
|
||||
RelationshipId int `json:"relationship_id"`
|
||||
BookId int `json:"book_id"`
|
||||
// RoleId 角色:0 创始人(创始人不能被移除) / 1 管理员/2 编辑者/3 观察者
|
||||
RoleId int `json:"role_id"`
|
||||
RoleId conf.BookRole `json:"role_id"`
|
||||
RoleName string `json:"role_name"`
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,7 @@ func (m *MemberRelationshipResult) ResolveRoleName() *MemberRelationshipResult {
|
|||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// 根据项目ID查询用户
|
||||
func (m *MemberRelationshipResult) FindForUsersByBookId(bookId, pageIndex, pageSize int) ([]*MemberRelationshipResult, int, error) {
|
||||
o := orm.NewOrm()
|
||||
|
@ -107,33 +108,3 @@ func (m *MemberRelationshipResult) FindNotJoinUsersByAccount(bookId, limit int,a
|
|||
|
||||
return members, err
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ type Relationship struct {
|
|||
MemberId int `orm:"column(member_id);type(int)" json:"member_id"`
|
||||
BookId int `orm:"column(book_id);type(int)" json:"book_id"`
|
||||
// RoleId 角色:0 创始人(创始人不能被移除) / 1 管理员/2 编辑者/3 观察者
|
||||
RoleId int `orm:"column(role_id);type(int)" json:"role_id"`
|
||||
RoleId conf.BookRole `orm:"column(role_id);type(int)" json:"role_id"`
|
||||
}
|
||||
|
||||
// TableName 获取对应数据库表名.
|
||||
|
@ -31,7 +31,7 @@ func (m *Relationship) TableEngine() string {
|
|||
// 联合唯一键
|
||||
func (u *Relationship) TableUnique() [][]string {
|
||||
return [][]string{
|
||||
[]string{"MemberId", "BookId"},
|
||||
{"member_id", "book_id"},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,28 +55,28 @@ func (m *Relationship) FindFounder(book_id int) (*Relationship, error) {
|
|||
return m, err
|
||||
}
|
||||
|
||||
func (m *Relationship) UpdateRoleId(book_id, member_id, role_id int) (*Relationship, error) {
|
||||
func (m *Relationship) UpdateRoleId(bookId, memberId int, roleId conf.BookRole) (*Relationship, error) {
|
||||
o := orm.NewOrm()
|
||||
book := NewBook()
|
||||
book.BookId = book_id
|
||||
book.BookId = bookId
|
||||
|
||||
if err := o.Read(book); err != nil {
|
||||
logs.Error("UpdateRoleId => ", err)
|
||||
return m, errors.New("项目不存在")
|
||||
}
|
||||
err := o.QueryTable(m.TableNameWithPrefix()).Filter("member_id", member_id).Filter("book_id", book_id).One(m)
|
||||
err := o.QueryTable(m.TableNameWithPrefix()).Filter("member_id", memberId).Filter("book_id", bookId).One(m)
|
||||
|
||||
if err == orm.ErrNoRows {
|
||||
m = NewRelationship()
|
||||
m.BookId = book_id
|
||||
m.MemberId = member_id
|
||||
m.RoleId = role_id
|
||||
m.BookId = bookId
|
||||
m.MemberId = memberId
|
||||
m.RoleId = roleId
|
||||
} else if err != nil {
|
||||
return m, err
|
||||
} else if m.RoleId == conf.BookFounder {
|
||||
return m, errors.New("不能变更创始人的权限")
|
||||
}
|
||||
m.RoleId = role_id
|
||||
m.RoleId = roleId
|
||||
|
||||
if m.RelationshipId > 0 {
|
||||
_, err = o.Update(m)
|
||||
|
@ -88,7 +88,7 @@ func (m *Relationship) UpdateRoleId(book_id, member_id, role_id int) (*Relations
|
|||
|
||||
}
|
||||
|
||||
func (m *Relationship) FindForRoleId(book_id, member_id int) (int, error) {
|
||||
func (m *Relationship) FindForRoleId(book_id, member_id int) (conf.BookRole, error) {
|
||||
o := orm.NewOrm()
|
||||
|
||||
relationship := NewRelationship()
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
"github.com/lifei6671/mindoc/conf"
|
||||
"github.com/astaxie/beego/orm"
|
||||
"errors"
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
|
||||
//团队.
|
||||
type Team struct {
|
||||
TeamId int `orm:"column(team_id);pk;auto;unique;" json:"team_id"`
|
||||
TeamName string `orm:"column(team_name);size(255)" json:"team_name"`
|
||||
MemberId int `orm:"column(member_id);type(int);" json:"member_id"`
|
||||
IsDelete bool `orm:"column(is_delete);default(0)" json:"is_delete"`
|
||||
CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
|
||||
MemberCount int `orm:"-" json:"member_count"`
|
||||
BookCount int `orm:"-" json:"book_count"`
|
||||
MemberName string `orm:"-" json:"member_name"`
|
||||
}
|
||||
|
||||
// TableName 获取对应数据库表名.
|
||||
func (t *Team) TableName() string {
|
||||
return "teams"
|
||||
}
|
||||
|
||||
// TableEngine 获取数据使用的引擎.
|
||||
func (t *Team) TableEngine() string {
|
||||
return "INNODB"
|
||||
}
|
||||
|
||||
func (t *Team) TableNameWithPrefix() string {
|
||||
return conf.GetDatabasePrefix() + t.TableName()
|
||||
}
|
||||
|
||||
func NewTeam() *Team {
|
||||
return &Team{}
|
||||
}
|
||||
|
||||
// 查询一个团队.
|
||||
func (t *Team) First(id int, cols ...string) (*Team, error) {
|
||||
if id <= 0 {
|
||||
return nil, orm.ErrNoRows
|
||||
}
|
||||
o := orm.NewOrm()
|
||||
err := o.QueryTable(t.TableNameWithPrefix()).Filter("team_id", id).One(t, cols...)
|
||||
|
||||
return t, err
|
||||
}
|
||||
|
||||
func (t *Team) Delete(id int) (err error) {
|
||||
if id <= 0 {
|
||||
return ErrInvalidParameter
|
||||
}
|
||||
o := orm.NewOrm()
|
||||
|
||||
err = o.Begin()
|
||||
|
||||
if err != nil {
|
||||
beego.Error("开启事物时出错 ->",err)
|
||||
return
|
||||
}
|
||||
_,err = o.QueryTable(t.TableNameWithPrefix()).Filter("team_id",id).Delete()
|
||||
|
||||
if err != nil {
|
||||
beego.Error("删除团队时出错 ->", err)
|
||||
o.Rollback()
|
||||
return
|
||||
}
|
||||
|
||||
_,err = o.Raw("delete from md_team_member where team_id=?;", id).Exec()
|
||||
|
||||
if err != nil {
|
||||
beego.Error("删除团队成员时出错 ->", err)
|
||||
o.Rollback()
|
||||
return
|
||||
}
|
||||
|
||||
_,err = o.Raw("delete from md_team_relationship where team_id=?;",id).Exec()
|
||||
|
||||
if err != nil {
|
||||
beego.Error("删除团队项目时出错 ->", err)
|
||||
o.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
err = o.Commit()
|
||||
return
|
||||
}
|
||||
|
||||
//分页查询团队.
|
||||
func (t *Team) FindToPager(pageIndex, pageSize int) (list []*Team, totalCount int, err error) {
|
||||
o := orm.NewOrm()
|
||||
|
||||
offset := (pageIndex - 1) * pageSize
|
||||
|
||||
_, err = o.QueryTable(t.TableNameWithPrefix()).Offset(offset).Limit(pageSize).All(&list)
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
c, err := o.QueryTable(t.TableNameWithPrefix()).Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
totalCount = int(c)
|
||||
|
||||
for i,item := range list {
|
||||
if member,err := NewMember().Find(item.MemberId,"account","real_name"); err == nil {
|
||||
if member.RealName != "" {
|
||||
list[i].MemberName = member.RealName
|
||||
} else {
|
||||
list[i].MemberName = member.Account
|
||||
}
|
||||
}
|
||||
if c,err := o.QueryTable(NewTeamRelationship().TableNameWithPrefix()).Filter("team_id", item.TeamId).Count(); err == nil {
|
||||
list[i].BookCount = int(c)
|
||||
}
|
||||
if c,err := o.QueryTable(NewTeamMember().TableNameWithPrefix()).Filter("team_id", item.TeamId).Count(); err == nil {
|
||||
list[i].MemberCount = int(c)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//更新或添加一个团队.
|
||||
func (t *Team) Save(cols ... string) (err error) {
|
||||
if t.TeamName == "" {
|
||||
return NewError(5001, "团队名称不能为空")
|
||||
}
|
||||
|
||||
o := orm.NewOrm()
|
||||
|
||||
if t.TeamId <= 0 && o.QueryTable(t.TableNameWithPrefix()).Filter("team_name", t.TeamName).Exist() {
|
||||
return errors.New("团队名称已存在")
|
||||
}
|
||||
if t.TeamId <= 0 {
|
||||
_, err = o.Insert(t)
|
||||
} else {
|
||||
_, err = o.Update(t, cols...)
|
||||
}
|
||||
if err != nil {
|
||||
beego.Error("在保存团队时出错 ->", err)
|
||||
}
|
||||
return
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"github.com/lifei6671/mindoc/conf"
|
||||
"errors"
|
||||
"github.com/astaxie/beego/orm"
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
|
||||
type TeamMember struct {
|
||||
TeamMemberId int `orm:"column(team_member_id);pk;auto;unique;" json:"team_member_id"`
|
||||
TeamId int `orm:"column(team_id);type(int)" json:"team_id"`
|
||||
MemberId int `orm:"column(member_id);type(int)" json:"member_id"`
|
||||
// RoleId 角色:0 创始人(创始人不能被移除) / 1 管理员/2 编辑者/3 观察者
|
||||
RoleId conf.BookRole `orm:"column(role_id);type(int)" json:"role_id"`
|
||||
RoleName string `orm:"-" json:"role_name"`
|
||||
Account string `orm:"-" json:"account"`
|
||||
RealName string `orm:"-" json:"real_name"`
|
||||
Avatar string `orm:"-" json:"avatar"`
|
||||
}
|
||||
|
||||
// TableName 获取对应数据库表名.
|
||||
func (m *TeamMember) TableName() string {
|
||||
return "team_member"
|
||||
}
|
||||
func (m *TeamMember) TableNameWithPrefix() string {
|
||||
return conf.GetDatabasePrefix() + m.TableName()
|
||||
}
|
||||
|
||||
// TableEngine 获取数据使用的引擎.
|
||||
func (m *TeamMember) TableEngine() string {
|
||||
return "INNODB"
|
||||
}
|
||||
|
||||
// 联合唯一键
|
||||
func (m *TeamMember) TableUnique() [][]string {
|
||||
return [][]string{{"team_id", "member_id"}}
|
||||
}
|
||||
|
||||
func NewTeamMember() *TeamMember {
|
||||
return &TeamMember{}
|
||||
}
|
||||
|
||||
func (m *TeamMember) First(id int, cols ...string) (*TeamMember, error) {
|
||||
if id <= 0 {
|
||||
return nil, errors.New("参数错误")
|
||||
}
|
||||
o := orm.NewOrm()
|
||||
|
||||
err := o.QueryTable(m.TableNameWithPrefix()).Filter("team_member_id", id).One(m, cols...)
|
||||
|
||||
if err != nil && err != orm.ErrNoRows {
|
||||
beego.Error("查询团队成员错误 ->", err)
|
||||
}
|
||||
|
||||
return m.Include(), err
|
||||
}
|
||||
|
||||
func (m *TeamMember) ChangeRoleId(teamId int, memberId int, roleId conf.BookRole) (member *TeamMember, err error) {
|
||||
|
||||
if teamId <= 0 || memberId <= 0 || roleId <= 0 || roleId > conf.BookObserver {
|
||||
return nil, ErrInvalidParameter
|
||||
}
|
||||
o := orm.NewOrm()
|
||||
|
||||
err = o.QueryTable(m.TableNameWithPrefix()).Filter("team_id", teamId).Filter("member_id", memberId).One(m)
|
||||
|
||||
if err != nil {
|
||||
beego.Error("查询团队用户时失败 ->", err)
|
||||
return m, err
|
||||
}
|
||||
m.RoleId = roleId
|
||||
|
||||
err = m.Save("role_id")
|
||||
|
||||
if err == nil {
|
||||
m.Include()
|
||||
}
|
||||
return m, err
|
||||
}
|
||||
|
||||
func (m *TeamMember) FindFirst(teamId, memberId int) (*TeamMember, error) {
|
||||
if teamId <= 0 || memberId <= 0 {
|
||||
return nil, ErrInvalidParameter
|
||||
}
|
||||
o := orm.NewOrm()
|
||||
err := o.QueryTable(m.TableNameWithPrefix()).Filter("team_id",teamId).Filter("member_id",memberId).One(m)
|
||||
|
||||
if err != nil {
|
||||
beego.Error("查询团队用户失败 ->",err)
|
||||
return nil,err
|
||||
}
|
||||
return m.Include(),nil
|
||||
}
|
||||
|
||||
func (m *TeamMember) Save(cols ...string) (err error) {
|
||||
|
||||
if m.TeamId <= 0 {
|
||||
return errors.New("团队不能为空")
|
||||
}
|
||||
if m.MemberId <= 0 {
|
||||
return errors.New("用户不能为空")
|
||||
}
|
||||
|
||||
o := orm.NewOrm()
|
||||
|
||||
if !o.QueryTable(NewTeam().TableNameWithPrefix()).Filter("team_id", m.TeamId).Exist() {
|
||||
return errors.New("团队不存在")
|
||||
}
|
||||
if !o.QueryTable(NewMember()).Filter("member_id", m.MemberId).Filter("status", 0).Exist() {
|
||||
return errors.New("用户不存在或已禁用")
|
||||
}
|
||||
if m.TeamMemberId <= 0 {
|
||||
_, err = o.Insert(m)
|
||||
} else {
|
||||
_, err = o.Update(m, cols...)
|
||||
}
|
||||
if err != nil {
|
||||
beego.Error("在保存团队时出错 ->", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (m *TeamMember) Delete(id int) (err error) {
|
||||
|
||||
if id <= 0 {
|
||||
return ErrInvalidParameter
|
||||
}
|
||||
_, err = orm.NewOrm().QueryTable(m.TableNameWithPrefix()).Filter("team_member_id", id).Delete()
|
||||
|
||||
if err != nil {
|
||||
beego.Error("删除团队用户时出错 ->", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (m *TeamMember) FindToPager(teamId, pageIndex, pageSize int) (list []*TeamMember, totalCount int, err error) {
|
||||
if teamId <= 0 {
|
||||
err = ErrInvalidParameter
|
||||
return
|
||||
}
|
||||
offset := (pageIndex - 1) * pageSize
|
||||
|
||||
o := orm.NewOrm()
|
||||
|
||||
_, err = o.QueryTable(m.TableNameWithPrefix()).Filter("team_id", teamId).Offset(offset).Limit(pageSize).All(&list)
|
||||
|
||||
if err != nil {
|
||||
if err != orm.ErrNoRows {
|
||||
beego.Error("查询团队成员失败 ->", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
c, err := o.QueryTable(m.TableNameWithPrefix()).Filter("team_id", teamId).Count()
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
totalCount = int(c)
|
||||
|
||||
//将来优化
|
||||
for _, item := range list {
|
||||
item.Include()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (m *TeamMember) Include() *TeamMember {
|
||||
|
||||
if member, err := NewMember().Find(m.MemberId, "account", "real_name", "avatar"); err == nil {
|
||||
m.Account = member.Account
|
||||
m.RealName = member.RealName
|
||||
m.Avatar = member.Avatar
|
||||
}
|
||||
if m.RoleId == 0 {
|
||||
m.RoleName = "创始人"
|
||||
} else if m.RoleId == 1 {
|
||||
m.RoleName = "管理员"
|
||||
} else if m.RoleId == 2 {
|
||||
m.RoleName = "编辑者"
|
||||
} else if m.RoleId == 3 {
|
||||
m.RoleName = "观察者"
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
func (m *TeamMember) FindNotJoinMemberByAccount(teamId int, account string, limit int) (*SelectMemberResult, error) {
|
||||
if teamId <= 0 {
|
||||
return nil, ErrInvalidParameter
|
||||
}
|
||||
o := orm.NewOrm()
|
||||
|
||||
sql := `select member.member_id,member.account
|
||||
from md_members as member
|
||||
left join md_team_member as team on team.team_id = ? and member.member_id != team.member_id
|
||||
where member.account like ?
|
||||
order by member.member_id desc
|
||||
limit ?;`
|
||||
|
||||
members := make([]*Member, 0)
|
||||
|
||||
_, err := o.Raw(sql, teamId, "%"+account+"%", limit).QueryRows(&members)
|
||||
|
||||
if err != nil {
|
||||
beego.Error("查询团队用户时出错 ->", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := SelectMemberResult{}
|
||||
items := make([]KeyValueItem, 0)
|
||||
|
||||
for _, member := range members {
|
||||
item := KeyValueItem{}
|
||||
item.Id = member.MemberId
|
||||
item.Text = member.Account
|
||||
items = append(items, item)
|
||||
}
|
||||
result.Result = items
|
||||
|
||||
return &result, err
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"github.com/lifei6671/mindoc/conf"
|
||||
"time"
|
||||
)
|
||||
|
||||
type TeamRelationship struct {
|
||||
TeamRelationshipId int `orm:"column(team_relationship_id);pk;auto;unique;" json:"team_relationship_id"`
|
||||
BookId int `orm:"column(book_id)"`
|
||||
TeamId int `orm:"column(team_id)"`
|
||||
CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
|
||||
}
|
||||
|
||||
// TableName 获取对应数据库表名.
|
||||
func (m *TeamRelationship) TableName() string {
|
||||
return "team_relationship"
|
||||
}
|
||||
func (m *TeamRelationship) TableNameWithPrefix() string {
|
||||
return conf.GetDatabasePrefix() + m.TableName()
|
||||
}
|
||||
|
||||
// TableEngine 获取数据使用的引擎.
|
||||
func (m *TeamRelationship) TableEngine() string {
|
||||
return "INNODB"
|
||||
}
|
||||
|
||||
// 联合唯一键
|
||||
func (m *TeamRelationship) TableUnique() [][]string {
|
||||
return [][]string{{"team_id", "team_id"}}
|
||||
}
|
||||
|
||||
func NewTeamRelationship() *TeamRelationship {
|
||||
return &TeamRelationship{}
|
||||
}
|
|
@ -40,6 +40,23 @@ func init() {
|
|||
|
||||
beego.Router("/manager/config", &controllers.ManagerController{}, "*:Config")
|
||||
|
||||
beego.Router("/manager/team", &controllers.ManagerController{}, "*:Team")
|
||||
beego.Router("/manager/team/create", &controllers.ManagerController{}, "POST:TeamCreate")
|
||||
beego.Router("/manager/team/edit", &controllers.ManagerController{}, "POST:TeamEdit")
|
||||
beego.Router("/manager/team/delete", &controllers.ManagerController{}, "POST:TeamDelete")
|
||||
|
||||
beego.Router("/manager/team/member/list/:id", &controllers.ManagerController{}, "*:TeamMemberList")
|
||||
beego.Router("/manager/team/member/add", &controllers.ManagerController{}, "POST:TeamMemberAdd")
|
||||
beego.Router("/manager/team/member/delete", &controllers.ManagerController{}, "POST:TeamMemberDelete")
|
||||
beego.Router("/manager/team/member/change_role", &controllers.ManagerController{}, "POST:TeamChangeMemberRole")
|
||||
beego.Router("/manager/team/member/search", &controllers.ManagerController{}, "*:TeamSearchMember")
|
||||
|
||||
|
||||
beego.Router("/manager/team/book/list/:id", &controllers.ManagerController{}, "*:TeamBookList")
|
||||
beego.Router("/manager/team/book/add", &controllers.ManagerController{}, "POST:TeamBookAdd")
|
||||
beego.Router("/manager/team/book/delete", &controllers.ManagerController{}, "POST:TeamBookDelete")
|
||||
|
||||
|
||||
beego.Router("/setting", &controllers.SettingController{}, "*:Index")
|
||||
beego.Router("/setting/password", &controllers.SettingController{}, "*:Password")
|
||||
beego.Router("/setting/upload", &controllers.SettingController{}, "*:Upload")
|
||||
|
|
|
@ -12,12 +12,7 @@
|
|||
<link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet">
|
||||
<link href="{{cdncss "/static/select2/4.0.5/css/select2.min.css"}}" rel="stylesheet">
|
||||
<link href="{{cdncss "/static/css/main.css" "version"}}" rel="stylesheet">
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="{{cdnjs "/static/html5shiv/3.7.3/html5shiv.min.js"}}"></script>
|
||||
<script src="{{cdnjs "/static/respond.js/1.4.2/respond.min.js"}}"></script>
|
||||
<![endif]-->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="manual-reader">
|
||||
|
|
|
@ -0,0 +1,263 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>团队管理 - Powered by MinDoc</title>
|
||||
|
||||
<!-- Bootstrap -->
|
||||
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
|
||||
<link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet">
|
||||
<link href="{{cdncss "/static/css/main.css" "version"}}" rel="stylesheet">
|
||||
|
||||
<style type="text/css">
|
||||
.table > tbody > tr > td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="manual-reader">
|
||||
{{template "widgets/header.tpl" .}}
|
||||
<div class="container manual-body">
|
||||
<div class="row">
|
||||
{{template "manager/widgets.tpl" "team"}}
|
||||
<div class="page-right">
|
||||
<div class="m-box">
|
||||
<div class="box-head">
|
||||
<strong class="box-title"> 团队管理</strong>
|
||||
{{if eq .Member.Role 0}}
|
||||
<button type="button" class="btn btn-success btn-sm pull-right" data-toggle="modal"
|
||||
data-target="#addTeamDialogModal"><i class="fa fa-user-plus" aria-hidden="true"></i>
|
||||
创建团队
|
||||
</button>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="users-list" id="teamList">
|
||||
<template v-if="lists.length <= 0">
|
||||
<div class="text-center">暂无数据</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>团队名称</th>
|
||||
<th width="150px">成员数量</th>
|
||||
<th width="150px">项目数量</th>
|
||||
<th align="center" width="220px">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="item in lists">
|
||||
<td>${item.team_name}</td>
|
||||
<td>${item.member_count}</td>
|
||||
<td>${item.book_count}</td>
|
||||
<td>
|
||||
<a :href="'{{urlfor "ManagerController.TeamBookList" ":id" ""}}' + item.team_id" class="btn btn-primary btn-sm">项目</a>
|
||||
<a :href="'{{urlfor "ManagerController.TeamMemberList" ":id" ""}}' + item.team_id" type="button" class="btn btn-success btn-sm">成员</a>
|
||||
<button type="button" class="btn btn-sm btn-default" @click="editTeam(item.team_id)">编辑</button>
|
||||
<button type="button" class="btn btn-danger btn-sm" @click="deleteTeam(item.team_id,$event)" data-loading-text="删除中">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</template>
|
||||
<nav class="pagination-container">
|
||||
{{.PageHtml}}
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "widgets/footer.tpl" .}}
|
||||
</div>
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="addTeamDialogModal" tabindex="-1" role="dialog" aria-labelledby="addTeamDialogModalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<form method="post" autocomplete="off" class="form-horizontal"
|
||||
action="{{urlfor "ManagerController.TeamCreate"}}" id="addTeamDialogForm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
|
||||
aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel">创建团队</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="account">团队名称<span
|
||||
class="error-message">*</span></label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="teamName" class="form-control" placeholder="团队名称" id="teamName" maxlength="50">
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<span id="form-error-message"></span>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
|
||||
<button type="submit" class="btn btn-success" data-loading-text="保存中..." id="btnAddTeam">保存
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div><!--END Modal-->
|
||||
<div class="modal fade" id="editTeamDialogModal" tabindex="-1" role="dialog" aria-labelledby="editTeamDialogModalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<form method="post" autocomplete="off" class="form-horizontal" action="{{urlfor "ManagerController.TeamEdit"}}" id="editTeamDialogForm">
|
||||
<input type="hidden" name="teamId" value="">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
|
||||
aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel">编辑团队</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="account">团队名称<span class="error-message">*</span></label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="teamName" class="form-control" placeholder="团队名称" maxlength="50">
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<span id="form-error-message"></span>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
|
||||
<button type="submit" class="btn btn-success" data-loading-text="保存中..." id="btnEditTeam">保存
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div><!--END Modal-->
|
||||
|
||||
|
||||
<script src="{{cdnjs "/static/jquery/1.12.4/jquery.min.js"}}"></script>
|
||||
<script src="{{cdnjs "/static/bootstrap/js/bootstrap.min.js"}}"></script>
|
||||
<script src="{{cdnjs "/static/vuejs/vue.min.js"}}"></script>
|
||||
<script src="{{cdnjs "/static/js/jquery.form.js"}}" type="text/javascript"></script>
|
||||
<script src="{{cdnjs "/static/js/main.js"}}" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var editTeamDialogModal = $("#editTeamDialogModal");
|
||||
|
||||
$("#addTeamDialogModal").on("show.bs.modal", function () {
|
||||
window.addTeamDialogModalHtml = $(this).find("form").html();
|
||||
}).on("hidden.bs.modal", function () {
|
||||
$(this).find("form").html(window.addTeamDialogModalHtml);
|
||||
});
|
||||
$("#addTeamDialogForm").ajaxForm({
|
||||
beforeSubmit: function () {
|
||||
var account = $.trim($("#addTeamDialogForm #teamName").val());
|
||||
if (account === "") {
|
||||
return showError("团队名称不能为空");
|
||||
}
|
||||
$("#btnAddTeam").button("loading");
|
||||
return true;
|
||||
},
|
||||
success: function ($res) {
|
||||
if ($res.errcode === 0) {
|
||||
app.lists.splice(0, 0, $res.data);
|
||||
$("#addTeamDialogModal").modal("hide");
|
||||
} else {
|
||||
showError($res.message);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
showError("服务器异常");
|
||||
},
|
||||
complete: function () {
|
||||
$("#btnAddTeam").button("reset");
|
||||
}
|
||||
});
|
||||
|
||||
editTeamDialogModal.on("shown.bs.modal",function () {
|
||||
$(this).find("input[name='teamName']").focus();
|
||||
});
|
||||
$("#editTeamDialogForm").ajaxForm({
|
||||
beforeSubmit: function () {
|
||||
var account = $.trim(editTeamDialogModal.find("input[name='teamName']").val());
|
||||
if (account === "") {
|
||||
return showError("团队名称不能为空");
|
||||
}
|
||||
$("#btnEditTeam").button("loading");
|
||||
return true;
|
||||
},success :function ($res) {
|
||||
if ($res.errcode === 0) {
|
||||
for (var index in app.lists) {
|
||||
var item = app.lists[index];
|
||||
if (item.team_id == $res.data.team_id) {
|
||||
app.lists.splice(index, 1, $res.data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
editTeamDialogModal.modal("hide");
|
||||
}else {
|
||||
showError($res.message);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
showError("服务器异常");
|
||||
},
|
||||
complete: function () {
|
||||
$("#btnEditTeam").button("reset");
|
||||
}
|
||||
});
|
||||
|
||||
var app = new Vue({
|
||||
el: "#teamList",
|
||||
data: {
|
||||
lists: {{.Result}}
|
||||
},
|
||||
delimiters: ['${', '}'],
|
||||
methods: {
|
||||
deleteTeam: function (id, e) {
|
||||
var $this = this;
|
||||
$.ajax({
|
||||
url: "{{urlfor "ManagerController.TeamDelete"}}",
|
||||
type: "post",
|
||||
data: {"id": id},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if (res.errcode === 0) {
|
||||
|
||||
for (var index in $this.lists) {
|
||||
var item = $this.lists[index];
|
||||
if (item.team_id == id) {
|
||||
$this.lists.splice(index, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
alert("操作失败:" + res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
editTeam : function (id, e) {
|
||||
var $this = this;
|
||||
for (var index in $this.lists) {
|
||||
var item = $this.lists[index];
|
||||
if (item.team_id == id) {
|
||||
editTeamDialogModal.find("input[name='teamName']").val(item.team_name);
|
||||
editTeamDialogModal.find("input[name='teamId']").val(item.team_id);
|
||||
editTeamDialogModal.modal("show");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Vue.nextTick(function () {
|
||||
$("[data-toggle='tooltip']").tooltip();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,246 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>团队用户管理 - Powered by MinDoc</title>
|
||||
|
||||
<!-- Bootstrap -->
|
||||
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
|
||||
<link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet">
|
||||
<link href="{{cdncss "/static/select2/4.0.5/css/select2.min.css"}}" rel="stylesheet">
|
||||
<link href="{{cdncss "/static/css/main.css" "version"}}" rel="stylesheet">
|
||||
<style type="text/css">
|
||||
.table>tbody>tr>td{vertical-align: middle;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="manual-reader">
|
||||
{{template "widgets/header.tpl" .}}
|
||||
<div class="container manual-body">
|
||||
<div class="row">
|
||||
{{template "manager/widgets.tpl" "team"}}
|
||||
<div class="page-right">
|
||||
<div class="m-box">
|
||||
<div class="box-head">
|
||||
<strong class="box-title">{{.Model.TeamName}} - 成员管理</strong>
|
||||
{{if eq .Member.Role 0}}
|
||||
<button type="button" class="btn btn-success btn-sm pull-right" data-toggle="modal" data-target="#addTeamMemberDialogModal"><i class="fa fa-user-plus" aria-hidden="true"></i> 添加成员</button>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="users-list" id="teamMemberList">
|
||||
<template v-if="lists.length <= 0">
|
||||
<div class="text-center">暂无数据</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="80">头像</th>
|
||||
<th>账号</th>
|
||||
<th>姓名</th>
|
||||
<th>角色</th>
|
||||
<th width="80px">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="item in lists">
|
||||
<td><img :src="item.avatar" onerror="this.src='{{cdnimg "/static/images/middle.gif"}}'" class="img-circle" width="34" height="34"></td>
|
||||
<td>${item.account}</td>
|
||||
<td>${item.real_name}</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default btn-sm" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
${item.role_name}
|
||||
<span class="caret"></span></button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="javascript:;" @click="setTeamMemberRole(item.member_id,1)">管理员 <p class="text">拥有阅读、写作和管理权限</p></a> </li>
|
||||
<li><a href="javascript:;" @click="setTeamMemberRole(item.member_id,2)">编辑者 <p class="text">拥有阅读和写作权限</p></a> </li>
|
||||
<li><a href="javascript:;" @click="setTeamMemberRole(item.member_id,3)">观察者 <p class="text">拥有阅读权限</p></a> </li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-danger btn-sm" @click="deleteMember(item.member_id,$event)" data-loading-text="删除中">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</template>
|
||||
<nav class="pagination-container">
|
||||
{{.PageHtml}}
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "widgets/footer.tpl" .}}
|
||||
</div>
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="addTeamMemberDialogModal" tabindex="-1" role="dialog" aria-labelledby="addTeamMemberDialogModalLabel">
|
||||
<div class="modal-dialog modal-sm" role="document" style="width: 400px;">
|
||||
<form method="post" autocomplete="off" class="form-horizontal" action="{{urlfor "ManagerController.TeamMemberAdd"}}" id="addTeamMemberDialogForm">
|
||||
<input type="hidden" name="teamId" value="{{.Model.TeamId}}">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel">添加成员</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">账号</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="js-data-example-ajax form-control" multiple="multiple" name="memberId" id="memberId"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">角色</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="roleId" class="form-control">
|
||||
<option value="1">管理员</option>
|
||||
<option value="2">编辑者</option>
|
||||
<option value="3">观察者</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<span id="form-error-message"></span>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
|
||||
<button type="submit" class="btn btn-success" data-loading-text="保存中..." id="btnAddMember">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div><!--END Modal-->
|
||||
|
||||
<script src="{{cdnjs "/static/jquery/1.12.4/jquery.min.js"}}"></script>
|
||||
<script src="{{cdnjs "/static/bootstrap/js/bootstrap.min.js"}}"></script>
|
||||
<script src="{{cdnjs "/static/vuejs/vue.min.js"}}"></script>
|
||||
<script src="{{cdnjs "/static/js/jquery.form.js"}}" type="text/javascript"></script>
|
||||
<script src="{{cdnjs "/static/select2/4.0.5/js/select2.full.min.js"}}"></script>
|
||||
<script src="{{cdnjs "/static/select2/4.0.5/js/i18n/zh-CN.js"}}"></script>
|
||||
<script src="{{cdnjs "/static/js/main.js"}}" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var modalCache = $("#addTeamMemberDialogModal form").html();
|
||||
|
||||
/**
|
||||
* 添加用户
|
||||
*/
|
||||
$("#addTeamMemberDialogForm").ajaxForm({
|
||||
beforeSubmit : function () {
|
||||
var memberId = $.trim($("#memberId").val());
|
||||
if(memberId === ""){
|
||||
return showError("账号不能为空");
|
||||
}
|
||||
$("#btnAddMember").button("loading");
|
||||
},
|
||||
success : function (res) {
|
||||
if(res.errcode === 0){
|
||||
app.lists.splice(0,0,res.data);
|
||||
$("#addTeamMemberDialogModal").modal("hide");
|
||||
}else{
|
||||
showError(res.message);
|
||||
}
|
||||
$("#btnAddMember").button("reset");
|
||||
}
|
||||
});
|
||||
$("#addTeamMemberDialogModal").on("hidden.bs.modal",function () {
|
||||
$(this).find("form").html(modalCache);
|
||||
}).on("show.bs.modal",function () {
|
||||
$('.js-data-example-ajax').select2({
|
||||
language: "zh-CN",
|
||||
minimumInputLength : 1,
|
||||
minimumResultsForSearch: Infinity,
|
||||
maximumSelectionLength:1,
|
||||
width : "100%",
|
||||
ajax: {
|
||||
url: '{{urlfor "ManagerController.TeamSearchMember" "teamId" .Model.TeamId}}',
|
||||
dataType: 'json',
|
||||
data: function (params) {
|
||||
return {
|
||||
q: params.term, // search term
|
||||
page: params.page
|
||||
};
|
||||
},
|
||||
processResults: function (data, params) {
|
||||
return {
|
||||
results : data.data.results
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var app = new Vue({
|
||||
el : "#teamMemberList",
|
||||
data : {
|
||||
lists : {{.Result}}
|
||||
},
|
||||
delimiters : ['${','}'],
|
||||
methods : {
|
||||
setTeamMemberRole : function (member_id, role) {
|
||||
var $this = this;
|
||||
$.ajax({
|
||||
url :"{{urlfor "ManagerController.TeamChangeMemberRole"}}",
|
||||
dataType :"json",
|
||||
type :"post",
|
||||
data : { "memberId" : member_id,"roleId" : role ,"teamId":{{.Model.TeamId}}},
|
||||
success : function (res) {
|
||||
if(res.errcode === 0){
|
||||
for (var index in $this.lists) {
|
||||
var item = $this.lists[index];
|
||||
|
||||
if (item.member_id === member_id) {
|
||||
|
||||
$this.lists.splice(index,1,res.data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
alert("操作失败:" + res.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
deleteMember : function (id, e) {
|
||||
var $this = this;
|
||||
$.ajax({
|
||||
url : "{{urlfor "ManagerController.TeamMemberDelete"}}",
|
||||
type : "post",
|
||||
data : { "memberId":id ,"teamId":{{.Model.TeamId}}},
|
||||
dataType : "json",
|
||||
success : function (res) {
|
||||
if (res.errcode === 0) {
|
||||
|
||||
for (var index in $this.lists) {
|
||||
var item = $this.lists[index];
|
||||
if (item.member_id == id) {
|
||||
console.log(item);
|
||||
$this.lists.splice(index,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
alert("操作失败:" + res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
Vue.nextTick(function () {
|
||||
$("[data-toggle='tooltip']").tooltip();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,11 +1,12 @@
|
|||
<div class="page-left">
|
||||
<ul class="menu">
|
||||
<li{{if eq "index" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Index"}}" class="item"><i class="fa fa-dashboard" aria-hidden="true"></i> 仪表盘</a> </li>
|
||||
<li{{if eq "users" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Users" }}" class="item"><i class="fa fa-users" aria-hidden="true"></i> 用户管理</a> </li>
|
||||
<li{{if eq "users" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Users" }}" class="item"><i class="fa fa-user" aria-hidden="true"></i> 用户管理</a> </li>
|
||||
<li{{if eq "team" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Team" }}" class="item"><i class="fa fa-group" aria-hidden="true"></i> 团队管理</a> </li>
|
||||
<li{{if eq "books" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Books" }}" class="item"><i class="fa fa-book" aria-hidden="true"></i> 项目管理</a> </li>
|
||||
{{/*<li><a href="{{urlfor "ManagerController.Comments" }}" class="item"><i class="fa fa-comments-o" aria-hidden="true"></i> 评论管理</a> </li>*/}}
|
||||
<li{{if eq "setting" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Setting" }}" class="item"><i class="fa fa-cogs" aria-hidden="true"></i> 配置管理</a> </li>
|
||||
<li{{if eq "config" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Config" }}" class="item"><i class="fa fa-file" aria-hidden="true"></i> 配置文件</a> </li>
|
||||
{{/*<li{{if eq "config" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Config" }}" class="item"><i class="fa fa-file" aria-hidden="true"></i> 配置文件</a> </li>*/}}
|
||||
<li{{if eq "attach" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.AttachList" }}" class="item"><i class="fa fa-cloud-upload" aria-hidden="true"></i> 附件管理</a> </li>
|
||||
<li{{if eq "label" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.LabelList" }}" class="item"><i class="fa fa-bookmark" aria-hidden="true"></i> 标签管理</a> </li>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue