From aff7a2d3f61ca27a58cd2b4db851ba206f0da5ea Mon Sep 17 00:00:00 2001 From: kron Date: Sat, 10 May 2025 22:25:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0api=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis.js | 21 +++++++++++++++++++++ src/pages/index.vue | 19 ++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/apis.js diff --git a/src/apis.js b/src/apis.js new file mode 100644 index 0000000..a56c3b1 --- /dev/null +++ b/src/apis.js @@ -0,0 +1,21 @@ +const BASE_URL = "http://120.79.241.5:8000/api/shoot/index"; + +// 获取全局配置 +export const getAppConfig = () => { + return new Promise((resolve, reject) => { + uni.request({ + url: `${BASE_URL}/appConfig`, + method: "GET", + success: (res) => { + resolve(res.data); + }, + fail: (err) => { + reject(err); + uni.showToast({ + title: "获取配置失败", + icon: "none", + }); + }, + }); + }); +}; diff --git a/src/pages/index.vue b/src/pages/index.vue index f1ffee8..7825d7d 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -1,8 +1,9 @@