()
| 168 | } |
| 169 | |
| 170 | async getWxCode() { |
| 171 | if (!this.openid) return ""; |
| 172 | const { data } = await wechat.getCode(this.openid); |
| 173 | if (!data?.status) throw new Error(data?.message || "wx_server 获取 code 失败"); |
| 174 | const code = data.data?.code || data.code; |
| 175 | if (!code) throw new Error(`wx_server 未返回 code: ${JSON.stringify(data)}`); |
| 176 | this.wxcode = code; |
| 177 | return code; |
| 178 | } |
| 179 | |
| 180 | async getOperateData() { |
| 181 | if (!this.openid) throw new Error("缺少 openid,无法自动授权"); |