From 678d35042a503dd0c244fdf5bcad3b061ba71771 Mon Sep 17 00:00:00 2001 From: XiaoMo Date: Tue, 24 Jun 2025 17:46:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0API=E7=AB=AF=E7=82=B9?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E8=87=B3v2=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将/miniprogram/user/onlineCarHailing和/miniprogram/user等API端点路径更新为/v2/miniprogram/user/onlineCarHailing和/v2/miniprogram/user,以适配后端API的v2版本 --- pages/OnlineCarHailing/OnlineCarHailing.js | 2 +- pages/duiquan/duiquan.js | 8 ++--- pages/login/login.js | 2 +- pages/refund/refund.js | 6 ++-- pages/substituteWash/substituteWash.js | 4 +-- pages/user/user.js | 42 +++++++++++----------- pages/washCodeDetail/washCodeDetail.js | 4 +-- pages/washCodeList/washCodeList.js | 6 ++-- pages/washing/washing.js | 4 +-- 9 files changed, 39 insertions(+), 39 deletions(-) diff --git a/pages/OnlineCarHailing/OnlineCarHailing.js b/pages/OnlineCarHailing/OnlineCarHailing.js index 4ecc828..17c1e61 100644 --- a/pages/OnlineCarHailing/OnlineCarHailing.js +++ b/pages/OnlineCarHailing/OnlineCarHailing.js @@ -38,7 +38,7 @@ Page({ title: '提交中...' }) - t.request('/miniprogram/user/onlineCarHailing', { mobile }, !0).then((res) => { + t.request('/v2/miniprogram/user/onlineCarHailing', { mobile }, !0).then((res) => { wx.hideLoading() if (res.code == 200) { wx.showToast({ diff --git a/pages/duiquan/duiquan.js b/pages/duiquan/duiquan.js index 8ce47d9..c30c18c 100644 --- a/pages/duiquan/duiquan.js +++ b/pages/duiquan/duiquan.js @@ -7,7 +7,7 @@ Page({ code: '' }, onLoad() { - t.request('/miniprogram/coupons', {}, !0).then((res) => { + t.request('/v2/miniprogram/coupons', {}, !0).then((res) => { if (res.code == 200) { this.setData({ tips: res.data.tips, @@ -23,7 +23,7 @@ Page({ success: function (i) { console.log(i), wx.showLoading({ title: "" - }), e.globalData.qrcode = i.result, t.request("/miniprogram/identify", i, !0).then(function (t) { + }), e.globalData.qrcode = i.result, t.request("/v2/miniprogram/identify", i, !0).then(function (t) { console.log("data", t), wx.hideLoading(); // 保存设备编号 getApp().globalData.devicecode = t.data.devicecode || getApp().globalData.devicecode; @@ -38,7 +38,7 @@ Page({ startup: function () { if (getApp().globalData.devicecode) { // 已扫码,启动机器 - t.request('/miniprogram/machine/carwashcodestartup', { devicecode: getApp().globalData.devicecode, washcode: this.data.code }, !0).then((startRes) => { + t.request('/v2/miniprogram/machine/carwashcodestartup', { devicecode: getApp().globalData.devicecode, washcode: this.data.code }, !0).then((startRes) => { if (startRes.code == 200) { wx.showToast({ title: startRes.message || '启动成功', icon: 'success' }); // 跳转到洗车券列表页面 @@ -73,7 +73,7 @@ Page({ wx.showLoading({ title: '兑换中...' }) - t.request('/miniprogram/coupons/importDouyin', { code: code }, !0).then((res) => { + t.request('/v2/miniprogram/coupons/importDouyin', { code: code }, !0).then((res) => { wx.hideLoading() if (res.code == 200) { diff --git a/pages/login/login.js b/pages/login/login.js index 227d19e..d04f7d5 100644 --- a/pages/login/login.js +++ b/pages/login/login.js @@ -28,7 +28,7 @@ Page({ var n = Object.assign(this.userInfo, t, { code: a }); - o.request('/miniprogram/index/authorization', n, !0).then(function(o) { + o.request('/v2/miniprogram/index/authorization', n, !0).then(function(o) { if (wx.hideLoading(), console.log("toAuthorization", "app.globalData.needJumpUrl", e.globalData.needJumpUrl, o), 200 != o.code) return wx.showModal({ title: "提示", diff --git a/pages/refund/refund.js b/pages/refund/refund.js index afd04f3..899d4a0 100644 --- a/pages/refund/refund.js +++ b/pages/refund/refund.js @@ -36,7 +36,7 @@ Page({ title: '查询中...' }) - t.request('/miniprogram/Refund/query', { mobile }, !0).then((res) => { + t.request('/v2/miniprogram/Refund/query', { mobile }, !0).then((res) => { wx.hideLoading() if (res.code == 200) { this.setData({ @@ -70,7 +70,7 @@ Page({ }) return } - t.request('/miniprogram/pay/refund', {token: this.data.userInfo.token}, !0).then((res) => { + t.request('/v2/miniprogram/pay/refund', {token: this.data.userInfo.token}, !0).then((res) => { wx.hideLoading() if (res.code == 200) { wx.showToast({ @@ -117,7 +117,7 @@ Page({ }) return } - t.request('/miniprogram/pay/refundOffline', {token: this.data.userInfo.token}, !0).then((res) => { + t.request('/v2/miniprogram/pay/refundOffline', {token: this.data.userInfo.token}, !0).then((res) => { wx.hideLoading() if (res.code == 200) { wx.showToast({ diff --git a/pages/substituteWash/substituteWash.js b/pages/substituteWash/substituteWash.js index 33c944a..b727fd6 100644 --- a/pages/substituteWash/substituteWash.js +++ b/pages/substituteWash/substituteWash.js @@ -34,7 +34,7 @@ Page({ loading: true }); - e.request('/miniprogram/substituteWash/index', {}, true).then(function (res) { + e.request('/v2/miniprogram/substituteWash/index', {}, true).then(function (res) { a.setData({ loading: false }); @@ -93,7 +93,7 @@ Page({ mask: true }); - e.request('/miniprogram/substituteWash/pay', {token: a.data.token}, true).then(function (res) { + e.request('/v2/miniprogram/substituteWash/pay', {token: a.data.token}, true).then(function (res) { wx.hideLoading(); if (res.code === 200) { diff --git a/pages/user/user.js b/pages/user/user.js index 6ff2944..19302c0 100644 --- a/pages/user/user.js +++ b/pages/user/user.js @@ -6,22 +6,22 @@ Page({ urlList: [], user: {} }, - onLoad: function(n) { + onLoad: function (n) { var o = this; - e.pageStart(t).then(function(t) { + e.pageStart(t).then(function (t) { o.getContent(); }); }, - onShow: function() { + onShow: function () { this.refresh && this.getContent(); }, - onPullDownRefresh: function() {}, - onShareAppMessage: function() {}, - getContent: function() { + onPullDownRefresh: function () { }, + onShareAppMessage: function () { }, + getContent: function () { var n = this; wx.showLoading({ title: "" - }), e.request('/miniprogram/user', {}, !0).then(function(t) { + }), e.request('/v2/miniprogram/user', {}, !0).then(function (t) { if (wx.hideLoading(), 200 != t.code) return wx.showModal({ title: "提示", content: t.message @@ -30,18 +30,18 @@ Page({ showLoding: !1, user: t.data.user, urlList: t.data.menu - }, function() {}); - }).catch(function(t) { + }, function () { }); + }).catch(function (t) { wx.hideLoading(); }); }, - islogin: function() { + islogin: function () { wx.showLoading({ title: "加载中" }); }, refresh: 0, - toPage: function(t) { + toPage: function (t) { var e = t.currentTarget.dataset, n = (e.refresh, e.url); n ? wx.navigateTo({ url: "/pages/".concat(n) @@ -51,29 +51,29 @@ Page({ duration: 2e3 }), this.refresh = 1; }, - callUs: function() { + callUs: function () { if (!t.globalData.servicetel) return !1; wx.makePhoneCall({ phoneNumber: "" + t.globalData.servicetel }); }, - updateUserAvatar: function() { + updateUserAvatar: function () { var that = this; wx.chooseMedia({ count: 1, mediaType: ['image'], sourceType: ['album', 'camera'], - success: function(res) { + success: function (res) { wx.uploadFile({ url: 'https://t-jm.v0750.com/miniprogram/upload', filePath: res.tempFiles[0].tempFilePath, name: 'file', - success: function(uploadRes) { + success: function (uploadRes) { var data = JSON.parse(uploadRes.data); if (data.code == 200) { - e.request('/miniprogram/user/update', { + e.request('/v2/miniprogram/user/update', { avatar: data.data.url - }, true).then(function(res) { + }, true).then(function (res) { if (res.code == 200) { that.getContent(); wx.showToast({ @@ -93,18 +93,18 @@ Page({ } }); }, - updateUserNickname: function() { + updateUserNickname: function () { var that = this; wx.showModal({ title: '修改昵称', editable: true, placeholderText: '请输入新昵称', - success: function(res) { + success: function (res) { if (res.confirm && res.content) { // 发送请求到后端,更新用户昵称 - e.request('/miniprogram/user/update', { + e.request('/v2/miniprogram/user/update', { nickname: res.content - }, true).then(function(res) { + }, true).then(function (res) { if (res.code == 200) { that.getContent(); wx.showToast({ diff --git a/pages/washCodeDetail/washCodeDetail.js b/pages/washCodeDetail/washCodeDetail.js index 86d1b44..fb22a6d 100644 --- a/pages/washCodeDetail/washCodeDetail.js +++ b/pages/washCodeDetail/washCodeDetail.js @@ -20,7 +20,7 @@ Page({ var o = this; wx.showLoading({ title: "" - }), i.request('/miniprogram/coupons/details', { + }), i.request('/v2/miniprogram/coupons/details', { id: this.data.id }, !0).then(function (e) { if (wx.hideLoading(), 200 != e.code) return wx.showModal({ @@ -40,7 +40,7 @@ Page({ received: function () { if (this.isSubmit) return !1; var t = this; - this.isSubmit = !0, wx.showLoading(), console.log("received"), i.request('/miniprogram/coupons/receive', { + this.isSubmit = !0, wx.showLoading(), console.log("received"), i.request('/v2/miniprogram/coupons/receive', { id: t.data.id, token: t.data.info.token }, !0).then(function (e) { diff --git a/pages/washCodeList/washCodeList.js b/pages/washCodeList/washCodeList.js index 6ba1312..3547df4 100644 --- a/pages/washCodeList/washCodeList.js +++ b/pages/washCodeList/washCodeList.js @@ -59,7 +59,7 @@ Page({ if (this.isloading) return !1; wx.showLoading(), this.setData({ loading: !0 - }), this.isloading = !0, e.request('/miniprogram/coupons/lists', { devicecode: t.globalData.devicecode }, !0).then(function (t) { + }), this.isloading = !0, e.request('/v2/miniprogram/coupons/lists', { devicecode: t.globalData.devicecode }, !0).then(function (t) { if (o.isloading = !1, o.setData({ loading: !1 }), wx.hideLoading(), 200 != t.code) return wx.showModal({ @@ -86,7 +86,7 @@ Page({ success: function (i) { wx.showLoading({ title: "" - }), t.globalData.qrcode = i.result, e.request("/miniprogram/identify", i, !0).then(function (e) { + }), t.globalData.qrcode = i.result, e.request("/v2/miniprogram/identify", i, !0).then(function (e) { if (wx.hideLoading(), 200 != e.code) return wx.showModal({ title: "提示", content: e.message @@ -121,7 +121,7 @@ Page({ success: function (i) { i.confirm && (a.isSubmit = !0, wx.showLoading({ title: "正在启动" - }), e.request('/miniprogram/machine/carwashcodestartup', { + }), e.request('/v2/miniprogram/machine/carwashcodestartup', { washcode: a.data.selectID }, !0).then(function (t) { // 成功后返回提示 diff --git a/pages/washing/washing.js b/pages/washing/washing.js index 1ad7a06..cfade02 100644 --- a/pages/washing/washing.js +++ b/pages/washing/washing.js @@ -18,7 +18,7 @@ Page({ */ onLoad(options) { var a = this; - e.request('/miniprogram/index/balance', {}, !0).then(function (res) { + e.request('/v2/miniprogram/index/balance', {}, !0).then(function (res) { if (!res.data || !res.data.progressorder) { wx.showToast({ title: '没有进行中的订单', @@ -116,7 +116,7 @@ Page({ content: '确定要结算此次洗车订单吗?', success: (res) => { if (res.confirm) { - e.request('/miniprogram/machine/shutdown', { + e.request('/v2/miniprogram/machine/shutdown', { orderid: this.data.orderid }, true).then((res) => { if (res.code === 200) {