fix(runtime): 解决运行时错误并优化自动登录功能

-修复了 Taro 应用启动时的运行时错误
- 解决了 TypeScript 类型错误和导入问题
- 优化了自动登录逻辑,集成到 useUser Hook 中
- 从 app.ts 中移除了重复的自动登录代码
- 在 Header.tsx 中添加了正确的 API 调用
This commit is contained in:
2025-09-05 14:17:13 +08:00
parent 16db2c4eac
commit 1df0f7735c
6 changed files with 374 additions and 47 deletions

View File

@@ -96,12 +96,13 @@ const Header = (props: any) => {
const handleGetPhoneNumber = ({detail}: { detail: { code?: string, encryptedData?: string, iv?: string } }) => {
const {code, encryptedData, iv} = detail
Taro.login({
success: function () {
success: (loginRes)=> {
if (code) {
Taro.request({
url: 'https://server.websoft.top/api/wx-login/loginByMpWxPhone',
method: 'POST',
data: {
authCode: loginRes.code,
code,
encryptedData,
iv,