1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- 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: '',
- isShare: false,
- recordList: []
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- console.log(options, 'options');
- let videoId = options.videoId
- this.setData({
- videoId,
- isShare: options.isShare
- })
- this.getreadInfo(videoId)
- this.getPkRecord()
- },
- async getreadInfo(videoId) {
- let videoInfo = await getreadInfo(videoId)
- wx.setNavigationBarTitle({
- title: videoInfo.userRead.title
- })
- this.setData({
- videoInfo,
- currentId: videoId
- })
- },
- async getPkRecord() {
- let recordList = await getPkRecord({
- userReadId: this.data.videoId
- })
- this.setData({
- recordList
- })
- },
- jumpUserInfo({
- currentTarget
- }) {
- wx.navigateTo({
- url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=user`,
- })
- },
- jumpIndex() {
- wx.switchTab({
- url: '/pages/index/index',
- })
- },
- addCommentNum() {
- this.setData({
- ['videoInfo.userRead.commentAmount']: ++this.data.videoInfo.userRead.commentAmount
- })
- },
- onUnload() {
- this.resetAudio()
- this.setData({
- currentId: ''
- })
- }
- })
|