fix: 修复微信小程序appid及URL配置错误

修复了微信小程序的appid配置错误,将appid从"wxabe9cc4db1005fcb"更新为"wx3ae63fb09936b379"。同时,将URL从生产环境切换为本地开发环境,修改为"http://127.0.0.1:8080"。此外,优化了http请求的错误处理逻辑,增加了对响应状态码和业务状态码的检查,确保请求失败时能够正确捕获并处理错误。
This commit is contained in:
fuck
2025-04-07 17:18:09 +08:00
parent 60bb924d5c
commit 40f523595b
207 changed files with 2896 additions and 47650 deletions
+21 -22
View File
@@ -84,7 +84,8 @@
<script>
import {
getDeviceInfo
getDeviceInfo,
rentPowerBank
} from '@/config/user.js'
export default {
data() {
@@ -218,34 +219,32 @@
title: '处理中'
})
const selectedPkg = this.packages[this.selectedPackage]
// 添加手机号到请求参数
const result = await this.$api.createOrder({
deviceId: this.deviceId,
packageId: this.selectedPackage,
duration: selectedPkg.time,
amount: selectedPkg.price,
phone: this.phoneNumber
})
// 调用设备租借接口
const rentResult = await rentPowerBank(this.deviceId, this.phoneNumber)
if (rentResult.code !== 200) {
throw new Error(rentResult.msg || '设备租借失败')
}
// 获取后端返回的订单信息
const order = rentResult.data
uni.hideLoading()
if (result.success) {
uni.showToast({
title: '租借成功',
icon: 'success'
uni.showToast({
title: '租借成功',
icon: 'success'
})
// 跳转到订单页面
setTimeout(() => {
uni.redirectTo({
url: `/pages/order/index?orderId=${order.orderId}`
})
// 跳转到使用中页面
setTimeout(() => {
uni.redirectTo({
url: `/pages/return/index?deviceId=${this.deviceId}&orderId=${result.orderId}`
})
}, 1500)
}
}, 1500)
} catch (error) {
uni.hideLoading()
uni.showToast({
title: '租借失败,请重试',
title: error.message || '租借失败,请重试',
icon: 'none'
})
}