Browse Source

问答点赞

luyanan 7 years ago
parent
commit
ef33cb1535
5 changed files with 81 additions and 70 deletions
  1. 4 4
      css/genindex.css
  2. 1 1
      css/share.css
  3. 52 52
      js/discover.js
  4. 2 1
      js/public/zoomify.js
  5. 22 12
      js/qa-show.js

+ 4 - 4
css/genindex.css

916
.item_detail .h1Font{font-weight:normal;font-size:24px;line-height:34px;color:#000;margin-bottom:10px;}
916
.item_detail .h1Font{font-weight:normal;font-size:24px;line-height:34px;color:#000;margin-bottom:10px;}
917
.item_detail .list_con{font-size: 15px;color: #333;line-height: 26px;margin: 6px 0;text-align:justify}
917
.item_detail .list_con{font-size: 15px;color: #333;line-height: 26px;margin: 6px 0;text-align:justify}
918
.item_info{margin:10px 0 6px;font-size:14px;color:#888888;}
918
.item_info{margin:10px 0 6px;font-size:14px;color:#888888;}
919
.list_image{display: none;}
919
.list-main .list_image{display: none;}
920
.list_image li{display: inline-block;float:left; width:26%; -webkit-box-sizing: border-box;box-sizing: border-box;position: relative;}
920
.list_image li{display: inline-block;float:left; width:26%; -webkit-box-sizing: border-box;box-sizing: border-box;position: relative;}
921
.list_image li>.imgspan{display: block;width: 97%;height:120px;margin-bottom:10px;background-size: cover;background-position: center;}
921
.list_image li>.imgspan{display: block;width: 97%;height:120px;margin-bottom:10px;background-size: cover;background-position: center;}
922
.list_image li>.imgspan img{opacity: 0;width:100%}
922
.list_image li>.imgspan img{opacity: 0;width:100%;height:100%}
923
923
924
.list_hander{margin:10px 0;position: relative;}
924
.list_hander{margin:10px 0;position: relative;}
925
.list_hander .goSpan span{margin:0 6px 0 0;width: 102px;}
925
.list_hander .goSpan span{margin:0 6px 0 0;width: 102px;}
944
.qa-question{width:100%;font-size: 16px;line-height: 28px;color: #333;}
944
.qa-question{width:100%;font-size: 16px;line-height: 28px;color: #333;}
945
.list-hold .qa-owner{min-height: 50px;margin:6px 0 10px;position: relative;}
945
.list-hold .qa-owner{min-height: 50px;margin:6px 0 10px;position: relative;}
946
.list-hold .qa-owner .goSpan{position: absolute;right: 0; top:50%;margin-top:-17px;}
946
.list-hold .qa-owner .goSpan{position: absolute;right: 0; top:50%;margin-top:-17px;}
947
.list-hold .qa-owner .goSpan>span{margin: 0px;width: 100px;}
947
.list-hold .qa-owner .goSpan>span{margin: 0px;width: 100px;background-position: 26px center;}
948
.list-hold .qa-owner .owner-head.useHead{width:50px;height:50px;margin-top:-25px}
948
.list-hold .qa-owner .owner-head.useHead{width:50px;height:50px;margin-top:-25px}
949
.list-hold .qa-owner .owner-info{padding-left:60px;width: 100%;padding-right:100px;}
949
.list-hold .qa-owner .owner-info{padding-left:60px;width: 100%;padding-right:100px;}
950
.list-hold .owner-name{float: none;}
950
.list-hold .owner-name{float: none;}
958
.hold-icon{position:relative;top:3px;display:inline-block;width:15px;height:15px;background-size: 100% auto;background-repeat: no-repeat;}
958
.hold-icon{position:relative;top:3px;display:inline-block;width:15px;height:15px;background-size: 100% auto;background-repeat: no-repeat;}
959
.icon-zan{background-image:url(../images/qa-icon-zan.png);background-position:0 -14px;}
959
.icon-zan{background-image:url(../images/qa-icon-zan.png);background-position:0 -14px;}
960
.icon-cai{background-image:url(../images/qa-icon-cai.png);background-position:0 -13px;}
960
.icon-cai{background-image:url(../images/qa-icon-cai.png);background-position:0 -13px;}
961
.holdSpan .noZan,.holdSpan .noCai{background:none;padding:7px 6px;cursor:auto;}
961
.holdSpan .noZan,.holdSpan .noCai{cursor:auto;}
962
.holdSpan>div.active{color: #FFFFFF;background:#ff9900;}
962
.holdSpan>div.active{color: #FFFFFF;background:#ff9900;}
963
.holdSpan>div.active .icon-zan{background-image:url(../images/qa-icon-zan.png);background-position:0 0;}
963
.holdSpan>div.active .icon-zan{background-image:url(../images/qa-icon-zan.png);background-position:0 0;}
964
.holdSpan>div.active .icon-cai{background-image:url(../images/qa-icon-cai.png);background-position:0 1px;}
964
.holdSpan>div.active .icon-cai{background-image:url(../images/qa-icon-cai.png);background-position:0 1px;}

+ 1 - 1
css/share.css

450
.item-btn{overflow: hidden;}
450
.item-btn{overflow: hidden;}
451
.list_image li,.item-btn li{display: inline-block;float:left; width: 33.3%; -webkit-box-sizing: border-box;box-sizing: border-box;position: relative;}
451
.list_image li,.item-btn li{display: inline-block;float:left; width: 33.3%; -webkit-box-sizing: border-box;box-sizing: border-box;position: relative;}
452
.list_image li>.imgspan{display: block;width: 98%;height:90px;background-size: cover;background-position: center;}
452
.list_image li>.imgspan{display: block;width: 98%;height:90px;background-size: cover;background-position: center;}
453
.list_image li>.imgspan img{opacity: 0;width: 100%;}
453
.list_image li>.imgspan img{opacity: 0;width: 100%;height:100%}
454
454
455
.item-btn{margin:6px -16px -15px -15px;border-top:1px solid #e5e5e5;}
455
.item-btn{margin:6px -16px -15px -15px;border-top:1px solid #e5e5e5;}
456
.item-btn li{border-right:1px solid #e5e5e5;height: 46px;}
456
.item-btn li{border-right:1px solid #e5e5e5;height: 46px;}

+ 52 - 52
js/discover.js

81
		});
81
		});
82
	
82
	
83
		// 当有文件添加进来的时候
83
		// 当有文件添加进来的时候
84
		uploader.on('fileQueued', function(file) {
85
			fileId = file.id;
86
			var $len = $("#fileList").find("img").length;
87
			if($len == 0 || $len == 1) {
88
				var oRemove = $("#fileList").find("dd");
89
				oRemove.eq(oRemove.length - 1).remove();
90
			} 
91
			var $li = $(
92
					'<dd>' +
93
						'<div class="imgItem" id="' + file.id + '">'+
94
							'<img />' +
95
						'</div>'+
96
					'</dd>'
97
				),
98
				$btns = $('<div class="file-panel">' +
99
					'<span class="cancel"></span>' +
100
					'</div>').appendTo($li),
101
				$img = $li.find('img');
102
			var $list = $("#fileList");
103
			if($len == 1) {
104
				$list.find("dd").eq(0).after($li)
105
			} else if($len == 2) {
106
				$list.find("dd").eq(1).after($li)
107
			} else {
108
				$list.prepend($li);
109
			}
110
	
111
			// 创建缩略图
112
			// 如果为非图片文件,可以不用调用此方法。
113
			// thumbnailWidth x thumbnailHeight 为 100 x 100
114
			uploader.makeThumb(file, function(error, src) {
115
				if(error) {
116
					$img.replaceWith('<span>不能预览</span>');
117
					return;
118
				}
119
				$img.attr('src', src);
120
			}, 1, 1);
121
		});
122
		uploader.onError = function(code) {
123
			console.log(code)
124
			$.MsgBox.Alert('提示', '请上传jpg、jpeg、png格式的图片,大小不超过2M')
125
		};
126
		uploader.on('uploadSuccess', function(file, data) {
127
			if(data.success) {
128
					uploader.removeFile(fileId);
129
					var cacheImageKey = temp.push(data.data[0].cacheKey);
130
			}else{
131
				$.MsgBox.Alert('提示', '只支持jpeg/jpg/png格式的图片');
132
			}
133
		});
84
//		uploader.on('fileQueued', function(file) {
85
//			fileId = file.id;
86
//			var $len = $("#fileList").find("img").length;
87
//			if($len == 0 || $len == 1) {
88
//				var oRemove = $("#fileList").find("dd");
89
//				oRemove.eq(oRemove.length - 1).remove();
90
//			} 
91
//			var $li = $(
92
//					'<dd>' +
93
//						'<div class="imgItem" id="' + file.id + '">'+
94
//							'<img />' +
95
//						'</div>'+
96
//					'</dd>'
97
//				),
98
//				$btns = $('<div class="file-panel">' +
99
//					'<span class="cancel"></span>' +
100
//					'</div>').appendTo($li),
101
//				$img = $li.find('img');
102
//			var $list = $("#fileList");
103
//			if($len == 1) {
104
//				$list.find("dd").eq(0).after($li)
105
//			} else if($len == 2) {
106
//				$list.find("dd").eq(1).after($li)
107
//			} else {
108
//				$list.prepend($li);
109
//			}
110
//	
111
//			// 创建缩略图
112
//			// 如果为非图片文件,可以不用调用此方法。
113
//			// thumbnailWidth x thumbnailHeight 为 100 x 100
114
//			uploader.makeThumb(file, function(error, src) {
115
//				if(error) {
116
//					$img.replaceWith('<span>不能预览</span>');
117
//					return;
118
//				}
119
//				$img.attr('src', src);
120
//			}, 1, 1);
121
//		});
122
//		uploader.onError = function(code) {
123
//			console.log(code)
124
//			$.MsgBox.Alert('提示', '请上传jpg、jpeg、png格式的图片,大小不超过2M')
125
//		};
126
//		uploader.on('uploadSuccess', function(file, data) {
127
//			if(data.success) {
128
//					uploader.removeFile(fileId);
129
//					var cacheImageKey = temp.push(data.data[0].cacheKey);
130
//			}else{
131
//				$.MsgBox.Alert('提示', '只支持jpeg/jpg/png格式的图片');
132
//			}
133
//		});
134
		/*删除图片*/
134
		/*删除图片*/
135
		$("#fileList").on("click", ".cancel", function() {
135
		$("#fileList").on("click", ".cancel", function() {
136
			var flag=$(this).attr("flag");
136
			var flag=$(this).attr("flag");
680
        if (dataStr.num > 0) {
680
        if (dataStr.num > 0) {
681
            hd = '<span>回答 ' + dataStr.num + '</span>'
681
            hd = '<span>回答 ' + dataStr.num + '</span>'
682
        }
682
        }
683
        var strAdd = '<a target="_blank" href="/qa-show.html?id='+dataStr.id+'">'
683
        var strAdd = '<a target="_blank" href="/qa-show.html?id='+dataStr.id+'" class="flexCenter">'
684
        	strAdd += '<div class="lefthead qa-Head" style="background-image:url('+ baImg +')"><span class="columTag">问答</span></div>';
684
        	strAdd += '<div class="lefthead qa-Head" style="background-image:url('+ baImg +')"><span class="columTag">问答</span></div>';
685
			strAdd += '<div class="centercon centercon2"><p class="h1font ellipsisSty-2">'+ dataStr.title +'</p>';
685
			strAdd += '<div class="centercon centercon2"><p class="h1font ellipsisSty-2">'+ dataStr.title +'</p>';
686
			strAdd += '<div class="h2font showInfo clearfix">'
686
			strAdd += '<div class="h2font showInfo clearfix">'
694
	}
694
	}
695

695

696
	function otherQa(dataStr,listLi){
696
	function otherQa(dataStr,listLi){
697
        var strAdd = '<a target="_blank" href="/qa-show.html?id='+dataStr.qid+'&topid='+dataStr.id+'">'+
697
        var strAdd = '<a target="_blank" href="/qa-show.html?id='+dataStr.qid+'&topid='+dataStr.id+'" class="flexCenter">'+
698
            '<div class="madiaInfo">' +
698
            '<div class="madiaInfo">' +
699
            '<div class="ellipsisSty qa-question"></div>' +
699
            '<div class="ellipsisSty qa-question"></div>' +
700
            '<div class="flexCenter qa-owner">' +
700
            '<div class="flexCenter qa-owner">' +

+ 2 - 1
js/public/zoomify.js

76
		var that      = this,
76
		var that      = this,
77
			transform = this.$image.css('transform');
77
			transform = this.$image.css('transform');
78
			this.$image.css("opacity",1)
78
			this.$image.css("opacity",1)
79
		
79
			this.$image.css("height","auto")
80
		this.transition(this.$image, 'none');
80
		this.transition(this.$image, 'none');
81
		this.transform('none');
81
		this.transform('none');
82
		
82
		
109
	Zoomify.prototype.zoomOut = function () {
109
	Zoomify.prototype.zoomOut = function () {
110
		var that = this;
110
		var that = this;
111
		this.$image.css("opacity",0)
111
		this.$image.css("opacity",0)
112
		this.$image.css("height","100%")
112
		
113
		
113
		this._zooming = true;
114
		this._zooming = true;
114
		this.$image.trigger('zoom-out.zoomify');
115
		this.$image.trigger('zoom-out.zoomify');

+ 22 - 12
js/qa-show.js

14
	if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){
14
	if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){
15
	 	location.href="http://" + hurl + "/e/wen.html?id="+questionId;
15
	 	location.href="http://" + hurl + "/e/wen.html?id="+questionId;
16
	}
16
	}
17
	var rows = 2,
17
	var rows = 10,
18
		dataO = {
18
		dataO = {
19
			time: "",
19
			time: "",
20
			id: "",
20
			id: "",
312
			var zancai='<div class="zan canZan"><em class="hold-icon icon-zan"></em><span class="agreeCount"></span></div>'+
312
			var zancai='<div class="zan canZan"><em class="hold-icon icon-zan"></em><span class="agreeCount"></span></div>'+
313
						'<div class="cai canCai"><em class="hold-icon icon-cai"></em></div>'
313
						'<div class="cai canCai"><em class="hold-icon icon-cai"></em></div>'
314
			if(dataStr.uid==userid){
314
			if(dataStr.uid==userid){
315
				var ballot=""
316
				if(dataStr.ballot>0){
317
					ballot=dataStr.ballot
318
				}
319
				opertStr='<span class="xiugai">修改</span><span class="shanchu">删除</span>'
315
				opertStr='<span class="xiugai">修改</span><span class="shanchu">删除</span>'
320
				time="修改于 "+commenTime(dataStr.modifyTime)
316
				time="修改于 "+commenTime(dataStr.modifyTime)
321
				zancai='<div class="zan noZan"><em class="hold-icon icon-zan"></em><span class="agreeCount"></span></div>'+
317
				zancai='<div class="zan noZan"><em class="hold-icon icon-zan"></em><span class="agreeCount"></span></div>'+
322
						'<div class="cai noCai"><em class="hold-icon icon-cai"></em> <span>'+ballot+'</span></div>'
318
						'<div class="cai noCai"><em class="hold-icon icon-cai"></em></div>'
323
			}
319
			}
324
			liStr.className="list-qa"
320
			liStr.className="list-qa"
325
			liStr.setAttribute("data-id", dataStr.id);
321
			liStr.setAttribute("data-id", dataStr.id);
347
	            	'<div class="operateBlock tip-offs floatR">'+opertStr+'</div>'+
343
	            	'<div class="operateBlock tip-offs floatR">'+opertStr+'</div>'+
348
				'</div>'
344
				'</div>'
349
			
345
			
350
			liStr.innerHTML = '<div class="madiaInfo answerInfo"><a target="_blank" href="/qa-show.html?id='+dataStr.qid+'&topid='+dataStr.id+'">' +
346
			liStr.innerHTML = '<div class="madiaInfo answerInfo">' +
351
				'<div class="flexCenter qa-owner"></div>' +
347
				'<div class="flexCenter qa-owner"></div>' +
352
				'<p class="qa-con ellipsisSty-3">' + (dataStr.cnt).replace(/\n/g,"<br />") + '</p></a>' +
348
				'<p class="qa-con">' + (dataStr.cnt).replace(/\n/g,"<br />") + '</p>' +
353
				'<div class="item_info"><span class="time">' + time + '</span></div>'+
349
				'<div class="item_info"><span class="time">' + time + '</span></div>'+
354
				operatStr+
350
				operatStr+
355
				'</div>'+
351
				'</div>'+
449
			$str.find(".collectBtn").on('click', function() {
445
			$str.find(".collectBtn").on('click', function() {
450
				if(userid && userid != null && userid != "null") {
446
				if(userid && userid != null && userid != "null") {
451
					if($(this).is('.icon-collected')){
447
					if($(this).is('.icon-collected')){
452
						cancelCollectionAbout(anid,$(this),8)
448
						cancelCollectionAbout(anid,$(this),9)
453
					} else {
449
					} else {
454
						collectionAbout(anid,$(this),8);
450
						collectionAbout(anid,$(this),9);
455
					}
451
					}
456
				}else{
452
				}else{
457
					quickLog();
453
					quickLog();
471
				}
467
				}
472
			});
468
			});
473
			//点赞回答
469
			//点赞回答
474
			$str.find(".zan").on("click",function(){
470
			$str.find(".canZan").on("click",function(){
475
				if(userid && userid != null && userid != "null") {
471
				if(userid && userid != null && userid != "null") {
476
					if($(this).is('.active')){
472
					if($(this).is('.active')){
477
						oAjax('/ajax/question/answer/agree/cancle', {
473
						oAjax('/ajax/question/answer/agree/cancle', {
479
							"uid":userid,
475
							"uid":userid,
480
							"uname":username
476
							"uname":username
481
						}, "POST", function(res) {
477
						}, "POST", function(res) {
482
							$str.find(".zan").removeClass("active")
478
							$str.find(".canZan").removeClass("active")
483
						})
479
						})
484
					}else{
480
					}else{
485
						oAjax('/ajax/question/answer/agree', {
481
						oAjax('/ajax/question/answer/agree', {
632
				if(Fflag){
628
				if(Fflag){
633
					inviteStatus(dataStr.id, $str);
629
					inviteStatus(dataStr.id, $str);
634
				}
630
				}
631
				//关注专家
632
				$str.find(".attenSpan").on('click', function() {
633
					if(userid && userid != null && userid != "null") {
634
						if($(this).is('.attenedSpan')){
635
							cancelCollectionAbout(dataStr.id,$(this),1)
636
						} else {
637
							collectionAbout(dataStr.id,$(this),1);
638
						}
639
					}else{
640
						quickLog();
641
						operatTab();
642
						closeLog();
643
					}
644
				});
635
			});
645
			});
636
		},
646
		},
637
		isAgree=function(id,$str){
647
		isAgree=function(id,$str){