|
@@ -1,5 +1,7 @@
|
|
|
import {
|
|
|
getreadInfo,
|
|
|
+ likeVideo,
|
|
|
+ collectVideo,
|
|
|
submitPlayLog
|
|
|
} from '~/api/video'
|
|
|
import {
|
|
@@ -789,19 +791,40 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 收藏课程
|
|
|
+ async collect() {
|
|
|
+ let {
|
|
|
+ id,
|
|
|
+ type,
|
|
|
+ uid
|
|
|
+ } = this.data.videoInfo.userRead
|
|
|
+ if (wx.getStorageSync('uid') == uid) {
|
|
|
+ return wx.showToast({
|
|
|
+ title: '不能收藏自己作品哦!',
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ }
|
|
|
+ await collectVideo({
|
|
|
+ targetCode: id,
|
|
|
+ favoritesType: type
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ ['videoInfo.isFavorites']: !this.data.videoInfo.isFavorites
|
|
|
+ })
|
|
|
+ },
|
|
|
// 点赞
|
|
|
async likeVideo() {
|
|
|
- /* let {
|
|
|
- id
|
|
|
- } = this.data.videoInfoCopy.userRead
|
|
|
- if (this.data.videoInfoCopy.isLike) {
|
|
|
- return
|
|
|
- }
|
|
|
- await likeVideo(id)
|
|
|
- this.setData({
|
|
|
- ['videoInfoCopy.isLike']: true,
|
|
|
- ['videoInfoCopy.userRead.likeAmount']: this.data.videoInfoCopy.userRead.likeAmount + 1
|
|
|
- }) */
|
|
|
+ if (this.data.videoInfo.isLike) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let {
|
|
|
+ id
|
|
|
+ } = this.data.videoInfo.userRead
|
|
|
+ await likeVideo(id)
|
|
|
+ this.setData({
|
|
|
+ ['videoInfo.isLike']: true,
|
|
|
+ ['videoInfo.userRead.likeAmount']: this.data.videoInfo.userRead.likeAmount + 1
|
|
|
+ })
|
|
|
},
|
|
|
creatShare() {
|
|
|
return new Promise((resolve, reject) => {
|
|
@@ -845,13 +868,13 @@ Page({
|
|
|
dz.src = '/static/heart.png'
|
|
|
dz.onload = () => {
|
|
|
ctx.drawImage(dz, 318, 222, 22, 22)
|
|
|
- ctx.fillText(0, 254, 238)
|
|
|
+ ctx.fillText(video.userRead.likeAmount || 0, 254, 238)
|
|
|
// 评论
|
|
|
let pl = canvas.createImage();
|
|
|
pl.src = '/static/comment.png'
|
|
|
pl.onload = () => {
|
|
|
ctx.drawImage(pl, 228, 222, 22, 22)
|
|
|
- ctx.fillText(0, 340, 238)
|
|
|
+ ctx.fillText(video.userRead.commentAmount, 340, 238)
|
|
|
if (video.userReadExtend.resourcesType == 1) {
|
|
|
let aBg = canvas.createImage();
|
|
|
aBg.src = '/static/shareAudioBg.png';
|
|
@@ -883,8 +906,8 @@ Page({
|
|
|
canvas: canvas,
|
|
|
success(res) {
|
|
|
resolve({
|
|
|
- title: '我的新作品发布啦,快来捧场点赞!',
|
|
|
- path: `/pages/pkPage/index?videoId=${wx.getStorageSync('shareVideoId')}&uid=${wx.getStorageSync('uid')}&isShare=true`,
|
|
|
+ title: video.user.profession == '官方' ? '我正在听这篇朗读示范,这发音,播音专业水准!你也来听听!' : '我的新作品发布啦,快来捧场点赞!',
|
|
|
+ path: video.user.profession == '官方' ? `/pages/reading/index?uid=${wx.getStorageSync('uid')}` : `/pages/pkPage/index?videoId=${wx.getStorageSync('shareVideoId')}&uid=${wx.getStorageSync('uid')}&isShare=true`,
|
|
|
imageUrl: res.tempFilePath
|
|
|
})
|
|
|
},
|