Commit 154d48b7 by hanpeng

-mark-帖子详情,发帖,回复,点赞

parent 8c6bf1e2
......@@ -197,6 +197,9 @@ body {
font-family: PingFangSC;
font-weight: 400;
line-height: 0.6rem;
word-wrap:break-word;
word-break:break-all;
overflow:hidden;
}
.comment_info {
......
......@@ -2,6 +2,7 @@ body {
background: #F6F6FC;
font-size: 0.32rem;
color: #333333;
overflow: scroll
}
.reply_content {
......@@ -124,7 +125,8 @@ body {
height:0.72rem;
float:left;
border-radius:0.08rem;
border:none
border:none;
padding-left:0.2rem;
}
.footer_btn .reply_btn{
width:1.28rem;
......
......@@ -415,12 +415,13 @@ define(['zepto', 'medtap' /* ,'https://review-formal.iplusmed.com/Common/javaScr
}
}
}
if(index.offser > 1){
if(index.offset > 1){
$('.list_warp').append(str);
}else{
$('.list_warp').html(str);
}
$('.like').on('click',function(){
$('.like').on('click',function(event){
event.stopPropagation();
var id = $(this).parents('.list_item').attr('data-id');
var num = $(this).children('.likeNum').html();
var status = index.publishUp(id);
......@@ -436,6 +437,7 @@ define(['zepto', 'medtap' /* ,'https://review-formal.iplusmed.com/Common/javaScr
})
$('.list_item').on('click',function(){
var id = $(this).attr('data-id');
medtap.pushWindow('pages/cardDetail.html?cardId=' + id)
})
......
define(['zepto', 'medtap'], function($, medtap) {
var newCard = {
localIds: [],
serverId: "",
imgList: [],
init: function() {
newCard.getWechatTicket();
newCard.bindEve();
},
bindEve:function(){
$('.footer_btn').on('click',function(){
newCard.postPubbbs();
})
},
getWechatTicket: function() {
medtap.submitAjax({
url: 'https://testdevgw.medtap.cn/wechat/lung/fetchWechatTicket',
type: 'GET',
async: false,
data: {
url: window.location.href
},
success: function(res) {
var data = res.content;
wx.config({
debug: false,
appId: data.appId, // 必填,公众号的唯一标识
timestamp: data.timestamp, // 必填,生成签名的时间戳
nonceStr: data.nonceStr, // 必填,生成签名的随机串
signature: data.signature, // 必填,签名,见附录1
jsApiList: [
'chooseImage',
'previewImage',
'uploadImage'
]
})
}
})
},
//选择图片
choseImage: function() {
$('#upload').on('click', function() {
var html = '';
wx.ready(function() {
var syncUpload = function(localIds) {
localId = localIds[0];
localIds = localIds.length > 1 ? localIds.slice(1) : localIds[0];
wx.uploadImage({
localId: localId,
isShowProgressTips: 1,
success: function(res) {
var serverId = res.serverId; // 返回图片的服务器端ID
//其他对serverId做处理的代码
newCard.upLoadImg(serverId, localId);
if (localIds.length > 0) {
syncUpload(localIds);
}
}
});
};
wx.chooseImage({
count: 9,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: function(res) {
newCard.localIds = res.localIds;
//所有需要上传到图片预览
syncUpload(newCard.localIds);
}
})
})
})
},
//图片预览
previewImage: function() {
$('#ImgUp').on('click', '.image_files_img', function() {
var imgArray = [];
var curImageSrc = $(this).attr('src');
if (curImageSrc) {
$('#ImgUp .image_files_img').each(function(index, el) {
var itemSrc = $(this).attr('src');
imgArray.push(itemSrc);
});
wx.previewImage({
current: curImageSrc,
urls: imgArray
});
}
});
$('#ImgUp').on('click', '.image_del', function() {
if (confirm('确定要删除图片吗?')) {
$(this).parent().remove();
}
});
},
//上传图片
upLoadImg: function(serverId, localId) {
$.ajax({
url: 'https://testdevgw.medtap.cn/common/uploadWechatFile',
type: 'POST',
async: false,
data: {
bizType: "3",
folder: 'bbs',
mediaId: serverId,
ext: 'jpg'
},
success: function(data) {
if (data.success == true) {
var res = data.content;
var imgKey = res.ossKey;
newCard.imgList.push(imgKey);
var html = '<div class="image_files_item">' +
'<img src="' + localId + '" class="image_files_img" imgkey="' + imgKey + '">' +
'<img src="../images/post_delete_btn@2x.png" class="image_del" >' +
'</div>';
$('#ImgUp').append(html);
}
}
})
},
postPubbbs:function(){
var urls = [],
picUrl = "";
[].forEach.call($('#ImgUp .image_files_img'), function (item) {
urls.push($(item).attr('imgkey'));
});
var picUrl = urls.join(',');
alert(picUrl);
medtap.loading(1);
medtap.submitAjax({
url:'https://devgw.medtap.cn/operation/pubbbs/publish',
type:"POST",
asynv:false,
contentType: 'application/json',
data:{
groupId:1,
content:$('.content').val(),
picUrls:picUrl
},
success:function(res){
medtap.loading(0);
setTimeout(function() {
medtap.toast({
message: '发布成功',
time: 2000
})
medtap.pushWindow('myCardList.html')
}, 1000)
}
})
}
}
newCard.init();
newCard.choseImage();
newCard.previewImage();
})
define(['zepto', 'medtap'], function($, medtap) {
var reply = {
commentId: medtap.getRequest('commentId'),
init: function() {
reply.getDetail();
},
getDetail: function() {
medtap.loading(1);
medtap.submitAjax({
url: 'https://devgw.medtap.cn/operation/pubbbs/publishComment/' + reply.commentId,
type: 'GET',
async: false,
data: {
},
success: function(res) {
medtap.loading(0);
var replyDetail = res.content.publishComment;
$('.user_profile').attr('src', replyDetail.profile);
$('.reply_content_username').html(replyDetail.nickname)
$('.reply_content_time').html(replyDetail.updateTime.substring(5, 16));
$('.reply_like_num').html(replyDetail.upCount);
if (replyDetail.upStatus == 0) {
$('.reply_content_btn img').attr('src', '../images/post_unlike_png@2x.png');
} else if (replyDetail.upStatus == 1) {
$('.reply_content_btn img').attr('src', '../images/post_like_png@2x.png');
}
$('.like').on('click', function() {
var rs = reply.likeThisReply();
if (rs == 0) {
$('.reply_content_btn img').attr('src', '../images/post_unlike_png@2x.png');
$('.reply_like_num').html(parseInt(replyDetail.upCount));
} else if (rs == 1) {
$('.reply_like_num').html(parseInt(replyDetail.upCount) + 1);
$('.reply_content_btn img').attr('src', '../images/post_like_png@2x.png');
}
});
if(replyDetail.hasOwnProperty('commentList')){
var commentList = replyDetail.commentList;
$('.reply_list_header_num').html(commentList.length + '条')
var commentStr = '';
for(var i = 0;i < commentList.length;i++){
commentStr += '<div class="reply_list_item">'+
'<div class="reply_list_item_header clearfix">'+
'<img src="'+commentList[i].profile+'" class="reply_user_profile">'+
'<div class="reply_user_name">'+
commentList[i].nickname+
'</div>'+
'</div>'+
'<div class="reply_list_item_content">'+
commentList[i].content+
'</div>'+
'<div class="reply_list_item_time">'+
commentList[i].updateTime.substring(5,16)+
'</div>'+
'</div>';
}
}else{
$('.reply_list_header_num').html('0条')
}
$('.reply_list').append(commentStr);
}
})
},
//点赞当前回复
likeThisReply: function() {
var result;
medtap.loading(1);
medtap.submitAjax({
url: 'https://devgw.medtap.cn/operation/pubbbs/publishComment/up',
type: 'POST',
async: false,
contentType: 'application/json',
data: {
commentId: reply.commentId
},
success: function(res) {
medtap.loading(0);
if (res.success == true) {
result = res.content.upStatus;
}
}
});
return result;
}
}
reply.init();
})
......@@ -41,10 +41,7 @@
<div class="cardDetail">
</div>
<div class="cardImage clearfix">
<img src="../images/post_title_bg@2x.png" >
<img src="../images/post_title_bg@2x.png" >
<img src="../images/post_title_bg@2x.png" >
<img src="../images/post_title_bg@2x.png" >
</div>
<div class="card_tools clearfix">
<div class="tools clearfix seen">
......@@ -62,59 +59,16 @@
</div>
<div class="unFabulous clearfix">
<img src="../images/post_like_big_png@2x.png" class="fabulous_icon">
<span class="fabulous_desc">123</span>
<span class="fabulous_desc"></span>
</div>
</div>
<div class="comment_warp">
<div class="comment_header">
<span class="comment_header_title">评论</span>
<span class="comment_header_num">97条</span>
<span class="comment_header_num"></span>
</div>
<div class="comment_item noReply">
<div class="comment_item_header clearfix">
<img src="../images/post_title_bg@2x.png" >
<div class="comment_user_name">
文月康康
</div>
<div class="comment_tools_fabulous clearfix">
<img src="../images/post_like_png@2x.png" >
<span class="fabulous_num">78</span>
</div>
</div>
<div class="comment_content">
还是上大医院检查吧。自己找中药吃很危险的,中药不能治癌病呀。
</div>
<div class="comment_info">
<span class="comment_time txt_gray">07-08 12:41</span>
<span class="comment_reply_btn txt_blue">回复</span>
</div>
</div>
<div class="comment_item hasReply">
<div class="comment_item_header clearfix">
<img src="../images/post_title_bg@2x.png" >
<div class="comment_user_name">
文月康康
</div>
<div class="comment_tools_fabulous clearfix">
<img src="../images/post_like_png@2x.png" >
<span class="fabulous_num">78</span>
</div>
</div>
<div class="comment_content">
还是上大医院检查吧。自己找中药吃很危险的,中药不能治癌病呀。
</div>
<div class="comment_info">
<span class="comment_time txt_gray">07-08 12:41</span>
<span class="comment_reply_btn txt_blue">回复</span>
</div>
<div class="comment_reply">
<span class="comment_reply_name">佳佳:</span>
<span class="comment_reply_content">是的,找大医院认真诊断,确诊后对症下药吧。明确诊断是治疗的基础。否则就是耽误着。</span>
<span class="comment_reply_time">07-08 12:41</span>
<div class="comment_reply_more">
查看全部2条回复
</div>
</div>
<div class="comment_list">
</div>
</div>
<div class="footer_btn">
......
......@@ -10,19 +10,36 @@
<link rel="stylesheet" type="text/css" href="https://review-formal.iplusmed.com/Common/css/wechat_Reset.min.css" />
<link rel="stylesheet" type="text/css" href="../css/newCard.css"/>
<script src="https://review-formal.iplusmed.com/Common/javaScript/calRem.js" type="text/javascript" charset="utf-8"></script>
<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<title>发帖</title>
<script src="https://review-formal.iplusmed.com/Common/javaScript/require.min.js"></script>
<script type="text/javascript">
require.config({
baseUrl: "./",
paths: {
"zepto": "https://review-formal.iplusmed.com/Common/javaScript/zepto.min",
"medtap": "https://review-formal.iplusmed.com/Common/javaScript/medtap_core_wx",
"md5": "https://review-formal.iplusmed.com/Common/javaScript/md5.min"
},
shim: {
"zepto": {
exports: "$"
}
}
});
</script>
</head>
<body>
<div id="content">
<div class="card_info">
<textarea rows="" cols="" placeholder="请输入内容"></textarea>
<textarea rows="" cols="" placeholder="请输入内容" class="card_content"></textarea>
</div>
<div class="image_info clearfix">
<div class="image_upload" id="upload">
<img src="../images/post_ picture_btn@2x.png" >
</div>
<div class="image_files clearfix" id="ImgUp">
<div class="image_files_item">
<!-- <div class="image_files_item">
<img src="../images/post_title_bg@2x.png" class="image_files_img">
<img src="../images/post_delete_btn@2x.png" class="image_del" >
</div>
......@@ -57,7 +74,7 @@
<div class="image_files_item">
<img src="../images/post_title_bg@2x.png" class="image_files_img">
<img src="../images/post_delete_btn@2x.png" class="image_del" >
</div>
</div> -->
</div>
</div>
......@@ -66,4 +83,7 @@
发布
</div>
</body>
<script type="text/javascript">
require(['../javaScript/newCard.js'])
</script>
</html>
......@@ -11,17 +11,33 @@
<link rel="stylesheet" type="text/css" href="../css/replyDetail.css"/>
<script src="https://review-formal.iplusmed.com/Common/javaScript/calRem.js" type="text/javascript" charset="utf-8"></script>
<title>详情</title>
<script src="https://review-formal.iplusmed.com/Common/javaScript/require.min.js"></script>
<script type="text/javascript">
require.config({
baseUrl: "./",
paths: {
"zepto": "https://review-formal.iplusmed.com/Common/javaScript/zepto.min",
"medtap": "https://review-formal.iplusmed.com/Common/javaScript/medtap_core_wx",
"md5": "https://review-formal.iplusmed.com/Common/javaScript/md5.min"
},
shim: {
"zepto": {
exports: "$"
}
}
});
</script>
</head>
<body>
<div id="content">
<div class="reply_content">
<div class="reply_content_header clearfix">
<img src="../images/post_title_bg@2x.png" >
<img src="../images/post_title_bg@2x.png" class="user_profile">
<div class="reply_content_info">
<p class="reply_content_username">明天天晴</p>
<p class="reply_content_time">07-08 11:12</p>
</div>
<div class="reply_content_btn clearfix">
<div class="reply_content_btn like clearfix">
<img src="../images/post_unlike_png@2x.png" >
<span class="reply_like_num">14</span>
</div>
......@@ -33,64 +49,9 @@
<div class="reply_list">
<div class="reply_list_header">
<span class="reply_list_header_title">评论</span>
<span class="reply_list_header_num">2条</span>
</div>
<div class="reply_list_item">
<div class="reply_list_item_header clearfix">
<img src="../images/post_title_bg@2x.png" >
<div class="reply_user_name">
佳佳
</div>
</div>
<div class="reply_list_item_content">
还是上大医院检查吧。自己找中药吃很危险的,中药不能治癌病呀。
</div>
<div class="reply_list_item_time">
07-08 12:04
</div>
</div>
<div class="reply_list_item">
<div class="reply_list_item_header clearfix">
<img src="../images/post_title_bg@2x.png" >
<div class="reply_user_name">
佳佳
</div>
</div>
<div class="reply_list_item_content">
还是上大医院检查吧。自己找中药吃很危险的,中药不能治癌病呀。
</div>
<div class="reply_list_item_time">
07-08 12:04
</div>
</div>
<div class="reply_list_item">
<div class="reply_list_item_header clearfix">
<img src="../images/post_title_bg@2x.png" >
<div class="reply_user_name">
佳佳
</div>
</div>
<div class="reply_list_item_content">
还是上大医院检查吧。自己找中药吃很危险的,中药不能治癌病呀。
</div>
<div class="reply_list_item_time">
07-08 12:04
</div>
</div>
<div class="reply_list_item">
<div class="reply_list_item_header clearfix">
<img src="../images/post_title_bg@2x.png" >
<div class="reply_user_name">
佳佳
</div>
</div>
<div class="reply_list_item_content">
还是上大医院检查吧。自己找中药吃很危险的,中药不能治癌病呀。
</div>
<div class="reply_list_item_time">
07-08 12:04
</div>
<span class="reply_list_header_num"></span>
</div>
</div>
<div class="footer_btn clearfix">
<input type="text" name="" id="" value="" class="reply_input"/>
......@@ -100,4 +61,7 @@
</div>
</div>
</body>
<script type="text/javascript">
require(['../javaScript/replyDetail.js'])
</script>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment