|
@@ -290,8 +290,72 @@ function isWechat() {
|
|
|
<img class="icon-title-img" src='{{Msg "seo" "cdn"}}/images/collect.png' />
|
|
|
标讯收藏
|
|
|
</span>
|
|
|
+ <span class="com-collect" id="bidCollected" style="display: none;">
|
|
|
+ <img class="icon-title-img" src='{{Msg "seo" "cdn"}}/images/collected.png' />
|
|
|
+ 标讯收藏
|
|
|
+ </span>
|
|
|
<script>
|
|
|
-
|
|
|
+ // 查询是否已收藏
|
|
|
+ $.ajax({
|
|
|
+ type:'post',
|
|
|
+ url:'/publicapply/bidcoll/isColl?t=' + Date.now(),
|
|
|
+ data: {
|
|
|
+ bids: {{.T.obj._id}}
|
|
|
+ },
|
|
|
+ dataType:'json',
|
|
|
+ success: function(r){
|
|
|
+ if (r.data) {
|
|
|
+ r.data.forEach(function(item,index) {
|
|
|
+ if(item == {{.T.obj._id}}) {
|
|
|
+ $('#bidCollected').show()
|
|
|
+ $('#bidCollect').hide()
|
|
|
+ } else {
|
|
|
+ $('#bidCollected').hide()
|
|
|
+ $('#bidCollect').show()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 收藏事件
|
|
|
+ function collBidAction (baction, callback) {
|
|
|
+ var params = {
|
|
|
+ baction: baction,
|
|
|
+ binfo: [{
|
|
|
+ bid: {{.T.obj._id}}
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ $.ajax({
|
|
|
+ type:'post',
|
|
|
+ contentType: "application/json",
|
|
|
+ url:'/publicapply/bidcoll/action',
|
|
|
+ data: JSON.stringify(params),
|
|
|
+ dataType: 'json',
|
|
|
+ success: function(r){
|
|
|
+ if (r) {
|
|
|
+ callback && callback(r)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 收藏事件
|
|
|
+ $('#bidCollect').click(function() {
|
|
|
+ collBidAction('C',function(r) {
|
|
|
+ if (r.data) {
|
|
|
+ $('#bidCollected').show()
|
|
|
+ $('#bidCollect').hide()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ // 取消收藏事件
|
|
|
+ $('#bidCollected').click(function() {
|
|
|
+ collBidAction('R',function(r) {
|
|
|
+ if (r.data) {
|
|
|
+ $('#bidCollected').hide()
|
|
|
+ $('#bidCollect').show()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
</script>
|
|
|
{{if .T.isMember}}
|
|
|
<!--大会员用户,可直接在pc端关注项目 -->
|