sunsheng 1 жил өмнө
parent
commit
6a7dfb4ca5

+ 11 - 1
src/api/user.go

@@ -336,7 +336,17 @@ func ImportUser(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 				errors = append(errors, fmt.Sprintf("第%d行错误: %s", rowNum, "编号不能为空"))
 				continue
 			}
-			user.Roles = []string{us[2]}
+			roles := []string{}
+			if us[2] == "管理员" {
+				roles = []string{"admin"}
+			}
+			if us[2] == "教员" {
+				roles = []string{"teacher"}
+			}
+			if us[2] == "学员" {
+				roles = []string{"student"}
+			}
+			user.Roles = roles
 			user.Password = UtilMd5(us[3])
 			if len(us[3]) == 0 {
 				user.Password = UtilMd5("123456")

+ 11 - 1
src/api/userExcel.go

@@ -131,7 +131,17 @@ func (b *UserExcel) drawTableContent() error {
 	users := b.Content
 	if len(users) > 0 {
 		for _, user := range users {
-			rowMaxHeight := DrawRow(b.Row, user.Name, user.Nid, user.Roles[0], user.Password)
+			role := ""
+			if user.Roles[0] == "admin" {
+				role = "管理员"
+			}
+			if user.Roles[0] == "teacher" {
+				role = "教员"
+			}
+			if user.Roles[0] == "student" {
+				role = "学员"
+			}
+			rowMaxHeight := DrawRow(b.Row, user.Name, user.Nid, role, user.Password)
 			b.RowsHeightArray = append(b.RowsHeightArray, map[int]float64{b.Row: rowMaxHeight})
 			b.Row++
 		}

BIN
src/file/用户信息模板.xlsx


BIN
src/file/考核试题模板-tmp.xlsx


BIN
src/file/考核试题模板.xlsx