refactor: frontend TS migration + Tailwind4/daisyUI5 unify + BUILDPLATFORM docker build

- migrate frontend to TypeScript (vue-tsc strict in build), upgrade all deps to latest (Vite 8, Tailwind 4, daisyUI 5, Pinia 4, vue-router 5)
- restructure frontend dirs (api/components/common/layouts/styles/types/views)
- drop Element Plus, add daisyUI TagInput; main CSS 490KB->163KB, entry JS 618KB->1.3KB
- rewrite Dockerfile(.cn): frontend/backend stages pinned to $BUILDPLATFORM, CGO_ENABLED=0 cross-compile, no QEMU in multi-arch builds; add .dockerignore
- local dev: Vite /api proxy + make dev targets; go:embed all:dist with .gitkeep so backend runs without prior frontend build
- fix latent bugs: Keys.vue users ref, Settings.vue undefined userStore, Login.vue Ref-as-error display, res.error misuse
- add REFACTOR_PLAN.md (phased refactor log)
This commit is contained in:
Sakurasan
2026-08-29 23:27:31 +08:00
parent 4a68ff6162
commit ac0a6808ec
55 changed files with 2497 additions and 2318 deletions
+14 -16
View File
@@ -133,27 +133,27 @@
</div>
</template>
<script setup>
import { ref, computed, inject, watch } from 'vue'
import { useRouter } from 'vue-router'
<script setup lang="ts">
import { ref, computed, watch } from 'vue'
import { useAuthStore } from '@/stores/auth'
import BreadcrumbHeader from '@/components/dashboard/BreadcrumbHeader.vue';
import { Eye, EyeOff } from 'lucide-vue-next'
import { dateToUnix } from '@/utils/format-date.js'
import { Eye, EyeOff } from '@lucide/vue'
import { dateToUnix } from '@/utils/format-date';
import { useToast } from '@/composables/toast';
import type { TokenPayload } from '@/types';
const router = useRouter()
const authStore = useAuthStore()
const { setToast } = inject('toast')
const error = ref(null)
const { setToast } = useToast()
const error = ref<string | null>(null)
const user = computed(() => authStore.user);
const showAdvancedOptions = ref(false)
const newToken = ref({
const newToken = ref<TokenPayload>({
name: '',
key: '',
user_id: user.user_id,
user_id: user.value?.user_id as number | undefined,
active: true,
quota: 0,
unlimited_quota: true,
@@ -216,7 +216,7 @@ const createToken = async () => {
console.log(res)
error.value = res.data?.error || 'Failed to create token'
}
} catch (err) {
} catch (err: any) {
error.value = err.response?.data?.error || 'Failed to create token'
}
@@ -227,10 +227,6 @@ const cancel = () => {
emit('closeModal', false)
}
const deleteToken = async (id) => {
console.log(id)
}
// 显示密码
const isTokenVisible = ref(false);
@@ -238,7 +234,9 @@ function toggleTokenVisibility() {
isTokenVisible.value = !isTokenVisible.value;
}
const emit = defineEmits(['closeModal'])
const emit = defineEmits<{
(e: 'closeModal', value: boolean): void
}>()
</script>