wangshan 6 жил өмнө
parent
commit
d1f86f8c47

+ 35 - 28
src/web/templates/weixin/historypush.html

@@ -327,8 +327,32 @@ function structureHtml(object){
 			return '<div class="restime time-diff">'+area+datatype+industryname+tdf+'</div>';
 		});
 		$(this).append('<div style="clear:both;"></div>');
+		var tableVisit = ""
+		// 已读未读
+		var $list = $(this).find(".bt").attr("eid");
+		if (typeof (a_visitedindex) != "undefined") {
+			var xh = $(this).find(".xh").text().replace(".", "");
+			// console.log(xh);
+			for (var i = 0; i < a_visitedindex.length; i++) {
+				if (xh == a_visitedindex[i]) {
+					tableVisit="visited";
+					$(this).find("a.bt").addClass("visited");
+					$(this).find(".xh").addClass("visited");
+				}
+			}
+		}
+		if (typeof (a_visitedindex) != "undefined") {
+			for (var i = 0; i < a_visitedindex.length; i++) {
+				if ($list == a_visitedindex[i]) {
+					tableVisit="visited";
+					$(this).find("a.bt").addClass("visited");
+					$(this).find(".xh").addClass("visited");
+				}
+			}
+		}
 		//
-		tablehtml +='<tr onClick="tablejump(\''+$(this).find("a.bt").attr("eid")+'\',\''+$(this).find("a.bt").attr("s")+'\',\''+words.join("_")+'\')">'+
+		
+		tablehtml +='<tr onClick="tablejump(\''+$(this).find("a.bt").attr("eid")+'\',\''+$(this).find("a.bt").attr("s")+'\',\''+words.join("_")+'\',$(this))" class="'+tableVisit+'">'+
 					'<td>'+count+'</td>'
 		if(typeof(info.projectname) != "undefined"&&info.projectname != ""){
 			var pn = info.projectname;
@@ -404,29 +428,6 @@ function structureHtml(object){
 		}
 		var tabletime = formatDate(info.publishtime);
 		tablehtml +='<td>'+tabletime+'</td></tr>';
-
-		// 已读未读
-		// console.log(a_visitedindex);
-		var $list = $(this).find(".bt").attr("eid");
-		if (typeof (a_visitedindex) != "undefined") {
-			var xh = $(this).find(".xh").text().replace(".", "");
-			// console.log(xh);
-			for (var i = 0; i < a_visitedindex.length; i++) {
-				if (xh == a_visitedindex[i]) {
-					$(this).find("a.bt").addClass("visited");
-					$(this).find(".xh").addClass("visited");
-				}
-			}
-		}
-		if (typeof (a_visitedindex) != "undefined") {
-
-			for (var i = 0; i < a_visitedindex.length; i++) {
-				if ($list == a_visitedindex[i]) {
-					$(this).find("a.bt").addClass("visited");
-					$(this).find(".xh").addClass("visited");
-				}
-			}
-		}
 	});
 	listCache += content.prop("outerHTML");
 	tableCache += tablehtml;
@@ -462,7 +463,7 @@ function formatDate(date,sl)   {
 //
 function appendList(content,tablehtml){
 	content.children(".tslist").on("click", function(event){
-		setVisitedIndex($(this));
+		setVisitedIndex($(this),"");
 		var sds = $(this).attr("words");
 		var h = $(this).find("a.bt").attr("s");
 		var eid = $(this).find("a.bt").attr("eid");
@@ -474,10 +475,11 @@ function appendList(content,tablehtml){
 	$(".findnull").hide();
 	$(".listcontent").show();
 }
-function tablejump(eid,h,sds){
+function tablejump(eid,h,sds,t){
 	if(localStorage){
 		localStorage.setItem("listortable"+{{.T._id}},"T");
 	}
+	setVisitedIndex(t,eid)
 	beforeJump(eid,h,sds);
 }
 function beforeJump(eid,h,sds){
@@ -505,8 +507,9 @@ function setSessionStorage(){
 	}
 }
 
-function setVisitedIndex(obj){
-	if(obj.find("a.bt").hasClass("visit")){
+function setVisitedIndex(obj,eid){
+	console.log(obj.hasClass("visited")+"--------")
+	if(obj.find("a.bt").hasClass("visit")||obj.hasClass("visited")){
 		return;
 	}
 	obj.find("a.bt").addClass("visited");
@@ -517,6 +520,10 @@ function setVisitedIndex(obj){
 		index = index.substring(0,index.length-1)
 	}
 	var vsid=obj.find("a.bt").attr("eid");
+	if (eid!=""){
+		obj.addClass("visited");
+		vsid = eid;
+	}
 	$.post("/wxpush/bid/ajaxReq",{_id:_id,vsid:vsid,index:index});
 }