@@ -35,3 +35,12 @@ export const uploadBeauty = function(data) { | |||
}) | |||
} | |||
// 领取积分 | |||
export const getPoint = function(data) { | |||
return request({ | |||
url: '/userPoints/receive', | |||
method: 'POST', | |||
data | |||
}) | |||
} | |||
@@ -1,4 +1,5 @@ | |||
// package_first/pages/askDetail/index.js | |||
import {getPoint} from '../../../api/home.js' | |||
Page({ | |||
/** | |||
@@ -31,5 +32,18 @@ Page({ | |||
this.setData({dataSource}) | |||
} | |||
} | |||
}, | |||
// 领取积分 | |||
getPoints() { | |||
let params = {} | |||
params.openid = wx.getStorageSync('openid') | |||
params.knowId = this.data.dataSource.id | |||
getPoint(params).then(res=> { | |||
if(res.code === 0) { | |||
wx.navigateBack({ | |||
delta: 0, | |||
}) | |||
} | |||
}) | |||
} | |||
}) |
@@ -4,4 +4,9 @@ | |||
<text class="detail_date">{{dataSource.createTime || ''}}</text> | |||
<image wx:if="{{dataSource.image}}" class="detail_img" mode="widthFix" src="{{dataSource.image}}"></image> | |||
<rich-text type="node" style="width:100%; white-space: pre-wrap;word-break: break-all;" nodes="{{dataSource.content}}"></rich-text> | |||
<!-- 领取积分按钮 --> | |||
<view class="btn_box"> | |||
<view class="btn_item" bindtap="getPoints">领取积分</view> | |||
</view> | |||
</view> |
@@ -7,6 +7,7 @@ | |||
justify-content: flex-start; | |||
align-items: flex-start; | |||
background-color: #ffffff; | |||
position: relative; | |||
} | |||
.detail_title { | |||
width: 100%; | |||
@@ -22,4 +23,23 @@ | |||
.detail_img { | |||
width: 100%; | |||
margin-bottom: 20rpx; | |||
} | |||
.btn_box { | |||
width: 100%; | |||
padding: 0 30rpx; | |||
position: fixed; | |||
bottom: 20rpx; | |||
left: 0; | |||
} | |||
.btn_item { | |||
width: 100%; | |||
height: 80rpx; | |||
margin-bottom: 30rpx; | |||
border-radius: 40rpx; | |||
text-align: center; | |||
line-height: 80rpx; | |||
font-size: 32rpx; | |||
color: #ffffff; | |||
background-color: #2a82e4; | |||
} |