Bladeren bron

表单加密

HD_wangm 1 week geleden
bovenliggende
commit
5b4ce0bfa4
2 gewijzigde bestanden met toevoegingen van 97 en 20 verwijderingen
  1. 82 5
      pages/process/detail/index.vue
  2. 15 15
      pages/work/index.vue

+ 82 - 5
pages/process/detail/index.vue

@@ -113,6 +113,11 @@
 									<img style="width: 100%;" mode="widthFix"
 										:src="config.baseUrlPre + elem.defaultValue" />
 								</view>
+								<!-- type=25 时显示加密内容和复制按钮 -->
+								<view v-else-if="elem.type == '25'" class="encrypted_content_container">
+									<text class="element_value encrypted_text">{{ maskContent(elem.defaultValue) }}</text>
+									<button class="copy_button" @click="copyEncryptedContent(elem.defaultValue)" size="mini" type="primary">复制</button>
+								</view>
 								<text class="element_value" v-else>{{ Array.isArray(elem.defaultValue) ? elem.defaultValue.join(',') : elem.defaultValue }}</text>
 							</view>
 						</uni-forms-item>
@@ -242,7 +247,7 @@
 								</template>
 							</up-steps-item>
 							<up-steps-item v-else :title="step.title" :desc="step.desc" :key="index"></up-steps-item>
-							
+
 						</view>
 					</up-steps>
 				</view>
@@ -479,7 +484,7 @@
 	function initProcessForm() {
 		//debugger
 		if (processInfo.tinsId) {
-			// 待办审批流程表单数据todo 
+			// 待办审批流程表单数据todo
 			getProcessFormInfoInFlow(userStore.user.useId, processInfo).then(({ returnParams }) => {
 				console.log('returnParams', returnParams);
 
@@ -587,7 +592,7 @@
 	}
 	//单选框切换事件
 	function changeDataSingleCheckBox(){
-		
+
 	}
 
 	const timeRangeItems = ref([
@@ -794,6 +799,53 @@
 	function setTimeRange(e) {
 		// console.log('setTimeRange', e)
 	}
+	/**
+	 * 加密内容显示 - 将内容用 * 号替换
+	 * @param content 原始内容
+	 * @returns 加密后的字符串
+	 */
+	function maskContent(content) {
+		if (!content) return '';
+		const str = String(content);
+		if (str.length === 0) return '';
+		// 全部用 * 替换
+		return '*'.repeat(str.length);
+	}
+	/**
+	 * 复制加密内容到剪贴板
+	 * @param content 要复制的原始内容
+	 */
+	function copyEncryptedContent(content) {
+		if (!content) {
+			$modal.msg('没有可复制的内容');
+			return;
+		}
+		// #ifdef H5
+		const input = document.createElement('input');
+		input.value = String(content);
+		document.body.appendChild(input);
+		input.select();
+		try {
+			document.execCommand('copy');
+			$modal.msgSuccess('复制成功');
+		} catch (err) {
+			$modal.msgError('复制失败');
+		} finally {
+			document.body.removeChild(input);
+		}
+		// #endif
+		// #ifdef APP-PLUS || MP-WEIXIN
+		uni.setClipboardData({
+			data: String(content),
+			success: () => {
+				$modal.msgSuccess('复制成功');
+			},
+			fail: () => {
+				$modal.msgError('复制失败');
+			}
+		});
+		// #endif
+	}
 	// 生成人民币大写
 	function computedNumberToChineseCurrency(item, form) {
 		const elem = form.find(elem => !elem.elementName.endsWith('大写') && (elem.BddzText == item.BddzText || elem.elementName == item.BddzText.slice(3)))
@@ -1405,7 +1457,7 @@
 		// 		font-size: calc(1rem + 0px) !important;
 		// 		line-height: calc(1rem + 0px) !important;
 		// 		font-weight: 700;
-		// 	}		
+		// 	}
 		// 	.uni-forms-item__content {
 		// 		font-size: calc(14px + (1rem - 16px)) !important;
 		// 		font-weight: 500;
@@ -1616,4 +1668,29 @@
 	.username {
 		color: #2979ff;
 	}
-</style>
+
+	/* 加密内容容器样式 */
+	.encrypted_content_container {
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+		gap: 10px;
+	}
+
+	/* 加密文本样式 */
+	.encrypted_text {
+		flex: 1;
+		letter-spacing: 2px;
+		font-weight: 500;
+	}
+
+	/* 复制按钮样式 */
+	.copy_button {
+		padding: 0 15px;
+		height: 32px;
+		line-height: 32px;
+		font-size: 12px;
+		border-radius: 4px;
+		flex-shrink: 0;
+	}
+</style>

+ 15 - 15
pages/work/index.vue

@@ -137,7 +137,7 @@ const uni_grid_column = ref(4)
 
 const diaryShow = ref(false)
 if(config.companyCode && config.companyCode == 'yg'){
-	diaryShow.value = true;
+	diaryShow.value = false;
 }else{
 	diaryShow.value = false;
 }
@@ -155,18 +155,18 @@ function getUserRoom() {
 	})
 }
 // 点击房屋管家
-function changeHomesys(e) { 
+function changeHomesys(e) {
 	const roomIndex = e.detail.index
 	const roomListLength = homesysList.value.length
 	// if (roomIndex > roomListLength) {
 		switch (roomIndex) {
-			case roomListLength + 1: 
+			case roomListLength + 1:
 				$tab.navigateTo('/pages/work/homesysSetting/index')
 				break
-			case roomListLength + 2: 
+			case roomListLength + 2:
 				$tab.navigateTo('/pages/work/homesysSetting/user')
 				break
-			case roomListLength + 3: 
+			case roomListLength + 3:
 				$tab.navigateTo('/pages/work/homesysSetting/userList')
 				break
 			default:
@@ -206,7 +206,7 @@ function initProcessList() {
 	})
 }
 // 点击流程宫格
-function changeProcessGrid(item) { 
+function changeProcessGrid(item) {
 	// console.log('changeProcessGrid', e);
 	// const { modelName, modelId, control } = processList.value.fList[e.detail.index]
 	const { modelName, modelId, control } = item
@@ -244,7 +244,7 @@ function changeAttendanceGrid(e) {
 	}
 }
 // 点击日报宫格
-function changeDiaryGrid(e) { 
+function changeDiaryGrid(e) {
 	if (1 == e.detail.index) {
 		wx.navigateToMiniProgram({
 			appId: 'wxd45c635d754dbf59',
@@ -262,7 +262,7 @@ function changeDiaryGrid(e) {
 	}
 }
 // 点击工具宫格
-function changeToolsGrid(e) { 
+function changeToolsGrid(e) {
 	switch (e.detail.index) {
 		case 1:
 			openCalculatorPopup() // 打开计算器弹出层
@@ -335,20 +335,20 @@ view {
 		justify-content: center;
 		padding: 15px 0;
 	}
-	
+
 	// .uni-margin-wrap {
 	// 	width: 690rpx;
 	// 	width: 100%;
 	// }
-	
+
 	.swiper {
 		height: 300rpx;
 	}
-	
+
 	.swiper-box {
 		height: 150px;
 	}
-	
+
 	.swiper-item {
 		/* #ifndef APP-NVUE */
 		display: flex;
@@ -360,7 +360,7 @@ view {
 		height: 300rpx;
 		line-height: 300rpx;
 	}
-	
+
 	@media screen and (min-width: 500px) {
 		.uni-swiper-dot-box {
 			width: 400px;
@@ -369,11 +369,11 @@ view {
 			/* #endif */
 			margin-top: 8px;
 		}
-	
+
 		.image {
 			width: 100%;
 		}
 	}
 }
 
-</style>
+</style>