Commit 8ac3ba75 by zujiaozhang

'添加帖子分享与分享后未登录要去登录1'

parent 86007e7e
...@@ -203,7 +203,7 @@ define(['zepto', 'medtap'], function($, medtap) { ...@@ -203,7 +203,7 @@ define(['zepto', 'medtap'], function($, medtap) {
}, },
success: function(res) { success: function(res) {
// console.log(res) console.log('帖子详情',res)
medtap.loading(0); medtap.loading(0);
if (res.success == true) { if (res.success == true) {
var detailInfo = res.content.publish; var detailInfo = res.content.publish;
......
define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, medtap,beforeSubmit) { define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js','mui'], function($, medtap,beforeSubmit,mui) {
var card = { var card = {
wechatId: medtap.getRequest('wechatId') || '', wechatId: medtap.getRequest('wechatId') || '',
cardId: medtap.getRequest('cardId') || '', cardId: medtap.getRequest('cardId') || '',
token: localStorage.getItem('wxLungToken') || '',
limit: 10, limit: 10,
offset: 1, offset: 1,
hasMore: false, hasMore: false,
firstLoad: false, firstLoad: false,
upCount: 0, upCount: 0,
agencyId:medtap.getRequest('agencyId'), agencyId:medtap.getRequest('agencyId') || '',
shareId:'', shareId:'',
userId:'',
mask : mui.createMask(function(){
$('.mask').hide()
}),//callback为用户点击蒙版时自动执行的回调;
init: function() { init: function() {
card.checkUser();
card.getToken();
card.getCardDetail(); card.getCardDetail();
card.getCommentList(); card.getCommentList();
card.bindEve(); card.bindEve();
card.getWechatTicket(); card.getWechatTicket();
card.previewImage(); card.previewImage();
// card.getToken();
//滚动加载 //滚动加载
$(window).scroll(function() { $(window).scroll(function() {
var scrollTop = $(this).scrollTop(); //滚动条距离顶部的高度 var scrollTop = $(this).scrollTop(); //滚动条距离顶部的高度
...@@ -40,7 +44,7 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m ...@@ -40,7 +44,7 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m
}); });
$('.btn_do_comment').on('click', function() { $('.btn_do_comment').on('click', function() {
if(card.token){ if(card.userId){
$('.content_mod').show(); $('.content_mod').show();
$('.comment_btn').show(); $('.comment_btn').show();
$('.reply_input').focus(); $('.reply_input').focus();
...@@ -52,7 +56,9 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m ...@@ -52,7 +56,9 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m
card.replyPublish(); card.replyPublish();
}) })
}else { }else {
window.location.href='https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_login/login.html' card.mask.show()
$('.mask').show()
// window.location.href='https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_login/login.html'
} }
}); });
...@@ -71,31 +77,71 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m ...@@ -71,31 +77,71 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m
window.location.href='https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_login/login.html' window.location.href='https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_login/login.html'
}) })
}, },
// checkUser:function(){ getToken:function(){
// medtap.loading(1); localStorage.wxLungToken = '';
// medtap.submitAjax({ medtap.loading(1);
// url:'https://testdevgw.medtap.cn/wechat/user/getWechatUser', medtap.submitAjax({
// type:'GET', url: 'https://testdevgw.medtap.cn/user/auth/token',
// async: false, type: 'POST',
// data:{ async: false,
// wechatId:card.wechatId contentType: 'application/json',
// }, data: {
// success:function(res){ wechatId: card.wechatId
// medtap.loading(0); },
// var info = res.content.wechatUser; success: function(res) {
// // if(info.hasOwnProperty('userId')){ console.log('gettoken',res)
// // //medtap.pushWindow('index.html?wechatId=' + card.wechatId) medtap.loading(0);
// // window.location.replace('index.html?wechatId=' + card.wechatId) if (res.success == true) {
// // }else{ var token = res.content.token;
// // window.location.replace('https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_login/login.html?wechatId=' + card.wechatId) localStorage.setItem('wxLungToken', token);
// // } // card.checkUser();
// } } else {
// })
// }, }
},
error: function(res) {
console.log(res.resultDesc);
}
})
},
checkUser:function(){
medtap.loading(1);
medtap.submitAjax({
url:'https://testdevgw.medtap.cn/wechat/user/getWechatUser',
type:'GET',
async: false,
data:{
wechatId:card.wechatId
},
success:function(res){
console.log(res)
medtap.loading(0);
console.log(res.content.wechatUser)
var info = res.content.wechatUser
if(info.hasOwnProperty('userId')){
// card.userId = info.userId
}
// }else{
// window.location.replace('https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_login/login.html?wechatId=' + card.wechatId)
// }
}
})
},
bindEve: function() { bindEve: function() {
$('.mask_text_gologin').on('click',function(){
card.mask.close();
$('.mask').hide()
window.location.href='https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_login/login.html?wechatId=' + card.wechatId
})
$('.mask_text_cancle').on('click',function(){
$('.mask').hide();
card.mask.close();
})
//为TA加油 //为TA加油
$('.fabulous').on('click', function() { $('.fabulous').on('click', function() {
if(card.token){ if(card.userId){
var status = card.publishUp(card.cardId); var status = card.publishUp(card.cardId);
if (status == 1) { if (status == 1) {
$(this).hide(); $(this).hide();
...@@ -103,14 +149,17 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m ...@@ -103,14 +149,17 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m
card.getCardDetail(); card.getCardDetail();
var newNum = parseInt(card.upCount); var newNum = parseInt(card.upCount);
$('.unFabulous').children('.fabulous_desc').html(newNum); $('.unFabulous').children('.fabulous_desc').html(newNum);
}else{
window.location.href='https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_login/login.html'
} }
}else{
card.mask.show()
$('.mask').show()
// window.location.href='https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_login/login.html'
} }
}); });
//取消点赞 //取消点赞
$('.unFabulous').on('click', function() { $('.unFabulous').on('click', function() {
if(card.token){ if(card.userId){
var status = card.publishUp(card.cardId); var status = card.publishUp(card.cardId);
if (status == 0) { if (status == 0) {
$(this).hide(); $(this).hide();
...@@ -118,12 +167,14 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m ...@@ -118,12 +167,14 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m
$('.fabulous').children('.fabulous_desc').html('为TA加油'); $('.fabulous').children('.fabulous_desc').html('为TA加油');
} }
}else { }else {
window.location.href='https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_login/login.html' card.mask.show()
$('.mask').show()
// window.location.href='https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_login/login.html'
} }
}); });
//收藏 //收藏
$('.collect').on('click', function() { $('.collect').on('click', function() {
if(card.token){ if(card.userId){
var rs = card.publishCollect(); var rs = card.publishCollect();
var _this = this; var _this = this;
if (rs == 0) { if (rs == 0) {
...@@ -138,7 +189,9 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m ...@@ -138,7 +189,9 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m
}, 1000) }, 1000)
} }
}else { }else {
window.location.href='https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_login/login.html' card.mask.show()
$('.mask').show()
// window.location.href='https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_login/login.html'
} }
}) })
...@@ -421,30 +474,34 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m ...@@ -421,30 +474,34 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m
$('.comment_list').html(replyHtml); $('.comment_list').html(replyHtml);
} }
//评论点赞 //评论点赞
$('.comment_item .comment_tools_fabulous').on('click', function(event) { if(card.userId){
event.stopPropagation(); $('.comment_item .comment_tools_fabulous').on('click', function(event) {
var id = $(this).parents('.comment_item').attr('data-id'); event.stopPropagation();
var num = $(this).children('.fabulous_num').html(); var id = $(this).parents('.comment_item').attr('data-id');
var commentResult = card.commentUp(id); var num = $(this).children('.fabulous_num').html();
if (commentResult == 0) { var commentResult = card.commentUp(id);
var newNum = parseInt(num) - 1; if (commentResult == 0) {
$(this).children('img').attr('src', '../images/post_unlike_png@2x.png'); var newNum = parseInt(num) - 1;
$(this).children('.fabulous_num').html(newNum); $(this).children('img').attr('src', '../images/post_unlike_png@2x.png');
} else if (commentResult == 1) { $(this).children('.fabulous_num').html(newNum);
var newNum = parseInt(num) + 1; } else if (commentResult == 1) {
$(this).children('img').attr('src', '../images/post_like_png@2x.png'); var newNum = parseInt(num) + 1;
$(this).children('.fabulous_num').html(newNum); $(this).children('img').attr('src', '../images/post_like_png@2x.png');
} $(this).children('.fabulous_num').html(newNum);
}); }
});
}
//跳转至评论详情 //跳转至评论详情
$('.comment_item').on('click', function() { if(card.userId){
if(card.token){ $('.comment_item').on('click', function() {
var id = $(this).attr('data-id'); if(card.token){
medtap.pushWindow('replyDetail.html?commentId=' + id); var id = $(this).attr('data-id');
} else { medtap.pushWindow('replyDetail.html?commentId=' + id);
window.location.href='https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_login/login.html' } else {
} window.location.href='https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_login/login.html'
}) }
})
}
} }
} }
}) })
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<meta content="email=no" name="format-detection"> <meta content="email=no" name="format-detection">
<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="https://review-formal.iplusmed.com/Common/css/wechat_Reset.min.css" />
<link rel="stylesheet" type="text/css" href="../css/cardDetail.css"/> <link rel="stylesheet" type="text/css" href="../css/cardDetail.css"/>
<link rel="stylesheet" type="text/css" href="https://review-formal.iplusmed.com/Common/css/mui.min.css">
<script src="https://review-formal.iplusmed.com/Common/javaScript/calRem.js" type="text/javascript" charset="utf-8"></script> <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> <script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<title>详情</title> <title>详情</title>
...@@ -19,6 +20,7 @@ ...@@ -19,6 +20,7 @@
paths: { paths: {
"zepto": "https://review-formal.iplusmed.com/Common/javaScript/zepto.min", "zepto": "https://review-formal.iplusmed.com/Common/javaScript/zepto.min",
"medtap": "https://review-formal.iplusmed.com/Common/javaScript/medtap_core_wx", "medtap": "https://review-formal.iplusmed.com/Common/javaScript/medtap_core_wx",
"mui": "https://review-formal.iplusmed.com/Common/javaScript/mui.min",
"md5": "https://review-formal.iplusmed.com/Common/javaScript/md5.min" "md5": "https://review-formal.iplusmed.com/Common/javaScript/md5.min"
}, },
shim: { shim: {
...@@ -29,6 +31,41 @@ ...@@ -29,6 +31,41 @@
}); });
</script> </script>
<style type="text/css"> <style type="text/css">
.mask{
display: none;
position:fixed;
margin: 0 auto;
top:50%;
left: 50%;
transform: translate(-50%,-50%);
height: 1.8rem;
width: 2.8rem;
background-color: #fff;
z-index: 999;
text-align: center;
border-radius: 0.1rem;
}
.mask_title {
margin-top:0.1rem;
padding: .2rem;
font-size: .3rem;
font-size: .28rem;
}
.mask_text{
margin-top: .2rem;
width: 100%;
display: flex;
justify-content: space-around;
}
.mask_text_gologin{
padding: .15rem;
color:#2CBCA0;
font-size: .2rem;
}
.mask_text_cancle{
padding: .15rem;
font-size: .2rem;
}
.top_header{ .top_header{
width:100%; width:100%;
height:0.8rem; height:0.8rem;
...@@ -136,6 +173,14 @@ ...@@ -136,6 +173,14 @@
<img src="../images/post_guide_buttn@2x.png" class="close_share"> <img src="../images/post_guide_buttn@2x.png" class="close_share">
</div> </div>
</div> </div>
<!-- mask -->
<div class="mask">
<p class="mask_title">注册登录</p>
<div class="mask_text">
<span class="mask_text_gologin">去登录</span>
<span class="mask_text_cancle">取消</span>
</div>
</div>
</body> </body>
<script type="text/javascript"> <script type="text/javascript">
require(['../javaScript/cardDetailForShare.js']) require(['../javaScript/cardDetailForShare.js'])
......
...@@ -3,6 +3,7 @@ define(['zepto', 'medtap'], function($, medtapCore) { ...@@ -3,6 +3,7 @@ define(['zepto', 'medtap'], function($, medtapCore) {
nums = 60; nums = 60;
var login = { var login = {
isTourist: medtapCore.getRequest('tourist'),
wechatId: medtapCore.getRequest('wechatId'), wechatId: medtapCore.getRequest('wechatId'),
doctorId: medtapCore.getRequest('doctorId'), doctorId: medtapCore.getRequest('doctorId'),
inviteCode: medtapCore.getRequest('inviteCode'), inviteCode: medtapCore.getRequest('inviteCode'),
......
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