Kaynağa Gözat

完成跳转页面后视频支持上下滑动并且支持分页功能-搜索视频也没按

c4az6 4 yıl önce
ebeveyn
işleme
7e4ca5c952

+ 2 - 1
components/public-videoList/public-videoList.vue

@@ -75,10 +75,11 @@
 			// 监听视频点击事件
 			handleVideoClick(id, index, list){
 				console.log(index)
+				// return
 				let currentPageIndex = Math.floor(index / 5) + 1
 				let currentVideoIndex = index % 5
 				let currentVideoList = list.slice((currentPageIndex - 1) * 5, (currentPageIndex * 5))
-				debugger
+				// debugger
 				this.$emit('onVideoClick', currentPageIndex, currentVideoIndex, currentVideoList)
 			},
 			// 监听删除按钮点击事件

+ 9 - 2
pages/search/search.vue

@@ -51,6 +51,7 @@
 		data() {
 			return {
 				videoList: [],		// 视频列表
+				videoTotal: 0,
 				payload: {
 					pageIndex: 1,
 					pageSize: 5,
@@ -65,8 +66,13 @@
 		},
 		methods: {
 			// 监听视频点击事件
-			handleVideoClick(e){
-				console.log(e)
+			handleVideoClick(currentPageIndex, currentVideoIndex, videoList){
+				// 通过getApp()传参
+				getApp().globalData.videoListJumpParams = {currentPageIndex,currentVideoIndex,videoList, source:'search', videoTotal: this.videoTotal}
+				console.log("getApp全局数据: ", getApp().globalData)
+				uni.redirectTo({
+					url: '/pages/videoPlayer/videoPlayer'
+				})
 			},
 			
 			// 获取所有二级科室数据
@@ -99,6 +105,7 @@
 				const response = await reqGetSearchList(this.payload)
 				uni.hideLoading()
 				if(response.isSuccess && response.resultCode===200) {
+					this.videoTotal = response.pager.totalItemCount
 					if(response.pager.totalItemCount > this.videoList.length) {
 						this.videoList = [...this.videoList, ...response.resultObject]
 						this.payload.pageIndex++

+ 9 - 8
pages/videoPlayer/videoPlayer.vue

@@ -39,9 +39,9 @@
 		reqGetCommentList
 	} from '../../api/index.js'
 	
-import {reqGetMyLikeList} from '../../api/home.js'
-	
-	
+import {reqGetMyLikeList, reqGetSearchList} from '../../api/home.js'
+
+
 	export default {
 		name: "videoPlayer",
 		components: {
@@ -81,6 +81,9 @@ import {reqGetMyLikeList} from '../../api/home.js'
 				switch(this.source){
 					case "myLike":
 						this.getVideoList(reqGetMyLikeList)
+						break
+					case "search":
+						this.getVideoList(reqGetSearchList)
 				}
 			},
 			
@@ -230,8 +233,7 @@ import {reqGetMyLikeList} from '../../api/home.js'
 				let videoIndex = e.target.current
 				if(videoIndex < this.currentIndex) {
 					// pre operation
-					console.log("上滑操作...")
-					if(videoIndex === 0) {
+					if(videoIndex === 0 && this.prePageIndex > 0) {
 						// 第一个视频
 						this.videoParams.pageIndex = this.prePageIndex
 						this.switchVaild()
@@ -239,7 +241,6 @@ import {reqGetMyLikeList} from '../../api/home.js'
 					
 				}else if (videoIndex > this.currentIndex) {
 					// next operation
-					console.log("下滑操作...")
 					if(videoIndex === this.videoList.length-1) {
 						// 最后一个视频
 						this.videoParams.pageIndex = this.nextPageIndex
@@ -266,9 +267,9 @@ import {reqGetMyLikeList} from '../../api/home.js'
 			this.prePageIndex = videoListJumpParams.currentPageIndex - 1
 			this.nextPageIndex = videoListJumpParams.currentPageIndex + 1
 			this.currentVideoIndex = videoListJumpParams.currentVideoIndex
-			console.log("prePageIndex: ", this.prePageIndex)
+/* 			console.log("prePageIndex: ", this.prePageIndex)
 			console.log("nextPageIndex: ", this.nextPageIndex)
-			console.log("currentVideoIndex: ", this.currentVideoIndex)
+			console.log("currentVideoIndex: ", this.currentVideoIndex) */
 			this.videoTotal = videoListJumpParams.videoTotal
 			this.videoList = videoListJumpParams.videoList.map(item=>{
 				return {

Dosya farkı çok büyük olduğundan ihmal edildi
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/components/public-videoList/public-videoList.js.map


Dosya farkı çok büyük olduğundan ihmal edildi
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/search/search.js.map


Dosya farkı çok büyük olduğundan ihmal edildi
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/videoPlayer/videoPlayer.js.map


+ 2 - 1
unpackage/dist/dev/mp-weixin/components/public-videoList/public-videoList.js

@@ -209,10 +209,11 @@ var _default =
     // 监听视频点击事件
     handleVideoClick: function handleVideoClick(id, index, list) {
       console.log(index);
+      // return
       var currentPageIndex = Math.floor(index / 5) + 1;
       var currentVideoIndex = index % 5;
       var currentVideoList = list.slice((currentPageIndex - 1) * 5, currentPageIndex * 5);
-      debugger;
+      // debugger
       this.$emit('onVideoClick', currentPageIndex, currentVideoIndex, currentVideoList);
     },
     // 监听删除按钮点击事件

+ 9 - 2
unpackage/dist/dev/mp-weixin/pages/search/search.js

@@ -183,6 +183,7 @@ var _home = __webpack_require__(/*! ../../api/home.js */ 21);function _interopRe
   data: function data() {
     return {
       videoList: [], // 视频列表
+      videoTotal: 0,
       payload: {
         pageIndex: 1,
         pageSize: 5,
@@ -197,8 +198,13 @@ var _home = __webpack_require__(/*! ../../api/home.js */ 21);function _interopRe
   },
   methods: {
     // 监听视频点击事件
-    handleVideoClick: function handleVideoClick(e) {
-      console.log(e);
+    handleVideoClick: function handleVideoClick(currentPageIndex, currentVideoIndex, videoList) {
+      // 通过getApp()传参
+      getApp().globalData.videoListJumpParams = { currentPageIndex: currentPageIndex, currentVideoIndex: currentVideoIndex, videoList: videoList, source: 'search', videoTotal: this.videoTotal };
+      console.log("getApp全局数据: ", getApp().globalData);
+      uni.redirectTo({
+        url: '/pages/videoPlayer/videoPlayer' });
+
     },
 
     // 获取所有二级科室数据
@@ -231,6 +237,7 @@ var _home = __webpack_require__(/*! ../../api/home.js */ 21);function _interopRe
                   (0, _home.reqGetSearchList)(_this2.payload));case 3:response = _context2.sent;
                 uni.hideLoading();
                 if (response.isSuccess && response.resultCode === 200) {
+                  _this2.videoTotal = response.pager.totalItemCount;
                   if (response.pager.totalItemCount > _this2.videoList.length) {
                     _this2.videoList = [].concat(_toConsumableArray(_this2.videoList), _toConsumableArray(response.resultObject));
                     _this2.payload.pageIndex++;

+ 8 - 7
unpackage/dist/dev/mp-weixin/pages/videoPlayer/videoPlayer.js

@@ -212,7 +212,10 @@ var _home = __webpack_require__(/*! ../../api/home.js */ 21);function _interopRe
     switchVaild: function switchVaild() {
       switch (this.source) {
         case "myLike":
-          this.getVideoList(_home.reqGetMyLikeList);}
+          this.getVideoList(_home.reqGetMyLikeList);
+          break;
+        case "search":
+          this.getVideoList(_home.reqGetSearchList);}
 
     },
 
@@ -362,8 +365,7 @@ var _home = __webpack_require__(/*! ../../api/home.js */ 21);function _interopRe
       var videoIndex = e.target.current;
       if (videoIndex < this.currentIndex) {
         // pre operation
-        console.log("上滑操作...");
-        if (videoIndex === 0) {
+        if (videoIndex === 0 && this.prePageIndex > 0) {
           // 第一个视频
           this.videoParams.pageIndex = this.prePageIndex;
           this.switchVaild();
@@ -371,7 +373,6 @@ var _home = __webpack_require__(/*! ../../api/home.js */ 21);function _interopRe
 
       } else if (videoIndex > this.currentIndex) {
         // next operation
-        console.log("下滑操作...");
         if (videoIndex === this.videoList.length - 1) {
           // 最后一个视频
           this.videoParams.pageIndex = this.nextPageIndex;
@@ -398,9 +399,9 @@ var _home = __webpack_require__(/*! ../../api/home.js */ 21);function _interopRe
     this.prePageIndex = videoListJumpParams.currentPageIndex - 1;
     this.nextPageIndex = videoListJumpParams.currentPageIndex + 1;
     this.currentVideoIndex = videoListJumpParams.currentVideoIndex;
-    console.log("prePageIndex: ", this.prePageIndex);
-    console.log("nextPageIndex: ", this.nextPageIndex);
-    console.log("currentVideoIndex: ", this.currentVideoIndex);
+    /* 			console.log("prePageIndex: ", this.prePageIndex)
+                                                                    			console.log("nextPageIndex: ", this.nextPageIndex)
+                                                                    			console.log("currentVideoIndex: ", this.currentVideoIndex) */
     this.videoTotal = videoListJumpParams.videoTotal;
     this.videoList = videoListJumpParams.videoList.map(function (item) {
       return _objectSpread({},

+ 7 - 0
unpackage/dist/dev/mp-weixin/project.config.json

@@ -41,6 +41,13 @@
 					"pathName": "pages/myLike/myLike",
 					"query": "",
 					"scene": null
+				},
+				{
+					"id": -1,
+					"name": "视频搜索页面",
+					"pathName": "pages/search/search",
+					"query": "",
+					"scene": null
 				}
 			]
 		}