feat(miniprogram): 用 karuo-316 替换小程序目录

- 从 github/karuo-316 覆盖 miniprogram/
- 排除 project.private.config.json 与 *.backup

Made-with: Cursor
This commit is contained in:
卡若
2026-03-17 18:25:24 +08:00
parent 982622368a
commit 34f7c7bbdc
34 changed files with 450 additions and 891 deletions

View File

@@ -88,10 +88,7 @@ App({
isSinglePageMode: false,
// 更新检测:上次检测时间戳,避免频繁请求
lastUpdateCheck: 0,
// 审核模式:后端 /api/miniprogram/config 返回 auditMode=true 时隐藏所有支付相关UI
auditMode: false
lastUpdateCheck: 0
},
onLaunch(options) {
@@ -363,7 +360,6 @@ App({
this.globalData.mchId = mpConfig.mchId || this.globalData.mchId
this.globalData.withdrawSubscribeTmplId = mpConfig.withdrawSubscribeTmplId || this.globalData.withdrawSubscribeTmplId
this.globalData.supportWechat = mpConfig.supportWechat || mpConfig.customerWechat || mpConfig.serviceWechat || ''
this.globalData.auditMode = mpConfig.auditMode || false
try {
wx.setStorageSync('apiBaseUrl', this.globalData.baseUrl)
} catch (_) {}
@@ -513,7 +509,7 @@ App({
},
fail: (err) => {
const msg = (err && err.errMsg) ? (err.errMsg.indexOf('timeout') !== -1 ? '请求超时,请重试' : '网络异常,请重试') : '网络异常,请重试'
console.warn('[App] request fail:', url, msg)
showError(msg)
reject(new Error(msg))
}
})
@@ -531,6 +527,7 @@ App({
})
if (!loginRes || !loginRes.code) {
console.warn('[App] wx.login 未返回 code')
wx.showToast({ title: '获取登录态失败,请重试', icon: 'none' })
return null
}
try {
@@ -572,13 +569,16 @@ App({
return res.data
}
} catch (apiError) {
console.warn('[App] API登录失败:', apiError.message)
console.log('[App] API登录失败:', apiError.message)
// 不使用模拟登录,提示用户网络问题
wx.showToast({ title: '网络异常,请重试', icon: 'none' })
return null
}
return null
} catch (e) {
console.warn('[App] 登录失败:', e)
console.error('[App] 登录失败:', e)
wx.showToast({ title: '登录失败,请重试', icon: 'none' })
return null
}
},
@@ -630,7 +630,7 @@ App({
return res.data.openId
}
} catch (e) {
console.warn('[App] 获取openId失败:', e)
console.error('[App] 获取openId失败:', e)
}
return null
@@ -646,7 +646,7 @@ App({
wx.login({ success: resolve, fail: reject })
})
if (!loginRes.code) {
console.warn('[App] loginWithPhone: wx.login 未返回 code')
wx.showToast({ title: '获取登录态失败', icon: 'none' })
return null
}
const res = await this.request('/api/miniprogram/phone-login', {
@@ -677,7 +677,8 @@ App({
return res.data
}
} catch (e) {
console.warn('[App] 手机号登录失败:', e)
console.log('[App] 手机号登录失败:', e)
wx.showToast({ title: '登录失败,请重试', icon: 'none' })
}
return null