import behavior from '~/mixins/video' import share from '~/mixins/share' import { getreadInfo } from '~/api/video' import { getPkRecord } from '~/api/works' Page({ behaviors: [behavior, share], data: { videoInfo: '', videoId: '', recordList: [] }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { let videoId = options.videoId this.setData({ videoId }) this.getreadInfo(videoId) this.getPkRecord() }, async getreadInfo(videoId) { let videoInfo = await getreadInfo(videoId) wx.setNavigationBarTitle({ title: videoInfo.userRead.title }) this.setData({ videoInfo }) }, async getPkRecord() { let recordList = await getPkRecord({ userReadId: this.data.videoId }) this.setData({ recordList }) console.log(recordList); }, jumpUserInfo({ currentTarget }) { wx.navigateTo({ url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=user`, }) }, addCommentNum() { this.setData({ ['videoInfo.userRead.commentAmount']: ++this.data.videoInfo.userRead.commentAmount }) }, onUnload() { this.resetAudio() this.setData({ currentId: '' }) } })