Преглед на файлове

完成我喜欢的视频列表接口联调

c4az6 преди 4 години
родител
ревизия
7d13e2f818

+ 6 - 4
api/home.js

@@ -1,4 +1,6 @@
-import {ajax} from './ajax.js'
+import {
+	ajax
+} from './ajax.js'
 /* 个人中心页面接口请求函数 */
 // 用户登陆
 export const userLogin = (data) => {
@@ -11,7 +13,7 @@ export const userLogin = (data) => {
 }
 
 // 绑定用户手机号
-export const  reqBindPhone = (data) => {
+export const reqBindPhone = (data) => {
 	return ajax({
 		url: '/ymall/phone',
 		method: 'POST',
@@ -41,11 +43,11 @@ export const reqGetMyLikeList = data => {
 }
 
 // 获取医生作品列表(用户查看用医生的)
-export const reqGetDoctorVideoList = data=> {
+export const reqGetDoctorVideoList = data => {
 	return ajax({
 		url: '/ymall/videoUser/GetVideoList',
 		method: 'POST',
 		data,
 		isLoading: true
 	})
-}
+}

+ 37 - 25
pages/myLike/myLike.vue

@@ -4,17 +4,19 @@
 			<block slot="backText">返回</block>
 			<block slot="content">我的喜欢</block>
 		</cu-custom>
-		
-		<scroll-view class="content-wrap" :scroll-y="true" @scrolltolower="lower"  enable-flex >
-				<publicVideoList  :videoList="videoList" @onLower="handleLower" isShowDoctorName></publicVideoList>				
+
+		<scroll-view class="content-wrap" :scroll-y="true" @scrolltolower="lower" enable-flex>
+			<publicVideoList :videoList="videoList" @onLower="handleLower" isShowDoctorName></publicVideoList>
 		</scroll-view>
-		
+
 	</view>
 </template>
 
 <script>
 	import publicVideoList from '@/components/public-videoList/public-videoList.vue'
-	import {reqGetMyLikeList} from '../../api/home.js'
+	import {
+		reqGetMyLikeList
+	} from '../../api/home.js'
 	export default {
 		name: "myLike",
 		components: {
@@ -22,47 +24,57 @@
 		},
 		data() {
 			return {
-				videoList: [],		// 视频列表
-				queryParams: {		// 请求视频列表参数
+				videoList: [], // 视频列表
+				payload: { // 请求视频列表参数
 					pageIndex: 1,
-					pageSize: 10
+					pageSize: 5
 				}
 			};
 		},
 		methods: {
 			// 获取视频列表数据
-			async getList(){
-				const response = await reqGetMyLikeList(this.queryParams)
+			async getList() {
+				const response = await reqGetMyLikeList(this.payload)
+				uni.hideLoading()
 				console.log("get video list response: ", response)
-				if(response.isSuccess && response.resultCode === 200) {
-					this.videoList = response.resultObject
+				if (response.isSuccess && response.resultCode === 200) {
+					if (response.pager.totalItemCount > this.videoList.length) {
+						this.videoList = [...this.videoList, ...response.resultObject]
+						this.payload.pageIndex++
+					} else {
+						uni.showToast({
+							title: '没有更多数据了...',
+							icon: 'none'
+						})
+					}
+				} else {
+					uni.showToast({
+						title: '服务器异常...',
+						icon: 'none'
+					})
 				}
 			},
 			// 触底事件
 			lower(e) {
-				console.log(e)
-				
-/* 				uni.showLoading({
+				uni.showLoading({
 					title: '加载中...',
 					mask: true
-				}) */
-				setTimeout(_=>{
-					uni.hideLoading()
-				}, 1500)
+				})
+				this.getList()
 			}
 		},
-		onLoad(){
+		onLoad() {
 			console.log(111)
 		},
-		onShow(){
+		onShow() {
 			this.getList()
 		}
 	}
 </script>
 
 <style lang="less">
-.content-wrap {
-	height: calc(100vh);
-	padding: 8rpx;
-}
+	.content-wrap {
+		height: calc(100vh);
+		padding: 8rpx;
+	}
 </style>

Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/common/vendor.js.map


Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/myLike/myLike.js.map


+ 2 - 0
unpackage/dist/dev/mp-weixin/common/vendor.js

@@ -8981,6 +8981,8 @@ internalMixin(Vue);
 
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });exports.reqGetDoctorVideoList = exports.reqGetMyLikeList = exports.reqGetMyFollowList = exports.reqBindPhone = exports.userLogin = void 0;var _ajax = __webpack_require__(/*! ./ajax.js */ 22);
+
+
 /* 个人中心页面接口请求函数 */
 // 用户登陆
 var userLogin = function userLogin(data) {

Файловите разлики са ограничени, защото са твърде много
+ 27 - 15
unpackage/dist/dev/mp-weixin/pages/myLike/myLike.js


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

@@ -48,6 +48,13 @@
 					"id": -1,
 					"name": "我的关注",
 					"pathName": "pages/myAttention/myAttention",
+					"query": "",
+					"scene": null
+				},
+				{
+					"id": -1,
+					"name": "我的喜欢",
+					"pathName": "pages/myLike/myLike",
 					"scene": null
 				}
 			]