Переглянути джерело

Merge branch 'master' of ssh://192.168.136.45:10022/SERVER/langer

chenjunkai 5 роки тому
батько
коміт
f921b98a26

+ 15 - 9
controller/SkuConditionName.py

@@ -42,16 +42,22 @@ class skuConditionView(TemplateView):
             user_qs = UserModel.objects.filter(id=userID)
             if not user_qs.exists():
                 return response.json(403)
-            if operation == 'add':
-                return self.do_add(request_dict, response)
-            elif operation == 'update':
-                return self.do_update(request_dict, response)
-            elif operation == 'delete':
-                return self.do_delete(request_dict, response)
-            elif operation == 'query':
-                return self.do_query(request_dict, response, userID)
+            if user_qs[0].username == "admin":
+                if operation == 'add':
+                    return self.do_add(request_dict, response)
+                elif operation == 'update':
+                    return self.do_update(request_dict, response)
+                elif operation == 'delete':
+                    return self.do_delete(request_dict, response)
+                elif operation == 'query':
+                    return self.do_query(request_dict, response, userID)
+                else:
+                    return response.json(414)
             else:
-                return response.json(414)
+                if operation == 'query':
+                    return self.do_query(request_dict, response, userID)
+                else:
+                    return response.json(414)
         else:
             return response.json(tko.code)
 

+ 19 - 13
controller/SkuRuleName.py

@@ -42,20 +42,26 @@ class skuRuleView(TemplateView):
             user_qs = UserModel.objects.filter(id=userID)
             if not user_qs.exists():
                 return response.json(403)
-            if operation == 'add':
-                return self.do_add(request_dict, response)
-            elif operation == 'update':
-                return self.do_update(request_dict, response)
-            elif operation == 'delete':
-                return self.do_delete(request_dict, response)
-            elif operation == 'query':
-                return self.do_query(request_dict, response, userID)
-            elif operation == 'query_all':
-                return self.do_query_all(request_dict, response, userID)
-
-
+            if user_qs[0].username == "admin":
+                if operation == 'add':
+                    return self.do_add(request_dict, response)
+                elif operation == 'update':
+                    return self.do_update(request_dict, response)
+                elif operation == 'delete':
+                    return self.do_delete(request_dict, response)
+                elif operation == 'query':
+                    return self.do_query(request_dict, response, userID)
+                elif operation == 'query_all':
+                    return self.do_query_all(request_dict, response, userID)
+                else:
+                    return response.json(414)
             else:
-                return response.json(414)
+                if operation == 'query':
+                    return self.do_query(request_dict, response, userID)
+                elif operation == 'query_all':
+                    return self.do_query_all(request_dict, response, userID)
+                else:
+                    return response.json(414)
         else:
             return response.json(tko.code)
 

+ 22 - 12
controller/SkuSuitName.py

@@ -41,24 +41,34 @@ class skuSuitView(TemplateView):
         if tko.code == 0:
             userID = tko.userID
             user_qs = UserModel.objects.filter(id=userID)
+            if user_qs[0].username == "admin":
+                if operation == 'add':
+                    return self.do_add(request_dict, response)
+                elif operation == 'update':
+                    return self.do_update(request_dict, response)
+                elif operation == 'delete':
+                    return self.do_delete(request_dict, response)
+                elif operation == 'query':
+                    return self.do_query(request_dict, response, userID)
+                elif operation == 'query_all':
+                    return self.do_query_all(request_dict, response, userID)
+                else:
+                    return response.json(414)
+            else:
+                if operation == 'query':
+                    return self.do_query(request_dict, response, userID)
+                elif operation == 'query_all':
+                    return self.do_query_all(request_dict, response, userID)
+                else:
+                    return response.json(414)
             if not user_qs.exists():
                 return response.json(403)
-            if operation == 'add':
-                return self.do_add(request_dict, response)
-            elif operation == 'update':
-                return self.do_update(request_dict, response)
-            elif operation == 'delete':
-                return self.do_delete(request_dict, response)
-            elif operation == 'query':
-                return self.do_query(request_dict, response, userID)
-            elif operation == 'query_all':
-                return self.do_query_all(request_dict, response, userID)
-            else:
-                return response.json(414)
+
         else:
             return response.json(tko.code)
 
     def do_add(self, request_dict, response):
+
         name = request_dict.get('name', None)
         if name:
             nowTime = int(time.time())

+ 10 - 2
controller/User.py

@@ -39,11 +39,14 @@ class registerView(TemplateView):
         response = ResponseObject()
         username = request_dict.get('username', None)
         password = request_dict.get('password', None)
+        role_id = request_dict.get('role_id', None)
+
         if username and password:
             nowTime = int(time.time())
             create_dict = {
                 'username': username,
                 'password': make_password(password),
+                'role_id':role_id,
                 'addTime': nowTime,
                 'updTime': nowTime}
             try:
@@ -73,11 +76,14 @@ class loginView(TemplateView):
         password = request_dict.get('password', None)
         if username and password:
             user_qs = UserModel.objects.filter(username=username)
+
             if not user_qs.exists():
                 return response.json(401)
             if check_password(password, user_qs[0].password):
                 tko = TokenObject()
                 res = tko.generate({'userID': user_qs[0].id})
+                res['role_id'] = user_qs[0].role_id
+
                 return response.json(0, res)
             else:
                 return response.json(401)
@@ -105,7 +111,7 @@ class queryView(TemplateView):
             user_qs = UserModel.objects.filter(id=userID, username='admin')
             if not user_qs.exists():
                 return response.json(403)
-            um_qs = UserModel.objects.filter().values('id', 'username')
+            um_qs = UserModel.objects.filter().values('id', 'username','role_id')
 
             ls_qs = LangSetModel.objects.filter().values('user__id', 'lang__lang')
             res = []
@@ -138,11 +144,13 @@ class updateView(TemplateView):
         id = request_dict.get('id', None)
         langSetArr = request_dict.get('langSetArr', None)
         username = request_dict.get('username', None)
+        role_id = request_dict.get('role_id', None)
         nowTime = int(time.time())
         tko = TokenObject(token)
         if tko.code == 0:
             user = UserModel.objects.get(id=id)
             user.username = username
+            user.role_id = role_id
             user.updTime = nowTime
             user.save()
             if id and langSetArr:
@@ -152,7 +160,7 @@ class updateView(TemplateView):
                                                 user=UserModel.objects.get(id=id), addTime=nowTime, updTime=nowTime)
                 return response.json(0)
             else:
-                return
+                return response.json(0)
         else:
             return response.json(tko.code)
 

+ 1 - 0
model/models.py

@@ -7,6 +7,7 @@ class UserModel(models.Model):
     id = models.AutoField(primary_key=True)
     username = models.CharField(max_length=64, unique=True, default='', verbose_name='用户名')
     password = models.CharField(max_length=128, default='', verbose_name='密码')
+    role_id = models.CharField(max_length=64, default='', verbose_name='角色')
     addTime = models.IntegerField(verbose_name='添加时间', default=0)
     updTime = models.IntegerField(verbose_name='更新时间', default=0)
 

+ 23 - 1
web/js/jqhttpsdk.js

@@ -7,7 +7,29 @@ let domain = document.domain;
 
 // let http_ip_prot = 'http://192.168.136.40:7724/';
     //生产环境
-let http_ip_prot = 'http://47.107.129.126:7724/';
+// let http_ip_prot = 'http://47.107.129.126:7724/';
+
+var http_ip_prot = convertTemp()+ "/";
+	if( http_ip_prot.indexOf("zositech")==-1 ){
+		http_ip_prot="http://192.168.136.39:8000/";
+//		http_ip_prot="http://www.zositech.xyz:7724/";
+		console.log(http_ip_prot);
+	}else{
+		console.log(http_ip_prot);
+	}
+
+
+
+// 获取访问路径
+function convertTemp(){
+   var the_url = document.location.toString();
+   var first_split = the_url.split("//");
+   var without_resource = first_split[1];
+   var second_split = without_resource.split("/");
+   var domain = second_split[0];
+   return first_split[0] +'//'+ domain;
+}
+
 
 $.GetJSON = function (url, data, callback) {
     $.ajax({

+ 10 - 1
web/sku/css/commonality.css

@@ -58,4 +58,13 @@ body {
 	background: white;
 	height: 800px;
 	padding-left: 40px;
-}
+}
+
+.logout{
+	float: right; 
+	margin-right: 30px;
+}
+
+.logout:hover{
+	color: red;
+}

+ 1 - 1
web/sku/css/find_sku.css

@@ -123,4 +123,4 @@
 	text-align: center;    
 	border-top: 2px solid #e4e7e9; 
 	width: 50%;
-}
+}

+ 0 - 1
web/sku/css/sku_index.css

@@ -1,5 +1,4 @@
 
-
 /*添加套装*/
 .new_suit{
 	float: left;

+ 10 - 9
web/sku/find_sku.html

@@ -5,25 +5,26 @@
 		<title>查找SKU</title>
 	</head>
 	<style type="text/css">  
-		@import url("css/bootstrap.min.css?ver=zb20191128");
-    	@import url("css/commonality.css?ver=zb20191128");
-    	@import url("css/find_sku.css?ver=zb20191128" );
+		@import url("css/bootstrap.min.css?ver=zb20191130");
+    	@import url("css/commonality.css?ver=zb20191130");
+    	@import url("css/find_sku.css?ver=zb20191130" );
     </style>
     
-    <script type="text/javascript" src="js/jquery-2.1.1.min.js?ver=zb20191128"></script>
-    <script type="text/javascript" src="js/bootstrap-paginator.js?ver=zb20191128" ></script>
-    <script type="text/javascript" src="js/find_sku.js?ver=zb20191128" ></script>
-    <script type="text/javascript" src="js/ip.js?ver=zb20191128" ></script>
-    <script type="text/javascript" src="js/jquery_cookie_min.js?ver=zb20191128"></script>
+    <script type="text/javascript" src="js/jquery-2.1.1.min.js?ver=zb20191130"></script>
+    <script type="text/javascript" src="js/bootstrap-paginator.js?ver=zb20191130" ></script>
+    <script type="text/javascript" src="js/find_sku.js?ver=zb20191130" ></script>
+    <script type="text/javascript" src="js/ip.js?ver=zb20191130" ></script>
+    <script type="text/javascript" src="js/jquery_cookie_min.js?ver=zb20191130"></script>
     
 	<body>
 		<!--头部-->
 		<div class='head'>
 			<div class="col-sm-2 col-xs-12 head_left"><img class="head_logo" src="img/ansjer@2x.png"></div>
+			<div class="logout" id="logout"><img src="img/logout@2x.png" style="margin-right: 5px;">注销</div>
 		</div>
 		<!--菜单-->
 		<div class="col-sm-2 col-xs-12 menu">
-			<div class="menu_list" onclick="javascript:window.location.href='sku_index.html?ver=zb20191128'" style="border-left: 3px solid #efefef;"> 
+			<div class="menu_list" onclick="javascript:window.location.href='sku_index.html?ver=zb20191130'" style="border-left: 3px solid #efefef;"> 
 				<div class="menu_ico"><img src="img/SKUnaming_rule@2x.png" class="menu_img"></div>
 				<div class="menu_text">SKU命名规则</div>
 			</div>

+ 10 - 1
web/sku/js/find_sku.js

@@ -201,5 +201,14 @@ $(function () {
 //	$(".ipt_find").on('blur',function(){
 //		$(".find_img").removeClass("find_img_hover");
 //	});
-
+	
+//	注销登录
+	$("#logout").on('click',function(){
+	//清空cookie
+		$.cookie("access_token", "", {expires: -1});
+		$.cookie("refresh_token", "", {expires: -1});
+		$.cookie("role_id", "", {expires: -1});
+	//回到首页
+		window.location.href = "sku_index.html";
+	});
 });

+ 2 - 1
web/sku/js/ip.js

@@ -18,4 +18,5 @@ function convertTemp(){
    var second_split = without_resource.split("/");
    var domain = second_split[0];
    return first_split[0] +'//'+ domain;
-}
+}
+

+ 146 - 103
web/sku/js/sku_index.js

@@ -1,12 +1,20 @@
 $(function () {
+	$(".new_suit").show(400);
+	
 	var token=$.cookie('access_token');
-	 
+	var role_id=$.cookie('role_id');
 	if(token==undefined){
 		window.location.href = "login.html";
 	}
 	
     var url=http+"cku_suit/query_all"; 
     var data_string = JSON.stringify({token:token});
+    if(role_id=="admin"){
+    	
+    }else{
+    	$(".new_suit_a").hide();
+    }
+   
 //  首次获取
     $.ajax({
         url: url,
@@ -24,8 +32,8 @@ $(function () {
 					suit_html=suit_html +		 '<div class="suit_title_text">'+data.res[k].suitName+'</div>';
 					suit_html=suit_html +		 '<div class="suit_title_ico"><img src="img/spread.png"></div>';
 					suit_html=suit_html +		 '</div>';
-					
-					suit_html=suit_html +		 '<div class="add_rule" >'
+					if(role_id=="admin"){
+						suit_html=suit_html +		 '<div class="add_rule" >'
 										+		 	'<div class="add_rule_a" rid="'+data.res[k].id+'">'
 										+		 		'<div class="icon_img">'
 										+		 			'<img src="img/Add@2x.png">'
@@ -34,16 +42,29 @@ $(function () {
 										+			'</div>'
 										+		'</div>'
 										+	'</div>';
-				 
-						suit_html=suit_html +	'<div class="rule_all_list" >';
+					}else{
+						suit_html=suit_html +		 '<div class="add_rule" >'
+									 	+		 	'<div class="add_rule_a" style=" border: 1px solid white;">'
+									 	+		 		'<div class="icon_img">' 
+										+				'</div>'
+										+				'<div class="add_rule_title"></div>'
+										+			'</div>'
+										+		'</div>'
+										+	'</div>';
+					}
+					
+				 	
+					suit_html=suit_html +	'<div class="rule_all_list" >';
 					let num=8;
 					for(var i=0;i<data.res[k].sr_qs.length;i++){
-						
+						 
 						if(i==0){
 							suit_html=suit_html +	'<div class="rule_one" style="border-top: 1px solid #e4e7e9;">';
 						}else{
 							suit_html=suit_html +	'<div class="rule_one">';
 						}
+						 
+						
 						
 						suit_html=suit_html+		'<div class="rule_ rule_hr" rid="'+data.res[k].sr_qs[i].id+'">'+data.res[k].sr_qs[i].ruleName+'</div>';
 //					 
@@ -79,12 +100,16 @@ $(function () {
 								}
 							}
 						}
-						suit_html=suit_html+		'<div class="rule_" style="float: right;">'
+						if(role_id=="admin"){
+							suit_html=suit_html +		'<div class="rule_" style="float: right;">'
 								 				+		'<div class="rule_operate"><img style="margin-left: 50%; "src="img/modify@2x.png" class="compile" title="编辑"></div>'
 								 				+		'<div class="rule_operate"><img style="margin-left: 10%; " src="img/delete@2x.png" class="remove" title="删除"></div>'
-								 				
 								 				+		'<div class="rule_save_div"><div class="rule_save">保存</div></div>'
 								 				+	'</div>'
+						}else{
+								suit_html=suit_html +		'<div class="rule_" style="float: right;">'
+								+	'</div>'
+						}
 						suit_html=suit_html+'</div>';
 					}
 				  
@@ -136,9 +161,8 @@ $(function () {
 	        data: data_string,
 	        async: true,//同步
 	        success: function (data)
-	        {
+	        {	console.log(data);
 	            if(data.code==0){
-	             	console.log(data);
 	             	let id = data.res[0].id;
 				              var suit_html='					<div class="suit_" >';
 						suit_html=suit_html +		 	'<div style="height: 80px;width: 100%;">';
@@ -162,6 +186,7 @@ $(function () {
 					console.log(suit_exit_value.parent());	
 					suit_exit_value.parent().parent().parent().children().eq(0).append(suit_html);
 	            }else{
+	            	alert("该用户没有权限!")
 	             	return;
 	            }
 	        },
@@ -179,26 +204,31 @@ $(function () {
 	var add_rule;
 	var add_i=0;
 	var suit_rid;
-//	添加规则和添加条件
+	
+	
+	//	添加规则和添加条件
 	$(document).on('click','.add_rule_a', function() {
-		suit_rid = $(this).attr("rid");
-		add_i=0;
-		add_rule = $(this).parent().parent().parent().children().eq(1);
-		$(".add_role_div").parent().children().eq(0).html('');
-		var html_ = '<div>'
-	            +'        		 <div class="condition_one">'
-	            +'       		 	 <input class="ipt_condition" id="condition_number_'+add_i+'" type="text" placeholder="输入条件编号,例如:1"> :'
-		        +'           	 </div>'
-		        +'           	 <div class="condition_one">'
-		        +'           		<input class="ipt_condition" id="condition_that_'+add_i+'" type="text" placeholder="输入条件说明,例如:红色">'
-		        +'          	 </div>'
-	            +'      	</div>'
-	    $(".add_role_div").parent().children().eq(0).append(html_);
-		 
-		add_i=add_i+1;
-		$('#rule_add_id').fadeIn(100);
-		$('#rule_add').slideDown(200);
+		if(role_id=="admin"){
+			suit_rid = $(this).attr("rid");
+			add_i=0;
+			add_rule = $(this).parent().parent().parent().children().eq(1);
+			$(".add_role_div").parent().children().eq(0).html('');
+			var html_ = '<div>'
+		            +'        		 <div class="condition_one">'
+		            +'       		 	 <input class="ipt_condition" id="condition_number_'+add_i+'" type="text" placeholder="输入条件编号,例如:1"> :'
+			        +'           	 </div>'
+			        +'           	 <div class="condition_one">'
+			        +'           		<input class="ipt_condition" id="condition_that_'+add_i+'" type="text" placeholder="输入条件说明,例如:红色">'
+			        +'          	 </div>'
+		            +'      	</div>'
+		    $(".add_role_div").parent().children().eq(0).append(html_);
+			 
+			add_i=add_i+1;
+			$('#rule_add_id').fadeIn(100);
+			$('#rule_add').slideDown(200);
+		}
 	});
+
 	
 	
 //	编辑
@@ -272,7 +302,6 @@ $(function () {
 //				显示隐藏
 				$(this).parent().parent().parent().children().eq(i).children().eq(1).hide();
 				$(this).parent().parent().parent().children().eq(i).children().eq(0).show();
-				 
 			}
 			
 		}
@@ -325,11 +354,84 @@ $(function () {
 	        async: false,//同步
 	        success: function (data)
 	        {
-//	        	console.log(data);
+	        	console.log(data);
 	            if(data.code==0){
 //	             	console.log(data);
 					rule_id = data.res[0].id;
+					for(let i=0;i<add_i;i++){
+						let number = $("#condition_number_"+i).val();
+						if(number!="" && number!=undefined){
+							condition_number.push([number]); 
+						}
+						let that = $("#condition_that_"+i).val();
+						if(that!="" && that!=undefined){
+							condition_that.push([that]);
+						}
+						let url=http+"sku_condition/add"; 
+					    let data_string = JSON.stringify({token:token,numName:number,name:that,id:rule_id});
+					    $.ajax({
+					        url: url,
+					        type: "post",
+					        dataType:"JSON",
+					        data: data_string,
+					        async: false,//同步
+					        success: function (data)
+					        {
+					            if(data.code==0){
+			//		             	console.log(data);
+					             	condition_id.push(data.res[0].id);
+					            }else{
+					             	return;
+					            }
+					        },
+					        error:function (XMLHttpRequest) {
+					            console.log("失败!");
+					            
+					    	}
+						});
+							
+					}
+			//		console.log(condition_number);
+			//		console.log(condition_that)
+					let suit_html='';
+					let num=8;
+					for(let i=0;i<1;i++){
+						suit_html=suit_html +	'<div class="rule_one">';
+						suit_html=suit_html+		'<div class="rule_ rule_hr" rid="'+rule_id+'">'+role_edit_name+'</div>';
+						if (condition_that.length>8){
+							num=17
+						}
+						if (condition_that.length>18){
+							num=26
+						}
+						for(let j=0;j<num;j++){
+							if(j==9){
+								suit_html=suit_html+		'<div class="rule_ rule_hr"></div>';
+								try{
+									suit_html=suit_html+		'<div class="rule_"><span class="rule_term">'+condition_number[j]+':'+condition_that[j]+'</span> <input class="rule_input" rid="'+condition_id[j]+'" value="'+condition_number[j]+':'+condition_that[j]+'"></div>';
+								}catch(e){
+									//TODO handle the exception
+									suit_html=suit_html+		'<div class="rule_ rule_hr"></div>';
+								}
+							}else{
+								if(j<condition_number.length){
+									suit_html=suit_html+		'<div class="rule_"><span class="rule_term">'+condition_number[j]+':'+condition_that[j]+'</span> <input class="rule_input"  rid="'+condition_id[j]+'"  value="'+condition_number[j]+':'+condition_that[j]+'"></div>';
+								}else{
+									suit_html=suit_html+		'<div class="rule_"></div>';
+								}
+							}
+						}
+						suit_html=suit_html+		'<div class="rule_" style="float: right;">'
+						 				+		'<div class="rule_operate"><img style="margin-left: 50%; "src="img/modify@2x.png" class="compile" title="编辑"></div>'
+						 				+		'<div class="rule_operate"><img style="margin-left: 10%; " src="img/delete@2x.png" class="remove" title="删除"></div>'
+						 				+		'<div class="rule_save_div"><div class="rule_save">保存</div></div>'
+						 				+		'</div>'
+						 				+	'</div>';
+					}
+					add_rule.append(suit_html);
+					add_i=0; //重置为0
 	            }else{
+	            	alert("该用户没有权限!");
 	             	return;
 	            }
 	        },
@@ -339,85 +441,15 @@ $(function () {
 	    	}
 		});
 		
-		for(let i=0;i<add_i;i++){
-			let number = $("#condition_number_"+i).val();
-			if(number!="" && number!=undefined){
-				condition_number.push([number]); 
-			}
-			let that = $("#condition_that_"+i).val();
-			if(that!="" && that!=undefined){
-				condition_that.push([that]);
-			}
-			let url=http+"sku_condition/add"; 
-		    let data_string = JSON.stringify({token:token,numName:number,name:that,id:rule_id});
-		    $.ajax({
-		        url: url,
-		        type: "post",
-		        dataType:"JSON",
-		        data: data_string,
-		        async: false,//同步
-		        success: function (data)
-		        {
-		            if(data.code==0){
-//		             	console.log(data);
-		             	condition_id.push(data.res[0].id);
-		            }else{
-		             	return;
-		            }
-		        },
-		        error:function (XMLHttpRequest) {
-		            console.log("失败!");
-		            
-		    	}
-			});
-				
-		}
-//		console.log(condition_number);
-//		console.log(condition_that)
-		let suit_html='';
-		let num=8;
-		for(let i=0;i<1;i++){
-			suit_html=suit_html +	'<div class="rule_one">';
-			suit_html=suit_html+		'<div class="rule_ rule_hr" rid="'+rule_id+'">'+role_edit_name+'</div>';
-			if (condition_that.length>8){
-				num=17
-			}
-			if (condition_that.length>18){
-				num=26
-			}
-			for(let j=0;j<num;j++){
-				if(j==9){
-					suit_html=suit_html+		'<div class="rule_ rule_hr"></div>';
-					try{
-						suit_html=suit_html+		'<div class="rule_"><span class="rule_term">'+condition_number[j]+':'+condition_that[j]+'</span> <input class="rule_input" rid="'+condition_id[j]+'" value="'+condition_number[j]+':'+condition_that[j]+'"></div>';
-					}catch(e){
-						//TODO handle the exception
-						suit_html=suit_html+		'<div class="rule_ rule_hr"></div>';
-					}
-				}else{
-					if(j<condition_number.length){
-						suit_html=suit_html+		'<div class="rule_"><span class="rule_term">'+condition_number[j]+':'+condition_that[j]+'</span> <input class="rule_input"  rid="'+condition_id[j]+'"  value="'+condition_number[j]+':'+condition_that[j]+'"></div>';
-					}else{
-						suit_html=suit_html+		'<div class="rule_"></div>';
-					}
-				}
-			}
-			suit_html=suit_html+		'<div class="rule_" style="float: right;">'
-			 				+		'<div class="rule_operate"><img style="margin-left: 50%; "src="img/modify@2x.png" class="compile" title="编辑"></div>'
-			 				+		'<div class="rule_operate"><img style="margin-left: 10%; " src="img/delete@2x.png" class="remove" title="删除"></div>'
-			 				+		'<div class="rule_save_div"><div class="rule_save">保存</div></div>'
-			 				+		'</div>'
-			 				+	'</div>';
-		}
-		add_rule.append(suit_html);
-		add_i=0; //重置为0
+		
 	});
 	
 //	套装的显示隐藏
 	
 	$(document).on('click','.suit_title', function() {
 //		console.log($(this).parent().parent().children().eq(1).is(':hidden'))
-		if($(this).parent().parent().children().eq(1).is(':hidden')){
+		if($(this).parent().children().eq(1).children().is(':hidden')){
+			console.log($(this).parent().children().eq(1).children().html())
 			$(this).parent().parent().children().eq(1).show();
 			$(this).parent().children().eq(1).children().show();
 //			切换图标
@@ -474,6 +506,17 @@ $(function () {
 		$('#rule_add_id').fadeOut(100);
 		$('#rule_add').slideUp(200);
 	});
+	
+	
+//	注销登录
+	$("#logout").on('click',function(){
+	//清空cookie
+		$.cookie("access_token", "", {expires: -1});
+		$.cookie("refresh_token", "", {expires: -1});
+		$.cookie("role_id", "", {expires: -1});
+	//回到首页
+		window.location.href = "sku_index.html";
+	});
 });
 
 

+ 12 - 13
web/sku/login.html

@@ -7,14 +7,14 @@
     <title>sku_login</title>
     <style type="text/css">  
 		@import url("http://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css");
-    	@import url("css/bootstrap-grid.css?ver=zb20191128");
-    	@import url("css/htmleaf-demo.css?ver=zb20191128" );
-    	@import url("css/login.css?ver=zb20191128" );
+    	@import url("css/bootstrap-grid.css?ver=zb20191130");
+    	@import url("css/htmleaf-demo.css?ver=zb20191130" );
+    	@import url("css/login.css?ver=zb20191130" );
     </style>
     
-    <script src="js/jquery-2.1.1.min.js?ver=zb20191128"></script>
-    <script src="js/jquery_cookie_min.js?ver=zb20191128"></script>
-    <script src="js/ip.js?ver=zb20191128"></script>
+    <script src="js/jquery-2.1.1.min.js?ver=zb20191130"></script>
+    <script src="js/jquery_cookie_min.js?ver=zb20191130"></script>
+    <script src="js/ip.js?ver=zb20191130"></script>
      
 </head>
 <body>
@@ -74,13 +74,11 @@
 	        success: function (data)
 	        {
 	            if (data['code'] == 0) {
-	                if (username == 'admin' || RegExp(/sku/).test(username)==true) {
-	                	$.cookie('access_token', data.res.access_token, data.res.access_expire);
-	                	$.cookie('refresh_token', data.res.refresh_token, data.res.refresh_expire);
-	                	window.location.href = "sku_index.html?ver=zb20191128";
-	                }else{
-	                	alert("该用户没有权限,请联系管理员!");
-	                }
+	                console.log(data);
+                	$.cookie('access_token', data.res.access_token, data.res.access_expire);
+                	$.cookie('refresh_token', data.res.refresh_token, data.res.refresh_expire);
+                	$.cookie('role_id', data.res.role_id, data.res.access_expire);
+                	window.location.href = "sku_index.html?ver=zb20191130";
 	            } else {
 	                alert(data['msg'])
 	            }
@@ -90,5 +88,6 @@
 	    	}
 		});
 	}
+    //http://www.zositech.xyz:7724/cku_suit/delete?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySUQiOjE4LCJleHAiOjE1NzU1MzQwNjB9.345rdh34fmEsQ6dX225BQgXbSnbrOh3vGwxqERr2Kr4&id=2
 </script>
 </html>

+ 13 - 9
web/sku/sku_index.html

@@ -6,20 +6,21 @@
 	</head>
 	
 	<style type="text/css">  
-		@import url("css/bootstrap.min.css?ver=zb20191128");
-		@import url("css/commonality.css?ver=zb20191128");
-    	@import url("css/sku_index.css?ver=zb20191128");
+		@import url("css/bootstrap.min.css?ver=zb20191130");
+		@import url("css/commonality.css?ver=zb20191130");
+    	@import url("css/sku_index.css?ver=zb20191130");
     </style>
     
-    <script type="text/javascript" src="js/jquery-2.1.1.min.js?ver=zb20191128"></script>
-    <script type="text/javascript" src="js/sku_index.js?ver=zb20191128" ></script>
-    <script type="text/javascript" src="js/ip.js?ver=zb20191128" ></script>
-    <script type="text/javascript" src="js/jquery_cookie_min.js?ver=zb20191128"></script>
+    <script type="text/javascript" src="js/jquery-2.1.1.min.js?ver=zb20191130"></script>
+    <script type="text/javascript" src="js/sku_index.js?ver=zb20191130" ></script>
+    <script type="text/javascript" src="js/ip.js?ver=zb20191130" ></script>
+    <script type="text/javascript" src="js/jquery_cookie_min.js?ver=zb20191130"></script>
     
 	<body>
 		<!--头部-->
 		<div class='head'>
 			<div class="col-sm-2 col-xs-12 head_left"><img class="head_logo" src="img/ansjer@2x.png"></div>
+			<div class="logout" id="logout"><img src="img/logout@2x.png" style="margin-right: 5px;">注销</div>
 		</div>
 		<!--菜单-->
 		<div class="col-sm-2 col-xs-12 menu">
@@ -27,7 +28,7 @@
 				<div class="menu_ico"><img src="img/SKUNaming_rules_select@2x.png" class="menu_img"></div>
 				<div class="menu_text" style="color: #40ace6;">SKU命名规则</div>
 			</div>
-			<div class="menu_list" onclick="javascript:window.location.href='find_sku.html?ver=zb20191128'" style=" border-left: 3px solid #efefef;"> 
+			<div class="menu_list" onclick="javascript:window.location.href='find_sku.html?ver=zb20191130'" style=" border-left: 3px solid #efefef;"> 
 				<div class="menu_ico"><img src="img/findSKU@2x.png" class="menu_img"></div>
 				<div class="menu_text">查找SKU</div>
 			</div>
@@ -38,7 +39,9 @@
 				
 			</div>
 			<!--新增套装-->
-			<div class="new_suit">
+			
+			
+			<div class="new_suit" style="display: none;">
 				<div class="col-sm-2 col-xs-12 new_suit_a">
 					<div class="new_suit_b" title="新增套装">
 						<div class="new_suit_img">
@@ -117,4 +120,5 @@
 	    </div>
 		<div class="theme-popover-mask" id="rule_add_id" style="display: none;"></div>
 	</body>
+</body>   
 </html>

+ 20 - 3
web/userTab.html

@@ -80,6 +80,10 @@
                                     密码
                                 </label>
                                 <input type="text" class="form-control" id="InputPassword"/>
+                                <label for="InputRole">
+                                    角色
+                                </label>
+                                <input type="text" class="form-control" id="InputRole"/>
                             </div>
 
                             <button type="submit" class="btn btn-primary" onclick="subRegAction();return false;">
@@ -99,6 +103,7 @@
                                 <th>编号</th>
                                 <th>用户</th>
                                 <th>语言</th>
+                                <th>角色</th>
                                 <th>操作</th>
                             </tr>
                             </thead>
@@ -165,6 +170,7 @@
                 if (data['code'] == 0) {
                     console.log(data)
                     index_data = data['res']
+
                     addTable(data['res'])
                 } else {
                     alert(data['msg'])
@@ -194,7 +200,8 @@
                 langArr_td += (y + '&nbsp;&nbsp')
             });
             langArr_td += '</td>';
-            body_html += '<tr><td>' + obj['id'] + '</td><td>' + obj['username'] + '</td>' + langArr_td + '<td>' + edit_btn + '&nbsp;&nbsp;&nbsp;' + del_btn + '</td></tr>'
+
+            body_html += '<tr><td>' + obj['id'] + '</td><td>' + obj['username'] + '</td>' + langArr_td + '<td>' + obj['role_id'] + '</td><td>' + edit_btn + '&nbsp;&nbsp;&nbsp;' + del_btn + '</td> </tr>'
         })
         $('#tabBody').html(body_html)
     }
@@ -247,14 +254,20 @@
         // alert(langKey)
         console.log(index_data)
         $('#modal-container-edit').modal('show')
-        let html_edit = '<label for="editDataInput" class="form-group">用户名:</label>'
         let user_lang_arr
+        let html_edit = '<label for="editDataInput" class="form-group">用户名:</label>'
+
         $.each(index_data, function (idx, obj) {
             if (id == obj['id']) {
                 user_lang_arr = obj['lang_arr']
                 html_edit += '<input type="text" class="form-control" id="editDataInput" value="' + obj['username'] + '" lid="' + id + '">'
+                html_edit += '<label for="editDataRole" class="form-group">角色:</label>'
+                html_edit += '<input type="text" class="form-control" id="editDataRole" value="' + obj['role_id'] + '" lid="' + id + '">'
             }
         });
+
+
+
         html_edit += '<hr><span class="form-group">显示语言:</span>';
         $.each(lang_data, function (idx, obj) {
             let checkbox_val=''
@@ -284,6 +297,7 @@
             'token': $.cookie('access_token'),
             'id': $('#editDataInput').attr('lid'),
             'username': $('#editDataInput').val(),
+            'role_id': $('#editDataRole').val(),
             'langSetArr': sub_lang_arr
         }
         console.log(post_data)
@@ -304,9 +318,12 @@
     function subRegAction() {
         let username = $("#InputUsername").val();
         let password = $("#InputPassword").val();
+        let role_id = $("#InputRole").val();
+
         let post_data = {
             'username': username,
-            'password': password
+            'password': password,
+            'role_id':role_id
         };
         $.postJSON(
             http_ip_prot + 'user/register',