1234567891011121314151617181920212223242526272829 |
- import { api_wechatAuth, api_systemConfiguration, api_getDictionary} from "@/http/api.js"
- import { useLoginSuccess } from '@/share/useLoginSuccess.js'
- const { loginSuccess, transform } = 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);
- transform(res.user, 'menu');
- }
- });
- }
- return {
- wechatAuth
- };
- }
|