Browse Source

剑鱼添加关键词

wangchuanjin 9 years ago
parent
commit
02f4b43ae2

+ 13 - 11
core/src/web/staticres/wxswordfish/main.js

@@ -119,13 +119,16 @@ KeyWordDialog.AppendNode = function(dialogObj,value){
 		return '<div class="keyWordGroup">'
 					+'<lable style="white-space:nowrap;">关键词<font>'+index+'</font></lable>'
 					+'<div><input type="text" onfocus="setFocus(this)" value="'+(value?value:"")+'" placeholder="示例:税务局 软件" maxlength="100"></div>'
-					+'<div>'+(index==1?'':'<img src="/wxswordfish/images/delete.png" class="delete">')+'</div>'
+					+'<div><img src="/wxswordfish/images/delete.png" class="delete"'+(index==1?' style="display: none;"':'')+'></div>'
 				+'</div>';
 	}
 	var count = dialogObj.find(".keyWordGroup").length;
 	if(count >= 10){
 		return;
 	}
+	if(count > 0){
+		dialogObj.find(".keyWordGroup:first").find(".delete").show();
+	}
 	var obj = $(getHtml(count+1,value));
 	dialogObj.find(".addKeyWordArea").before(obj);
 	//自动滚动到底部
@@ -136,6 +139,9 @@ KeyWordDialog.AppendNode = function(dialogObj,value){
 		dialogObj.find(".keyWordGroup").each(function(i){
 			$(this).children("lable").children("font").text(i+1);
 		});
+		if(dialogObj.find(".keyWordGroup").length == 1){
+			dialogObj.find(".keyWordGroup:first").find(".delete").hide();
+		}
 	});
 	if(typeof(value) == "undefined" || value == ""){
 		obj.find("[type='text']").focus();
@@ -499,22 +505,18 @@ $(function(){
 	$("body").append($("#tender-keyword").clone().removeAttr("id").attr("id","bid-keyword"))
 			.append($("#tender-scope").clone().removeAttr("id").attr("id","bid-scope"));
 	var searchnameIsExsit = false;
-	if(msgset == ""){
-		if(typeof(searchname) != "undefined" && searchname.length > 0 ){
+	if(typeof(searchname) != "undefined" && searchname.length > 0 ){
+		searchname = searchname.replace(/\s+/g,"+");
+		if(msgset == ""){
 			msgset = {};
 			msgset[s_type] = {"a_key":[searchname],"s_scope":"A"};
-		}
-	}else{
-		if (typeof(searchname) != "undefined" && searchname.length > 0 ){
+		}else{
 			if(typeof(msgset[s_type]) != "undefined"){
 				var keywordes = msgset[s_type].a_key;
 				if(typeof(keywordes) != "undefined" && keywordes.length > 0){
 					for(var i=0;i<keywordes.length;i++){
-						var keywordesArr = keywordes[i].split("+");
-						for(var k=0;k<keywordesArr.length;k++){
-							if(keywordesArr[k] == searchname){
-								searchnameIsExsit = true;
-							}
+						if(keywordes[i] == searchname){
+							searchnameIsExsit = true;
 						}
 					}
 					if(!searchnameIsExsit){

+ 2 - 2
core/src/web/staticres/wxswordfish/style.css

@@ -152,7 +152,7 @@ img{
 	top: 0px;
 	background-color: rgba(0,0,1,.5);
 	display: none;
-	z-index: 11;
+	z-index: 99999;
 }
 .dialog-main{
 	position: absolute;
@@ -512,7 +512,7 @@ img{
 	width: 100%;
 	border-top: 1px solid #CCCCCC;
 	background-color: #F8F8F8;
-	z-index: 1;
+	z-index: 9999;
 }
 .bottom-toolbar>li{
 	display: table-cell;

+ 14 - 18
core/src/web/templates/swordfish/rssset.html

@@ -347,22 +347,18 @@ $(function(){
 	}
 	var msgset = {{.T.msgset}};
 	var searchvalueIsExsit = false;
-	if(msgset == ""){
-		if(typeof(searchvalue) != "undefined" && searchvalue.length > 0 ){
+	if(typeof(searchvalue) != "undefined" && searchvalue.length > 0 ){
+		searchvalue = searchvalue.replace(/\s+/g,"+");
+		if(msgset == ""){
 			msgset = {};
 			msgset[searchtype] = {"a_key":[searchvalue],"s_scope":"A"};
-		}
-	}else{
-		if (typeof(searchvalue) != "undefined" && searchvalue.length > 0 ){
+		}else{
 			if(typeof(msgset[searchtype]) != "undefined"){
 				var keywordes = msgset[searchtype].a_key;
 				if(typeof(keywordes) != "undefined" && keywordes.length > 0){
 					for(var i=0;i<keywordes.length;i++){
-						var keywordesArr = keywordes[i].split("+");
-						for(var k=0;k<keywordesArr.length;k++){
-							if(keywordesArr[k] == searchvalue){
-								searchvalueIsExsit = true;
-							}
+						if(keywordes[i] == searchvalue){
+							searchvalueIsExsit = true;
 						}
 					}
 					if(!searchvalueIsExsit){
@@ -532,14 +528,8 @@ function appendKeyWord(type,value,isFocus){
 		var html='<div class="swordfish-keyword">'
 					+'<lable>关键词<font>'+index+'</font>:</lable>'
 					+'<input type="text" class="form-control" value="'+(value?value:"")+'" placeholder="示例:税务局 软件" maxlength="100">'
-					+'<img src="{{Msg "seo" "cdn"}}/images/swordfish/delete.png">'
-				+'</div>';
-		if (index==1){
-			html='<div class="swordfish-keyword">'
-					+'<lable>关键词<font>'+index+'</font>:</lable>'
-					+'<input type="text" class="form-control" value="'+(value?value:"")+'" placeholder="示例:税务局 软件" maxlength="100">'
-				+'</div>';
-		}
+					+'<img src="{{Msg "seo" "cdn"}}/images/swordfish/delete.png"'+(index==1?' style="display: none;"':'')+'>'
+					+'</div>';
 		return html;
 	}
 	var obj = $("#"+type+"-keywords");
@@ -547,6 +537,9 @@ function appendKeyWord(type,value,isFocus){
 	if(count >= 10){
 		return;
 	}
+	if(count > 0){
+		obj.children(".swordfish-keyword:first").children("img").show();
+	}
 	if(count == 9){
 		$("#"+type+"-addkeyword").attr("disabled",true);
 	}
@@ -558,6 +551,9 @@ function appendKeyWord(type,value,isFocus){
 		obj.find(".swordfish-keyword").each(function(i){
 			$(this).children("b").children("font").text(i+1);
 		});
+		if(obj.children(".swordfish-keyword").length == 1){
+			obj.children(".swordfish-keyword:first").children("img").hide();
+		}
 		ajaxReq();
 	});
 	node.children("[type='text']").blur(function(){

+ 4 - 0
core/src/web/templates/swordfish/wxsearchlist.html

@@ -258,6 +258,10 @@ body{
 .nullcontent{
 	bottom: 46px;
 	padding-top: 30%;
+	position: absolute;
+    top: 65px;
+    left: 0px;
+    right: 0px;
 }
 #wrapper{
 	padding-bottom: 98px;