import { api_wechatAuth } from "@/http/api.js" import { useLoginSuccess } from '@/share/useLoginSuccess.js' const { loginSuccess } = useLoginSuccess() export function useWechatAuth() { /** * 微信登录2 */ const wechatAuth = () => { uni.showLoading({ title: "登录中", mask: true, }); api_wechatAuth({ redirectUrl: location.origin + location.pathname }).then(res => { uni.hideLoading(); if (res.url) { window.location.href = res.url; } else { loginSuccess(res.user); } }); } return { wechatAuth }; }