diff --git a/src/main/resources/zzz/src/services/authServices.js b/src/main/resources/zzz/src/services/authServices.js index b012884..e5e1828 100644 --- a/src/main/resources/zzz/src/services/authServices.js +++ b/src/main/resources/zzz/src/services/authServices.js @@ -19,7 +19,7 @@ export const authServices = { const requestData = { username: registerData.username, password: registerData.password, - userType: 'repairer', // 固定为repairer类型 + userType: 'repairman', // 固定为repairma 类型 repairmanId: registerData.repairmanId } diff --git a/src/main/resources/zzz/src/services/workOrderService.js b/src/main/resources/zzz/src/services/workOrderService.js new file mode 100644 index 0000000..c1419b2 --- /dev/null +++ b/src/main/resources/zzz/src/services/workOrderService.js @@ -0,0 +1,14 @@ +// src/services/workOrderService.js +import api from './api' + +export const workOrderService = { + // 获取我的工单 + async getMyOrders(repairmanId) { + try { + const response = await api.get(`/api/app/repairman/my-orders?repairmanId=${repairmanId}`) + return response.data + } catch (error) { + throw error.response?.data || error.message + } + } +} diff --git a/src/main/resources/zzz/src/stores/auth.js b/src/main/resources/zzz/src/stores/auth.js index 1e4c28f..fa8910e 100644 --- a/src/main/resources/zzz/src/stores/auth.js +++ b/src/main/resources/zzz/src/stores/auth.js @@ -35,10 +35,11 @@ export const useAuthStore = defineStore('auth', () => { return user.value?.userType || localStorage.getItem('userType') }) - // 获取维修人员ID - const getRepairmanId = computed(() => { - return user.value?.repairmanId || localStorage.getItem('repairmanId') - }) + // 获取维修人员ID +const getRepairmanId = computed(() => { + return user.value?.userId || localStorage.getItem('userId') // 使用userId而不是repairmanId +}) + // 登出 const logout = () => { diff --git a/src/main/resources/zzz/src/views/HomePage.vue b/src/main/resources/zzz/src/views/HomePage.vue index 219ee16..a6b810a 100644 --- a/src/main/resources/zzz/src/views/HomePage.vue +++ b/src/main/resources/zzz/src/views/HomePage.vue @@ -16,7 +16,7 @@
-
5
+
{{ processingOrders.length }}
待处理工单
@@ -41,20 +41,30 @@

待处理工单

-
-
紧急
-
-
制水机#A201 - TDS超标
-
教学楼A区 - 10分钟前
+
+
+ {{ getOrderPriorityText(order.priority) }}
-
-
-
一般
-
供水机#B105 - 水位异常
-
图书馆 - 25分钟前
+
{{ order.description || `工单#${order.orderId}` }}
+ +
{{ getTimeAgo(order.createdTime) }}
+ + +
+ 暂无待处理工单 +
+ + +
+ 加载中... +
@@ -77,14 +87,93 @@
- diff --git a/src/main/resources/zzz/src/views/LoginPage.vue b/src/main/resources/zzz/src/views/LoginPage.vue index 60f833f..e39b8a5 100644 --- a/src/main/resources/zzz/src/views/LoginPage.vue +++ b/src/main/resources/zzz/src/views/LoginPage.vue @@ -6,7 +6,7 @@ import { useAuthStore } from '@/stores/auth' const authStore = useAuthStore() const router = useRouter() -const usertype = ref('repairer') +const usertype = ref('repairman') const username = ref('') const password = ref('') const loading = ref(false) @@ -42,7 +42,7 @@ const handleLogin = async () => { username: result.data.username, userType: result.data.userType, userId: result.data.userId, - repairmanId: username.value + repairmanId: result.data.userId }, result.data.token); // 保存到本地存储 @@ -50,7 +50,7 @@ const handleLogin = async () => { localStorage.setItem('userId', result.data.userId); localStorage.setItem('username', result.data.username); localStorage.setItem('userType', result.data.userType); - localStorage.setItem('repairmanId', username.value); + localStorage.setItem('repairmanId', result.data.userId); alert('登录成功!'); router.push('/home');