refactor: 统一API请求路径并优化请求逻辑

将多个页面中的API请求路径统一为相对路径,并在`utils/login.js`中自动补全为完整URL。优化了请求方法,默认为POST,同时支持GET请求。简化了代码结构,提高了代码的可维护性和一致性。
This commit is contained in:
2025-04-10 19:01:02 +08:00
parent 764df18ad0
commit 1af84dc1ee
11 changed files with 235 additions and 247 deletions

View File

@@ -44,7 +44,7 @@ Page({
loading: !0
}), wx.showLoading({
title: ""
}), e.request(t.globalData.config.recharge.init, {
}), e.request('/miniprogram/recharge', {
page: this.data.page.next_page
}, !0).then(function (t) {
if (wx.hideLoading(), a.setData({
@@ -68,7 +68,7 @@ Page({
var i = a.currentTarget.dataset.id;
wx.showLoading({
title: ""
}), e.request(t.globalData.config.recharge.create, {
}), e.request('/miniprogram/recharge/create', {
id: i
}, !0).then(function (t) {
if (wx.hideLoading(), 200 != t.code) return wx.showModal({
@@ -125,7 +125,7 @@ Page({
title: ""
});
var i = this;
e.request(t.globalData.config.recharge.create, {
e.request('/miniprogram/recharge/create', {
id: i.data.selectItemID
}, !0).then(function (t) {
if (wx.hideLoading(), i.isSubmit = !1, 200 != t.code) return wx.showModal({