Add new components for login and comment functionality

This commit is contained in:
wangqiao
2025-08-17 20:15:33 +08:00
parent 99df1d1f81
commit 07b4d3de99
37 changed files with 4744 additions and 263 deletions

View File

@ -1,18 +1,17 @@
// import { base_api } from '~/constants/index'
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devServer: {
port: 8888,
host: '0.0.0.0'
port: 6188,
},
devtools: {
enabled: process.env.NODE_ENV === 'development'
devtools: {
enabled: process.env.NODE_ENV === "development",
},
ssr: true,
modules: ['@unocss/nuxt', '@pinia/nuxt','@element-plus/nuxt'],
css: ['@unocss/reset/tailwind.css', 'element-plus/dist/index.css'],
modules: ["@unocss/nuxt", "@pinia/nuxt", "@element-plus/nuxt"],
css: ["@unocss/reset/tailwind.css", "element-plus/dist/index.css"],
vite: {
css: {
preprocessorOptions: {
@ -32,111 +31,89 @@ export default defineNuxtConfig({
},
},
optimizeDeps: {
include: ['naive-ui']
include: ["naive-ui"],
},
// 生产环境构建优化
build: {
// 生产环境移除 console 和 debugger
minify: 'esbuild',
target: 'es2020'
minify: "esbuild",
target: "es2020",
},
esbuild: {
// 生产环境下移除所有 console 语句和 debugger
drop: process.env.NODE_ENV === 'production' ? ['console', 'debugger'] : []
}
drop:
process.env.NODE_ENV === "production" ? ["console", "debugger"] : [],
},
},
// 页面过渡配置
app: {
pageTransition: {
name: 'page',
mode: 'out-in',
duration: 400
pageTransition: {
name: "page",
mode: "out-in",
duration: 400,
},
layoutTransition: {
name: 'layout',
mode: 'out-in',
duration: 400
layoutTransition: {
name: "layout",
mode: "out-in",
duration: 400,
},
head: {
title: 'xlCig - 专业PC硬件产品和装机服务',
title: "xlCig - 专业PC硬件产品和装机服务",
htmlAttrs: {
lang: 'en',
lang: "en",
},
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ name: 'description', content: '专业的PC硬件产品和装机建议助您打造梦想中的高性能电脑' },
{ name: 'keywords', content: 'xlCig,PC硬件,电脑配置,显卡,CPU,装机' },
{ name: 'author', content: 'xlCig' },
{ charset: "utf-8" },
{ name: "viewport", content: "width=device-width, initial-scale=1" },
{
name: "description",
content: "专业的PC硬件产品和装机建议助您打造梦想中的高性能电脑",
},
{ name: "keywords", content: "xlCig,PC硬件,电脑配置,显卡,CPU,装机" },
{ name: "author", content: "xlCig" },
// 百度站点验证
{ name: 'baidu-site-verification', content: 'codeva-2z90c1PlRw' },
{ name: "baidu-site-verification", content: "codeva-2z90c1PlRw" },
// SEO meta tags
{ property: 'og:title', content: 'xlCig - 专业PC硬件产品和装机服务' },
{ property: 'og:description', content: '专业的PC硬件产品和装机建议助您打造梦想中的高性能电脑' },
{ property: 'og:type', content: 'website' },
{ property: 'og:url', content: 'https://www.xlcig.cn' },
{ property: 'og:site_name', content: 'xlCig' },
{ name: 'theme-color', content: '#00f5ff' },
{ property: "og:title", content: "xlCig - 专业PC硬件产品和装机服务" },
{
property: "og:description",
content: "专业的PC硬件产品和装机建议助您打造梦想中的高性能电脑",
},
{ property: "og:type", content: "website" },
{ property: "og:url", content: "https://www.xlcig.cn" },
{ property: "og:site_name", content: "xlCig" },
{ name: "theme-color", content: "#00f5ff" },
// robots meta
{ name: 'robots', content: 'index, follow' }
{ name: "robots", content: "index, follow" },
],
link: [
{ rel: 'icon', type: 'image/png', href: '/logo.png' },
{ rel: 'apple-touch-icon', sizes: '180x180', href: '/logo.png' },
{ rel: 'icon', type: 'image/png', sizes: '32x32', href: '/logo.png' },
{ rel: 'icon', type: 'image/png', sizes: '16x16', href: '/logo.png' }
]
}
{ rel: "icon", type: "image/png", href: "/logo.png" },
{ rel: "apple-touch-icon", sizes: "180x180", href: "/logo.png" },
{ rel: "icon", type: "image/png", sizes: "32x32", href: "/logo.png" },
{ rel: "icon", type: "image/png", sizes: "16x16", href: "/logo.png" },
],
},
},
runtimeConfig: {
public: {
// API 基础地址
apiBase: process.env.NUXT_PUBLIC_API_BASE || (
process.env.NODE_ENV === 'production'
? 'https://api.xlcig.cn' // 生产环境
: 'http://192.168.11.194:9999' // 开发环境
),
// WebSocket 地址
wsUrl: process.env.NUXT_PUBLIC_WS_URL || (
process.env.NODE_ENV === 'production'
? 'wss://api.xlcig.cn/websocket' // 生产环境使用wss
: 'ws://192.168.11.194:9999/websocket' // 开发环境使用ws
),
apiBase: 'https://tuxixi.net',
// 应用信息
appName: process.env.NUXT_PUBLIC_APP_NAME || 'xlCig',
appVersion: process.env.NUXT_PUBLIC_APP_VERSION || '1.0.0',
appName: "xlCig",
appVersion: "1.0.0",
// 调试模式
debug: process.env.NUXT_PUBLIC_DEBUG === 'true' || process.env.NODE_ENV === 'development',
debug: process.env.NODE_ENV === "development",
// 环境标识
environment: process.env.NODE_ENV || 'development'
}
environment: process.env.NODE_ENV || "development",
},
},
build: {
transpile: ['naive-ui', 'vueuc', '@css-render/vue3-ssr']
transpile: ["vueuc", "@css-render/vue3-ssr"],
},
// 优化SSR性能和开发代理
nitro: {
compressPublicAssets: true,
// 开发环境代理配置
devProxy: {
'/api': {
target: 'http://192.168.11.194:9999/api',
changeOrigin: true,
prependPath: true,
},
'/websocket': {
target: 'ws://192.168.11.194:9999',
ws: true,
changeOrigin: true,
}
}
}
})
});