diff --git a/backend/ngrok.exe b/backend/ngrok.exe deleted file mode 100644 index 74ac2c3..0000000 Binary files a/backend/ngrok.exe and /dev/null differ diff --git a/insurance_admin-system/src/router/index.js b/insurance_admin-system/src/router/index.js index 24e4bd7..945ec70 100644 --- a/insurance_admin-system/src/router/index.js +++ b/insurance_admin-system/src/router/index.js @@ -175,7 +175,7 @@ const routes = [ ] const router = createRouter({ - history: createWebHistory(), + history: createWebHistory('/insurance/'), routes }) diff --git a/insurance_admin-system/src/utils/api.js b/insurance_admin-system/src/utils/api.js index 7d1ed54..b9af461 100644 --- a/insurance_admin-system/src/utils/api.js +++ b/insurance_admin-system/src/utils/api.js @@ -58,6 +58,8 @@ export const applicationAPI = { export const policyAPI = { getList: (params) => api.get('/policies', { params }), getDetail: (id) => api.get(`/policies/${id}`), + create: (data) => api.post('/policies', data), + update: (id, data) => api.put(`/policies/${id}`, data), updateStatus: (id, data) => api.put(`/policies/${id}/status`, data), delete: (id) => api.delete(`/policies/${id}`) } diff --git a/insurance_admin-system/src/utils/request.js b/insurance_admin-system/src/utils/request.js index c4c7ced..10135da 100644 --- a/insurance_admin-system/src/utils/request.js +++ b/insurance_admin-system/src/utils/request.js @@ -164,6 +164,31 @@ const fetchRequest = async (url, options = {}) => { // 设置默认请求头 options.headers = createHeaders(options.headers) + // ========== 请求前日志 ========== + try { + const hasAuth = !!options.headers?.Authorization + const contentType = options.headers?.['Content-Type'] + const acceptType = options.headers?.['Accept'] + let bodyPreview = null + if (options.body) { + try { + bodyPreview = JSON.stringify(JSON.parse(options.body)) + } catch (_) { + bodyPreview = String(options.body).slice(0, 1000) + } + } + console.log('🔶 [前端] 准备发起请求', { + method: options.method || 'GET', + url: fullUrl, + hasAuthorization: hasAuth ? '是' : '否', + contentType, + acceptType, + bodyPreview + }) + } catch (logError) { + console.warn('记录请求前日志失败:', logError) + } + // 设置超时 const controller = new AbortController() const timeoutId = setTimeout(() => controller.abort(), API_CONFIG.timeout) @@ -172,10 +197,66 @@ const fetchRequest = async (url, options = {}) => { try { const response = await fetch(fullUrl, options) clearTimeout(timeoutId) - return await handleResponse(response) + + // ========== 原始响应日志 ========== + try { + console.log('🟩 [前端] 收到原始响应', { + status: response.status, + statusText: response.statusText, + url: fullUrl, + ok: response.ok, + contentType: response.headers.get('content-type') + }) + } catch (respLogErr) { + console.warn('记录原始响应日志失败:', respLogErr) + } + + const result = await handleResponse(response) + + // ========== 处理后响应日志 ========== + try { + const safeData = (() => { + try { + return typeof result.data === 'string' ? result.data.slice(0, 1000) : JSON.stringify(result.data).slice(0, 1000) + } catch (_) { + return '[不可序列化数据]' + } + })() + console.log('✅ [前端] 请求成功', { + url: fullUrl, + method: options.method || 'GET', + status: result.status, + statusText: result.statusText, + dataPreview: safeData + }) + } catch (resLogErr) { + console.warn('记录处理后响应日志失败:', resLogErr) + } + + return result } catch (error) { clearTimeout(timeoutId) + // ========== 错误日志 ========== + try { + console.error('❌ [前端] 请求失败', { + url: fullUrl, + method: options.method || 'GET', + message: error.message, + name: error.name, + responseStatus: error.response?.status, + responseDataPreview: (() => { + try { + return JSON.stringify(error.response?.data).slice(0, 1000) + } catch (_) { + return String(error.response?.data || '') + } + })() + }) + } catch (errLogErr) { + console.warn('记录错误日志失败:', errLogErr) + } + // 处理401错误 if (error.response?.status === 401) { const errorCode = error.response?.data?.code diff --git a/insurance_admin-system/src/views/InsuranceTypeManagement.vue b/insurance_admin-system/src/views/InsuranceTypeManagement.vue index 6482fbb..1d2f906 100644 --- a/insurance_admin-system/src/views/InsuranceTypeManagement.vue +++ b/insurance_admin-system/src/views/InsuranceTypeManagement.vue @@ -6,7 +6,7 @@ > - + 新增险种 @@ -17,19 +17,21 @@ - + 搜索 - + 重置 @@ -45,30 +47,32 @@ :pagination="pagination" @change="handleTableChange" :scroll="{ x: 1500 }" + :rowKey="getRowKey" > handleToggleOnSaleStatus(record, checked)" checked-children="在售" un-checked-children="停售" /> - {{ formatApplicableLivestock(record.applicable_livestock) }} + {{ formatApplicableLivestock(record.applicable_livestock) }} - {{ formatCoverageAmount(record.coverage_amount_min, record.coverage_amount_max) }} + {{ formatCoverageAmount(record.coverage_amount_min, record.coverage_amount_max) }} - {{ record.insurance_term ? `${record.insurance_term}个月` : '-' }} + {{ record.insurance_term ? `${record.insurance_term}个月` : '-' }} - {{ record.created_at ? formatDate(record.created_at) : '-' }} + {{ record.created_at ? formatDate(record.created_at) : '-' }} - + 编辑 详情 + + {{ getDefaultCellText(column, record) }} + @@ -90,9 +97,11 @@ :title="isEdit ? '编辑险种' : '新增险种'" :ok-text="isEdit ? '更新' : '创建'" cancel-text="取消" + :confirmLoading="submitLoading" @ok="handleSubmit" @cancel="handleCancel" width="1000px" + :destroyOnClose="true" > - + 牛 羊 @@ -135,9 +154,12 @@ 1个月 3个月 @@ -150,15 +172,25 @@ - + 电子保单 纸质保单 @@ -173,12 +205,14 @@ @@ -199,20 +235,38 @@ + + + + + + + @@ -227,6 +281,7 @@ title="险种详情" :footer="null" width="800px" + :destroyOnClose="true" > @@ -264,7 +319,7 @@ + + + + + + + ‹ + 电子围栏 + + + 显示牧场 + ⚙ + — + ⊙ + + + + + + + + + + + + 智能采集器:4 + 智能设备:4 + + + 各德 + 设备:24065000912更多>> + + 切换地图 + + + + + ↻ + + + + + + + + 新增围栏 + × + + + + + + 围栏名称 + 类型:- + 面积:- + 状态:- + 描述:- + + + 编辑 + 删除 + + + + + + + 围栏名称 + + + + + 围栏类型 + + 放牧围栏 + 禁入围栏 + 安全围栏 + 监控围栏 + + + + + 描述 + + + + + 坐标点 (点击地图添加) + + + 点击地图添加坐标点 + + + + + + 取消 + 保存围栏 + + + + + + + 加载中... + + + + + +
类型:-
面积:-
状态:-
描述:-