From a0914e543c5415c32574dd4151f8a2f09dd91185 Mon Sep 17 00:00:00 2001 From: lipengcheng <3066788796@qq.com> Date: Fri, 11 Jul 2025 21:48:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/api.js | 8 + common/http.js | 26 + pages/tabBar/xjPage/xj.vue | 16 +- .../.sourcemap/mp-weixin/common/vendor.js.map | 2 +- unpackage/dist/dev/mp-weixin/common/vendor.js | 2874 ++++++++++------- 5 files changed, 1837 insertions(+), 1089 deletions(-) create mode 100644 common/api.js create mode 100644 common/http.js diff --git a/common/api.js b/common/api.js new file mode 100644 index 0000000..70f645c --- /dev/null +++ b/common/api.js @@ -0,0 +1,8 @@ +import { request } from './http.js'; +export const listHouseWithCount = (data) => { + return request({ + url: '/system/dict/data/list', + method: 'GET', + data, + }); +}; \ No newline at end of file diff --git a/common/http.js b/common/http.js new file mode 100644 index 0000000..87822b4 --- /dev/null +++ b/common/http.js @@ -0,0 +1,26 @@ +const baseUrl = 'http://219.146.91.110:30801/mz-api'; +export const request = (options) => { + return new Promise((resolve, reject) => { + uni.request({ + url: baseUrl + options.url, // 拼接完整接口地址 + method: options.method , // 默认 GET 请求 + data: options.data || {}, // 请求参数 + header: { + 'Content-Type': 'application/json', + Authorization: uni.getStorageSync('token') || '', // 携带 Token + }, + success: (res) => { + if (res.statusCode === 200) { + resolve(res.data); // 请求成功返回数据 + } else { + uni.showToast({ title: res.data.message || '请求失败', icon: 'none' }); + reject(res); + } + }, + fail: (err) => { + uni.showToast({ title: '网络异常', icon: 'none' }); + reject(err); + }, + }); + }); +}; \ No newline at end of file diff --git a/pages/tabBar/xjPage/xj.vue b/pages/tabBar/xjPage/xj.vue index a9334f9..a88bae8 100644 --- a/pages/tabBar/xjPage/xj.vue +++ b/pages/tabBar/xjPage/xj.vue @@ -52,6 +52,7 @@