-
@@ -31,6 +43,7 @@
&.active {
background-color: #1890ff;
+ transition: 300ms;
}
}
}
diff --git a/src/router/index.js b/src/router/index.js
index d5fd278..86ac836 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -14,7 +14,12 @@ const routes = [
path: '/home',
name: 'home',
component: () => import('@/views/home/index.vue'),
- }
+ },
+ {
+ path: '/order',
+ name: 'order',
+ component: () => import('@/views/order/index.vue'),
+ }
]
},
{
diff --git a/src/utils/axios.js b/src/utils/axios.js
index ba6cfca..b589d29 100644
--- a/src/utils/axios.js
+++ b/src/utils/axios.js
@@ -1,4 +1,7 @@
import axios from "axios";
+import { ElMessage } from "element-plus";
+import { useRouter } from "vue-router";
+import { useUserStore } from "../store/user";
const request = axios.create({
baseURL: import.meta.env.VITE_BASE_URL + '/api',
@@ -27,11 +30,34 @@ request.interceptors.request.use(
request.interceptors.response.use(
response => {
// 对响应数据做些什么,例如解析数据、统一处理错误等
+ if (response.data.status === 401 || response.data.status === 4000) {
+ const router = useRouter();
+ ElMessage({
+ message: response.data.message,
+ type: 'error',
+ })
+ setTimeout(() => {
+ const userStore = useUserStore();
+ userStore.setUserInfo({});
+ userStore.setToken('');
+ router.push('/login');
+ }, 1000);
+ }
+ if (response.data.status === 400) {
+ ElMessage({
+ message: response.data.message,
+ type: 'error',
+ })
+ }
return response.data;
},
error => {
// 处理响应错误
console.error(error);
+ ElMessage({
+ message: error,
+ type: 'error',
+ })
return Promise.reject(error);
}
);
diff --git a/src/views/home/component/order.vue b/src/views/home/component/order.vue
index bc2db2a..5cfd9a1 100644
--- a/src/views/home/component/order.vue
+++ b/src/views/home/component/order.vue
@@ -1,24 +1,48 @@
@@ -36,22 +69,22 @@ defineExpose({
-
+
-
很不错的商品名称很不错的商品名称很不错的商品名称很不错的商品名称
-
删除
+
{{ item.spu.store_name }}
+
删除
设备规格
-
¥100
-
+
¥{{ item.productAttr.price }}
+
@@ -59,7 +92,7 @@ defineExpose({