()
| 119 | } |
| 120 | |
| 121 | async getWxCode() { |
| 122 | const { data } = await wechat.getCode(this.account); |
| 123 | if (!data?.status) throw new Error(data?.message || "wx_server 获取 code 失败"); |
| 124 | const code = data.data?.code || data.code; |
| 125 | if (!code) throw new Error(`wx_server 未返回 code: ${JSON.stringify(data)}`); |
| 126 | return code; |
| 127 | } |
| 128 | |
| 129 | async login() { |
| 130 | const code = await this.getWxCode(); |