linwei
2024-01-22 f8b20c360116f022ada37db0b826b53fd7cdb0d4
src/page/login/userlogin.vue
@@ -53,6 +53,7 @@
</template>
<script>
import Layout from "@/page/index/"
import { mapGetters } from "vuex"
import { info } from "@/api/system/tenant"
// import {getCaptcha} from "@/api/user";
@@ -176,15 +177,15 @@
    },
    props: [],
    methods: {
        refreshCode () {
            if (this.website.captchaMode) {
                getCaptcha().then(res => {
                    const data = res.data
                    this.loginForm.key = data.key
                    this.loginForm.image = data.image
                })
            }
        },
        // refreshCode () {
        //     if (this.website.captchaMode) {
        //         getCaptcha().then(res => {
        //             const data = res.data
        //             this.loginForm.key = data.key
        //             this.loginForm.image = data.image
        //         })
        //     }
        // },
        showPassword () {
            this.passwordType === ""
                ? (this.passwordType = "password")
@@ -208,7 +209,7 @@
                        text: '登录中,请稍后。。。',
                        spinner: "el-icon-loading"
                    })
                    this.$store.dispatch("LoginByUsername", this.loginForm).then(() => {
                    this.$store.dispatch("LoginByUsername", this.loginForm).then((res) => {
                        if (this.website.switchMode) {
                            const deptId = this.userInfo.dept_id
                            const roleId = this.userInfo.role_id
@@ -222,15 +223,24 @@
                                return false
                            }
                        }
                        this.$router.push({ path: this.tagWel.value })
                        if (JSON.stringify(res) == '{}') {
                            this.$router.push({ path: this.tagWel.value })
                        } else {
                            this.$router.$avueRouter.formatRoutes(res.menuData, true)
                            this.$router.push({ path: res.fistMenu.path })
                        }
                        loading.close()
                    }).catch(() => {
                        loading.close()
                        this.refreshCode()
                        // this.refreshCode()
                    })
                }
            })
        },
        getTenant () {
            let domain = getTopUrl()
            // 临时指定域名,方便测试