Selaa lähdekoodia

feat: 自动返回;

qiansailong 1 vuosi sitten
vanhempi
commit
3d02b0cd61

+ 2 - 2
api/api.js

@@ -105,11 +105,11 @@ export function getVideoList(params = {}) {
     filter_id: filter_id,
     next_id: next_id,
     count: size,
-    uuid: "128eaeb697b2e02aa4badbc02f49c182", // 固定值,实际应用中可能需要动态生成
+    uuid:  getApp().globalData.uuid, // 固定值,实际应用中可能需要动态生成
     gh_id: "gh_acc9a32b2122" // 固定值
   };
   
-  return post("https://applet.xiaoduer.cn/cashvideoapi/cashvideo/getvideolist", requestData)
+  return postWithCommonParams("https://applet.xiaoduer.cn/cashvideoapi/cashvideo/getvideolist", requestData)
     .then(data => {
 
      return data;

+ 8 - 2
app.js

@@ -78,7 +78,10 @@ App({
 
   globalData: {
     userInfo: null,
-    isLogin: false
+    isLogin: false,
+    novelManager: {},
+    uuid: '',
+    isShowDialog: false
   }
 })
 
@@ -86,7 +89,10 @@ App({
 async function onNovelPluginLoad(data) {
   // data.id - 阅读器实例 id,每个插件页对应一个阅读器实例
   const novelManager = novelPlugin.getNovelManager(data.id)
-
+  getApp().globalData.novelManager = novelManager
+  novelManager.setFullScreenComponentStatus({
+    show: true,
+  })
 
   let pluginInfo = novelManager.getPluginInfo();
 

+ 4 - 2
app.json

@@ -20,7 +20,8 @@
     "navigationBarTextStyle": "black"
   },
   "usingComponents": {
-    "charge-dialog": "/components/charge-dialog/charge-dialog"
+    "charge-dialog": "/components/charge-dialog/charge-dialog",
+    "full-screen": "/components/full-screen/full-screen"
   },
   "plugins": {
     "novel-plugin": {
@@ -28,7 +29,8 @@
       "provider": "wx293c4b6097a8a4d0",
       "genericsImplementation": {
         "novel": {
-          "charge-dialog": "/components/charge-dialog/charge-dialog"
+          "charge-dialog": "/components/charge-dialog/charge-dialog",
+          "full-screen": "/components/full-screen/full-screen"
         }
       }
     }

+ 1 - 1
components/charge-dialog/charge-dialog.js

@@ -25,7 +25,7 @@ Component({
   },
 
   onLoad(options) {
-    console.log('options',options)
+    console.log('options',options, '解锁-----------------------------------------')
     getNovelDetail(options.id).then(res => {
       console.log('res',res)
     })

+ 50 - 0
components/full-screen/full-screen.js

@@ -0,0 +1,50 @@
+const novelPlugin = requirePlugin('novel-plugin')
+import { getNovelDetail, getVideoDetail } from '../../api/api'
+Component({
+  properties: {
+    novelManagerId: {
+      type: Number,
+      value: -1,
+    },
+    chapterId: {
+      type: String,
+      value: '',
+    }
+  },
+
+  data: {
+    posterUrl: {
+      type: String,
+      value: ''
+    }
+  },
+
+  ready() {
+    const novelManager = novelPlugin.getNovelManager(this.properties.novelManagerId)
+    if (getApp().globalData.isShowDialog) {
+      setTimeout(() => {
+        getApp().globalData.isShowDialog = false
+        novelManager.navigateBack()
+      }, 3000)
+    }
+
+    // getVideoDetail(this.properties.bookId).then(res => {
+    //   console.log('res',res, 111111111111111111111111111122222222222222222222222)
+    //   this.setData({
+    //     posterUrl: res.cover
+    //   })
+    // })
+  },
+
+  methods: {
+    // 海报点击事件
+    handlePosterTap() {
+      const novelManager = novelPlugin.getNovelManager(this.properties.novelManagerId)
+      novelManager.setFullScreenComponentStatus({
+        show: false,
+      })
+      novelManager.navigateBack()
+      console.log('点击海报')
+    }
+  },
+})

+ 4 - 0
components/full-screen/full-screen.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 7 - 0
components/full-screen/full-screen.wxml

@@ -0,0 +1,7 @@
+<!-- <view style="width: 100%;height: 100vh;background: rgba(0, 0, 0, 0.4);display: flex;align-items: center;">
+  <view style="width: 50vh;">
+    111122121111
+    <image bind:tap="handlePosterTap" style="position: absolute; width: 100rpx;height: 100rpx;top: 50%; left: 49%;transform: translate(-50%,-50%);" src="/assets/images/icon-video-play.png" mode="" />
+    <image style="display: block;width: 100%;" src="{{posterUrl}}" bind:tap="handlePosterTap" />
+  </view>
+</view> -->

+ 40 - 0
components/full-screen/full-screen.wxss

@@ -0,0 +1,40 @@
+/* components/fullscreen-poster/index.wxss */
+.fullscreen-wrapper {
+  position: relative;
+  top: -200%;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  z-index: 9999;
+  transition: all 0.3s ease;
+  background: rgba(0, 0, 0, 0.9);
+}
+
+.fullscreen-wrapper.show {
+  top: 0;
+}
+
+.mask {
+  position: absolute;
+  width: 100%;
+  height: 100%;
+  background: rgba(0, 0, 0, 0.9);
+}
+
+.poster-container {
+  position: relative;
+  width: 100%;
+  height: 100%;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  padding: 40rpx;
+}
+
+.poster-image {
+  max-width: 80%;
+  max-height: 70vh;
+  border-radius: 16rpx;
+  box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.2);
+  margin: 0 auto;
+}

+ 1 - 1
pages/video/detail.js

@@ -368,7 +368,7 @@ Page({
 
   // 跳转到书籍详情
   goToBookDetail() {      
-    // 使用公共的goToBookDetail函数
+    getApp().globalData.isShowDialog = true
     goToBookDetail({
       bookId: 7266,
       wxBookId: 'A1Hcfv456vGtMYxQjxUm8KNdJ8',

+ 2 - 1
pages/video/video.js

@@ -440,7 +440,8 @@ Page({
     },
 
     // 跳转到书籍详情
-    goToBookDetail() {      
+    goToBookDetail() {
+      getApp().globalData.isShowDialog = true
       // 使用公共的goToBookDetail函数
       goToBookDetail({
         bookId: 7266,