Browse Source

no message

Jianghan 3 years ago
parent
commit
949ec0668f

+ 1 - 0
src/front/project.go

@@ -60,6 +60,7 @@ func (f *Front) ProjectList() {
 	} else {
 		query := map[string]interface{}{"s_type": "tag"}
 		info, _ := util.Mgo.Find("v_field", query, nil, map[string]interface{}{"s_name": 1, "s_code": 1}, false, -1, -1)
+		qu.Debug(query, len(*info))
 		f.T["fields"] = *info
 		_ = f.Render("project/project_list.html", &f.T)
 	}

+ 4 - 1
src/front/user.go

@@ -85,7 +85,10 @@ func (f *Front) Login() {
 				"id":        mgo.BsonIdToSId((*user)["_id"]),
 			})
 			UserMenu[username] = GetUserMenu(qu.IntAll((*user)["i_role"]))
-
+			f.ServeJson(map[string]interface{}{
+				"checked": checked,
+				"role":    (*user)["i_role"],
+			})
 		}
 		f.ServeJson(map[string]interface{}{
 			"checked": checked,

+ 11 - 1
src/web/templates/login.html

@@ -105,7 +105,17 @@
                 data:{"username": username,"pwd": pwd,"imgCode": $("#verifyImgCode").val()},
                 success:function(r){
                     if(r.checked){
-                        window.location.href="/front/index"
+                      alert(r.role)
+                      if (r.role === "4") {
+                        window.location.href="/front/user/task/list"
+                      }else if (r.role === "3") {
+                        window.location.href="/front/user/check/list"
+                      }else if (r.role === "2") {
+                        window.location.href="/front/group/task/list"
+                      }else {
+                        window.location.href="/front/project"
+                      }
+                      // window.location.href="/front/index"
                     }else{
                       $("#verifyImg")[0].src = '/code?' + Math.random()
                       alert(r.message);

+ 10 - 6
src/web/templates/project/task_detail.html

@@ -285,6 +285,8 @@
     });
 
     function cancelModel() {
+        $("#task-man").attr("style", "display:block;")
+        $("#task-auto").attr("style", "display:none;")
         $('#TaskDiv .group-item.clone-template').remove()
         $("#modal-create-task").modal('hide')
         document.getElementById("modal-form-task").reset();
@@ -312,13 +314,15 @@
                 num.value = isNotGiveNum;
             }
         }
-        for (var i in userList) {
-            var opt = document.createElement('option');
-            opt.innerText = userList[i]["s_login"];
-            opt.value = userList[i]["_id"];
-            $('#group-select')[0].appendChild(opt)
+        if ($('#group-select option').length === 0) {
+            for (var i in userList) {
+                var opt = document.createElement('option');
+                opt.innerText = userList[i]["s_login"];
+                opt.value = userList[i]["_id"];
+                $('#group-select')[0].appendChild(opt)
+            }
+            $("#group-select").selectpicker("refresh");
         }
-        $("#group-select").selectpicker("refresh");
     }
 
     function addTaskSelect() {