future 1 ano atrás
pai
commit
e24e4fc5f3

+ 42 - 2
xs-app/pages/bookshelf/bookshelf-readHistory.vue

@@ -21,7 +21,7 @@
 				</view>
 			</view>
 		</view>
-		<view class="book-list">
+		<view class="book-list" :style="{marginBottom:is_edit?bottom_tools_all_height+'rpx':0}">
 			<view class="book-list__item" v-for="(item,index) in book_list" :key="index"
 			@click="clickBook(item,index)">
 			    <view class="book-list__item__book-cover">
@@ -39,7 +39,17 @@
 				</view>
 			</view>
 		</view>
-		<z-paging-empty-view v-if="book_list.length<=0" ></z-paging-empty-view>
+		<view v-if="is_edit" class="bottom-tools" :style="{height:bottom_tools_all_height+'rpx'}">
+			<view class="bottom-tools__all" :style="{height:bottom_tools_real_height+'rpx'}" @click="clickSelectedAll">
+				{{ is_selected_all?'取消全选':'全选' }}
+			</view>
+			<view class="bottom-tools__delete bottom-tools__all" :style="{height:bottom_tools_real_height+'rpx'}" @click="clickDelete">
+				删除({{edit_book_list.length}})
+			</view>
+		</view>
+		<view class="empty" v-if="book_list.length<=0" :style="{height:empty_height}">
+			<z-paging-empty-view :emptyViewFixed="false" ></z-paging-empty-view>
+		</view>
 	</view>
 </template>
 
@@ -270,5 +280,35 @@
 				}
 			}
 		}
+		
+		.bottom-tools{
+			position: fixed;
+			left: 0%;
+			right: 0%;
+			bottom: 0%;
+			width: 100%;
+			// height: 98rpx;
+			display: flex;
+			justify-content: space-between;
+			background-color: #ffffff;
+			border-top: 1rpx solid #999;
+			&__all{
+				display: flex;
+				width: 50%;
+				height: 100%;
+				justify-content: center;
+				align-items: center;
+				// background-color: green;
+			}
+			&__delete{
+				// background-color: paleturquoise;
+			}
+		}
+		
+		.empty{
+			display: flex; 
+			justify-content: center; 
+			align-items: center;
+		}
 	}
 </style>

+ 59 - 27
xs-app/pages/bookshelf/bookshelf.vue

@@ -27,6 +27,7 @@
 			:book_list='data_read_history_list' 
 			@clickBook='gotoReadBook' 
 			@clickEdit='clickEdit'
+			@clickButtonStatus='readHistoryClickButtonStatus'
 			@clickDeleteBook='readHistoryClickDeleteBook'></readHistory>
 		</view>
 	</view>
@@ -128,6 +129,15 @@
 					break
 				}
 			}
+			for (let i = 0; i < data_read_history_list.value.length; i++) {
+				let element = data_read_history_list.value[i]
+				if(element.book_id==book_data.book_id) {
+					if(element.start_read_chapter_id!=book_data.start_read_chapter_id) {
+						element.start_read_chapter_id = book_data.start_read_chapter_id
+					}
+					break
+				}
+			}
 		})
 	}
 	
@@ -139,33 +149,8 @@
 		is_edit_status.value = is_edit
 	}
 	
-	function bookListClickDeleteBook() {
-		data_book_list.value = tools.getLocalBookshelfList()
-	}
-	
-	function readHistoryClickDeleteBook() {
-		data_read_history_list.value = tools.getLocalReadHistoryList()
-	}
-		
-	function bookListClickButtonStatus(status:number) {
+	function changeButtonStatusTips(status:number) {
 		// console.log('button status=',status)
-		data_book_list.value = []
-		let call_back = (()=>{
-			if(status==config.book_action_status.QUAN_BU) {
-			    data_book_list.value = tools.getLocalBookshelfList()
-				return
-			}
-			let temp_list:book_item_data[] = []
-			for (let i = 0; i < tools.getLocalBookshelfList().length; i++) {
-				let element = tools.getLocalBookshelfList()[i]
-				if(element.book_is_action == status) {
-					temp_list.push(element)
-				}
-			}
-			if(temp_list.length>0) {
-				data_book_list.value = temp_list
-			}
-		})
 		let status_string = ''
 		switch (status){
 			case config.book_action_status.QUAN_BU:
@@ -181,10 +166,57 @@
 				break;
 		}
 		if(status_string.length>0) {
-			call_back()
 			util.showInfoToast(status_string)
 		}
 	}
+		
+	function bookListClickButtonStatus(status:number) {
+		changeButtonStatusTips(status)
+		
+		data_book_list.value = []
+		if(status==config.book_action_status.QUAN_BU) {
+		    data_book_list.value = tools.getLocalBookshelfList()
+			return
+		}
+		let temp_list:book_item_data[] = []
+		for (let i = 0; i < tools.getLocalBookshelfList().length; i++) {
+			let element = tools.getLocalBookshelfList()[i]
+			if(element.book_is_action == status) {
+				temp_list.push(element)
+			}
+		}
+		if(temp_list.length>0) {
+			data_book_list.value = temp_list
+		}
+	}
+	
+	function bookListClickDeleteBook() {
+		data_book_list.value = tools.getLocalBookshelfList()
+	}
+	
+	function readHistoryClickButtonStatus(status:number) {
+		changeButtonStatusTips(status)
+		
+		data_read_history_list.value = []
+		if(status==config.book_action_status.QUAN_BU) {
+		    data_read_history_list.value = tools.getLocalReadHistoryList()
+			return
+		}
+		let temp_list:book_item_data[] = []
+		for (let i = 0; i < tools.getLocalReadHistoryList().length; i++) {
+			let element = tools.getLocalReadHistoryList()[i]
+			if(element.book_is_action == status) {
+				temp_list.push(element)
+			}
+		}
+		if(temp_list.length>0) {
+			data_read_history_list.value = temp_list
+		}
+	}
+	
+	function readHistoryClickDeleteBook() {
+		data_read_history_list.value = tools.getLocalReadHistoryList()
+	}
 	
 	function gotoReadBook(book_data:book_item_data, index:number) {
 		// console.log('book_data=',book_data,'index=',index)