From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 28 五月 2025 16:48:52 +0800
Subject: [PATCH] 初始化项目

---
 pages/sys/logs/index.vue |  115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 115 insertions(+), 0 deletions(-)

diff --git a/pages/sys/logs/index.vue b/pages/sys/logs/index.vue
new file mode 100644
index 0000000..59a464a
--- /dev/null
+++ b/pages/sys/logs/index.vue
@@ -0,0 +1,115 @@
+<template>
+	<view class="wrap">
+		<scroll-view class="scroll-list" scroll-y="true" @scrolltolower="loadMore">
+			<u-cell-group class="list" :border="false">
+				<u-swipe-action :options="options" v-for="(item, index) in list" :key="item.id" :index="index"
+					@click="optionsClick">
+					<u-cell-item :arrow="true" @click="navTo('form?logInfo='+JSON.stringify(item))">
+						<text slot="title">{{ item.title }}</text>
+						<text slot="label">鍒涘缓鏃堕棿锛歿{ item.createTime }}</text>
+					</u-cell-item>
+				</u-swipe-action>
+			</u-cell-group>
+			<view class="loadmore" @click="loadMore">
+				<u-loadmore :status="loadStatus"></u-loadmore>
+			</view>
+		</scroll-view>
+	</view>
+</template>
+<script>
+	export default {
+		data() {
+			return {
+				query: {
+					current: 1,
+					size: 20
+				},
+				list: [],
+				count: 0,
+				loadStatus: 'loadmore',
+				options: [{
+					text: '鍒犻櫎',
+					style: {
+						background: '#dd524d'
+					}
+				}]
+			};
+		},
+		onLoad() {
+			this.loadList();
+		},
+		onShow() {
+			if (uni.getStorageSync('refreshList') === true) {
+				uni.removeStorageSync('refreshList');
+				this.search('');
+			}
+		},
+		methods: {
+			loadMore() {
+				this.loadStatus = "loading";
+				setTimeout(() => {
+					this.query.current += 1;
+					this.loadList();
+				}, 100);
+			},
+			loadList() {
+				this.$u.api.pigxLog.page(this.query).then(res => {
+					if (!res.data.records || res.data.records.length == 0) {
+						this.loadStatus = "nomore";
+						return;
+					}
+					this.list = this.list.concat(res.data.records);
+					this.total = res.data.total;
+					this.query.current = res.data.current;
+					this.query.size = res.data.size;
+					this.loadStatus = "loadmore";
+				});
+			},
+			optionsClick(rowIndex, btnIndex) {
+				if (btnIndex == 0) {
+					let self = this;
+					uni.showModal({
+						title: '鎻愮ず',
+						content: '纭瑕佸垹闄よ鏁版嵁鍚楋紵',
+						showCancel: true,
+						success: function(res2) {
+							if (res2.confirm) {
+								let row = self.list[rowIndex];
+								self.$u.api.pigxLog.delete({
+									id: row.id
+								}).then(res => {
+									self.$u.toast('鍒犻櫎鎴愬姛');
+									self.query.current = 1
+									self.list = []
+									self.loadList()
+								});
+							}
+						}
+					});
+				}
+			},
+			navTo(url) {
+				uni.navigateTo({
+					url: '/pages/sys/logs/' + url
+				});
+			}
+		}
+	};
+</script>
+<style lang="scss">
+	page {
+		background-color: #f8f8f8;
+	}
+
+	.btn-plus {
+		position: absolute;
+		bottom: 50rpx;
+		right: 50rpx;
+		z-index: 1;
+		opacity: 0.6;
+	}
+
+	.btn-plus:hover {
+		opacity: 1;
+	}
+</style>

--
Gitblit v1.9.3