Commit 6c9e2e67 by chenwq1

feat: 更新二手车质检平台功能

- 修改 pnpm-lock.yaml,更新依赖版本和规范
- 新增 Tailwind CSS 和 PostCSS 配置
- 实现 OSS 文件上传功能
- 优化路由和状态管理,增强用户体验
- 添加新组件和页面,支持车检报告展示
- 更新样式和布局,提升界面友好性
1 parent 959b6809
Pipeline #67 for 6c9e2e67 failed in 0 seconds
Showing 30 changed files with 960 additions and 440 deletions
export default {
// 必填:填你自己的真实值(本文件建议不要提交到仓库)
ACCESS_KEY_ID: "LTAI5tCRcCUgd7bt1J7JY596",
ACCESS_KEY_SECRET: "kJos9mgylkR5ztosnDt8Asrc3ulgqy",
STS_ROLE_ARN: "OPTIONAL",
BUCKET: "glsk-oss",
REGION: "oss-cn-shenzhen",
DIR: "usedCarH5/",
PORT: 3000,
};
......@@ -11,11 +11,14 @@
"type-check": "vue-tsc --noEmit"
},
"dependencies": {
"axios": "^1.12.2",
"@vueuse/core": "catalog:",
"dayjs": "catalog:",
"glsk-toolkit": "catalog:",
"glsk-oss-jssdk": "catalog:",
"pinia": "catalog:",
"pinia-plugin-persistedstate": "catalog:",
"tailwindcss": "catalog:",
"vant": "^4.9.0",
"vue": "catalog:",
"vue-router": "catalog:"
......@@ -25,7 +28,7 @@
"@vitejs/plugin-vue": "catalog:",
"autoprefixer": "catalog:",
"postcss": "catalog:",
"postcss-px-to-viewport-8-plugin": "^1.2.5",
"postcss-pxtorem": "^6.1.0",
"sass": "catalog:",
"typescript": "catalog:",
"unplugin-auto-import": "catalog:",
......
import tailwindcss from "tailwindcss";
import autoprefixer from "autoprefixer";
import pxtorem from "postcss-pxtorem";
export default {
plugins: [
tailwindcss,
autoprefixer,
pxtorem({
// 与 flexible 中的 BASE_FONT_SIZE 保持一致:
// 设计稿 375 宽时,html 字体为 14px,则 1rem = 14px
rootValue: 14,
propList: ["*"],
unitPrecision: 5,
minPixelValue: 1,
selectorBlackList: [".ignore", "html"],
}),
],
};
@tailwind base;
@tailwind components;
@tailwind utilities;
......@@ -13,7 +13,9 @@ declare module 'vue' {
VanButton: typeof import('vant/es')['Button']
VanCell: typeof import('vant/es')['Cell']
VanCellGroup: typeof import('vant/es')['CellGroup']
VanCheckbox: typeof import('vant/es')['Checkbox']
VanEmpty: typeof import('vant/es')['Empty']
VanField: typeof import('vant/es')['Field']
VanGrid: typeof import('vant/es')['Grid']
VanGridItem: typeof import('vant/es')['GridItem']
VanIcon: typeof import('vant/es')['Icon']
......
import { onMounted, ref } from "vue";
const isPad = ref(false);
let inited = false;
const updateDevice = () => {
const width = window.innerWidth;
const height = window.innerHeight;
isPad.value = width >= 768 && width > height;
};
export function useDeviceLayout() {
if (typeof window !== "undefined" && !inited) {
updateDevice();
window.addEventListener("resize", updateDevice);
inited = true;
}
onMounted(() => {
if (typeof window !== "undefined" && !inited) {
updateDevice();
window.addEventListener("resize", updateDevice);
inited = true;
}
});
return {
isPad,
};
}
export const OSS_CONFIG = {
BUCKET_NAME: "glsk-oss",
OSS_DOMAIN: "https://glsk-oss.oss-cn-shenzhen.aliyuncs.com",
FOLDER: "usedCarH5/",
/**
* glsk-oss-jssdk 需要的 systemSource(会传给 STS 凭证接口)
* H5 默认用 h5,按你们接口约定调整
*/
SYSTEM_SOURCE: "h5",
} as const;
......@@ -8,20 +8,20 @@ const router = useRouter();
const showTabBar = computed(() => route.meta.showTabBar !== false);
const tabList = [
{ name: "home", title: "首页", icon: "home-o", activeIcon: "home" },
{ name: "car-list", title: "找车", icon: "search", activeIcon: "search" },
{ name: "mine", title: "我的", icon: "contact-o", activeIcon: "contact" },
{ routeName: "Home", title: "检测工单", icon: "todo-list-o", activeIcon: "todo-list" },
{ routeName: "CarList", title: "检测报告", icon: "description", activeIcon: "description" },
{ routeName: "Mine", title: "我的", icon: "user-o", activeIcon: "user" },
];
const activeTab = computed(() => {
const name = route.name as string;
return tabList.findIndex((tab) => tab.name === name.toLowerCase());
const name = route.name as string | undefined;
return tabList.findIndex((tab) => tab.routeName === name);
});
function onTabChange(index: number) {
const tab = tabList[index];
if (tab) {
router.push({ name: tab.name.charAt(0).toUpperCase() + tab.name.slice(1) });
router.push({ name: tab.routeName });
}
}
</script>
......@@ -44,7 +44,7 @@ function onTabChange(index: number) {
</RouterView>
<van-tabbar v-if="showTabBar"
active-color="#ee0a24"
active-color="var(--color-primary)"
fixed
inactive-color="#7d7e80"
:model-value="activeTab"
......@@ -52,7 +52,7 @@ function onTabChange(index: number) {
safe-area-inset-bottom
@change="onTabChange">
<van-tabbar-item v-for="tab in tabList"
:key="tab.name"
:key="tab.routeName"
:icon="activeTab === tabList.indexOf(tab) ? tab.activeIcon : tab.icon">
{{ tab.title }}
</van-tabbar-item>
......
......@@ -6,17 +6,24 @@ import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
import App from "./App.vue";
import { fetchConfig } from "./config/center.ts";
import router from "./router";
import { initFlexible } from "./utils/flexible.ts";
import "@assets/styles/reset.scss";
import "@assets/styles/index.scss";
import "@assets/tailwind.css";
import "vant/es/toast/style";
import { useUserStore } from "@/stores/modules/user";
async function bootstrap() {
initFlexible();
await fetchConfig();
const app = createApp(App);
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
app.use(pinia);
app.use(router);
const userStore = useUserStore();
userStore.setToken("mock-token-123");
app.mount("#app");
}
......
......@@ -3,6 +3,7 @@ import { createRouter, createWebHistory } from "vue-router";
import { closeToast, showLoadingToast } from "vant";
import routes from "./routes.ts";
import { useUserStore } from "@stores/modules/user.ts";
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
......@@ -15,7 +16,12 @@ const router = createRouter({
},
});
router.beforeEach((to, _from, next) => {
// 不需要登录的白名单路由
const WHITE_LIST: string[] = ["/login"];
router.beforeEach((to, from, next) => {
const userStore = useUserStore();
showLoadingToast({
message: "加载中...",
forbidClick: true,
......@@ -27,7 +33,33 @@ router.beforeEach((to, _from, next) => {
document.title = `${to.meta.title} - ${import.meta.env.VITE_APP_TITLE}`;
}
next();
const hasToken = !!userStore.token;
// 1. 有 token 的情况
if (hasToken) {
// 已经登录还去登录页,直接跳到首页或来源页
if (to.path === "/login") {
next(from.path && from.path !== "/login" ? from.fullPath : "/home");
return;
}
next();
return;
}
// 2. 没有 token 的情况
if (WHITE_LIST.includes(to.path)) {
next();
return;
}
// 记录想去的地址,占个位:登录后再跳回来
next({
path: "/login",
query: {
redirect: to.fullPath,
},
});
});
router.afterEach(() => {
......
......@@ -2,6 +2,15 @@ import type { RouteRecordRaw } from "vue-router";
const routes: RouteRecordRaw[] = [
{
path: "/login",
name: "Login",
component: () => import("@views/login/index.vue"),
meta: {
title: "登录",
showTabBar: false,
},
},
{
path: "/",
component: () => import("@/layouts/index.vue"),
children: [
......@@ -14,7 +23,7 @@ const routes: RouteRecordRaw[] = [
name: "Home",
component: () => import("@views/home/index.vue"),
meta: {
title: "首页",
title: "检测工单",
keepAlive: true,
showTabBar: true,
},
......@@ -24,7 +33,7 @@ const routes: RouteRecordRaw[] = [
name: "CarList",
component: () => import("@views/car-list/index.vue"),
meta: {
title: "找车",
title: "检测报告",
keepAlive: true,
showTabBar: true,
},
......
/**
* glsk-oss-jssdk 类型声明
*/
declare module "glsk-oss-jssdk" {
export interface MultipartUploadResult {
aliyunAddress: string;
attachment: string;
size?: string;
[key: string]: any;
}
class GlOssApi {
multipartUpload(
file: File,
successCallback: (result: MultipartUploadResult) => void,
errCallBack: (error: Error) => void,
bucketName?: string,
dir?: string,
custAttrObj?: Record<string, any>,
compressObj?: Record<string, any>,
partSize?: number,
maxRetries?: number
): Promise<void> | void;
}
export default GlOssApi;
}
// 简易版 rem 适配:
// 以设计稿 375 宽为基准,希望设计稿下 html 字体为 14px。
// 不同屏幕下:html.fontSize = (当前宽度 / 375) * 14px。
const DESIGN_WIDTH = 375;
const BASE_FONT_SIZE = 14; // 设计稿宽度下的根字体大小
function setRootFontSize() {
const docEl = document.documentElement;
const width = docEl.clientWidth || window.innerWidth;
// 限制最大/最小宽度,防止在大屏或非常小的屏幕上过大/过小
const minWidth = 320;
const maxWidth = 540;
const clampedWidth = Math.min(Math.max(width, minWidth), maxWidth);
const fontSize = (clampedWidth / DESIGN_WIDTH) * BASE_FONT_SIZE;
docEl.style.fontSize = `${fontSize}px`;
}
export function initFlexible() {
if (typeof window === "undefined") return;
setRootFontSize();
window.addEventListener("resize", () => {
setRootFontSize();
});
window.addEventListener("pageshow", (event) => {
if (event.persisted) {
setRootFontSize();
}
});
}
import { getRequestApi } from "@/config/center.ts";
/**
* 请求封装 - 基于 glsk-toolkit Request
* 参考 gscrequest.ts 模式,Authorization 通过 center 拦截器统一处理
*/
import axios, { AxiosInstance, AxiosResponse } from "axios";
import { showToast } from "vant";
import { getConfig } from "@/config/center.ts";
export interface ApiResponse<T = unknown> {
code: number;
message: string;
data: T;
code: number;
message: string;
data: T;
}
export interface PageData<T = unknown> {
list: T[];
total: number;
page: number;
pageSize: number;
list: T[];
total: number;
page: number;
pageSize: number;
}
/** 请求配置 */
export interface RequestConfig {
params?: Record<string, unknown>;
headers?: Record<string, string>;
[key: string]: unknown;
params?: Record<string, unknown>;
headers?: Record<string, string>;
[key: string]: unknown;
}
function getInstance() {
const api = getRequestApi();
if (!api) {
throw new Error(
"[Request] API 实例未初始化,请确保 fetchConfig 已在 main.ts 中执行"
);
}
return api;
const TOKEN_KEY = "venus_usedcar_token";
const defaultBaseURL = import.meta.env.VITE_API_BASE_URL ?? "";
let axiosInstance: AxiosInstance | null = null;
function getToken(): string {
const token = localStorage.getItem(TOKEN_KEY);
return token ? `Bearer ${token}` : "";
}
function resolveBaseURL(): string {
const cfg = getConfig() as Record<string, unknown>;
const apiBaseUrl = (cfg.apiBaseUrl ??
(cfg.gsc as { baseUrl?: string; baseURL?: string })?.baseUrl ??
(cfg.gsc as { baseUrl?: string; baseURL?: string })?.baseURL) as
| string
| undefined;
return apiBaseUrl || defaultBaseURL || "/";
}
function getInstance(): AxiosInstance {
if (axiosInstance) return axiosInstance;
const baseURL = resolveBaseURL();
const instance = axios.create({
baseURL,
timeout: 15_000,
headers: {
"Content-Type": "application/json",
},
});
// 请求拦截:自动附带 Token
instance.interceptors.request.use(
(config) => {
const token = getToken();
if (token) {
config.headers = {
...(config.headers || {}),
Authorization: token,
} as typeof config.headers;
}
return config;
},
(error) => Promise.reject(error)
);
// 响应拦截:统一处理 HTTP 状态码
instance.interceptors.response.use(
(response) => response,
(error) => {
const status = error?.response?.status as number | undefined;
const msg =
error?.response?.data?.message ||
error?.message ||
"网络错误,请检查网络连接";
switch (status) {
case 401: {
showToast("登录已过期,请重新登录");
localStorage.removeItem(TOKEN_KEY);
window.location.href = "/login";
break;
}
case 403: {
showToast("暂无权限");
break;
}
case 500: {
showToast("服务器异常,请稍后重试");
break;
}
default: {
showToast(msg);
}
}
return Promise.reject(error);
}
);
axiosInstance = instance;
return instance;
}
/** 统一处理响应,提取 data 或按业务码处理 */
async function handleResponse<T>(promise: Promise<unknown>): Promise<T> {
async function handleResponse<T>(
promise: Promise<AxiosResponse<ApiResponse<T> | T>>
): Promise<T> {
const res = await promise;
const data = res as ApiResponse<T>;
if (data?.code === 200 || data?.code === 0) {
return (data.data ?? res) as T;
}
if (data?.code === undefined) {
return res as T;
const data = res.data as ApiResponse<T> | T;
// 兼容有业务 code 的返回
if (typeof data === "object" && data && "code" in data) {
const biz = data as ApiResponse<T>;
if (biz.code === 200 || biz.code === 0) {
return (biz.data ?? (data as unknown)) as T;
}
showToast(biz.message || "请求失败");
throw new Error(biz.message || "请求失败");
}
showToast(data?.message || "请求失败");
throw new Error(data?.message || "请求失败");
// 非标准结构,直接返回 data
return data as T;
}
function get<T = unknown>(
......
import GlOssApi from "glsk-oss-jssdk";
import { OSS_CONFIG } from "@/config/oss.ts";
let ossApi = null;
function getOssApi() {
if (!ossApi) ossApi = new GlOssApi();
return ossApi;
}
/**
* 使用 glsk-oss-jssdk 分片上传到 OSS。
*
* @param {File} file
* @param {{
* bucketName?: string,
* dir?: string,
* custAttrObj?: Record<string, any>,
* partSizeKB?: number,
* maxRetries?: number
* }} [options]
* @returns {Promise<any>} SDK 返回结果(含 aliyunAddress/attachment 等字段)
*/
export function uploadFile(file, options = {}) {
if (!file) return Promise.reject(new Error("file 不能为空"));
const api = getOssApi();
const bucketName = options.bucketName ?? OSS_CONFIG.BUCKET_NAME;
const dir = options.dir ?? OSS_CONFIG.FOLDER;
const custAttrObj =
options.custAttrObj ?? { systemSource: OSS_CONFIG.SYSTEM_SOURCE };
const partSizeKB = options.partSizeKB ?? 500;
const maxRetries = options.maxRetries ?? 3;
return new Promise((resolve, reject) => {
api.multipartUpload(
file,
(res) => resolve(res),
(err) => reject(err),
bucketName,
dir,
custAttrObj,
{},
partSizeKB,
maxRetries
);
});
}
/**
* 批量上传
* @param {File[]} files
* @param {Parameters<typeof uploadFile>[1]} [options]
*/
export function uploadFiles(files, options = {}) {
if (!Array.isArray(files) || files.length === 0) {
return Promise.reject(new Error("files 不能为空"));
}
return Promise.all(files.map((f) => uploadFile(f, options)));
}
<script setup lang="ts">
import { useLogin } from "./useLogin.ts";
const {
phone,
code,
agreed,
sending,
countdown,
hasSent,
handleSendCode,
handleLogin,
} = useLogin();
</script>
<template>
<div class="relative flex min-h-screen flex-col box-border bg-gradient-to-b from-[#f4f7ff] via-[#f7f9ff] to-white px-[32px] pb-6">
<div class="pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_0_0,#e4f0ff_0,transparent_50%),radial-gradient(circle_at_100%_0,#e1e8ff_0,transparent_50%)]" />
<div class="relative flex flex-1 flex-col mt-[160px]">
<div class="text-center text-[24px] font-semibold text-[#111]">
检测端登录
</div>
<div class="mt-[6px] text-center text-[12px] text-[#999]">
专业的车辆检测工具
</div>
<div class="mt-8 space-y-4">
<van-field v-model="phone"
class="rounded-full login-input"
clearable
label="手机号"
maxlength="11"
placeholder="请输入手机号"
type="tel" />
<van-field v-model="code"
class="rounded-full login-input"
clearable
label="验证码"
maxlength="6"
placeholder="请输入验证码"
type="tel">
<template #button>
<van-button class="p-0 text-[13px]"
:class="countdown > 0 ? '!text-[#CCCCCC]' : '!text-[#185EFE]'"
:disabled="sending || countdown > 0"
:loading="sending"
size="small"
@click="handleSendCode">
<span v-if="!hasSent">获取验证码</span>
<span v-else-if="countdown > 0">重新发送({{ countdown }}s)</span>
<span v-else>重新发送</span>
</van-button>
</template>
</van-field>
<van-button block
class="mt-6 !h-[52px] border-0 bg-gradient-to-r from-[#84a9ff] to-[#90b5ff] text-[16px] font-medium"
round
type="primary"
@click="handleLogin">
登录
</van-button>
<div class="absolute bottom-[70px] left-1/2 flex -translate-x-1/2 items-center justify-center text-[12px] text-[#999]">
<van-checkbox v-model="agreed"
checked-color="#4f8cff"
icon-size="14px">
<span class="whitespace-nowrap">
我已阅读并同意
<a class="mx-0.5 text-[#4f8cff] no-underline" href="javascript:;">《用户协议》</a>
<a class="mx-0.5 text-[#4f8cff] no-underline" href="javascript:;">《隐私协议》</a>
</span>
</van-checkbox>
</div>
</div>
</div>
</div>
</template>
<style scoped lang="scss">
.login-input {
padding: 16px !important;
background: #f2f4f7;
&:deep(.van-field__label) {
font-size: 14px;
font-weight: 500;
color: #333;
}
&:deep(.van-button--default) {
padding: 0;
font-size: 13px;
color: transparent;
background: transparent;
border: none;
}
}
</style>
<script setup lang="ts">
import { useLogin } from "./useLogin.ts";
const {
phone,
code,
agreed,
sending,
countdown,
hasSent,
handleSendCode,
handleLogin,
} = useLogin();
</script>
<template>
<div class="flex min-h-screen items-center justify-center pad">
<div class="relative flex ">
<div class="flex-1">
<div class="text-center text-[40px] font-semibold text-[#111]">
检测端登录
</div>
<div class="mt-2 text-center text-[16px] text-[#999]">
专业的车辆检测工具
</div>
<div class="mt-8 space-y-4">
<van-field v-model="phone"
class="rounded-full login-input"
clearable
label="手机号"
maxlength="11"
placeholder="请输入手机号"
type="tel" />
<van-field v-model="code"
class="rounded-full login-input"
clearable
label="验证码"
maxlength="6"
placeholder="请输入验证码"
type="tel">
<template #button>
<van-button class="p-0 text-[13px]"
:class="countdown > 0 ? '!text-[#CCCCCC]' : '!text-[#185EFE]'"
:disabled="sending || countdown > 0"
:loading="sending"
size="small"
@click="handleSendCode">
<span v-if="!hasSent">获取验证码</span>
<span v-else-if="countdown > 0">重新发送({{ countdown }}s)</span>
<span v-else>重新发送</span>
</van-button>
</template>
</van-field>
<van-button block
class="mt-6 !h-[52px] w-[83%] border-0 bg-gradient-to-r from-[#84a9ff] to-[#90b5ff] text-[16px] font-medium"
round
type="primary"
@click="handleLogin">
登录
</van-button>
<div class="mt-4 flex items-center justify-center text-[12px] text-[#999]">
<van-checkbox v-model="agreed"
checked-color="#4f8cff"
icon-size="14px">
<span class="whitespace-nowrap">
我已阅读并同意
<a class="mx-0.5 text-[#4f8cff] no-underline" href="javascript:;">《用户协议》</a>
<a class="mx-0.5 text-[#4f8cff] no-underline" href="javascript:;">《隐私协议》</a>
</span>
</van-checkbox>
</div>
</div>
</div>
</div>
</div>
</template>
<style scoped lang="scss">
.pad {
background: url('@assets/image/login_pad.png') no-repeat center center;
background-size: 100% 100%;
}
.login-input {
padding: 16px !important;
background: #f2f4f7;
&:deep(.van-field__label) {
font-size: 14px;
font-weight: 500;
color: #333;
}
&:deep(.van-button--default) {
height: auto !important;
padding: 0;
font-size: 13px;
color: transparent;
background: transparent;
border: none;
}
}
</style>
<script setup lang="ts">
import { useDeviceLayout } from "@/composables/useDeviceLayout";
import LoginMobile from "./LoginMobile.vue";
import LoginPad from "./LoginPad.vue";
const { isPad } = useDeviceLayout();
</script>
<template>
<LoginPad v-if="isPad" />
<LoginMobile v-else />
</template>
import { ref } from "vue";
import { useRoute, useRouter } from "vue-router";
import { showFailToast, showSuccessToast } from "vant";
import { login, sendSmsCode } from "@/api/modules/user.ts";
import { useUserStore } from "@/stores/modules/user.ts";
export function useLogin() {
const router = useRouter();
const route = useRoute();
const userStore = useUserStore();
const phone = ref("");
const code = ref("");
const agreed = ref(false);
const sending = ref(false);
const countdown = ref(0);
const hasSent = ref(false);
let timer: number | null = null;
const validPhone = (value: string) => /^1\d{10}$/.test(value);
const handleSendCode = async () => {
if (sending.value || countdown.value > 0) return;
if (!validPhone(phone.value)) {
showFailToast("请输入正确的手机号");
return;
}
try {
sending.value = true;
await sendSmsCode(phone.value);
showSuccessToast("验证码已发送");
hasSent.value = true;
countdown.value = 60;
timer && window.clearInterval(timer);
timer = window.setInterval(() => {
if (countdown.value <= 1) {
window.clearInterval(timer!);
timer = null;
countdown.value = 0;
sending.value = false;
} else {
countdown.value -= 1;
}
}, 1000);
} catch (error) {
console.error("sendSmsCode error", error);
sending.value = false;
showFailToast("验证码发送失败,请稍后重试");
}
};
const handleLogin = async () => {
if (!validPhone(phone.value)) {
showFailToast("请输入正确的手机号");
return;
}
if (!code.value) {
showFailToast("请输入验证码");
return;
}
if (!agreed.value) {
showFailToast("请先阅读并同意相关协议");
return;
}
try {
const res = await login({
phone: phone.value,
code: code.value,
});
userStore.setToken(res.token);
userStore.setUserInfo(res.userInfo);
showSuccessToast("登录成功");
const redirect = (route.query.redirect as string) || "/home";
router.replace(redirect);
} catch (error) {
console.error("login error", error);
showFailToast("登录失败,请稍后重试");
}
};
return {
phone,
code,
agreed,
sending,
countdown,
hasSent,
handleSendCode,
handleLogin,
};
}
......@@ -4,51 +4,6 @@ import { showToast } from "vant";
const userStore = useUserStore();
const menuList = [
{
title: "我的收藏",
icon: "star-o",
iconColor: "#ee0a24",
action: () => showToast("功能开发中"),
},
{
title: "浏览历史",
icon: "clock-o",
iconColor: "#1989fa",
action: () => showToast("功能开发中"),
},
{
title: "我的订单",
icon: "orders-o",
iconColor: "#07c160",
action: () => showToast("功能开发中"),
},
{
title: "消息通知",
icon: "bell",
iconColor: "#ff976a",
action: () => showToast("功能开发中"),
},
];
const settingList = [
{
title: "关于我们",
icon: "info-o",
action: () => showToast("功能开发中"),
},
{
title: "意见反馈",
icon: "comment-o",
action: () => showToast("功能开发中"),
},
{
title: "隐私政策",
icon: "shield-o",
action: () => showToast("功能开发中"),
},
];
function onLogin() {
showToast("登录功能开发中");
}
......@@ -61,113 +16,49 @@ async function onLogout() {
<template>
<div class="mine-page safe-bottom">
<!-- 用户信息 -->
<div class="mine-header">
<div class="header-bg" />
<div class="user-info">
<div class="user-row">
<van-image class="avatar"
fit="cover"
height="64"
height="44"
round
:src="userStore.userInfo?.avatar || ''"
width="64">
width="44"
@click="!userStore.isLoggedIn && onLogin()">
<template #error>
<van-icon color="#fff"
name="contact"
size="36" />
<van-icon color="#fff" name="contact" size="26" />
</template>
</van-image>
<div v-if="userStore.isLoggedIn" class="user-detail">
<p class="username">
<div class="user-text">
<div v-if="userStore.isLoggedIn" class="name">
{{ userStore.username }}
</p>
<p class="phone">
{{ userStore.userInfo?.phone }}
</p>
</div>
<div v-else
class="user-login"
@click="onLogin">
<p class="login-text">
</div>
<div v-else class="name" @click="onLogin">
点击登录
</p>
<p class="login-tip">
登录后享受更多服务
</p>
</div>
<div class="phone">
{{ userStore.isLoggedIn ? userStore.userInfo?.phone : "" }}
</div>
</div>
</div>
</div>
<!-- 数据统计 -->
<div class="mine-stats card">
<div class="stat-item" @click="showToast('功能开发中')">
<div class="stat-value">
0
</div>
<div class="stat-label">
收藏
</div>
</div>
<div class="stat-divider" />
<div class="stat-item" @click="showToast('功能开发中')">
<div class="stat-value">
0
</div>
<div class="stat-label">
浏览
</div>
<div class="avg-card card">
<div class="avg-label">
平均检测耗时
</div>
<div class="stat-divider" />
<div class="stat-item" @click="showToast('功能开发中')">
<div class="stat-value">
0
</div>
<div class="stat-label">
询价
</div>
<div class="avg-value">
2小时35分钟
</div>
</div>
<!-- 功能菜单 -->
<van-cell-group class="mine-menu" inset>
<van-cell v-for="item in menuList"
:key="item.title"
center
is-link
:title="item.title"
@click="item.action">
<template #icon>
<van-icon class="menu-icon"
:color="item.iconColor"
:name="item.icon"
size="20" />
</template>
</van-cell>
</van-cell-group>
<!-- 设置项 -->
<van-cell-group class="mine-settings" inset>
<van-cell v-for="item in settingList"
:key="item.title"
center
is-link
:title="item.title"
@click="item.action">
<template #icon>
<van-icon class="menu-icon"
color="#969799"
:name="item.icon"
size="20" />
</template>
</van-cell>
</van-cell-group>
<!-- 退出登录 -->
<div v-if="userStore.isLoggedIn" class="logout-btn">
<div class="logout-wrap">
<van-button block
color="#ee0a24"
plain
round
class="logout-btn"
@click="onLogout">
退出登录
</van-button>
......@@ -189,30 +80,31 @@ const __APP_VERSION__ = "1.0.0";
.mine-page {
min-height: 100vh;
background-color: var(--color-bg-page);
background: #f2f6fb;
}
.mine-header {
position: relative;
padding-bottom: 16px;
padding-bottom: 14px;
.header-bg {
position: absolute;
top: 0;
right: 0;
left: 0;
height: 120px;
background: linear-gradient(135deg, #ee0a24 0%, #ff5a5a 100%);
border-radius: 0 0 24px 24px;
height: 220px;
background:
radial-gradient(circle at 40px 40px, rgb(25 137 250 / 20%), transparent 60%),
linear-gradient(180deg, #eaf3ff 0%, rgb(234 243 255 / 0%) 100%);
}
.user-info {
.user-row {
position: relative;
z-index: 1;
display: flex;
gap: 14px;
gap: 12px;
align-items: center;
padding: 40px 20px 20px;
padding: 28px 18px 10px;
}
.avatar {
......@@ -220,86 +112,58 @@ const __APP_VERSION__ = "1.0.0";
flex-shrink: 0;
align-items: center;
justify-content: center;
background-color: rgb(255 255 255 / 20%);
border: 3px solid rgb(255 255 255 / 60%);
background-color: rgb(25 137 250 / 15%);
border: 2px solid rgb(25 137 250 / 25%);
border-radius: 50%;
}
.user-detail {
.username {
.user-text {
.name {
margin-bottom: 4px;
font-size: $font-size-lg;
font-size: 18px;
font-weight: 700;
color: #fff;
line-height: 1.2;
color: $color-text-primary;
}
.phone {
font-size: $font-size-sm;
color: rgb(255 255 255 / 80%);
}
}
.user-login {
cursor: pointer;
.login-text {
margin-bottom: 4px;
font-size: $font-size-lg;
font-weight: 700;
color: #fff;
}
.login-tip {
font-size: $font-size-sm;
color: rgb(255 255 255 / 80%);
min-height: 16px;
font-size: 13px;
color: $color-text-secondary;
}
}
}
.mine-stats {
display: flex;
align-items: center;
padding: 16px 0;
margin: 0 12px 12px;
border-radius: $radius-base;
.avg-card {
padding: 16px;
margin: 6px 12px 0;
border-radius: 10px;
.stat-item {
flex: 1;
text-align: center;
cursor: pointer;
.stat-value {
margin-bottom: 4px;
font-size: $font-size-xl;
font-weight: 700;
color: $color-text-primary;
}
.stat-label {
font-size: $font-size-xs;
color: $color-text-secondary;
}
.avg-label {
margin-bottom: 8px;
font-size: 13px;
color: $color-text-secondary;
}
.stat-divider {
width: 1px;
height: 32px;
background-color: $color-border;
.avg-value {
font-size: 24px;
font-weight: 800;
color: var(--color-primary);
letter-spacing: 0.5px;
}
}
.mine-menu,
.mine-settings {
margin-bottom: 12px;
.menu-icon {
margin-right: 10px;
}
.logout-wrap {
padding: 0 12px;
margin-top: auto;
}
.logout-btn {
padding: 0 12px;
margin-bottom: 16px;
height: 44px;
color: $color-text-primary;
background: #fff;
border: 0;
box-shadow: 0 1px 0 rgb(0 0 0 / 4%);
}
.app-version {
......
// 避免通过 workspace 包的 stub(dist) 再次触发 jiti(会和 tailwindcss 内部的 jiti 叠加导致递归/栈溢出)。
// 这里直接引用源配置,让 tailwindcss 自己的 jiti 只处理一次 TS。
export { default } from "../../../internal/tailwind-config/src/index";
......@@ -7,7 +7,12 @@
"skipLibCheck": true,
"strict": true
},
"files": [
"vite.config.ts",
"src/utils/upload.ts"
],
"include": [
"vite.config.ts"
"src/**/*.ts",
"src/**/*.d.ts"
]
}
......@@ -2,7 +2,6 @@ import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import vue from "@vitejs/plugin-vue";
import autoprefixer from "autoprefixer";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { VantResolver } from "unplugin-vue-components/resolvers";
......@@ -53,22 +52,6 @@ export default defineConfig(({ mode }) => {
api: "modern-compiler",
},
},
postcss: {
plugins: [
autoprefixer({
overrideBrowserslist: ["Android >= 4", "iOS >= 7", "Chrome >= 31"],
}),
pxToViewport({
viewportWidth: 375,
unitPrecision: 5,
viewportUnit: "vw",
fontViewportUnit: "vw",
selectorBlackList: [".ignore", ".hairlines", "html"],
minPixelValue: 1,
mediaQuery: false,
}),
],
},
},
server: {
......
packages:
- internal/lint-configs/prettier-config/plugin/*
- internal/*
- internal/lint-configs/*
- packages/*
- packages/@core/base/*
- packages/@core/ui-kit/*
- packages/@core/*
- packages/effects/*
- packages/business/*
- packages/cli/*
- packages/utils/*
- packages/common-ui/*
- packages/common-ui/vue-ui
- apps/*
- apps/miniprogram/**/*
- apps/web/**/*
- apps/uniapp/**/*
- apps/uniappX/*
- scripts/**/*
- docs
- example
- internal/lint-configs/prettier-config/plugin/*
- internal/*
- internal/lint-configs/*
- packages/*
- packages/@core/base/*
- packages/@core/ui-kit/*
- packages/@core/*
- packages/effects/*
- packages/business/*
- packages/cli/*
- packages/utils/*
- packages/common-ui/*
- packages/common-ui/vue-ui
- apps/*
- apps/miniprogram/**/*
- apps/web/**/*
- apps/uniapp/**/*
- apps/uniappX/*
- scripts/**/*
- docs
- example
catalog:
"eslint-plugin-wxml": ^0.8.0
"jsencrypt": ^3.3.1
"@ast-grep/napi": ^0.37.0
"@changesets/changelog-github": ^0.5.1
"@changesets/cli": ^2.29.5
"@changesets/git": ^3.0.4
"@clack/prompts": ^0.10.1
"@commitlint/cli": ^19.8.1
"@commitlint/config-conventional": ^19.8.1
"@ctrl/tinycolor": ^4.1.0
"@eslint/js": ^9.30.1
"@iconify/json": ^2.2.354
"@iconify/tailwind": ^1.2.0
"@manypkg/get-packages": ^3.0.0
"@playwright/test": ^1.53.2
"@stylistic/stylelint-plugin": ^3.1.3
"@tailwindcss/nesting": 0.0.0-insiders.565cd3e
"@tailwindcss/typography": ^0.5.16
"@types/eslint": ^9.6.1
"@types/node": ^24.9.2
"@types/postcss-import": ^14.0.3
"@types/sortablejs": ^1.15.8
"@typescript-eslint/eslint-plugin": ^8.35.1
"@typescript-eslint/parser": ^8.35.1
"@vitejs/plugin-vue": ^6.0.1
"@vitejs/plugin-vue-jsx": ^5.0.1
"@vue/test-utils": ^2.4.6
"@types/archiver": ^6.0.3
"@vueuse/core": ^13.4.0
glsk-oss-jssdk: ^1.0.6
react: ^18.2.0
react-dom: ^18.2.0
ant-design-vue: ^4.2.6
archiver: ^7.0.1
autoprefixer: ^10.4.21
axios: ^1.7.9
cac: ^6.7.14
chalk: ^5.4.1
circular-dependency-scanner: ^2.3.0
clsx: ^2.1.1
commitlint-plugin-function-rules: ^4.0.2
consola: ^3.4.2
cross-env: ^7.0.3
cspell: ^8.19.4
cssnano: ^7.0.7
cz-git: ^1.11.2
czg: ^1.11.1
dayjs: ^1.11.13
defu: ^6.1.4
depcheck: ^1.4.7
dotenv: ^16.6.1
"@element-plus/icons-vue": ^2.3.2
element-plus: ^2.11.9
eslint: ^9.30.1
eslint-config-turbo: ^2.5.4
eslint-plugin-command: ^3.3.1
eslint-plugin-eslint-comments: ^3.2.0
eslint-plugin-import-x: ^4.16.1
eslint-plugin-jsdoc: ^50.8.0
eslint-plugin-jsonc: ^2.20.1
eslint-plugin-n: ^17.20.0
eslint-plugin-no-only-tests: ^3.3.0
eslint-plugin-perfectionist: ^4.15.0
eslint-plugin-prettier: ^5.5.1
eslint-plugin-regexp: ^2.9.0
eslint-plugin-unicorn: ^59.0.1
eslint-plugin-unused-imports: ^4.1.4
"@wxml/parser": ^0.4.0
eslint-plugin-vitest: ^0.5.4
eslint-plugin-vue: ^10.2.0
execa: ^9.6.0
find-up: ^7.0.0
globals: ^16.3.0
glsk-toolkit: ^1.0.5
happy-dom: ^17.6.3
jsonc-eslint-parser: ^2.4.0
lefthook: ^1.11.14
lucide-vue-next: ^0.507.0
nprogress: ^0.2.0
ora: ^8.2.0
pinia: ^3.0.3
pinia-plugin-persistedstate: ^4.4.1
pkg-types: ^2.2.0
playwright: ^1.53.2
postcss: ^8.5.6
postcss-antd-fixes: ^0.2.0
postcss-html: ^1.8.0
postcss-import: ^16.1.1
postcss-preset-env: ^10.2.4
postcss-scss: ^4.0.9
prettier: ^3.6.2
prettier-plugin-tailwindcss: ^0.6.13
publint: ^0.3.12
qs: ^6.14.0
qiankun: ^2.10.16
radix-vue: ^1.9.17
rimraf: ^6.0.1
rollup: ^4.44.1
"@rollup/plugin-node-resolve": ^15.3.0
"@rollup/plugin-commonjs": ^28.0.1
"@rollup/plugin-terser": ^0.4.4
rollup-plugin-typescript2: ^0.36.0
rollup-plugin-vue: ^6.0.0
rollup-plugin-postcss: ^4.0.2
sass: ^1.89.2
scss: ^0.2.4
secure-ls: ^2.0.0
sortablejs: ^1.15.6
stylelint: ^16.21.0
stylelint-config-recess-order: ^6.1.0
stylelint-config-recommended: ^16.0.0
stylelint-config-recommended-scss: ^14.1.0
stylelint-config-recommended-vue: ^1.6.1
stylelint-config-standard: ^38.0.0
stylelint-order: ^7.0.0
stylelint-prettier: ^5.0.3
stylelint-scss: ^6.12.1
tailwindcss: ^3.4.17
tailwindcss-animate: ^1.0.7
turbo: ^2.5.4
typescript: ^5.8.3
unbuild: ^3.6.1
unplugin-auto-import: ^0.17.5
unplugin-element-plus: ^0.10.0
unplugin-vue-components: ^0.26.0
vite: ^7.1.2
vite-plugin-compression: ^0.5.1
vite-plugin-dts: ^4.5.4
vite-plugin-html: ^3.2.2
vite-plugin-lazy-import: ^1.0.7
vite-plugin-qiankun: ^1.0.15
vitepress: ^1.6.3
vitest: ^3.2.4
vue: ^3.5.17
vue-eslint-parser: ^10.2.0
vue-router: ^4.5.1
vue-tsc: 2.2.10
vue-demi: ^0.14.6
"@vue-office/excel": ^1.7.14
"@vue-office/docx": ^1.6.3
"@vue-office/pdf": ^2.0.10
"@vue-office/pptx": ^1.0.1
"@js-preview/excel": ^1.7.14
"@js-preview/pdf": ^2.0.10
vite-plugin-pwa: ^1.0.1
vite-plugin-vue-devtools: ^8.0.3
"@pnpm/workspace.read-manifest": ^1000.2.6
"@jspm/generator": ^2.6.2
"@intlify/unplugin-vue-i18n": ^6.0.8
get-port: ^7.1.0
nitropack: ^2.11.13
resolve.exports: ^2.0.3
cheerio: ^1.1.0
html-minifier-terser: ^7.2.0
"@js-preview/docx": ^1.6.4
"jiti": ^1.21.6
rollup-plugin-visualizer: ^5.14.0
"@types/html-minifier-terser": ^7.0.2
'@ast-grep/napi': ^0.37.0
'@changesets/changelog-github': ^0.5.1
'@changesets/cli': ^2.29.5
'@changesets/git': ^3.0.4
'@clack/prompts': ^0.10.1
'@commitlint/cli': ^19.8.1
'@commitlint/config-conventional': ^19.8.1
'@ctrl/tinycolor': ^4.1.0
'@element-plus/icons-vue': ^2.3.2
'@eslint/js': ^9.30.1
'@iconify/json': ^2.2.354
'@iconify/tailwind': ^1.2.0
'@intlify/unplugin-vue-i18n': ^6.0.8
'@js-preview/docx': ^1.6.4
'@js-preview/excel': ^1.7.14
'@js-preview/pdf': ^2.0.10
'@jspm/generator': ^2.6.2
'@manypkg/get-packages': ^3.0.0
'@playwright/test': ^1.53.2
'@pnpm/workspace.read-manifest': ^1000.2.6
'@rollup/plugin-commonjs': ^28.0.1
'@rollup/plugin-node-resolve': ^15.3.0
'@rollup/plugin-terser': ^0.4.4
'@stylistic/stylelint-plugin': ^3.1.3
'@tailwindcss/nesting': 0.0.0-insiders.565cd3e
'@tailwindcss/typography': ^0.5.16
'@types/archiver': ^6.0.3
'@types/eslint': ^9.6.1
'@types/html-minifier-terser': ^7.0.2
'@types/node': ^24.9.2
'@types/postcss-import': ^14.0.3
'@types/sortablejs': ^1.15.8
'@typescript-eslint/eslint-plugin': ^8.35.1
'@typescript-eslint/parser': ^8.35.1
'@vitejs/plugin-vue': ^6.0.1
'@vitejs/plugin-vue-jsx': ^5.0.1
'@vue-office/docx': ^1.6.3
'@vue-office/excel': ^1.7.14
'@vue-office/pdf': ^2.0.10
'@vue-office/pptx': ^1.0.1
'@vue/test-utils': ^2.4.6
'@vueuse/core': ^13.4.0
'@wxml/parser': ^0.4.0
ant-design-vue: ^4.2.6
archiver: ^7.0.1
autoprefixer: ^10.4.21
axios: ^1.7.9
cac: ^6.7.14
chalk: ^5.4.1
cheerio: ^1.1.0
circular-dependency-scanner: ^2.3.0
clsx: ^2.1.1
commitlint-plugin-function-rules: ^4.0.2
consola: ^3.4.2
cross-env: ^7.0.3
cspell: ^8.19.4
cssnano: ^7.0.7
cz-git: ^1.11.2
czg: ^1.11.1
dayjs: ^1.11.13
defu: ^6.1.4
depcheck: ^1.4.7
dotenv: ^16.6.1
element-plus: ^2.11.9
eslint: ^9.30.1
eslint-config-turbo: ^2.5.4
eslint-plugin-command: ^3.3.1
eslint-plugin-eslint-comments: ^3.2.0
eslint-plugin-import-x: ^4.16.1
eslint-plugin-jsdoc: ^50.8.0
eslint-plugin-jsonc: ^2.20.1
eslint-plugin-n: ^17.20.0
eslint-plugin-no-only-tests: ^3.3.0
eslint-plugin-perfectionist: ^4.15.0
eslint-plugin-prettier: ^5.5.1
eslint-plugin-regexp: ^2.9.0
eslint-plugin-unicorn: ^59.0.1
eslint-plugin-unused-imports: ^4.1.4
eslint-plugin-vitest: ^0.5.4
eslint-plugin-vue: ^10.2.0
eslint-plugin-wxml: ^0.8.0
execa: ^9.6.0
find-up: ^7.0.0
get-port: ^7.1.0
globals: ^16.3.0
glsk-oss-jssdk: 1.0.6
glsk-toolkit: ^1.0.5
happy-dom: ^17.6.3
html-minifier-terser: ^7.2.0
jiti: ^1.21.6
jsencrypt: ^3.3.1
jsonc-eslint-parser: ^2.4.0
lefthook: ^1.11.14
lucide-vue-next: ^0.507.0
nitropack: ^2.11.13
nprogress: ^0.2.0
ora: ^8.2.0
pinia: ^3.0.3
pinia-plugin-persistedstate: ^4.4.1
pkg-types: ^2.2.0
playwright: ^1.53.2
postcss: ^8.5.6
postcss-antd-fixes: ^0.2.0
postcss-html: ^1.8.0
postcss-import: ^16.1.1
postcss-preset-env: ^10.2.4
postcss-scss: ^4.0.9
prettier: ^3.6.2
prettier-plugin-tailwindcss: ^0.6.13
publint: ^0.3.12
qiankun: ^2.10.16
qs: ^6.14.0
radix-vue: ^1.9.17
react: ^18.2.0
react-dom: ^18.2.0
resolve.exports: ^2.0.3
rimraf: ^6.0.1
rollup: ^4.44.1
rollup-plugin-postcss: ^4.0.2
rollup-plugin-typescript2: ^0.36.0
rollup-plugin-visualizer: ^5.14.0
rollup-plugin-vue: ^6.0.0
sass: ^1.89.2
scss: ^0.2.4
secure-ls: ^2.0.0
sortablejs: ^1.15.6
stylelint: ^16.21.0
stylelint-config-recess-order: ^6.1.0
stylelint-config-recommended: ^16.0.0
stylelint-config-recommended-scss: ^14.1.0
stylelint-config-recommended-vue: ^1.6.1
stylelint-config-standard: ^38.0.0
stylelint-order: ^7.0.0
stylelint-prettier: ^5.0.3
stylelint-scss: ^6.12.1
tailwindcss: ^3.4.17
tailwindcss-animate: ^1.0.7
turbo: ^2.5.4
typescript: ^5.8.3
unbuild: ^3.6.1
unplugin-auto-import: ^0.17.5
unplugin-element-plus: ^0.10.0
unplugin-vue-components: ^0.26.0
vite: ^7.1.2
vite-plugin-compression: ^0.5.1
vite-plugin-dts: ^4.5.4
vite-plugin-html: ^3.2.2
vite-plugin-lazy-import: ^1.0.7
vite-plugin-pwa: ^1.0.1
vite-plugin-qiankun: ^1.0.15
vite-plugin-vue-devtools: ^8.0.3
vitepress: ^1.6.3
vitest: ^3.2.4
vue: ^3.5.17
vue-demi: ^0.14.6
vue-eslint-parser: ^10.2.0
vue-router: ^4.5.1
vue-tsc: 2.2.10
File mode changed
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!