Browse Source

勾选时问题修复

soft5566 2 years ago
parent
commit
2ab02f38aa
1 changed files with 44 additions and 24 deletions
  1. 44 24
      src/views/businessInfo/index.vue

+ 44 - 24
src/views/businessInfo/index.vue

@@ -36,7 +36,7 @@
 								<el-button type="primary" class="btn-update-get-article" @click="article_get">获取文章</el-button>
 							</div>
 						</div>
-						<el-table :data="tableData" height="564" style="width: 100%" :cell-style="cell_style" :key='Math.random()'
+						<el-table ref="myTable" :data="tableData" height="564" style="width: 100%" :cell-style="cell_style"
 							:header-cell-style="header_cell_style" @selection-change="handle_table_change">
 							<el-table-column type="selection" width="50"></el-table-column>
 							<el-table-column label="标题" align="center">
@@ -91,45 +91,46 @@
 				</div>
 			</el-col>
 		</el-row>
-		<el-dialog custom-class="dialog-qingzhang" :visible.sync="dialog_del_article" :close-on-click-modal="false" :close-on-press-escape="false"
+		<el-dialog custom-class="dialog-have-no-title" :visible.sync="dialog_del_article" :close-on-click-modal="false" :close-on-press-escape="false"
 			:show-close="false">
-			<div slot="" class="dialog-qingzhang-body">
+			<div slot="" class="dialog-have-no-title-body">
 				<img src="../../icons/serveAC/del_warning.png" alt="">
-				<div class="dialog-qingzhang-body-txt">删除后的文章将不在民宿小程序<br>上进行展示,确定删除吗?</div>
+				<div class="dialog-have-no-title-body-txt">删除后的文章将不在民宿小程序<br>上进行展示,确定删除吗?</div>
 			</div>
 			<div slot="footer" class="dialog-footer">
 				<el-button class="add-user-cancel-btn" @click="dialog_del_article = false"> 取消 </el-button>
 				<el-button class="add-user-confirm-btn" @click="handle_del_article"> 确定 </el-button>
 			</div>
 		</el-dialog>
-		<el-dialog custom-class="dialog-qingzhang" :visible.sync="dialog_update_article" :close-on-click-modal="false" :close-on-press-escape="false"
+		<el-dialog custom-class="dialog-have-no-title" :visible.sync="dialog_update_article" :close-on-click-modal="false" :close-on-press-escape="false"
 			:show-close="false">
-			<div slot="" class="dialog-qingzhang-body">
+			<div slot="" class="dialog-have-no-title-body">
 				<img src="../../icons/serveAC/del_warning.png" alt="">
-				<div class="dialog-qingzhang-body-txt">确定对选中的文章进行更新吗?</div>
+				<div class="dialog-have-no-title-body-txt">确定对选中的文章进行更新吗?</div>
 			</div>
 			<div slot="footer" class="dialog-footer">
 				<el-button class="add-user-cancel-btn" @click="dialog_update_article = false"> 取消 </el-button>
 				<el-button class="add-user-confirm-btn" @click="handle_update_article"> 确定 </el-button>
 			</div>
 		</el-dialog>
-		<el-dialog custom-class="dialog-qingzhang" :visible.sync="dialog_get_article" :close-on-click-modal="false" :close-on-press-escape="false"
+		<el-dialog custom-class="dialog-have-no-title" :visible.sync="dialog_get_article" :close-on-click-modal="false" :close-on-press-escape="false"
 			:show-close="false">
-			<div slot="" class="dialog-qingzhang-body">
+			<div slot="" class="dialog-have-no-title-body">
 				<img src="../../icons/serveAC/del_warning.png" alt="">
-				<div class="dialog-qingzhang-body-txt">确定从公众号获取最新文章数据吗?</div>
+				<div class="dialog-have-no-title-body-txt">确定从公众号获取最新文章数据吗?</div>
 			</div>
 			<div slot="footer" class="dialog-footer">
 				<el-button class="add-user-cancel-btn" @click="dialog_get_article = false"> 取消 </el-button>
 				<el-button class="add-user-confirm-btn" @click="handle_get_article"> 确定 </el-button>
 			</div>
 		</el-dialog>
-		<el-dialog :visible.sync="dialog_show_article" title="文章详情" width="50%">
+		<el-dialog custom-class="dialog-have-title" :visible.sync="dialog_show_article" title="资讯详情" width="50%">
 			<div>
 				<h3 style="text-align: center;">{{ article_detail.title }}</h3>
-				<p style="text-align: center;">作者:{{ article_detail.author }}</p>
+				<p style="text-align: center;" v-if="article_detail.is_top == 0">作者:{{ article_detail.author }} 【已置顶】</p>
+				<p style="text-align: center;" v-else>作者:{{ article_detail.author }} 【未置顶】</p>
 				<p style="text-align: center;">时间:{{ article_detail.time }}</p>
-				<div v-html="article_detail.content" style="height: 500px; overflow: auto; border: 1px solid #e3e3e3; padding: 10px 10px 10px 30px;"></div>
+				<div v-html="article_detail.content" class="show-article"></div>
 			</div>
 		</el-dialog>
 	</div>
@@ -220,13 +221,13 @@
 		methods: {
 			// 显示文章详情
 			show_article_detail(row) {
-				console.log(row);
+				// console.log(row);
 				this.article_detail.title = row.title
 				this.article_detail.author = row.author
 				this.article_detail.content = row.content
 				this.article_detail.time = row.update_time
 				this.article_detail.first_img = row.first_img
-				
+
 				this.dialog_show_article = true
 			},
 			// 置顶/取消置顶
@@ -248,13 +249,14 @@
 				});
 			},
 			// 获取选择的文章ids
-			handle_table_change(val) {
-				// console.log(val);
-				this.update_ids = []
+			handle_table_change(selection) {
+				// console.log(selection);
+				// 保存要删除和更新的ids
 				this.del_ids = []
-				val.forEach(row => {
-					this.update_ids.push(row.id)
+				this.update_ids = []
+				selection.forEach(row => {
 					this.del_ids.push(row.id)
+					this.update_ids.push(row.id)
 				});
 			},
 			// 删除文章
@@ -575,7 +577,7 @@
 			}
 		}
 
-		.dialog-qingzhang-body {
+		.dialog-have-no-title-body {
 			display: flex;
 			flex-direction: column;
 			justify-content: center;
@@ -586,7 +588,7 @@
 				width: 72px;
 			}
 
-			.dialog-qingzhang-body-txt {
+			.dialog-have-no-title-body-txt {
 				height: 38px;
 				line-height: 38px;
 				text-align: center;
@@ -596,6 +598,13 @@
 				margin-top: 20px;
 			}
 		}
+
+		.show-article {
+			height: 500px;
+			overflow: auto;
+			border: 1px solid #e3e3e3;
+			padding: 10px 10px 10px 30px;
+		}
 	}
 </style>
 
@@ -625,17 +634,28 @@
 		margin-top: -10px !important;
 	}
 
-	.dialog-qingzhang {
+	.dialog-have-no-title {
 		height: 300px !important;
 		width: 500px !important;
 		margin-top: 330px !important;
 		border-radius: 8px !important;
 	}
 
-	.dialog-qingzhang .el-dialog__header {
+	.dialog-have-no-title .el-dialog__header {
 		display: none !important;
 	}
 
+	.dialog-have-title .el-dialog__header {
+		display: flex;
+		align-items: center;
+		width: 100%;
+		height: 58px;
+		padding: 30px;
+		border-radius: 6px 6px 0px 0px;
+		font-weight: bold;
+		border-bottom: 1px solid rgba(230, 230, 230, 1);
+	}
+
 	.add-user-cancel-btn {
 		color: rgba(9, 101, 98, 1) !important;
 		border: 1px solid rgba(9, 101, 98, 1) !important;