关注企业接口
This commit is contained in:
@@ -89,5 +89,16 @@ Page({
|
||||
wx.navigateTo({
|
||||
url: '/pages/mall/index',
|
||||
})
|
||||
},
|
||||
// 关注企业 取消关注企业
|
||||
force() {
|
||||
wx.$api.companyModule.companyLike(wx.getStorageSync('company_id')).then(res => {
|
||||
console.log(res);
|
||||
var info = this.data.info;
|
||||
info.isSubscrib = !this.data.info.isSubscrib
|
||||
this.setData({
|
||||
info: info
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -26,8 +26,8 @@
|
||||
<view class=" cop_call cop_shop" catchtap="goMall">
|
||||
<image src="/static/images/com_shop.png" mode="widthFix"></image>进入商城
|
||||
</view>
|
||||
<view class=" cop_call cop_focus">
|
||||
<image src="/static/images/eye.png" mode="widthFix"></image>关注企业
|
||||
<view class=" cop_call cop_focus" catchtap="force">
|
||||
<image src="/static/images/eye.png" mode="widthFix"></image> {{info.isSubscrib ? '取消关注' :'关注企业'}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -89,11 +89,11 @@ Page({
|
||||
|
||||
// 关注取消关注项目
|
||||
islike() {
|
||||
if (!this.data.info.isLike) {
|
||||
if (!this.data.info.isSubscribed) {
|
||||
wx.$api.companyModule.crowdfundsLike(this.data.crowdfund_id).then(res => {
|
||||
var info = this.data.info;
|
||||
info.isLike = true;
|
||||
info.likes = res.likes
|
||||
info.isSubscribed = true;
|
||||
info.subscribes = res.subscribes
|
||||
this.setData({
|
||||
info: info
|
||||
})
|
||||
@@ -101,8 +101,8 @@ Page({
|
||||
} else {
|
||||
wx.$api.companyModule.crowdfundsUnLike(this.data.crowdfund_id).then(res => {
|
||||
var info = this.data.info;
|
||||
info.isLike = false;
|
||||
info.likes = res.likes
|
||||
info.isSubscribed = false;
|
||||
info.subscribes = res.subscribes
|
||||
this.setData({
|
||||
info: info
|
||||
})
|
||||
|
||||
@@ -104,15 +104,14 @@
|
||||
<view class="project_now_act {{acted?'acted':''}}">
|
||||
<view class="left" wx:if='{{info.status!=2}}' catchtap="islike" >
|
||||
<image class="collect" mode="widthFix"
|
||||
src="{{info.isLike ? '/static/images/collect.png':'/static/images/unCollect.png'}}">
|
||||
src="{{info.isSubscribed ? '/static/images/collect.png':'/static/images/unCollect.png'}}">
|
||||
</image>
|
||||
关注{{info.likes>0?info.likes:''}}
|
||||
关注{{info.subscribes>0?info.subscribes:''}}
|
||||
</view>
|
||||
<view wx:else class="left">
|
||||
{{info.likes || 0}}人已关注
|
||||
{{info.subscribes || 0}}人已关注
|
||||
</view>
|
||||
<span class="nolike" wx:if='{{info.status==3 || info.status==4 }}'>我要支持</span>
|
||||
<button size="mini" class="{{info.isLike?'nolike':''}}" bindtap="{{!info.isLike?'like':'islike'}}" wx:elif='{{info.status==2}}' hover-class="other-button-hover">{{!info.isLike?'关注项目':'不再关注项目'}}</button>
|
||||
<button size="mini" class="{{info.isSubscribed?'nolike':''}}" bindtap="{{!info.isSubscribed?'like':'islike'}}" wx:elif='{{info.status==2}}' hover-class="other-button-hover">{{!info.isSubscribed?'关注项目':'不再关注项目'}}</button>
|
||||
<span wx:else catchtap="goDetail">我要支持</span>
|
||||
|
||||
</view>
|
||||
Reference in New Issue
Block a user