From f24c3eb46b67ec958640701fb85279ae33f6ff3e Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期三, 06 八月 2025 11:17:39 +0800
Subject: [PATCH] 添加 设置页面显示哪些页签 功能

---
 pages/index/index.vue |  300 +++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 188 insertions(+), 112 deletions(-)

diff --git a/pages/index/index.vue b/pages/index/index.vue
index 915434d..1653898 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -1,15 +1,27 @@
 <template>
 	<view class="content">
-		<view class="header">鏅轰簯L-MES鍒堕�犳墽琛岀郴缁�</view>
+		<view class="header">鏅轰簯L-MES鍒堕�犳墽琛岀郴缁�
+			<view class="switch-button">
+				<uni-icons type="loop" @click="switchIconsModeHandler"></uni-icons>
+			</view>
+		</view>
 		<view class="mains">
-			<view class="box" v-for="(item,index) in itemData" :key="index" @tap="toUrl(item)">
+			<view v-if="!canEdit" :hidden="item.hidden" class="box" v-for="(item,index) in itemData" :key="index" @tap="toUrl(item)">		
+					<image :src="item.img" mode=""></image>
+					<view class="texts">
+						{{item.text}}
+					</view>
+			</view>
+			<view :enable-hidden="item.hidden" v-if="canEdit" class="box edit" v-for="(item,index) in itemData"
+				:key="index" @tap="switchHidden(index)">
+				<uni-icons class="edit-mark" color="red" type="closeempty"></uni-icons>
 				<image :src="item.img" mode=""></image>
 				<view class="texts">
 					{{item.text}}
 				</view>
 			</view>
 		</view>
-		
+
 		<vers></vers>
 	</view>
 </template>
@@ -18,117 +30,139 @@
 	import vers from './vers.vue';
 	export default {
 		components: {
-			vers
+			vers,
 		},
 		data() {
 			return {
+				canEdit: false,
 				serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
 				itemData: [{
-						img: '../../static/icon/icon8.png',
-						text: '閲囪喘璁㈠崟鏍囩',
-						url: '/pages/caigoudingdan/caigoudingdan',
-						id: 1
-					},{
-						img: '../../static/icon/icon4.png',
-						text: '閲囪喘璁㈠崟瀛愭爣绛�',
-						url: '/pages/tiaomadaying/tiaomadaying',
-						id: 2,
-					},{
-						img: '../../static/icon/icon11.png',
-						text: '鏀舵枡閫氱煡鍗曟爣绛�',
-						url: '/pages/shouliaotongzhi/table',
-						id: 3,
-					},{
-						img: '../../static/icon/icon17.png',
-						text: '閲囪喘鍏ュ簱鏂板',
-						url: '/pages/caigouruku/form?OperationType=1',
-						id: 4,
-					},{
-						img: '../../static/icon/icon20.png',
-						text: '閲囪喘閫�鏂欐柊澧�',
-						url: '/pages/caigoutuiliao/form?OperationType=1',
-						id: 5,
-					},{
-						img: '../../static/icon/icon32.png',
-						text: '鐩存帴璋冩嫧鏂板',
-						url: '/pages/zhijiediaobo/form?OperationType=1',
-						id: 6,
-					},{
-						img: '../../static/icon/icon30.png',
-						text: '鐢熶骇棰嗘枡鏂板',
-						url: '/pages/shengchanlingliaoshengdan/form?OperationType=1',
-						id: 7,
-					},{
-						img: '../../static/icon/icon31.png',
-						text: '鐢熶骇琛ユ枡鏂板',
-						url: '/pages/shengchanbuliao/form?OperationType=1',
-						id: 8,
-					},{
-						img: '../../static/icon/icon17.png',
-						text: '鐢熶骇鍏ュ簱鏂板',
-						url: '/pages/shengchanrukushengdan/form?OperationType=1',
-						id: 9,
-					},{
-						img: '../../static/icon/icon30.png',
-						text: '濮斿棰嗘枡鏂板',
-						url: '/pages/weiwailingliao/form?OperationType=1',
-						id: 10,
-					},{
-						img: '../../static/icon/icon17.png',
-						text: '鍏朵粬鍏ュ簱鏂板',
-						url: '/pages/qitaruku_v2/form?OperationType=1',
-						id: 11,
-					},{
-						img: '../../static/icon/icon18.png',
-						text: '鍏朵粬鍑哄簱鏂板',
-						url: '/pages/qitachuku_v2/form?OperationType=1',
-						id: 12,
-					},{
-						img: '../../static/icon/icon18.png',
-						text: '閿�鍞嚭搴撴柊澧�',
-						url: '/pages/xiaoshouchuku/form?OperationType=1',
-						id: 13,
-					},{
-						img: '../../static/icon/icon19.png',
-						text: '閿�鍞��璐ф柊澧�',
-						url: '/pages/xiaoshoutuihuo/form?OperationType=1',
-						id: 14,
-					},{
-						img: '../../static/icon/icon30.png',
-						text: '鐢熶骇棰嗘枡妫�楠�',
-						url: '/pages/shengchanlingliao/form?OperationType=1',
-						id: 15,
-					},{
-						img: '../../static/icon/icon31.png',
-						text: '鐢熶骇琛ユ枡鏍¢獙',
-						url: '/pages/shengchanbuliaojiaoyan/form?OperationType=1',
-						id: 16,
-					},{
-						img: '../../static/icon/icon32.png',
-						text: '鐢熶骇璋冩嫧鏍¢獙',
-						url: '/pages/shengchandiaobo/form?OperationType=1',
-						id: 17,
-					},{
-						img: '../../static/icon/icon18.png',
-						text: '鍏朵粬鍑哄簱鏍¢獙',
-						url: '/pages/qitachukujiaoyan/detail?OperationType=1',
-						id: 18,
-					},{
-						img: '../../static/icon/icon17.png',
-						text: '鐢熶骇鍏ュ簱鏍¢獙',
-						url: '/pages/shengchanruku/form?OperationType=1',
-						id: 19,
-					},{
-						img: '../../static/icon/icon18.png',
-						text: '閿�鍞嚭搴撴牎楠�',
-						url: '/pages/xiaoshouchukujiaoyan/form?OperationType=1',
-						id: 20,
-					},{
-						img: '../../static/icon/icon30.png',
-						text: '濮斿棰嗘枡鏍¢獙',
-						url: '/pages/weiwailingliaojiaoyan/form?OperationType=1',
-						id: 21,
-					}],
+					img: '../../static/icon/icon8.png',
+					text: '閲囪喘璁㈠崟鏍囩',
+					url: '/pages/caigoudingdan/caigoudingdan',
+					id: 1,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon4.png',
+					text: '閲囪喘璁㈠崟瀛愭爣绛�',
+					url: '/pages/tiaomadaying/tiaomadaying',
+					id: 2,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon11.png',
+					text: '鏀舵枡閫氱煡鍗曟爣绛�',
+					url: '/pages/shouliaotongzhi/table',
+					id: 3,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon17.png',
+					text: '閲囪喘鍏ュ簱鏂板',
+					url: '/pages/caigouruku/form?OperationType=1',
+					id: 4,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon20.png',
+					text: '閲囪喘閫�鏂欐柊澧�',
+					url: '/pages/caigoutuiliao/form?OperationType=1',
+					id: 5,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon32.png',
+					text: '鐩存帴璋冩嫧鏂板',
+					url: '/pages/zhijiediaobo/form?OperationType=1',
+					id: 6,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon30.png',
+					text: '鐢熶骇棰嗘枡鏂板',
+					url: '/pages/shengchanlingliaoshengdan/form?OperationType=1',
+					id: 7,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon31.png',
+					text: '鐢熶骇琛ユ枡鏂板',
+					url: '/pages/shengchanbuliao/form?OperationType=1',
+					id: 8,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon17.png',
+					text: '鐢熶骇鍏ュ簱鏂板',
+					url: '/pages/shengchanrukushengdan/form?OperationType=1',
+					id: 9,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon30.png',
+					text: '濮斿棰嗘枡鏂板',
+					url: '/pages/weiwailingliao/form?OperationType=1',
+					id: 10,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon17.png',
+					text: '鍏朵粬鍏ュ簱鏂板',
+					url: '/pages/qitaruku_v2/form?OperationType=1',
+					id: 11,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon18.png',
+					text: '鍏朵粬鍑哄簱鏂板',
+					url: '/pages/qitachuku_v2/form?OperationType=1',
+					id: 12,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon18.png',
+					text: '閿�鍞嚭搴撴柊澧�',
+					url: '/pages/xiaoshouchuku/form?OperationType=1',
+					id: 13,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon19.png',
+					text: '閿�鍞��璐ф柊澧�',
+					url: '/pages/xiaoshoutuihuo/form?OperationType=1',
+					id: 14,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon30.png',
+					text: '鐢熶骇棰嗘枡妫�楠�',
+					url: '/pages/shengchanlingliao/form?OperationType=1',
+					id: 15,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon31.png',
+					text: '鐢熶骇琛ユ枡鏍¢獙',
+					url: '/pages/shengchanbuliaojiaoyan/form?OperationType=1',
+					id: 16,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon32.png',
+					text: '鐢熶骇璋冩嫧鏍¢獙',
+					url: '/pages/shengchandiaobo/form?OperationType=1',
+					id: 17,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon18.png',
+					text: '鍏朵粬鍑哄簱鏍¢獙',
+					url: '/pages/qitachukujiaoyan/detail?OperationType=1',
+					id: 18,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon17.png',
+					text: '鐢熶骇鍏ュ簱鏍¢獙',
+					url: '/pages/shengchanruku/form?OperationType=1',
+					id: 19,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon18.png',
+					text: '閿�鍞嚭搴撴牎楠�',
+					url: '/pages/xiaoshouchukujiaoyan/form?OperationType=1',
+					id: 20,
+					hidden: false,
+				}, {
+					img: '../../static/icon/icon30.png',
+					text: '濮斿棰嗘枡鏍¢獙',
+					url: '/pages/weiwailingliaojiaoyan/form?OperationType=1',
+					id: 21,
+					hidden: false,
+				}],
 				// itemData: [{
 				// 		img: '../../static/icon/icon1.png',
 				// 		text: '璁惧妗f',
@@ -361,9 +395,27 @@
 			}
 		},
 		onLoad() {
-
+			this.getHiddenItem()
 		},
 		methods: {
+			getHiddenItem() {
+				let itemCache = uni.getStorageSync('HIndexItemData') || ''
+				console.log('itemCache: ',itemCache);
+				if(itemCache !== '') {
+					this.itemData = itemCache
+				}
+			},
+			async switchHidden(index) {
+				console.log(this.itemData[index].hidden)
+				this.itemData[index].hidden = !this.itemData[index].hidden
+				await this.$nextTick(() => {
+					uni.setStorageSync("HIndexItemData", this.itemData)
+				})
+			},
+			switchIconsModeHandler() {
+				this.canEdit = !this.canEdit
+				this.$forceUpdate()
+			},
 			toUrl(item) {
 				if (item.url) {
 					uni.navigateTo({
@@ -371,8 +423,8 @@
 					})
 				} else {
 					uni.showToast({
-						title:'鍔熻兘寮�鍙戜腑銆傘�傘��',
-						icon:'none'
+						title: '鍔熻兘寮�鍙戜腑銆傘�傘��',
+						icon: 'none'
 					})
 				}
 			}
@@ -389,6 +441,13 @@
 		color: #FFFFFF;
 		text-align: center;
 		padding: 9vh 0 6vh 0;
+		position: relative;
+	}
+
+	.switch-button {
+		position: absolute;
+		right: 0;
+		bottom: 0;
 	}
 
 	.mains {
@@ -418,5 +477,22 @@
 				margin-top: .2vh;
 			}
 		}
+		
+		.edit {
+			position: relative;
+		}
+		
+		.edit-mark {
+			position: absolute;
+			top: 0;
+			right: 0;
+		}
+
+		view[enable-hidden] {
+			opacity: .4 !important;
+		}
+		view[hidden] {
+			display: none;
+		}
 	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.1