refactor: 统一API请求路径并优化请求逻辑
将多个页面中的API请求路径统一为相对路径,并在`utils/login.js`中自动补全为完整URL。优化了请求方法,默认为POST,同时支持GET请求。简化了代码结构,提高了代码的可维护性和一致性。
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user