소스 검색

论坛指向分页

canghailong 6 달 전
부모
커밋
b171f23ad4
2개의 변경된 파일37개의 추가작업 그리고 45개의 파일을 삭제
  1. 19 23
      src/views/forum/addForum.vue
  2. 18 22
      src/views/forum/form.vue

+ 19 - 23
src/views/forum/addForum.vue

@@ -111,36 +111,32 @@
 	const filterOption = (input, option) => {
 		return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
 	}
-	const popupScroll = (el) => {
-		let offset = 0
-		if (el.target.scrollHeight - el.target.scrollTop - offset <= el.target.clientHeight) {
-			userPagination.value.current += 1
-			getUserAllList(true)
-		}
-	}
 	const userPagination = ref({
 		size: 10,
-		current: 1,
+		current: 1
 	})
 	const userTotal = ref(0)
 	//获取用户
 	const getUserAllList = (add) => {
-		if (userPagination.value.size * userPagination.value.current < userTotal.value) {
-			forumApi.allUserList(userPagination.value).then((res) => {
-				userTotal.value = res.total
-				let userList = res.records.map((r) => {
-					return {
-						label: r.name,
-						value: r.id,
-						...r
-					}
-				})
-				if (add) {
-					usertypeOptions.value.push(userList)
-				} else {
-					usertypeOptions.value = userList
+		forumApi.allUserList(userPagination.value).then((res) => {
+			userTotal.value = res.total
+			let userList = res.records.map((r) => {
+				return {
+					label: `${r.name}-${r.eduIdentityName}`,
+					value: r.id,
+					...r
 				}
 			})
+			usertypeOptions.value = add ? [...usertypeOptions.value, ...userList] : userList
+		})
+	}
+	const popupScroll = (el) => {
+		let offset = 0
+		if (el.target.scrollHeight - el.target.scrollTop - offset <= el.target.clientHeight) {
+			if (userPagination.value.size * userPagination.value.current < userTotal.value) {
+				userPagination.value.current += 1
+				getUserAllList(true)
+			}
 		}
 	}
 	const getData = async () => {
@@ -224,7 +220,7 @@
 	}
 	//获取操作系统/浏览器等信息
 	const browserObj = ref({
-		forumSupportEnvParam:{}
+		forumSupportEnvParam: {}
 	})
 	function getBower() {
 		const browser = Bowser.getParser(window.navigator.userAgent)

+ 18 - 22
src/views/forum/form.vue

@@ -81,36 +81,32 @@
 	const filterOption = (input, option) => {
 		return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
 	}
-	const popupScroll = (el) => {
-		let offset = 0
-		if (el.target.scrollHeight - el.target.scrollTop - offset <= el.target.clientHeight) {
-			userPagination.value.current += 1
-			getUserAllList(true)
-		}
-	}
 	const userPagination = ref({
 		size: 10,
-		current: 1,
+		current: 1
 	})
 	const userTotal = ref(0)
 	//获取用户
 	const getUserAllList = (add) => {
-		if (userPagination.value.size * userPagination.value.current < userTotal.value) {
-			forumApi.allUserList(userPagination.value).then((res) => {
-				userTotal.value = res.total
-				let userList = res.records.map((r) => {
-					return {
-						label: `${r.name}-${r.eduIdentityName}`,
-						value: r.id,
-						...r
-					}
-				})
-				if (add) {
-					usertypeOptions.value.push(userList)
-				} else {
-					usertypeOptions.value = userList
+		forumApi.allUserList(userPagination.value).then((res) => {
+			userTotal.value = res.total
+			let userList = res.records.map((r) => {
+				return {
+					label: `${r.name}-${r.eduIdentityName}`,
+					value: r.id,
+					...r
 				}
 			})
+			usertypeOptions.value = add ? [...usertypeOptions.value, ...userList] : userList
+		})
+	}
+	const popupScroll = (el) => {
+		let offset = 0
+		if (el.target.scrollHeight - el.target.scrollTop - offset <= el.target.clientHeight) {
+			if (userPagination.value.size * userPagination.value.current < userTotal.value) {
+				userPagination.value.current += 1
+				getUserAllList(true)
+			}
 		}
 	}
 	// 打开抽屉