mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
fix bugs
This commit is contained in:
Vendored
+6
-6
@@ -9,13 +9,13 @@ export {}
|
|||||||
|
|
||||||
declare module '@vue/runtime-core' {
|
declare module '@vue/runtime-core' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
CardStatisticsHorizontal: typeof import('./src/@core/components/cards/CardStatisticsHorizontal.vue')['default']
|
CardStatisticsHorizontal: typeof import('./src/components/cards/CardStatisticsHorizontal.vue')['default']
|
||||||
CardStatisticsVertical: typeof import('./src/@core/components/cards/CardStatisticsVertical.vue')['default']
|
CardStatisticsVertical: typeof import('./src/components/cards/CardStatisticsVertical.vue')['default']
|
||||||
CardStatisticsWithImages: typeof import('./src/@core/components/cards/CardStatisticsWithImages.vue')['default']
|
CardStatisticsWithImages: typeof import('./src/components/cards/CardStatisticsWithImages.vue')['default']
|
||||||
ErrorHeader: typeof import('./src/@core/components/ErrorHeader.vue')['default']
|
ErrorHeader: typeof import('./src/@components/ErrorHeader.vue')['default']
|
||||||
MoreBtn: typeof import('./src/@core/components/MoreBtn.vue')['default']
|
MoreBtn: typeof import('./src/@components/MoreBtn.vue')['default']
|
||||||
RouterLink: typeof import('vue-router')['RouterLink']
|
RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
RouterView: typeof import('vue-router')['RouterView']
|
RouterView: typeof import('vue-router')['RouterView']
|
||||||
ThemeSwitcher: typeof import('./src/@core/components/ThemeSwitcher.vue')['default']
|
ThemeSwitcher: typeof import('./src/@components/ThemeSwitcher.vue')['default']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
interface Props {
|
interface Props {
|
||||||
errorCode: string
|
errorCode?: string
|
||||||
errorTitle: string
|
errorTitle?: string
|
||||||
errorDescription: string
|
errorDescription?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<Props>()
|
const props = defineProps<Props>()
|
||||||
@@ -11,13 +11,19 @@ const props = defineProps<Props>()
|
|||||||
<template>
|
<template>
|
||||||
<div class="text-center mb-4">
|
<div class="text-center mb-4">
|
||||||
<!-- 👉 Title and subtitle -->
|
<!-- 👉 Title and subtitle -->
|
||||||
<h1 class="text-h1">
|
<h1
|
||||||
|
v-if="props.errorCode"
|
||||||
|
class="text-h1 font-weight-medium"
|
||||||
|
>
|
||||||
{{ props.errorCode }}
|
{{ props.errorCode }}
|
||||||
</h1>
|
</h1>
|
||||||
<h5 class="text-h5 mb-1">
|
<h5
|
||||||
|
v-if="props.errorTitle"
|
||||||
|
class="text-h5 font-weight-medium mb-3"
|
||||||
|
>
|
||||||
{{ props.errorTitle }}
|
{{ props.errorTitle }}
|
||||||
</h5>
|
</h5>
|
||||||
<p class="text-sm">
|
<p v-if="props.errorDescription">
|
||||||
{{ props.errorDescription }}
|
{{ props.errorDescription }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+3
-6
@@ -1,9 +1,6 @@
|
|||||||
import router from '@/router';
|
import router from '@/router'
|
||||||
import axios from 'axios';
|
import store from '@/store'
|
||||||
import { useStore } from 'vuex';
|
import axios from 'axios'
|
||||||
|
|
||||||
// Vuex Store
|
|
||||||
const store = useStore();
|
|
||||||
|
|
||||||
// 创建axios实例
|
// 创建axios实例
|
||||||
const api = axios.create({
|
const api = axios.create({
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
interface Props {
|
|
||||||
errorCode?: string
|
|
||||||
errorTitle?: string
|
|
||||||
errorDescription?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = defineProps<Props>()
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="text-center mb-4">
|
|
||||||
<!-- 👉 Title and subtitle -->
|
|
||||||
<h1
|
|
||||||
v-if="props.errorCode"
|
|
||||||
class="text-h1 font-weight-medium"
|
|
||||||
>
|
|
||||||
{{ props.errorCode }}
|
|
||||||
</h1>
|
|
||||||
<h5
|
|
||||||
v-if="props.errorTitle"
|
|
||||||
class="text-h5 font-weight-medium mb-3"
|
|
||||||
>
|
|
||||||
{{ props.errorTitle }}
|
|
||||||
</h5>
|
|
||||||
<p v-if="props.errorDescription">
|
|
||||||
{{ props.errorDescription }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
+6
-7
@@ -15,10 +15,9 @@ loadFonts()
|
|||||||
// Create vue app
|
// Create vue app
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
|
||||||
// Use plugins
|
// Use plugins Mount vue app
|
||||||
app.use(vuetify)
|
app
|
||||||
app.use(store)
|
.use(vuetify)
|
||||||
app.use(router)
|
.use(router)
|
||||||
|
.use(store)
|
||||||
// Mount vue app
|
.mount('#app')
|
||||||
app.mount('#app')
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import AnalyticsTotalProfitLineCharts from '@/views/dashboard/AnalyticsTotalProf
|
|||||||
import AnalyticsTransactions from '@/views/dashboard/AnalyticsTransactions.vue'
|
import AnalyticsTransactions from '@/views/dashboard/AnalyticsTransactions.vue'
|
||||||
import AnalyticsUserTable from '@/views/dashboard/AnalyticsUserTable.vue'
|
import AnalyticsUserTable from '@/views/dashboard/AnalyticsUserTable.vue'
|
||||||
import AnalyticsWeeklyOverview from '@/views/dashboard/AnalyticsWeeklyOverview.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 = {
|
const totalProfit = {
|
||||||
title: 'Total Profit',
|
title: 'Total Profit',
|
||||||
|
|||||||
+10
-10
@@ -1,11 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import api from '@/api';
|
import { useStore } from 'vuex'
|
||||||
import router from '@/router';
|
import api from '@/api'
|
||||||
import logo from '@images/logo.svg?raw';
|
import router from '@/router'
|
||||||
import { useStore } from 'vuex';
|
import logo from '@images/logo.svg?raw'
|
||||||
|
|
||||||
// Vuex Store
|
// Vuex Store
|
||||||
const store = useStore();
|
const store = useStore()
|
||||||
|
|
||||||
// 表单
|
// 表单
|
||||||
const form = ref({
|
const form = ref({
|
||||||
@@ -59,11 +59,11 @@ const login = () => {
|
|||||||
})
|
})
|
||||||
.then((response: any) => {
|
.then((response: any) => {
|
||||||
// 获取token
|
// 获取token
|
||||||
const token = response.access_token;
|
const token = response.access_token
|
||||||
|
|
||||||
// 更新token和remember状态到Vuex Store
|
// 更新token和remember状态到Vuex Store
|
||||||
store.dispatch('auth/updateToken', token);
|
store.dispatch('auth/updateToken', token)
|
||||||
store.dispatch('auth/updateRemember', form.value.remember);
|
store.dispatch('auth/updateRemember', form.value.remember)
|
||||||
|
|
||||||
// 跳转到首页
|
// 跳转到首页
|
||||||
router.push('/')
|
router.push('/')
|
||||||
@@ -90,8 +90,8 @@ const login = () => {
|
|||||||
// 自动登录
|
// 自动登录
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 从Vuex Store中获取token和remember状态
|
// 从Vuex Store中获取token和remember状态
|
||||||
const token = store.state.auth.token;
|
const token = store.state.auth.token
|
||||||
const remember = store.state.auth.remember;
|
const remember = store.state.auth.remember
|
||||||
|
|
||||||
// 如果token存在,且保持登录状态为true,则跳转到首页
|
// 如果token存在,且保持登录状态为true,则跳转到首页
|
||||||
if (token && remember) {
|
if (token && remember) {
|
||||||
|
|||||||
+7
-6
@@ -1,5 +1,5 @@
|
|||||||
import store from '@/store';
|
import { createRouter, createWebHistory } from 'vue-router'
|
||||||
import { createRouter, createWebHistory } from 'vue-router';
|
import store from '@/store'
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(import.meta.env.BASE_URL),
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
@@ -105,13 +105,14 @@ const router = createRouter({
|
|||||||
// 导航守卫
|
// 导航守卫
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
// 通过 Vuex Store 检查用户是否已登录
|
// 通过 Vuex Store 检查用户是否已登录
|
||||||
const isAuthenticated = store.state.auth.token !== null;
|
const isAuthenticated = store.state.auth.token !== null
|
||||||
if (to.meta.requiresAuth && !isAuthenticated) {
|
if (to.meta.requiresAuth && !isAuthenticated) {
|
||||||
// 如果路由需要登录权限且用户未登录,则跳转到登录页面
|
// 如果路由需要登录权限且用户未登录,则跳转到登录页面
|
||||||
next('/login');
|
next('/login')
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// 否则,允许继续进行路由导航
|
// 否则,允许继续进行路由导航
|
||||||
next();
|
next()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
import { fileURLToPath } from 'node:url'
|
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
import vueJsx from '@vitejs/plugin-vue-jsx'
|
import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||||
|
import { fileURLToPath } from 'node:url'
|
||||||
import AutoImport from 'unplugin-auto-import/vite'
|
import AutoImport from 'unplugin-auto-import/vite'
|
||||||
import Components from 'unplugin-vue-components/vite'
|
import Components from 'unplugin-vue-components/vite'
|
||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
@@ -20,7 +20,7 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
Components({
|
Components({
|
||||||
dirs: ['src/@core/components'],
|
dirs: ['src/@components'],
|
||||||
dts: true,
|
dts: true,
|
||||||
}),
|
}),
|
||||||
AutoImport({
|
AutoImport({
|
||||||
|
|||||||
Reference in New Issue
Block a user