From d85836bf6b1574122830f6db8770e98184edd51c Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期六, 20 九月 2025 09:49:01 +0800
Subject: [PATCH] 巡检上传页面
---
src/utils/common.ts | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/src/utils/common.ts b/src/utils/common.ts
new file mode 100644
index 0000000..25d4147
--- /dev/null
+++ b/src/utils/common.ts
@@ -0,0 +1,54 @@
+/**
+* 鏄剧ず娑堟伅鎻愮ず妗�
+* @param content 鎻愮ず鐨勬爣棰�
+*/
+export function toast(content:string) {
+ uni.showToast({
+ icon: 'none',
+ title: content
+ })
+}
+
+/**
+* 鏄剧ず妯℃�佸脊绐�
+* @param content 鎻愮ず鐨勬爣棰�
+*/
+export function showConfirm(content:string):Promise<any> {
+ return new Promise((resolve, reject) => {
+ uni.showModal({
+ title: '鎻愮ず',
+ content: content,
+ cancelText: '鍙栨秷',
+ confirmText: '纭畾',
+ success: function(res) {
+ resolve(res)
+ }
+ })
+ })
+}
+
+/**
+* 鍙傛暟澶勭悊
+* @param params 鍙傛暟
+*/
+export function tansParams(params:any) {
+ let result = ''
+ for (const propName of Object.keys(params)) {
+ const value = params[propName]
+ var part = encodeURIComponent(propName) + "="
+ if (value !== null && value !== "" && typeof (value) !== "undefined") {
+ if (typeof value === 'object') {
+ for (const key of Object.keys(value)) {
+ if (value[key] !== null && value[key] !== "" && typeof (value[key]) !== 'undefined') {
+ let params = propName + '[' + key + ']'
+ var subPart = encodeURIComponent(params) + "="
+ result += subPart + encodeURIComponent(value[key]) + "&"
+ }
+ }
+ } else {
+ result += part + encodeURIComponent(value) + "&"
+ }
+ }
+ }
+ return result
+}
\ No newline at end of file
--
Gitblit v1.9.3