1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <template>
- <div></div>
- </template>
- <script>
- import {defineComponent, ref} from "vue";
- import {useRouter} from "vue-router";
- import {useUserStore} from "@/store/modules/user";
- import {isWechat, wxAuth} from "@/utils/wechat";
- import {getUrlParams} from "@/utils/urlUtils";
- export default defineComponent({
- name: "sysindex",
- setup() {
- const router = useRouter();
- const userStore = useUserStore();
- const user = ref(userStore.getUserInfo);
- const urlParams = getUrlParams();
- let redirectUrl = urlParams["redirectUrl"] || '/login';
- if (redirectUrl === '/index') {
- redirectUrl = '/login';
- }
- const wxLogin = async function () {
- await wxAuth(redirectUrl);
- };
- if (isWechat()) {
- wxLogin().then(res => {
- router.push(redirectUrl);
- });
- } else {
- router.push(redirectUrl);
- }
- return {}
- }
- });
- </script>
- <style lang="less">
- </style>
|