From 025bb05563f677232b87fef9b294b807cbe3a3af Mon Sep 17 00:00:00 2001 From: zeyan <258785420@qq.com> Date: Fri, 18 Jul 2025 09:45:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uniapp/api/apiRoute.js | 38 ++ uniapp/common/config.js | 4 +- uniapp/components/ChildSelector.vue | 214 +++++++ uniapp/mock/index.js | 212 ++++++- uniapp/pages.json | 76 ++- .../parent/contracts/contract-detail.vue | 177 ++++++ uniapp/pages/parent/contracts/index.vue | 296 +++++++++ uniapp/pages/parent/courses/course-detail.vue | 187 ++++++ uniapp/pages/parent/courses/index.vue | 330 ++++++++++ uniapp/pages/parent/materials/index.vue | 279 +++++++++ .../parent/materials/material-detail.vue | 181 ++++++ uniapp/pages/parent/messages/index.vue | 280 +++++++++ .../pages/parent/messages/message-detail.vue | 174 +++++ uniapp/pages/parent/orders/index.vue | 305 +++++++++ uniapp/pages/parent/orders/order-detail.vue | 182 ++++++ uniapp/pages/parent/services/index.vue | 279 +++++++++ .../pages/parent/services/service-detail.vue | 159 +++++ .../pages/parent/user-info/child-detail.vue | 308 +++++++++ uniapp/pages/parent/user-info/index.vue | 592 ++++++++++++++++++ uniapp/pages/student/login/login.vue | 23 +- uniapp/store/index.js | 23 + 21 files changed, 4310 insertions(+), 9 deletions(-) create mode 100644 uniapp/components/ChildSelector.vue create mode 100644 uniapp/pages/parent/contracts/contract-detail.vue create mode 100644 uniapp/pages/parent/contracts/index.vue create mode 100644 uniapp/pages/parent/courses/course-detail.vue create mode 100644 uniapp/pages/parent/courses/index.vue create mode 100644 uniapp/pages/parent/materials/index.vue create mode 100644 uniapp/pages/parent/materials/material-detail.vue create mode 100644 uniapp/pages/parent/messages/index.vue create mode 100644 uniapp/pages/parent/messages/message-detail.vue create mode 100644 uniapp/pages/parent/orders/index.vue create mode 100644 uniapp/pages/parent/orders/order-detail.vue create mode 100644 uniapp/pages/parent/services/index.vue create mode 100644 uniapp/pages/parent/services/service-detail.vue create mode 100644 uniapp/pages/parent/user-info/child-detail.vue create mode 100644 uniapp/pages/parent/user-info/index.vue diff --git a/uniapp/api/apiRoute.js b/uniapp/api/apiRoute.js index 567bc4e9..e9987d33 100644 --- a/uniapp/api/apiRoute.js +++ b/uniapp/api/apiRoute.js @@ -449,6 +449,44 @@ export default { return await http.post('/orderTable/add', data); }, + //↓↓↓↓↓↓↓↓↓↓↓↓-----家长接口相关-----↓↓↓↓↓↓↓↓↓↓↓↓ + // 获取家长下的孩子列表 + async parent_getChildrenList(data = {}) { + return await http.get('/parent/children', data); + }, + // 获取指定孩子的详细信息 + async parent_getChildInfo(data = {}) { + return await http.get('/parent/child/info', data); + }, + // 更新孩子信息 + async parent_updateChildInfo(data = {}) { + return await http.post('/parent/child/update', data); + }, + // 获取指定孩子的课程信息 + async parent_getChildCourses(data = {}) { + return await http.get('/parent/child/courses', data); + }, + // 获取指定孩子的订单信息 + async parent_getChildOrders(data = {}) { + return await http.get('/parent/child/orders', data); + }, + // 获取指定孩子的教学资料 + async parent_getChildMaterials(data = {}) { + return await http.get('/parent/child/materials', data); + }, + // 获取指定孩子的服务记录 + async parent_getChildServices(data = {}) { + return await http.get('/parent/child/services', data); + }, + // 获取指定孩子的消息记录 + async parent_getChildMessages(data = {}) { + return await http.get('/parent/child/messages', data); + }, + // 获取指定孩子的合同信息 + async parent_getChildContracts(data = {}) { + return await http.get('/parent/child/contracts', data); + }, + //↓↓↓↓↓↓↓↓↓↓↓↓-----学生接口相关-----↓↓↓↓↓↓↓↓↓↓↓↓ //学生登陆接口 async xy_login(data = {}) { diff --git a/uniapp/common/config.js b/uniapp/common/config.js index 44d4e8a0..accb611f 100644 --- a/uniapp/common/config.js +++ b/uniapp/common/config.js @@ -1,7 +1,7 @@ // 环境变量配置 const env = process.env.VUE_APP_ENV || 'development' -const isMockEnabled = process.env.VUE_APP_MOCK_ENABLED === 'true' -const isDebug = process.env.VUE_APP_DEBUG === 'true' +const isMockEnabled = process.env.VUE_APP_MOCK_ENABLED === 'true' || true // 默认启用Mock数据 +const isDebug = process.env.VUE_APP_DEBUG === 'true' || true // 默认启用调试模式 // API配置 - 支持环境变量 const Api_url = process.env.VUE_APP_API_URL || 'http://localhost:20080/api' diff --git a/uniapp/components/ChildSelector.vue b/uniapp/components/ChildSelector.vue new file mode 100644 index 00000000..428d5b46 --- /dev/null +++ b/uniapp/components/ChildSelector.vue @@ -0,0 +1,214 @@ + + + + + + \ No newline at end of file diff --git a/uniapp/mock/index.js b/uniapp/mock/index.js index 40f5868e..2329c02c 100644 --- a/uniapp/mock/index.js +++ b/uniapp/mock/index.js @@ -106,6 +106,105 @@ const mockData = { updated_at: '2024-01-01 10:00:00' }, + // 家长信息 (school_customer_resources) + parentInfo: { + id: 1001, + name: '张家长', + phone_number: '13800138000', + gender: 'male', + age: 35, + created_at: '2024-01-01 10:00:00', + updated_at: '2024-01-01 10:00:00' + }, + + // 孩子列表 (school_student) + childrenList: [ + { + id: 2001, + name: '张小明', + gender: 1, // 1男 2女 + age: 8.5, // 8岁5个月 + birthday: '2015-06-15', + user_id: 1001, // 关联家长ID + campus_id: 1, + campus_name: '总部校区', + class_id: 101, + class_name: '少儿篮球初级班', + note: '性格活泼,运动能力强', + status: 1, // 1有效 + emergency_contact: '张家长', + contact_phone: '13800138000', + member_label: '优秀学员', + consultant_id: '1', + coach_id: '1', + coach_name: '王教练', + created_at: '2024-01-01 10:00:00', + updated_at: '2024-01-01 10:00:00', + avatar: 'https://via.placeholder.com/100x100?text=张小明', + // 统计数据 + total_courses: 12, + completed_courses: 8, + remaining_courses: 4, + attendance_rate: 85.5 + }, + { + id: 2002, + name: '张小丽', + gender: 2, // 2女 + age: 6.2, // 6岁2个月 + birthday: '2017-10-20', + user_id: 1001, // 关联家长ID + campus_id: 2, + campus_name: '南山校区', + class_id: 102, + class_name: '少儿舞蹈基础班', + note: '喜欢舞蹈,有艺术天赋', + status: 1, // 1有效 + emergency_contact: '张家长', + contact_phone: '13800138000', + member_label: '新学员', + consultant_id: '2', + coach_id: '2', + coach_name: '李教练', + created_at: '2024-01-15 10:00:00', + updated_at: '2024-01-15 10:00:00', + avatar: 'https://via.placeholder.com/100x100?text=张小丽', + // 统计数据 + total_courses: 8, + completed_courses: 3, + remaining_courses: 5, + attendance_rate: 95.0 + }, + { + id: 2003, + name: '张小华', + gender: 1, // 1男 + age: 10.8, // 10岁8个月 + birthday: '2013-04-10', + user_id: 1001, // 关联家长ID + campus_id: null, // 未分配校区 + campus_name: '未分配', + class_id: null, // 未分配班级 + class_name: '未分配', + note: '刚报名,待安排班级', + status: 1, // 1有效 + emergency_contact: '张家长', + contact_phone: '13800138000', + member_label: '待分班', + consultant_id: '3', + coach_id: null, + coach_name: '未分配', + created_at: '2024-01-20 10:00:00', + updated_at: '2024-01-20 10:00:00', + avatar: 'https://via.placeholder.com/100x100?text=张小华', + // 统计数据 + total_courses: 0, + completed_courses: 0, + remaining_courses: 0, + attendance_rate: 0 + } + ], + // 学员信息 (xy_memberInfo) memberInfo: { id: 1001, @@ -380,6 +479,97 @@ class MockService { return patterns.some(pattern => endpoint.includes(pattern)) } + // 家长端API接口 + if (checkEndpoint(['/parent/children', 'parent_getChildrenList'])) { + return this.createResponse({ + data: mockData.childrenList, + total: mockData.childrenList.length, + parent_info: mockData.parentInfo + }, 1, 'success') + } + + // 获取指定孩子信息 + if (checkEndpoint(['/parent/child/info', 'parent_getChildInfo'])) { + const childId = params.child_id || params.id + const child = mockData.childrenList.find(item => item.id == childId) + return this.createResponse(child || {}, child ? 1 : 0, child ? 'success' : '孩子信息不存在') + } + + // 获取指定孩子的课程信息 + if (checkEndpoint(['/parent/child/courses', 'parent_getChildCourses'])) { + const childId = params.child_id || params.id + const child = mockData.childrenList.find(item => item.id == childId) + if (!child) { + return this.createResponse([], 0, '孩子信息不存在') + } + + // 模拟该孩子的课程数据 + const childCourses = [ + { + id: 1, + course_name: child.class_name || '未分配班级', + teacher_name: child.coach_name || '未分配', + campus_name: child.campus_name || '未分配', + schedule_time: '周六 09:00-10:30', + progress: `${child.completed_courses}/${child.total_courses}`, + status: child.class_id ? 'active' : 'inactive', + next_class: child.class_id ? '2024-01-20 09:00' : null + } + ] + + return this.createResponse({ + data: childCourses, + total: childCourses.length, + child_info: child + }, 1, 'success') + } + + // 获取指定孩子的订单信息 + if (checkEndpoint(['/parent/child/orders', 'parent_getChildOrders'])) { + const childId = params.child_id || params.id + const child = mockData.childrenList.find(item => item.id == childId) + if (!child) { + return this.createResponse([], 0, '孩子信息不存在') + } + + // 模拟该孩子的订单数据 + const childOrders = [ + { + id: 1001, + order_no: 'ORD202401001', + course_name: child.class_name || '课程包', + amount: 2880.00, + status: 'paid', + status_text: '已支付', + created_at: '2024-01-01 10:00:00', + pay_time: '2024-01-01 10:05:00' + } + ] + + return this.createResponse({ + data: childOrders, + total: childOrders.length, + child_info: child + }, 1, 'success') + } + + // 其他家长端API的Mock数据处理 + if (checkEndpoint(['/parent/child/materials', 'parent_getChildMaterials'])) { + return this.createResponse({ data: [], total: 0 }, 1, 'success') + } + + if (checkEndpoint(['/parent/child/services', 'parent_getChildServices'])) { + return this.createResponse({ data: [], total: 0 }, 1, 'success') + } + + if (checkEndpoint(['/parent/child/messages', 'parent_getChildMessages'])) { + return this.createResponse({ data: [], total: 0 }, 1, 'success') + } + + if (checkEndpoint(['/parent/child/contracts', 'parent_getChildContracts'])) { + return this.createResponse({ data: [], total: 0 }, 1, 'success') + } + // 学员信息 if (checkEndpoint(['/customerResourcesAuth/info', 'xy_memberInfo'])) { return this.createResponse(mockData.memberInfo, 1, 'success') @@ -498,6 +688,16 @@ class MockService { '/xy/personCourseSchedule', // xy_personCourseSchedule相关 '/xy/assignment', // xy_assignment相关 '/xy/login', // xy_login + // 家长端专用API - URL匹配 + '/parent/children', // parent_getChildrenList + '/parent/child/info', // parent_getChildInfo + '/parent/child/courses', // parent_getChildCourses + '/parent/child/orders', // parent_getChildOrders + '/parent/child/materials', // parent_getChildMaterials + '/parent/child/services', // parent_getChildServices + '/parent/child/messages', // parent_getChildMessages + '/parent/child/contracts', // parent_getChildContracts + '/parent/child/update', // parent_updateChildInfo // 学员端专用API - 方法名匹配(用于开发调试) 'xy_memberInfo', 'xy_physicalTest', @@ -507,7 +707,17 @@ class MockService { 'xy_assignmentSubmitObj', 'xy_personCourseScheduleGetCalendar', 'xy_personCourseScheduleGetMyCoach', - 'xy_login' + 'xy_login', + // 家长端专用API - 方法名匹配(用于开发调试) + 'parent_getChildrenList', + 'parent_getChildInfo', + 'parent_getChildCourses', + 'parent_getChildOrders', + 'parent_getChildMaterials', + 'parent_getChildServices', + 'parent_getChildMessages', + 'parent_getChildContracts', + 'parent_updateChildInfo' ] return mockableEndpoints.some(endpoint => url.includes(endpoint)) diff --git a/uniapp/pages.json b/uniapp/pages.json index 414fc2f5..98336c6d 100644 --- a/uniapp/pages.json +++ b/uniapp/pages.json @@ -761,10 +761,80 @@ "navigationBarBackgroundColor": "#292929", "navigationBarTextStyle": "white" } - } - + }, - + { + "path": "pages/parent/user-info/index", + "style": { + "navigationBarTitleText": "用户信息", + "navigationStyle": "custom", + "navigationBarBackgroundColor": "#29d3b4", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/parent/user-info/child-detail", + "style": { + "navigationBarTitleText": "孩子详情", + "navigationStyle": "default", + "navigationBarBackgroundColor": "#29d3b4", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/parent/courses/index", + "style": { + "navigationBarTitleText": "课程管理", + "navigationStyle": "default", + "navigationBarBackgroundColor": "#29d3b4", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/parent/materials/index", + "style": { + "navigationBarTitleText": "教学资料", + "navigationStyle": "default", + "navigationBarBackgroundColor": "#29d3b4", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/parent/services/index", + "style": { + "navigationBarTitleText": "服务管理", + "navigationStyle": "default", + "navigationBarBackgroundColor": "#29d3b4", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/parent/orders/index", + "style": { + "navigationBarTitleText": "订单管理", + "navigationStyle": "default", + "navigationBarBackgroundColor": "#29d3b4", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/parent/messages/index", + "style": { + "navigationBarTitleText": "消息管理", + "navigationStyle": "default", + "navigationBarBackgroundColor": "#29d3b4", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/parent/contracts/index", + "style": { + "navigationBarTitleText": "合同管理", + "navigationStyle": "default", + "navigationBarBackgroundColor": "#29d3b4", + "navigationBarTextStyle": "white" + } + } ], "globalStyle": { diff --git a/uniapp/pages/parent/contracts/contract-detail.vue b/uniapp/pages/parent/contracts/contract-detail.vue new file mode 100644 index 00000000..3b445110 --- /dev/null +++ b/uniapp/pages/parent/contracts/contract-detail.vue @@ -0,0 +1,177 @@ + + + + + + \ No newline at end of file diff --git a/uniapp/pages/parent/contracts/index.vue b/uniapp/pages/parent/contracts/index.vue new file mode 100644 index 00000000..c7a6c818 --- /dev/null +++ b/uniapp/pages/parent/contracts/index.vue @@ -0,0 +1,296 @@ + + + + + + \ No newline at end of file diff --git a/uniapp/pages/parent/courses/course-detail.vue b/uniapp/pages/parent/courses/course-detail.vue new file mode 100644 index 00000000..9545e57c --- /dev/null +++ b/uniapp/pages/parent/courses/course-detail.vue @@ -0,0 +1,187 @@ + + + + + + \ No newline at end of file diff --git a/uniapp/pages/parent/courses/index.vue b/uniapp/pages/parent/courses/index.vue new file mode 100644 index 00000000..3be9903c --- /dev/null +++ b/uniapp/pages/parent/courses/index.vue @@ -0,0 +1,330 @@ + + + + + + \ No newline at end of file diff --git a/uniapp/pages/parent/materials/index.vue b/uniapp/pages/parent/materials/index.vue new file mode 100644 index 00000000..f02b381f --- /dev/null +++ b/uniapp/pages/parent/materials/index.vue @@ -0,0 +1,279 @@ + + + + + + \ No newline at end of file diff --git a/uniapp/pages/parent/materials/material-detail.vue b/uniapp/pages/parent/materials/material-detail.vue new file mode 100644 index 00000000..f85b09e0 --- /dev/null +++ b/uniapp/pages/parent/materials/material-detail.vue @@ -0,0 +1,181 @@ + + + + + + \ No newline at end of file diff --git a/uniapp/pages/parent/messages/index.vue b/uniapp/pages/parent/messages/index.vue new file mode 100644 index 00000000..71958b6c --- /dev/null +++ b/uniapp/pages/parent/messages/index.vue @@ -0,0 +1,280 @@ + + + + + + \ No newline at end of file diff --git a/uniapp/pages/parent/messages/message-detail.vue b/uniapp/pages/parent/messages/message-detail.vue new file mode 100644 index 00000000..4e093ff3 --- /dev/null +++ b/uniapp/pages/parent/messages/message-detail.vue @@ -0,0 +1,174 @@ + + + + + + \ No newline at end of file diff --git a/uniapp/pages/parent/orders/index.vue b/uniapp/pages/parent/orders/index.vue new file mode 100644 index 00000000..a6e207f5 --- /dev/null +++ b/uniapp/pages/parent/orders/index.vue @@ -0,0 +1,305 @@ + + + + + + \ No newline at end of file diff --git a/uniapp/pages/parent/orders/order-detail.vue b/uniapp/pages/parent/orders/order-detail.vue new file mode 100644 index 00000000..95283255 --- /dev/null +++ b/uniapp/pages/parent/orders/order-detail.vue @@ -0,0 +1,182 @@ + + + + + + \ No newline at end of file diff --git a/uniapp/pages/parent/services/index.vue b/uniapp/pages/parent/services/index.vue new file mode 100644 index 00000000..4a34f552 --- /dev/null +++ b/uniapp/pages/parent/services/index.vue @@ -0,0 +1,279 @@ + + + + + + \ No newline at end of file diff --git a/uniapp/pages/parent/services/service-detail.vue b/uniapp/pages/parent/services/service-detail.vue new file mode 100644 index 00000000..1ac6537e --- /dev/null +++ b/uniapp/pages/parent/services/service-detail.vue @@ -0,0 +1,159 @@ + + + + + + \ No newline at end of file diff --git a/uniapp/pages/parent/user-info/child-detail.vue b/uniapp/pages/parent/user-info/child-detail.vue new file mode 100644 index 00000000..4f1f9cdf --- /dev/null +++ b/uniapp/pages/parent/user-info/child-detail.vue @@ -0,0 +1,308 @@ + + + + + + \ No newline at end of file diff --git a/uniapp/pages/parent/user-info/index.vue b/uniapp/pages/parent/user-info/index.vue new file mode 100644 index 00000000..e719439a --- /dev/null +++ b/uniapp/pages/parent/user-info/index.vue @@ -0,0 +1,592 @@ + + + + + + \ No newline at end of file diff --git a/uniapp/pages/student/login/login.vue b/uniapp/pages/student/login/login.vue index 20d7d67d..b0333416 100644 --- a/uniapp/pages/student/login/login.vue +++ b/uniapp/pages/student/login/login.vue @@ -158,9 +158,26 @@ //员工登录 res = await apiRoute.personnelLogin(params); } else { - //学生 - //res = await apiRoute.xy_login(params); - this.openViewHome(); + //学生登录 - 直接跳转到家长端用户信息页面 + uni.showToast({ + title: '登录成功', + icon: 'success' + }); + + // 模拟设置用户信息和token + uni.setStorageSync("token", "mock_token_" + Date.now()); + uni.setStorageSync("userType", "4"); + uni.setStorageSync("userInfo", { + id: 1001, + name: this.user, + phone: this.user, + role: 'parent' + }); + + // 直接跳转到家长端用户信息页面 + uni.redirectTo({ + url: '/pages/parent/user-info/index' + }); return; } diff --git a/uniapp/store/index.js b/uniapp/store/index.js index 76b8f4a6..3ffbf850 100644 --- a/uniapp/store/index.js +++ b/uniapp/store/index.js @@ -24,6 +24,10 @@ const store = new Vuex.Store({ }], address: {}, remark: '不打包', + // 家长端状态管理 + userRole: 'parent', // 用户角色: parent-家长, student-学生 + childrenList: [], // 孩子列表 + selectedChild: null, // 当前选中的孩子 }, mutations: { SET_ORDER_TYPE(state, orderType) { @@ -44,6 +48,25 @@ const store = new Vuex.Store({ setCarbarData(state, data) { state.carbarData = data }, + // 家长端状态管理mutations + SET_USER_ROLE(state, userRole) { + state.userRole = userRole + }, + SET_CHILDREN_LIST(state, childrenList) { + state.childrenList = childrenList + }, + SET_SELECTED_CHILD(state, selectedChild) { + state.selectedChild = selectedChild + }, + // 添加或更新孩子信息 + UPDATE_CHILD_INFO(state, childInfo) { + const index = state.childrenList.findIndex(child => child.id === childInfo.id) + if (index !== -1) { + state.childrenList.splice(index, 1, childInfo) + } else { + state.childrenList.push(childInfo) + } + }, }, })