Commit 8ac3ba75 by zujiaozhang

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

parent 86007e7e
......@@ -203,7 +203,7 @@ define(['zepto', 'medtap'], function($, medtap) {
},
success: function(res) {
// console.log(res)
console.log('帖子详情',res)
medtap.loading(0);
if (res.success == true) {
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 = {
wechatId: medtap.getRequest('wechatId') || '',
cardId: medtap.getRequest('cardId') || '',
token: localStorage.getItem('wxLungToken') || '',
limit: 10,
offset: 1,
hasMore: false,
firstLoad: false,
upCount: 0,
agencyId:medtap.getRequest('agencyId'),
agencyId:medtap.getRequest('agencyId') || '',
shareId:'',
userId:'',
mask : mui.createMask(function(){
$('.mask').hide()
}),//callback为用户点击蒙版时自动执行的回调;
init: function() {
card.checkUser();
card.getToken();
card.getCardDetail();
card.getCommentList();
card.bindEve();
card.getWechatTicket();
card.previewImage();
// card.getToken();
//滚动加载
$(window).scroll(function() {
var scrollTop = $(this).scrollTop(); //滚动条距离顶部的高度
......@@ -40,7 +44,7 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m
});
$('.btn_do_comment').on('click', function() {
if(card.token){
if(card.userId){
$('.content_mod').show();
$('.comment_btn').show();
$('.reply_input').focus();
......@@ -52,7 +56,9 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m
card.replyPublish();
})
}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
window.location.href='https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_login/login.html'
})
},
// 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){
// medtap.loading(0);
// var info = res.content.wechatUser;
// // if(info.hasOwnProperty('userId')){
// // //medtap.pushWindow('index.html?wechatId=' + card.wechatId)
// // window.location.replace('index.html?wechatId=' + card.wechatId)
// // }else{
// // window.location.replace('https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_login/login.html?wechatId=' + card.wechatId)
// // }
getToken:function(){
localStorage.wxLungToken = '';
medtap.loading(1);
medtap.submitAjax({
url: 'https://testdevgw.medtap.cn/user/auth/token',
type: 'POST',
async: false,
contentType: 'application/json',
data: {
wechatId: card.wechatId
},
success: function(res) {
console.log('gettoken',res)
medtap.loading(0);
if (res.success == true) {
var token = res.content.token;
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() {
$('.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加油
$('.fabulous').on('click', function() {
if(card.token){
if(card.userId){
var status = card.publishUp(card.cardId);
if (status == 1) {
$(this).hide();
......@@ -103,14 +149,17 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m
card.getCardDetail();
var newNum = parseInt(card.upCount);
$('.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() {
if(card.token){
if(card.userId){
var status = card.publishUp(card.cardId);
if (status == 0) {
$(this).hide();
......@@ -118,12 +167,14 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m
$('.fabulous').children('.fabulous_desc').html('为TA加油');
}
}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() {
if(card.token){
if(card.userId){
var rs = card.publishCollect();
var _this = this;
if (rs == 0) {
......@@ -138,7 +189,9 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m
}, 1000)
}
}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,6 +474,7 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m
$('.comment_list').html(replyHtml);
}
//评论点赞
if(card.userId){
$('.comment_item .comment_tools_fabulous').on('click', function(event) {
event.stopPropagation();
var id = $(this).parents('.comment_item').attr('data-id');
......@@ -436,7 +490,9 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m
$(this).children('.fabulous_num').html(newNum);
}
});
}
//跳转至评论详情
if(card.userId){
$('.comment_item').on('click', function() {
if(card.token){
var id = $(this).attr('data-id');
......@@ -447,6 +503,7 @@ define(['zepto', 'medtap','../javaScript/beforeSubmitForLung.js'], function($, m
})
}
}
}
})
},
//为TA加油
......
......@@ -9,6 +9,7 @@
<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="../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://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<title>详情</title>
......@@ -19,6 +20,7 @@
paths: {
"zepto": "https://review-formal.iplusmed.com/Common/javaScript/zepto.min",
"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"
},
shim: {
......@@ -29,6 +31,41 @@
});
</script>
<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{
width:100%;
height:0.8rem;
......@@ -136,6 +173,14 @@
<img src="../images/post_guide_buttn@2x.png" class="close_share">
</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>
<script type="text/javascript">
require(['../javaScript/cardDetailForShare.js'])
......
......@@ -3,6 +3,7 @@ define(['zepto', 'medtap'], function($, medtapCore) {
nums = 60;
var login = {
isTourist: medtapCore.getRequest('tourist'),
wechatId: medtapCore.getRequest('wechatId'),
doctorId: medtapCore.getRequest('doctorId'),
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