Browse Source

修改问答模块bug

luyanan 7 years ago
parent
commit
a921d52489

+ 4 - 0
app/css/app.css

@ -1051,6 +1051,8 @@ ul.tagList>li .h2Font{color: #666; -webkit-user-select:text;}
1051 1051
.thumbBlock .thumbBtn.thumbedBtn{background-color: #e0e0e0;}
1052 1052
.thumbBlock .stepBtn{display:inline-block;position:relative;padding:10px;padding-left:30px;font-size:16px;color:#666;background:url(../images/g_article_icon_cai_nor.png) no-repeat 10px center;background-size:16px 16px;cursor: pointer;}
1053 1053
.thumbBlock .stepBtn.stepedBtn{opacity: .6;}
1054
.thumbBlock .thumbspan{display:inline-block;position:relative;padding:10px 24px;padding-left:44px;font-size:16px;color:#666;background:url(../images/g_article_icon_dianzan_hig.png) no-repeat 24px center;background-size:16px 16px;border-radius:30px;}
1055
.thumbBlock .stepspan{display:inline-block;position:relative;padding:10px;padding-left:30px;font-size:16px;color:#666;background:url(../images/g_article_icon_cai_nor.png) no-repeat 10px center;background-size:16px 16px;}
1054 1056
/*留言*/
1055 1057
.commentBlock .flexCenter{min-height:38px;}
1056 1058
.commentBlock .commenttime{margin-right:18px;}
@ -1196,8 +1198,10 @@ ul.tagList>li .h2Font{color: #666; -webkit-user-select:text;}
1196 1198
.item_detail .h1Font{font-weight:normal;font-size:18px;line-height:24px;color:#000}
1197 1199
.item_detail .list_con{font-size: 15px;color: #333;line-height: 24px;margin: 6px 0;text-align:justify}
1198 1200
.list_image,.item-btn{overflow: hidden;}
1201
.list-main .list_image{display: none;}
1199 1202
.list_image li,.item-btn li{display: inline-block; overflow: hidden;float:left; width: 33.3%; -webkit-box-sizing: border-box;box-sizing: border-box;position: relative;}
1200 1203
.list_image li>.imgspan{display: block;width: 98%;height:90px;background-size: cover;background-position: center;}
1204
.list_image li>.imgspan img{opacity: 0;}
1201 1205
@media only screen and (min-width:640px) and (max-width:980px)  {
1202 1206
	.list_image li>.imgspan{height:140px;width: 96%;}
1203 1207
}

+ 1 - 1
app/html/myaccount.html

@ -126,7 +126,7 @@
126 126
									<span class="mui-pull-left">需求搜索</span>
127 127
								</a>
128 128
							</li>
129
							<li class="mui-table-view-cell" id="goZixun">
129
							<li class="mui-table-view-cell displayNone" id="goZixun">
130 130
								<a class="mui-navigate-right">
131 131
									<em class="itemIcon iconAssess"></em>
132 132
									<span class="mui-pull-left">我收到的评价</span>

+ 8 - 2
app/html/qa-answer-show.html

@ -68,8 +68,14 @@
68 68
					<div class="h3Font" style="margin-top: 10px;" id="answerTime"></div>
69 69
					<!--点赞模块-->
70 70
					<div class="thumbBlock">
71
						<span class="thumbBtn">赞 <span id="snum"></span></span>
72
						<span class="stepBtn">踩</span>
71
						<div class="canTap">
72
							<span class="thumbBtn">赞 <span id="snum"></span></span>
73
							<span class="stepBtn">踩</span>
74
						</div>
75
						<div class="noTap displayNone">
76
							<span class="thumbspan">赞 <span id="zanNum"></span></span>
77
							<span class="stepspan">踩 <span id="caiNum"></span></span>
78
						</div>
73 79
					</div>
74 80
					<!--留言-->
75 81
					<div class="madiaBlock">

+ 1 - 1
app/html/qa-going-q-03.html

@ -19,7 +19,7 @@
19 19
		<header class="mui-bar mui-bar-nav toptitbox">
20 20
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left topback"></a>
21 21
		    <h1 class="mui-title toptit">添加问题的关键词</h1>
22
		    <span class="mui-pull-right topsave">保存</span>
22
		    <span class="mui-pull-right topsave">发布</span>
23 23
		</header>
24 24
		<div class="mui-content">
25 25
			<div class="littip-top">为了让问题更快获得回答,请添加1-5个关键词</div>

+ 4 - 1
app/html/qa-question-show.html

@ -7,6 +7,7 @@
7 7
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
8 8
		<link href="../css/mui.min.css" rel="stylesheet" />
9 9
		<link href="../css/iconfont.css" rel="stylesheet" />
10
		<link href="../css/previewImage.css" rel="stylesheet" type="text/css" />
10 11
		<link href="../css/app.css" rel="stylesheet" />
11 12
		<style type="text/css">
12 13
			.mui-fullscreen .mui-segmented-control~.mui-slider-group{top:-1px;}
@ -33,7 +34,7 @@
33 34
										<div class="item_detail" id="questionId">
34 35
											<h3 class="h1Font" id="questionTit"></h3>
35 36
											<div class="list_con" id="questionCnt"></div>
36
											<ul class="list_image"></ul>
37
											<ul class="list_image"><li><span class="imgspan"></span></li></ul>
37 38
											<div class="item_info">
38 39
												<span class="time h3Font" id="questionTime"></span>
39 40
											</div>
@ -86,6 +87,8 @@
86 87
		</div>
87 88
		<script src="../js/public/mui.min.js"></script>
88 89
		<script src="../js/public/mui.pullToRefresh1.js"></script>
90
		<script src="../js/public/mui.zoom.js" type="text/javascript" charset="utf-8"></script>
91
		<script src="../js/public/mui.previewimage.js" type="text/javascript" charset="utf-8"></script>
89 92
		<script src="../js/public/base.js"></script>
90 93
		<script type="text/javascript">
91 94
			mui.init()

BIN
app/images/g_article_icon_dianzan_hig.png


+ 10 - 0
app/js/moreItem.js

@ -172,5 +172,15 @@ mui.ready(function(){
172 172
				});
173 173
			}
174 174
		})
175
		
176
		var old_back = mui.back;
177
		mui.back = function() {
178
		    // 获取目标口窗口对象
179
		    var targetP = plus.webview.getWebviewById('qa-answer-show.html');
180
		    // 执行相应的事件
181
		    mui.fire(targetP, 'customEvent', {});
182
		    // 执行关闭
183
		    old_back();
184
		};
175 185
	})
176 186
})

+ 9 - 3
app/js/qa-answer-q.js

@ -7,6 +7,8 @@ mui.ready(function(){
7 7
			
8 8
		var userid = plus.storage.getItem('userid'),
9 9
			username = plus.storage.getItem('name');
10
			
11
		document.getElementById("questionTit").innerHTML=qutit
10 12
		
11 13
		plus.nativeUI.closeWaiting();
12 14
		self.show("slide-in-right", 150);
@ -14,7 +16,6 @@ mui.ready(function(){
14 16
		if(aflag){
15 17
			var anid=self.anid,
16 18
				qucnt=self.qucnt;
17
			document.getElementById("questionTit").innerHTML=qutit
18 19
			document.getElementById("question").value=qucnt
19 20
			var con=document.getElementById("question")
20 21
			document.getElementsByClassName("topsave")[0].addEventListener("tap",function(){
@ -35,7 +36,8 @@ mui.ready(function(){
35 36
						if(data.success) {
36 37
							console.log("xiugai"+JSON.stringify(data))
37 38
							plus.nativeUI.toast("回答修改成功", toastStyle);
38
							mui.back();
39
							
40
							mui.back()
39 41
						}
40 42
					}
41 43
				})
@ -60,7 +62,11 @@ mui.ready(function(){
60 62
						console.log("fabu"+JSON.stringify(data))
61 63
						if(data.success) {
62 64
							plus.nativeUI.toast("回答发布成功", toastStyle);
63
							mui.back();
65
												  	
66
						  	plus.nativeUI.showWaiting();
67
							plus.webview.create("../html/qa-question-show.html", 'qa-question-show.html', {}, {
68
								"quid": quid
69
							});
64 70
						}
65 71
					}
66 72
				});

+ 61 - 25
app/js/qa-answer-show.js

@ -34,7 +34,13 @@ mui.ready(function() {
34 34
				}, "get", function(res) {
35 35
					var $da = res.data
36 36
					document.getElementById("answerTime").innerHTML = commenTime($da.createTime);
37
					document.getElementById("snum").innerHTML = $da.agree;
37
					if($da.agree>0){
38
						document.getElementById("snum").innerHTML = $da.agree;
39
						document.getElementById("zanNum").innerHTML = $da.agree;
40
					}
41
					if($da.ballot>0){
42
						document.getElementById("caiNum").innerHTML = $da.ballot;
43
					}
38 44
					if($da.cnt) {
39 45
						answerTit=$da.cnt
40 46
						document.getElementById("answerCnt").innerHTML = ($da.cnt).replace(/\n/g,"<br />");
@ -43,6 +49,8 @@ mui.ready(function() {
43 49
						oattenSpan.style.display="block";
44 50
						ifcollectionAbout($da.uid,oattenSpan, 1,1);
45 51
					}else{
52
						document.getElementsByClassName("canTap")[0].classList.add("displayNone")
53
						document.getElementsByClassName("noTap")[0].classList.remove("displayNone")
46 54
						flag=1
47 55
					}
48 56
					proinfo($da.uid)
@ -138,12 +146,12 @@ mui.ready(function() {
138 146
					"uid":id
139 147
				}, "get", function(res) {
140 148
					if(res.success){
141
						if(res.data){
149
						console.log(JSON.stringify(res))
150
						if(res.data==null){
151
							
152
						}else if(res.data.flag){
142 153
							thumbs.classList.add("thumbedBtn")
143
							steps.classList.remove("stepedBtn")
144
							steps.innerHTML="踩"
145 154
						}else{
146
							thumbs.classList.remove("thumbedBtn")
147 155
							steps.classList.add("stepedBtn")
148 156
							steps.innerHTML="取消踩"
149 157
						}
@ -201,37 +209,65 @@ mui.ready(function() {
201 209
		
202 210
		mui(".thumbBlock").on("tap",".thumbBtn",function(){
203 211
			if(userid && userid != null && userid != "null") {
204
				oAjax('/ajax/question/answer/agree', {
205
					"id": answerId,
206
					"uid":userid,
207
					"uname":username
208
				}, "POST", function(res) {
209
					thumbs.classList.add("thumbedBtn")
210
					steps.classList.remove("stepedBtn")
211
					steps.innerHTML="踩"
212
					getConmain()
213
				})
212
				if(this.className=="thumbBtn thumbedBtn"){
213
					oAjax('/ajax/question/answer/agree/cancle', {
214
						"id": answerId,
215
						"uid":userid,
216
						"uname":username
217
					}, "POST", function(res) {
218
						thumbs.classList.remove("thumbedBtn")
219
						getConmain()
220
					})
221
				}else{
222
					oAjax('/ajax/question/answer/agree', {
223
						"id": answerId,
224
						"uid":userid,
225
						"uname":username
226
					}, "POST", function(res) {
227
						thumbs.classList.add("thumbedBtn")
228
						steps.classList.remove("stepedBtn")
229
						steps.innerHTML="踩"
230
						getConmain()
231
					})
232
				}
214 233
			}else{
215 234
				isLogin();
216 235
			}
217 236
		})
218 237
		mui(".thumbBlock").on("tap",".stepBtn",function(){
219 238
			if(userid && userid != null && userid != "null") {
220
				oAjax('/ajax/question/answer/unAgree', {
221
					"id": answerId,
222
					"uid":userid,
223
					"uname":username
224
				}, "POST", function(res) {
225
					thumbs.classList.remove("thumbedBtn")
226
					steps.classList.add("stepedBtn")
227
					steps.innerHTML="取消踩"
228
					getConmain()
229
				})
239
				if(this.className=="stepBtn stepedBtn"){
240
					oAjax('/ajax/question/answer/oppose/cancle', {
241
						"id": answerId,
242
						"uid":userid,
243
						"uname":username
244
					}, "POST", function(res) {
245
						steps.classList.remove("stepedBtn")
246
						steps.innerHTML="踩"
247
						getConmain()
248
					})
249
				}else{
250
					oAjax('/ajax/question/answer/oppose', {
251
						"id": answerId,
252
						"uid":userid,
253
						"uname":username
254
					}, "POST", function(res) {
255
						steps.classList.add("stepedBtn")
256
						steps.innerHTML="取消踩"
257
						thumbs.classList.remove("thumbedBtn")
258
						getConmain()
259
					})
260
				}
230 261
			}else{
231 262
				isLogin();
232 263
			}
233 264
		})
234 265
		
266
		window.addEventListener('customEvent', function(event) {
267
		    var detail = event.detail;
268
		    getConmain()
269
		});
270
		
235 271
		/*微信及微信朋友圈分享专家*/
236 272
		var auths, shares;
237 273
		plus.oauth.getServices(function(services) {

+ 5 - 5
app/js/qa-going-q-01.js

@ -21,11 +21,11 @@ mui.ready(function(){
21 21
				plus.nativeUI.toast("提问不得少于5个字");
22 22
				return;
23 23
			}
24
			var lastStr=con.value.substr(con.value.length-1,1)
25
			if(lastStr !="?" && lastStr !="?") {
26
				plus.nativeUI.toast("提问最好以问号结尾");
27
				return;
28
			}
24
//			var lastStr=con.value.substr(con.value.length-1,1)
25
//			if(lastStr !="?" && lastStr !="?") {
26
//				plus.nativeUI.toast("提问最好以问号结尾");
27
//				return;
28
//			}
29 29
			plus.nativeUI.showWaiting();
30 30
			plus.webview.create("../html/qa-going-q-02.html", 'qa-going-q-02.html', {}, {
31 31
				title: con.value

+ 11 - 3
app/js/qa-going-q-02.js

@ -14,16 +14,17 @@ mui.plusReady(function() {
14 14
			}
15 15
			document.getElementById("fontAdd").innerHTML = this.value.length;
16 16
		})
17
	
17 18
	var imgStr=[]
18 19
	document.getElementsByClassName("topsave")[0].addEventListener("tap",function(){
19 20
		mui(".image-item .imgU").each(function() {
20 21
			imgStr.push(this.getAttribute("data-preview-src"));
21 22
		});
22
		//alert(imgStr);
23
		
23 24
		plus.nativeUI.showWaiting();
24 25
		plus.webview.create("../html/qa-going-q-03.html", 'qa-going-q-03.html', {}, {
25 26
			cnt: con.value,
26
			img: imgStr
27
			img: imgStr.join(",")
27 28
		});
28 29
	})
29 30
	
@ -71,7 +72,7 @@ mui.plusReady(function() {
71 72
						}
72 73
					}
73 74
				);
74
				task.addFile( imgurl, {key:"testdoc"} );
75
				task.addFile( imgurl, {key:"testwdoc"} );
75 76
				task.start();
76 77
				
77 78
			}, function(e) {
@ -118,6 +119,7 @@ mui.plusReady(function() {
118 119
			var i = e.index;
119 120
			if(i == 0) {
120 121
				$this.parent().remove();
122
				$("#F_CKJLB").show()
121 123
			}
122 124
		}, "删除图片", bts);
123 125
	});
@ -133,4 +135,10 @@ mui.plusReady(function() {
133 135
		html += '    </span>';
134 136
		html += '</div>';
135 137
		$("#F_CKJLBS").append(html);
138
		var imglen = $(".image-item .imgU").length;
139
		if(imglen==3){ 
140
			$("#F_CKJLB").hide()
141
		}else{
142
			$("#F_CKJLB").show()
143
		}
136 144
	}

+ 6 - 5
app/js/qa-going-q-03.js

@ -80,21 +80,22 @@ mui.ready(function() {
80 80
			}
81 81
			console.log(subjectAll);
82 82
			console.log(cnt+"++++++"+img);
83
			mui.ajax(baseUrl + '/ajax/question', {
84
				data: {
83
			var dataSt={
85 84
					"title": title,
86 85
					"cnt": cnt,
87 86
					"img": img,
88 87
					"keys": subjectAll,
89 88
					"uid": userid
90
				},
89
				}
90
			console.log(JSON.stringify(dataSt))
91
			mui.ajax(baseUrl + '/ajax/question', {
92
				data: dataSt,
91 93
				dataType: 'json',
92 94
				traditional: true,
93
				async: false,
94 95
				type: 'POST', 
95 96
				success: function(data) {
96 97
					if(data.success) {
97
						//console.log(JSON.stringify(data))
98
						console.log(JSON.stringify(data))
98 99
						plus.nativeUI.toast("问题发布成功", toastStyle);
99 100
						var w2 = plus.webview.getWebviewById('qa-going-q-02.html');
100 101
						var w1 = plus.webview.getWebviewById('qa-going-q-01.html');

+ 9 - 5
app/js/qa-question-show.js

@ -101,16 +101,17 @@ mui.ready(function() {
101 101
							subs[0] = $da.img;
102 102
						}
103 103
						oUrl=baseUrl + "/data/question"+subs[0].replace(/.jpg/,"_s.jpg");
104
						var imgH=$(".imgspan").height()+"px"
105
						var imgW=$(".imgspan").width()+"px"
104 106
						var pstr = ""
105 107
						if(subs.length > 0) {
106 108
							for(var i = 0; i < subs.length; i++) {
107 109
								var imgu= baseUrl + "/data/question"+subs[i]
108
								pstr += '<li><span class="imgspan" style="background-image: url('+imgu+');"></span></li>'
110
								pstr += '<li><span class="imgspan" style="background-image: url('+imgu+');"><img style="width:'+imgW+';height:'+imgH+'" src="'+imgu+'" data-preview-src=""></img></span></li>'
109 111
							};
112
							document.getElementsByClassName("list_image")[0].style.display = "block";
110 113
							document.getElementsByClassName("list_image")[0].innerHTML = pstr;
111
						} else {
112
							document.getElementsByClassName("list_image")[0].style.display = "none";
113
						}
114
						} 
114 115
					}
115 116
					
116 117
				})
@ -125,7 +126,7 @@ mui.ready(function() {
125 126
						if(res.data.state=="1"){
126 127
							oanswer.setAttribute("data-can", "0"); //回答过
127 128
							oanswer.classList.add("answered");
128
							oanswer.querySelector("span").innerText = "已回答"
129
							oanswer.querySelector("span").innerText = "已回答"
129 130
						}else{
130 131
							oanswer.setAttribute("data-anid",res.data.id);
131 132
							oanswer.setAttribute("data-can", "2"); //回答过但已删除
@ -405,6 +406,9 @@ mui.ready(function() {
405 406
				anid: id
406 407
			});
407 408
		})
409
		
410
		mui.previewImage();/*图像预览*/
411
	
408 412
409 413
	})
410 414
})

+ 1 - 1
app/js/qa-request-da.js

@ -52,7 +52,7 @@ mui.ready(function() {
52 52
			var $info = res.data;
53 53
			if($info.length > 0) {
54 54
				dataC.count = res.data[res.data.length - 1].kws;
55
				dataC.pid = res.data[res.data.length - 1].pid;
55
				dataC.pid = res.data[res.data.length - 1].id;
56 56

57 57
				for(var i = 0; i < $info.length; i++) {
58 58
					var liStr = document.createElement("li");