to add pinia modules
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
</el-icon>  21:00-23:00
|
||||
</div>
|
||||
</div>
|
||||
<el-dropdown trigger="click" v-show="tenant.account">
|
||||
<el-dropdown trigger="click" v-show="useTenantStore.tenant.account">
|
||||
<el-avatar src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" />
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
@@ -36,18 +36,18 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<span @click="doLogin" v-show="!tenant.account">登录</span>
|
||||
<span @click="doLogin" v-show="!useTenantStore.tenant.account">登录</span>
|
||||
</template>
|
||||
|
||||
<script setup lang='ts'>
|
||||
import $moment from "moment";
|
||||
import { reactive, ref } from "vue";
|
||||
import router from '../../router'
|
||||
import { tenantStore } from '../../store/tenant'
|
||||
import { tenantStore } from '../../store/modules/tenant'
|
||||
import { logout } from '../../api/user'
|
||||
// obtain user infomation
|
||||
const tenant = tenantStore()
|
||||
tenant.reflush()
|
||||
const useTenantStore = tenantStore()
|
||||
useTenantStore.reflush()
|
||||
const dialogVisible = ref(false)
|
||||
|
||||
// show time
|
||||
@@ -64,8 +64,8 @@ const doLogin = () => {
|
||||
}
|
||||
const doLogout = () => {
|
||||
dialogVisible.value = false
|
||||
logout(tenant.id).catch(() => { console.log(1) }).finally(() => {
|
||||
tenant.logout()
|
||||
logout(useTenantStore.tenant.id).catch(() => { console.log(1) }).finally(() => {
|
||||
useTenantStore.logout()
|
||||
router.push({
|
||||
path: '/login'
|
||||
})
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { reactive, ref } from 'vue'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { tenantStore } from '../../store/tenant'
|
||||
import { tenantStore } from '../../store/modules/tenant'
|
||||
import router from '../../router'
|
||||
import baiduCloudImage from "../../assets/baiducloud.png"
|
||||
import { config, scan } from '../../const/config'
|
||||
@@ -34,7 +34,7 @@ import { config, scan } from '../../const/config'
|
||||
|
||||
let qrcode = config.BAIDU_CLOUD_URL + config.RESPONSE_TYPE + config.CLIENT_ID + config.REDIRECT_URI + config.SCOPE + config.DEVICE_ID + config.QR_CODE + config.DISPLAY
|
||||
|
||||
const tenant = tenantStore()
|
||||
const useTenantStore = tenantStore()
|
||||
|
||||
const ruleFormRef = ref<FormInstance>()
|
||||
const loginForm = reactive({
|
||||
@@ -66,19 +66,19 @@ const dologin = (form: any) => {
|
||||
|
||||
if (!form)
|
||||
return
|
||||
form.validate((valid: any) => {
|
||||
if (valid) {
|
||||
tenant.login(loginForm.user_id, loginForm.password).then(res => {
|
||||
console.log(1)
|
||||
router.push({
|
||||
path: '/home'
|
||||
})
|
||||
})
|
||||
// form.validate((valid: any) => {
|
||||
// if (valid) {
|
||||
// useTenantStore.login(loginForm.user_id, loginForm.password).then(res => {
|
||||
// console.log(1)
|
||||
// router.push({
|
||||
// path: '/home'
|
||||
// })
|
||||
// })
|
||||
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
// } else {
|
||||
// return false
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
const style = reactive({} as any)
|
||||
|
||||
Reference in New Issue
Block a user