|
@@ -2,6 +2,7 @@ import { getIn } from "herculex/dist/utils/manipulate";
|
|
|
import { host, getTicketUrl, ywtRequestUrl, terminal } from "./constants";
|
|
|
import { getSilentAuthCode, getAppId, getServerTime } from "./jsapi";
|
|
|
import { joinUrl } from "./format";
|
|
|
+import { getCurrentStore } from "../../../antbuilder/core/utils/index";
|
|
|
|
|
|
function showErrorMessgage({ isShowError, error }) {
|
|
|
if (isShowError) {
|
|
@@ -235,7 +236,25 @@ export default async function request(options) {
|
|
|
return [error, null];
|
|
|
} else if (code === 401) {
|
|
|
// 手动发起请求
|
|
|
- console.log("手动发起授权请求 33 ===>", res);
|
|
|
+ const currentStore = getCurrentStore();
|
|
|
+ const { dispatchGlobal } = currentStore;
|
|
|
+ const scopes = "auth_user";
|
|
|
+ /* 这里表示如果不是通过按钮触发的手机号登录,需要打开按钮弹窗 */
|
|
|
+ // if (currentScope !== scopes) {
|
|
|
+ // await dispatch.call(currentStore, "launchPhone");
|
|
|
+ // }
|
|
|
+ const success = await dispatchGlobal("doLogin", { scopes });
|
|
|
+ /* 登录失败 */
|
|
|
+ if (!success) {
|
|
|
+ showErrorMessgage({
|
|
|
+ isShowError: true,
|
|
|
+ error: { msg: "登录失败" },
|
|
|
+ });
|
|
|
+ my.navigateBack();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const result = await request(options);
|
|
|
+ return result;
|
|
|
}
|
|
|
const data = res.data || null;
|
|
|
return [null, data];
|