acdr-ui/dist/build/mp-weixin/interceptors/route.js

2 lines
546 B
JavaScript

"use strict";const e=require("../common/vendor.js");require("../store/index.js");const r=require("../utils/index.js"),n=require("../store/user.js"),t={invoke({url:t}){const i=t.split("?")[0];let o=[];o=r.needLoginPages;if(!o.includes(i))return!0;if(n.useUserStore().isLogined)return!0;const s=`/pages/login/index?redirect=${encodeURIComponent(t)}`;return e.index.navigateTo({url:s}),!1}},i={install(){e.index.addInterceptor("navigateTo",t),e.index.addInterceptor("reLaunch",t),e.index.addInterceptor("redirectTo",t)}};exports.routeInterceptor=i;