()
| 178 | } |
| 179 | |
| 180 | async getWxCode() { |
| 181 | if (!this.openid) throw new Error("缺少 openid,无法从 wx_server 获取 code"); |
| 182 | const { data } = await wechat.getCode(this.openid); |
| 183 | if (!data?.status) throw new Error(data?.message || "wx_server 获取 code 失败"); |
| 184 | const code = data.data?.code || data.code; |
| 185 | if (!code) throw new Error(`wx_server 未返回 code: ${JSON.stringify(data)}`); |
| 186 | return code; |
| 187 | } |
| 188 | |
| 189 | async getOperateData() { |
| 190 | if (!this.openid) throw new Error("缺少 openid,无法从 wx_server 获取授权数据"); |