This commit is contained in:
jxxghp
2023-06-26 07:23:21 +08:00
parent 4d8f63c223
commit c1815e9266
12 changed files with 47 additions and 74 deletions

View File

@@ -8,7 +8,7 @@ import AnalyticsTotalProfitLineCharts from '@/views/dashboard/AnalyticsTotalProf
import AnalyticsTransactions from '@/views/dashboard/AnalyticsTransactions.vue'
import AnalyticsUserTable from '@/views/dashboard/AnalyticsUserTable.vue'
import AnalyticsWeeklyOverview from '@/views/dashboard/AnalyticsWeeklyOverview.vue'
import CardStatisticsVertical from '@core/components/cards/CardStatisticsVertical.vue'
import CardStatisticsVertical from '@components/cards/CardStatisticsVertical.vue'
const totalProfit = {
title: 'Total Profit',

View File

@@ -1,11 +1,11 @@
<script setup lang="ts">
import api from '@/api';
import router from '@/router';
import logo from '@images/logo.svg?raw';
import { useStore } from 'vuex';
import { useStore } from 'vuex'
import api from '@/api'
import router from '@/router'
import logo from '@images/logo.svg?raw'
// Vuex Store
const store = useStore();
const store = useStore()
// 表单
const form = ref({
@@ -59,11 +59,11 @@ const login = () => {
})
.then((response: any) => {
// 获取token
const token = response.access_token;
const token = response.access_token
// 更新token和remember状态到Vuex Store
store.dispatch('auth/updateToken', token);
store.dispatch('auth/updateRemember', form.value.remember);
store.dispatch('auth/updateToken', token)
store.dispatch('auth/updateRemember', form.value.remember)
// 跳转到首页
router.push('/')
@@ -90,8 +90,8 @@ const login = () => {
// 自动登录
onMounted(() => {
// 从Vuex Store中获取token和remember状态
const token = store.state.auth.token;
const remember = store.state.auth.remember;
const token = store.state.auth.token
const remember = store.state.auth.remember
// 如果token存在且保持登录状态为true则跳转到首页
if (token && remember) {