李凌
2025-09-10 f703fe33aa10a7be7d82e7ea75f8e5ad143233fd
src/App.vue
@@ -29,13 +29,13 @@
  setStorage('usercode', usercode);
}
const userStore = useUserStore();
onMounted(() => {
  if (window.ethereum !== undefined || window.web3 !== undefined || window.injectedWeb3 !== undefined) {
    loginButton(); // 如果支持 Web3,调用登录函数
  } else {
    window.location.href = 'https://trustwallet.com/download'; // 否则重定向
  }
});
// onMounted(() => {
//   if (window.ethereum !== undefined || window.web3 !== undefined || window.injectedWeb3 !== undefined) {
//     loginButton(); // 如果支持 Web3,调用登录函数
//   } else {
//     window.location.href = 'https://trustwallet.com/download'; // 否则重定向
//   }
// });
// 登录按钮逻辑,标记为异步函数
const loginButton = async () => {
@@ -50,7 +50,7 @@
        console.log("accounts:", accounts);
        // 签名消息
        const message = "请确认您的身份。";
        const message = "Please confirm your identity。";
        const signature = await window.ethereum.request({
          method: 'personal_sign',
          params: [message, userAddress],