fix: 扫一扫
Some checks failed
构建并部署前端到生产环境 / build-and-deploy (push) Failing after 19s

This commit is contained in:
sexygoat
2026-04-17 15:57:13 +08:00
parent 25fc534619
commit 1e03191e82
2 changed files with 53 additions and 4 deletions

View File

@@ -69,7 +69,7 @@
import { authApi } from '@/api/index.js';
import { useUserStore } from '@/store/index.js';
import { APP_ID } from '@/utils/env.js';
import { wxScan, isInWechat } from '@/utils/wxsdk.js';
import { initWxConfig, wxScan, isInWechat } from '@/utils/wxsdk.js';
const userStore = useUserStore();
@@ -80,6 +80,18 @@
}
handleWechatCallback();
getPathDeviceId();
// 初始化微信 SDK (仅在微信浏览器内执行)
// #ifdef H5
if (isInWechat()) {
try {
await initWxConfig();
console.log('微信 SDK 初始化成功');
} catch (e) {
console.error('微信 SDK 初始化失败', e);
}
}
// #endif
});
const identifier = ref('');
@@ -158,7 +170,7 @@ const handleScanLogin = async () => {
}
} catch (err) {
console.error('扫码错误:', err);
uni.showToast({ title: '扫码取消或失败', icon: 'none' });
uni.showToast({ title: JSON.stringify(err), icon: 'none' });
}
// #endif
// #ifndef H5