WebPageUrl.ts 591 B

123456789101112131415161718192021222324
  1. import { useAuthStore } from "@/store/auth";
  2. import { computed } from "vue";
  3. const WEB_URL = 'https://zycj.wenlvti.net';
  4. export function useWebPageUrl(subPath: string) {
  5. const authStore = useAuthStore();
  6. const src = computed(() => {
  7. const authInfo = {
  8. token: authStore.token,
  9. userId: authStore.userId,
  10. expireAt: authStore.expireAt,
  11. userInfo: authStore.userInfo,
  12. loginType: authStore.loginType,
  13. };
  14. return WEB_URL + `?inMiniProgram=true&directAuthInfo=${encodeURIComponent(JSON.stringify(authInfo))}#${subPath}`
  15. });
  16. return {
  17. src
  18. }
  19. }