diff --git a/dist.zip b/dist.zip index f65c86b..5f65097 100644 Binary files a/dist.zip and b/dist.zip differ diff --git a/src/router/mobile.js b/src/router/mobile.js index 8d88368..3967031 100644 --- a/src/router/mobile.js +++ b/src/router/mobile.js @@ -44,6 +44,12 @@ const mobileRoutes = [ component: () => import('/@/views/mobile/service/create.vue'), meta: { requiresAuth: true, mobileOnly: true } }, + { + path: '/mobile/service/detail', + name: 'MobileServiceDetail', + component: () => import('/@/views/mobile/service/detail.vue'), + meta: { requiresAuth: true, mobileOnly: true } + }, { path: '/mobile', redirect: '/mobile/login' @@ -84,7 +90,6 @@ function mobileRouteGuard(to, from, next) { next() } - // 导出移动端路由数组和守卫函数 export const mobileRouters = mobileRoutes -export { mobileRouteGuard } \ No newline at end of file +export { mobileRouteGuard } diff --git a/src/views/mobile/index.vue b/src/views/mobile/index.vue index 32f5862..0876ed9 100644 --- a/src/views/mobile/index.vue +++ b/src/views/mobile/index.vue @@ -102,7 +102,7 @@ async function getServiceList() { try { const res = await serviceApplicationsApi.queryPage({ pageNum: 1, - pageSize: 20 + pageSize: 10 }) if (res.code === 0) { @@ -127,26 +127,42 @@ function handleCreate() { // 查看详情 function viewDetail(item) { - // 这里可以跳转到详情页面或显示详情弹窗 console.log('查看申报详情:', item) - // router.push(`/mobile/service/detail/${item.id}`) + + // 判断状态:草稿状态(status=0)可以编辑,其他状态只能查看详情 + if (item.firmAuditStatus === 0) { + // 草稿状态:跳转到编辑页面 + router.push(`/mobile/service/create?applicationId=${item.applicationId}`) + } else { + // 其他状态:跳转到详情页面 + router.push(`/mobile/service/detail?applicationId=${item.applicationId}`) + } } // 退出登录 -function handleLogout() { - localStorage.removeItem('token') - localStorage.removeItem('userInfo') - router.push('/mobile/login') +async function handleLogout() { + try { + // 调用后端退出接口 + await loginApi.logout() + } catch (e) { + console.error('退出登录接口调用失败:', e) + // 即使接口调用失败,也要确保前端退出 + } finally { + // 前端状态清理 + localStorage.removeItem('token') + localStorage.removeItem('userInfo') + router.push('/mobile/login') + } } // 状态文本映射(与PC端保持一致) function getStatusText(status) { const statusMap = { - 0: '待审核', - 1: '审核通过', - 2: '审核拒绝', - 3: '已完成', - 4: '草稿' + 0: '未提交', + 1: '待审核', + 2: '审核中', + 3: '已通过', + 4: '驳回' } return statusMap[status] || '未知状态' } diff --git a/src/views/mobile/service/create.vue b/src/views/mobile/service/create.vue index dea2c7f..f245170 100644 --- a/src/views/mobile/service/create.vue +++ b/src/views/mobile/service/create.vue @@ -1,35 +1,383 @@ + + + + + + + ← + + + + 新建申报 + + + + + + + + + + + 一、基础信息 + + + + 姓名 + + + + + + 执业证号 + + + + + + 执业机构 + + + + + + 职务 + + 请选择职务 + + {{ position.positionName }} + + + + + + + + 二、服务信息 + + + + 服务开始时间 + + + + + + 服务结束时间 + + + + + + + 服务时长(小时) + 可通过时间选择也可手动填写 + + + 注:不足30分钟(不含本数)的,不计入时长,超过30分钟不足1个小时的(含本数),按照一个小时填报 + + + + + + 三、活动信息 + + + + 活动类型 + + 请选择活动类型 + + {{ category.categoryName }} + + + + + + + 活动名称 + + 请选择活动名称 + + {{ activity.goodsName }} + + + + + + + 参加人数(受益人数) + + + + + + 组织单位名称 + + + + + + 服务对象负责人/联系人姓名 + + + + + + 联系方式 + + + + + + 服务内容描述 + + + + + + + 四、证明材料 + + + 上传证明材料(最多5个文件) + + + + 注:(请上传活动方案、活动记录、照片、新闻报道等材料)支持图片(JPG/PNG)、文档(PDF/Word/PPT)格式,单文件最大10MB,最多上传5个文件 + + + + + {{ file.name || file.fileName || '未命名文件' }} + + 删除 + + + + + 证明材料已上传,但文件列表为空 + + + + + + + + 保存草稿 + + + 提交申报 + + + + + + + 处理中... + + + + \ No newline at end of file + +// 加载草稿数据 +async function loadDraftData(applicationId) { + loading.value = true + try { + const res = await serviceApplicationsApi.queryDetail(applicationId) + if (res.code === 0) { + // 将草稿数据合并到表单中 + Object.assign(form, res.data) + console.log('草稿数据加载成功:', res.data) + + // 如果有附件ID,则加载文件列表 + if (res.data.attachmentIds) { + await getFileListByAttachmentIds(res.data.attachmentIds) + } + + } else { + message.error(res.msg || '加载草稿数据失败') + } + } catch (error) { + console.error('加载草稿数据失败:', error) + message.error('网络错误,请稍后重试') + } finally { + loading.value = false + } +} + + // 根据attachmentIds获取文件列表 + async function getFileListByAttachmentIds(attachmentIds) { + try { + if (!attachmentIds || !attachmentIds.trim()) { + uploadedFiles.value = [] + return + } + + console.log('开始获取文件列表,attachmentIds:', attachmentIds) + + // 直接传递attachmentIds字符串,后端接口接收字符串参数 + const result = await fileApi.getFileList(attachmentIds) + console.log('文件列表API返回结果:', result) + + if (result.code === 0 && result.data && result.data.length > 0) { + // 将文件信息转换为移动端需要的格式 + uploadedFiles.value = result.data.map(file => ({ + id: file.id, + name: file.fileName || file.name || '未命名文件', + fileName: file.fileName || file.name || '未命名文件', + fileUrl: file.fileUrl, + fileSize: file.fileSize, + uploadTime: file.uploadTime + })) + + console.log('文件列表加载成功,文件数量:', uploadedFiles.value.length) + console.log('文件详情:', uploadedFiles.value) + } else { + uploadedFiles.value = [] + console.log('文件列表为空或获取失败') + } + } catch (error) { + console.error('获取文件列表失败:', error) + uploadedFiles.value = [] + message.error('获取文件列表失败') + } + } + + + \ No newline at end of file diff --git a/src/views/mobile/service/detail.vue b/src/views/mobile/service/detail.vue new file mode 100644 index 0000000..e596f02 --- /dev/null +++ b/src/views/mobile/service/detail.vue @@ -0,0 +1,812 @@ + + + + + + + ← + + + + {{ readonlyMode ? '申报详情' : '编辑申报' }} + + + + + + + + + + + 一、基础信息 + + + + 姓名 + + + + + + 执业证号 + + + + + + 执业机构 + + + + + + 职务 + + + + + + 请选择职务 + + {{ position.positionName }} + + + + + + + + + 二、服务信息 + + + + 服务开始时间 + + + + + + 服务结束时间 + + + + + + 服务时长(小时) + + + + + + + 三、活动信息 + + + + 活动类型 + + + + + + 请选择活动类型 + + {{ category.categoryName }} + + + + + + + + 活动名称 + + + + + + 请选择活动名称 + + {{ activity.goodsName }} + + + + + + + + 参加人数(受益人数) + + + + + + 组织单位名称 + + + + + + 服务对象负责人/联系人姓名 + + + + + + 联系方式 + + + + + + 服务内容描述 + + + {{ stripHtmlTags(form.serviceContent) || '无' }} + + + + + + + + + + + 四、证明材料 + + + + 证明材料 + + + {{ file.name || file.fileName || '未命名文件' }} + + + + 证明材料已上传,但文件列表为空 + + + 暂无证明材料 + + + + + + + 五、审核信息 + + + + + {{ getStatusText(form.firmAuditStatus) }} + + + + + + 审核意见 + + + + + + + + 返回 + + + + 保存草稿 + + + 提交申报 + + + + + + + + + + \ No newline at end of file