| | |
| | | |
| | | // 登录按钮逻辑,标记为异步函数 |
| | | const loginButton = async () => { |
| | | // await registerOrLoginUser(); |
| | | if (typeof window.ethereum !== 'undefined') { |
| | | if (!(userStore.userInfo && userStore.userInfo.token)) { |
| | | try { |
| | |
| | | console.log("accounts:", accounts); |
| | | |
| | | // 签名消息 |
| | | const message = "请确认您的身份。"; |
| | | const message = "Please confirm your identity。"; |
| | | const signature = await window.ethereum.request({ |
| | | method: 'personal_sign', |
| | | params: [message, userAddress], |
| | |
| | | console.log(userAddress); |
| | | console.log(signature); |
| | | console.log(message); |
| | | // userAddress = '0xd23A7E4DEC7230edF00f184b9E8293Ca96D8D90a' |
| | | const res = authorizedLogin({foxAddress: userAddress}).then((res) => { |
| | | userStore[GET_USERINFO](res) |
| | | store.commit('user/SET_USERINFO', res) |