|
|
@@ -1,6 +1,6 @@
|
|
|
// pages/video/video.js
|
|
|
import { getVideoList, getTemplateConfig, getUuid } from '../../api/api'
|
|
|
-import { rnd, deepCopy } from '../../utils/util'
|
|
|
+import { rnd, deepCopy, goToBookDetail } from '../../utils/util'
|
|
|
|
|
|
const app = getApp()
|
|
|
|
|
|
@@ -24,38 +24,19 @@ Page({
|
|
|
// 视频分类列表
|
|
|
categoryList: [],
|
|
|
// 当前选中的分类ID
|
|
|
- currentCategoryId: null
|
|
|
+ currentCategoryId: null,
|
|
|
+
|
|
|
+ share_count: 1
|
|
|
},
|
|
|
|
|
|
async onLoad() {
|
|
|
+ console.log('打开视频页面--------------------------')
|
|
|
if (!getApp().globalData.uuid) {
|
|
|
await this.getUUID().then(uuid => {
|
|
|
getApp().globalData.uuid = uuid
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- // 获取当前页面的参数
|
|
|
- const pages = getCurrentPages();
|
|
|
- const currentPage = pages[pages.length - 1];
|
|
|
- const options = currentPage.options;
|
|
|
-
|
|
|
- // 处理分享进入的情况
|
|
|
- if (options.shared_video_id) {
|
|
|
- // 延迟跳转,确保列表页已经加载完成
|
|
|
- setTimeout(() => {
|
|
|
- wx.navigateTo({
|
|
|
- url: `/pages/video/detail?id=${options.shared_video_id}&title=${options.title || ''}&tag_id=${options.tag_id || ''}`,
|
|
|
- fail: (err) => {
|
|
|
- console.error('跳转到视频详情页失败:', err);
|
|
|
- wx.showToast({
|
|
|
- title: '打开视频失败',
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- }, 500);
|
|
|
- }
|
|
|
-
|
|
|
getTemplateConfig({
|
|
|
box_type: 67,
|
|
|
uuid: getApp().globalData.uuid
|
|
|
@@ -73,6 +54,7 @@ Page({
|
|
|
},
|
|
|
|
|
|
onShow() {
|
|
|
+ console.log('页面显示--------------------------')
|
|
|
// 每次显示页面时刷新列表
|
|
|
if (this.data.videoList.length === 0) {
|
|
|
this.setData({
|
|
|
@@ -80,6 +62,38 @@ Page({
|
|
|
})
|
|
|
// this.loadVideoList()
|
|
|
}
|
|
|
+
|
|
|
+ // 获取当前页面的参数
|
|
|
+ const pages = getCurrentPages();
|
|
|
+ const currentPage = pages[pages.length - 1];
|
|
|
+ const options = currentPage.options;
|
|
|
+
|
|
|
+ // 处理分享进入的情况
|
|
|
+ if (options.shared_video_id) {
|
|
|
+ if (+options.share_count === 1 && this.data.share_count === 1) {
|
|
|
+ this.setData({
|
|
|
+ share_count: 2
|
|
|
+ })
|
|
|
+ this.goToBookDetail()
|
|
|
+ } else if (+options.share_count === 1 && this.data.share_count === 2) {
|
|
|
+ this.setData({
|
|
|
+ share_count: 3
|
|
|
+ })
|
|
|
+ // 延迟跳转,确保列表页已经加载完成
|
|
|
+ setTimeout(() => {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/pages/video/detail?id=${options.shared_video_id}&title=${options.title || ''}&tag_id=${options.tag_id || ''}`,
|
|
|
+ fail: (err) => {
|
|
|
+ console.error('跳转到视频详情页失败:', err);
|
|
|
+ wx.showToast({
|
|
|
+ title: '打开视频失败',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }, 500);
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
@@ -394,7 +408,7 @@ Page({
|
|
|
|
|
|
return {
|
|
|
title: video.title,
|
|
|
- path: `/pages/video/video?shared_video_id=${video.id}&title=${encodeURIComponent(video.title)}&tag_id=${video.tag_ids[0]}`,
|
|
|
+ path: `/pages/video/video?shared_video_id=${video.id}&title=${encodeURIComponent(video.title)}&tag_id=${video.tag_ids[0]}&share_count=1`,
|
|
|
imageUrl: video.cover_image,
|
|
|
success: function(res) {
|
|
|
wx.showToast({
|
|
|
@@ -420,8 +434,18 @@ Page({
|
|
|
|
|
|
return {
|
|
|
title: video.title,
|
|
|
- query: `shared_video_id=${video.id}&title=${encodeURIComponent(video.title)}&tag_id=${video.tag_ids[0]}`,
|
|
|
+ query: `shared_video_id=${video.id}&title=${encodeURIComponent(video.title)}&tag_id=${video.tag_ids[0]}&share_count=1`,
|
|
|
imageUrl: video.cover_image
|
|
|
}
|
|
|
+ },
|
|
|
+
|
|
|
+ // 跳转到书籍详情
|
|
|
+ goToBookDetail() {
|
|
|
+ // 使用公共的goToBookDetail函数
|
|
|
+ goToBookDetail({
|
|
|
+ bookId: 7266,
|
|
|
+ wxBookId: 'A1Hcfv456vGtMYxQjxUm8KNdJ8',
|
|
|
+ chapterId: null
|
|
|
+ });
|
|
|
}
|
|
|
})
|