diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..115cc02 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,31 @@ +/* + * Eslint config file + * Documentation: https://eslint.org/docs/user-guide/configuring/ + * Install the Eslint extension before using this feature. + */ +module.exports = { + env: { + es6: true, + browser: true, + node: true, + }, + ecmaFeatures: { + modules: true, + }, + parserOptions: { + ecmaVersion: 2018, + sourceType: 'module', + }, + globals: { + wx: true, + App: true, + Page: true, + getCurrentPages: true, + getApp: true, + Component: true, + requirePlugin: true, + requireMiniProgram: true, + }, + // extends: 'eslint:recommended', + rules: {}, +} diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 549e00a..0000000 --- a/.gitignore +++ /dev/null @@ -1,33 +0,0 @@ -HELP.md -target/ -!.mvn/wrapper/maven-wrapper.jar -!**/src/main/**/target/ -!**/src/test/**/target/ - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ -build/ -!**/src/main/**/build/ -!**/src/test/**/build/ - -### VS Code ### -.vscode/ diff --git a/Airtraffic/Airtraffic.js b/Airtraffic/Airtraffic.js new file mode 100644 index 0000000..b56870c --- /dev/null +++ b/Airtraffic/Airtraffic.js @@ -0,0 +1,509 @@ +// pages/Airtraffic/Airtraffic.js +Page({ + data: { + name:'Airtraffic', + selectedTime: '--时--分', + selectedDate: '--年--月--日', + selectedIndex1: 0, + selectedIndex2: 0, + selectedIndex4: 0, + selectedIndex5: 0, + selectedIndex7: 0, + selectedIndex8: 0, + selectedIndex9: 0, + selectedIndex10: 0, + selectedIndex11: 0, + selectedIndex12: 0, + selectedIndex13: 0, + selectedIndex14: 0, + selectedIndex15: 0, + selectedIndex16: 0, + selectedIndex100: 0, + selectedIndex101: 0, + selectedIndex102: 0, + selectedIndex103: 0, + selectedIndex104: 0, + selectedIndex105: 0, + selectedIndex106: 0, + selectedIndex107: 0, + inputValue1: '', + inputValue2: '', + inputValue3: '', + inputValue6: '', + inputValue7: '', + inputValue8: '', + inputValue15: '', + inputValue16: '', + inputValue20: '', + inputValue21: '', + inputValue22: '', + inputValue23: '', + inputValue100: '', + inputValue101: '', + inputValue102: '', + timezones: ['请选择','UTC-12:00', 'UTC-11:00', 'UTC-10:00', 'UTC-9:00', 'UTC-8:00', 'UTC-7:00', 'UTC-6:00', 'UTC-5:00', 'UTC-4:00', 'UTC-3:00', 'UTC-2:00', 'UTC-1:00', 'UTC+0:00', 'UTC+1:00', 'UTC+2:00', 'UTC+3:00', 'UTC+4:00', 'UTC+5:00', 'UTC+6:00', 'UTC+7:00', 'UTC+8:00', 'UTC+9:00', 'UTC+10:00', 'UTC+11:00', 'UTC+12:00'], + workposition:['请选择','区域','进近','塔台','管掉','总调','报告室','其他'], + License:['请选择','私用驾驶员执照','商用驾驶员执照','航线运输驾驶员执照','临时执照','无','其它'], + ACFT:['请选择','飞机','直升机','滑翔机','其它'], + controlledairspace:['请选择','A类空域','B类空域','C类空域','D类空域'], + task:['请选择','客运','货运','训练','检查','调机','通用飞行','其它'], + plan:['请选择','目视飞行计划','仪表飞行计划','其它'], + phase:['请选择','地面/滑行','起飞','爬升','巡航/作业','下降','进近','复飞','着陆','其它'], + weather:['请选择','IMC','VMC','雷暴','风切变','紊流','结冰','雨','雪','雾','多云','其它'], + lv:['请选择','黎明','昼间','黄昏/曙暮光','夜间/月光','夜间/黑暗','未知'], + ATS:['请选择','塔台管制席','地面管制席','主任管制席','助理管制席','程序管制席','雷达管制席','通报协调席','放行许可席','其它'], + ATC:['请选择','雷达管制','程序管制','雷达监视下的程序管制','其它'], + TCAS:['请选择','是','否'], + Advise:['请选择','是','否'], + }, + //时间选择 + onTimeChange: function (event) { + this.setData({ + selectedTime: event.detail.value + }); + }, + onTimezoneChange: function (event) { + this.setData({ + selectedIndex1: event.detail.value + }); + }, + onDateChange: function(e) { + this.setData({ + selectedDate: e.detail.value + }); + }, + //工作时间选择 + onInput1: function(event) { + this.setData({ + inputValue1: event.detail.value + }); + }, + onInput2: function(event) { + this.setData({ + inputValue2: event.detail.value + }); + }, + onInput3: function(event) { + this.setData({ + inputValue3: event.detail.value + }); + }, + //岗位选择 + onworkposition: function (event) { + this.setData({ + selectedIndex2: event.detail.value + }); + }, + //工作经历 + onInput15: function(event) { + this.setData({ + inputValue15: event.detail.value + }); + }, + onInput16: function(event) { + this.setData({ + inputValue16: event.detail.value + }); + }, + //执照选择 + onLicense: function(event) { + this.setData({ + selectedIndex4: event.detail.value + }); + }, + //管制席位 + onATS: function (event) { + this.setData({ + selectedIndex12: event.detail.value + }); + }, + //管制类型 + onATC: function (event) { + this.setData({ + selectedIndex13: event.detail.value + }); + }, + //管制空域 + onControlledairspace: function (event) { + this.setData({ + selectedIndex16: event.detail.value + }); + }, + + //航空器一 + //航空器种类 + onACFT: function(event) { + this.setData({ + selectedIndex5: event.detail.value + }); + }, + //任务 + ontask: function(event) { + this.setData({ + selectedIndex7: event.detail.value + }); + }, + //计划 + onplan: function(event) { + this.setData({ + selectedIndex8: event.detail.value + }); + }, + //飞行阶段 + onphase: function(event) { + this.setData({ + selectedIndex9: event.detail.value + }); + }, + //飞行高度 + onInput6: function(event) { + this.setData({ + inputValue6: event.detail.value + }); + }, + //天气 + onweather: function(event) { + this.setData({ + selectedIndex10: event.detail.value + }); + }, + //光线条件和能见度 + onlv: function(event) { + this.setData({ + selectedIndex11: event.detail.value + }); + }, + onInput7: function(event) { + this.setData({ + inputValue7: event.detail.value + }); + }, + onInput8: function(event) { + this.setData({ + inputValue8: event.detail.value + }); + }, + //TCAS + onTCAS: function (event) { + this.setData({ + selectedIndex14: event.detail.value + }); + }, + //Advise + onAdvise: function (event) { + this.setData({ + selectedIndex15: event.detail.value + }); + }, + + //航空器二 + //航空器种类 + onACFT0: function(event) { + this.setData({ + selectedIndex100: event.detail.value + }); + }, + //任务 + ontask0: function(event) { + this.setData({ + selectedIndex101: event.detail.value + }); + }, + //计划 + onplan0: function(event) { + this.setData({ + selectedIndex102: event.detail.value + }); + }, + //飞行阶段 + onphase0: function(event) { + this.setData({ + selectedIndex103: event.detail.value + }); + }, + //飞行高度 + onInput100: function(event) { + this.setData({ + inputValue100: event.detail.value + }); + }, + //天气 + onweather0: function(event) { + this.setData({ + selectedIndex104: event.detail.value + }); + }, + //光线条件和能见度 + onlv0: function(event) { + this.setData({ + selectedIndex105: event.detail.value + }); + }, + onInput101: function(event) { + this.setData({ + inputValue101: event.detail.value + }); + }, + onInput102: function(event) { + this.setData({ + inputValue102: event.detail.value + }); + }, + //TCAS + onTCAS0: function (event) { + this.setData({ + selectedIndex106: event.detail.value + }); + }, + //Advise + onAdvise0: function (event) { + this.setData({ + selectedIndex107: event.detail.value + }); + }, + //个人信息//姓名电话邮箱 + onInput21: function(event) { + this.setData({ + inputValue21: event.detail.value + }); + }, + onInput22: function(event) { + this.setData({ + inputValue22: event.detail.value + }); + }, + onInput23: function(event) { + this.setData({ + inputValue23: event.detail.value + }); + }, + //事件经过 + onInput20: function(event) { + this.setData({ + inputValue20: event.detail.value + }); + }, + //提交与重写 + onReset() { + this.setData({ + selectedTime: '--时--分', + selectedDate: '--年--月--日', + selectedIndex1: 0, + selectedIndex2: 0, + selectedIndex4: 0, + selectedIndex5: 0, + selectedIndex7: 0, + selectedIndex8: 0, + selectedIndex9: 0, + selectedIndex10: 0, + selectedIndex11: 0, + selectedIndex12: 0, + selectedIndex13: 0, + selectedIndex14: 0, + selectedIndex15: 0, + selectedIndex16: 0, + selectedIndex100: 0, + selectedIndex101: 0, + selectedIndex102: 0, + selectedIndex103: 0, + selectedIndex104: 0, + selectedIndex105: 0, + selectedIndex106: 0, + selectedIndex107: 0, + inputValue1: '', + inputValue2: '', + inputValue3: '', + inputValue6: '', + inputValue7: '', + inputValue8: '', + inputValue15: '', + inputValue16: '', + inputValue20: '', + inputValue21: '', + inputValue22: '', + inputValue23: '', + inputValue100: '', + inputValue101: '', + inputValue102: '', + },() => { + console.log('Form has been reset'); + }) + }, + // 提交数据 + onSubmit: function () { + // 获取存储中的 token + const token = wx.getStorageSync('token'); + + if (!token) { + console.log('Token 不存在,请先登录'); + wx.showToast({ + title: '请先登录', + icon: 'none' + }); + return; // 终止提交 + } + const data = this.data; + + // 获取各选择项的实际文本值 + const timezoneText = data.timezones[data.selectedIndex1]; // 获取时区的实际文本 + const workPositionText = data.workposition[data.selectedIndex2]; // 获取岗位的实际文本 + const licenseText = data.License[data.selectedIndex4]; // 获取执照类型的实际文本 + const acftText = data.ACFT[data.selectedIndex5]; // 获取航空器类型的实际文本 + const taskText = data.task[data.selectedIndex7]; // 获取任务的实际文本 + const planText = data.plan[data.selectedIndex8]; // 获取计划的实际文本 + const phaseText = data.phase[data.selectedIndex9]; // 获取飞行阶段的实际文本 + const weatherText = data.weather[data.selectedIndex10]; // 获取天气的实际文本 + const lightText = data.lv[data.selectedIndex11]; // 获取光线条件的实际文本 + const atsText = data.ATS[data.selectedIndex12]; // 获取管制席位的实际文本 + const atcText = data.ATC[data.selectedIndex13]; // 获取管制类型的实际文本 + const tcasText = data.TCAS[data.selectedIndex14]; // 获取TCAS的实际文本 + const adviseText = data.Advise[data.selectedIndex15]; // 获取建议的实际文本 + const acft0Text = data.ACFT[data.selectedIndex100]; // 获取航空器二的类型 + const task0Text = data.task[data.selectedIndex101]; // 获取航空器二的任务 + const plan0Text = data.plan[data.selectedIndex102]; // 获取航空器二的计划 + const phase0Text = data.phase[data.selectedIndex103]; // 获取航空器二的阶段 + const weather0Text = data.weather[data.selectedIndex104]; // 获取航空器二的天气 + const light0Text = data.lv[data.selectedIndex105]; // 获取航空器二的光线条件 + const tcas0Text = data.TCAS[data.selectedIndex106]; // 获取航空器二的TCAS + const advise0Text = data.Advise[data.selectedIndex107]; // 获取航空器二的建议 + + // 提交数据到后端 + wx.request({ + url: 'http://192.168.137.1:8080/report/add', + method: 'POST', + header: { + 'Authorization': `${token}`, + 'content-type': 'application/json' + }, + data: { + selectedTime: data.selectedTime, + selectedDate: data.selectedDate, + timezone: timezoneText, // 提交时区的实际文本 + workPosition: workPositionText,// 提交岗位的实际文本 + license: licenseText, // 提交执照类型的实际文本 + acftType: acftText, // 提交航空器类型的实际文本 + task: taskText, // 提交任务的实际文本 + plan: planText, // 提交计划的实际文本 + phase: phaseText, // 提交飞行阶段的实际文本 + weather: weatherText, // 提交天气的实际文本 + lightCondition: lightText, // 提交光线条件的实际文本 + ats: atsText, // 提交管制席位的实际文本 + atc: atcText, // 提交管制类型的实际文本 + tcas: tcasText, // 提交TCAS的实际文本 + advise: adviseText, // 提交建议的实际文本 + + acft0Type: acft0Text, // 提交航空器类型的实际文本 + task0: task0Text, // 提交任务的实际文本 + plan0: plan0Text, // 提交计划的实际文本 + phase0: phase0Text, // 提交飞行阶段的实际文本 + weather0: weather0Text, // 提交天气的实际文本 + lightCondition0: light0Text, // 提交光线条件的实际文本 + ats0: ats0Text, // 提交管制席位的实际文本 + atc0: atcT0ext, // 提交管制类型的实际文本 + tcas0: tcas0Text, // 提交TCAS的实际文本 + advise0: advise0Text, // 提交建议的实际文本 + inputValue1: data.inputValue1, + inputValue2: data.inputValue2, + inputValue3: data.inputValue3, + inputValue6: data.inputValue6, + inputValue7: data.inputValue7, + inputValue8: data.inputValue8, + inputValue15: data.inputValue15, + inputValue16: data.inputValue16, + inputValue20: data.inputValue20, + inputValue21: data.inputValue21, + inputValue22: data.inputValue22, + inputValue23: data.inputValue23, + inputValue100: data.inputValue100, + inputValue101: data.inputValue101, + inputValue102: data.inputValue102, + name: data.name + }, + success: function(res) { + console.log('Data submitted successfully:', res); + }, + fail: function(err) { + console.error('Error submitting data:', err); + } + }); + // 使用腾讯混元智能体的 API 调用 + wx.request({ + url: 'https://yuanqi.tencent.com/openapi/v1/agent/chat/completions', + method: 'POST', + header: { + 'X-Source': 'openapi', + 'Content-Type': 'application/json', + 'Authorization': 'Bearer jSNTZONSnnzJ2uuQT7IEgXlPzfE4lX5f' // 替换为你的实际 Bearer Token + }, + data: { + assistant_id: 'ty1W9unZM9IY', // 替换为实际的 assistant_id + user_id: '123456', // 替换为实际的用户ID + stream: false, + messages: [ + { + role: 'user', + content: [ + { + type: 'text', + text: JSON.stringify(data) // 将用户填写的数据转换为字符串 + } + ] + } + ] + }, + success: function (res) { + console.log('API 调用成功: ', res); // 打印完整的 API 响应 + console.log('API 返回的 choices:', res.data.choices); // 检查数据结构 + + // 检查选择项并从中提取智能体回复 + if (res.data && res.data.choices && res.data.choices.length > 0) { + // 确保 message 字段的内容可以被访问 + const messageContent = res.data.choices[0].message?.content; + let agentReply; + + // 如果 messageContent 存在并且是一个数组,则提取内容 + if (Array.isArray(messageContent) && messageContent.length > 0) { + agentReply = messageContent[0].text; // 假设内容在数组的第一个元素中 + } else { + agentReply = messageContent || '无法获取智能体的回复'; + } + + // 跳转到详情页面并传递数据和智能体的回复 + wx.navigateTo({ + url: '/pages/FlightCrewDetails/FlightCrewDetails', + success: function (navRes) { + navRes.eventChannel.emit('sendData', { + details: data, // 用户输入的数据 + agentReply: agentReply // 智能体的回复 + }); + } + }); + } else { + console.log('API 响应中没有 choices'); + } + }, + fail: function (err) { + console.log('智能体调用失败', err); + } + }); + }, + onLoad(options) { + }, + onReady() { + + }, + onShow() { + }, + onHide() { + }, + onUnload() { + }, + onPullDownRefresh() { + + }, + onReachBottom() { + + }, + onShareAppMessage() { + } +}) \ No newline at end of file diff --git a/Airtraffic/Airtraffic.json b/Airtraffic/Airtraffic.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/Airtraffic/Airtraffic.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/Airtraffic/Airtraffic.wxml b/Airtraffic/Airtraffic.wxml new file mode 100644 index 0000000..48c586a --- /dev/null +++ b/Airtraffic/Airtraffic.wxml @@ -0,0 +1,402 @@ + + + + + + 空中交通管制人员使用 (Air traffic controller) + + + + 欢迎您为民航不安全事件管理系统提供事件信息,请您仔细填写适用条目: + (红色字体为必填项) + + + + 事件发生时的当地时间: + + 时间: + + + {{selectedDate}} + + + + + {{ selectedTime }} + + + + 时区: + + + {{ timezones[selectedIndex1] }} + + + + + + 事件发生前您的工作时间: + + 过去一个月的工作天数: + + + + + + 过去一星期的工作天数: + + + + + + 过去24小时的工作时长: + + + 小时 + + + + + + 事件发生时您的岗位: + + + {{ workposition[selectedIndex2] }} + + + + + + + 您的工作经历是: + + 工作经验: + + + + + + 在此岗位工作了: + + + + + + + + + 您的执照类型: + + + {{ License[selectedIndex4] }} + + + + + + + + 事件发生时您的管制席位 + + + {{ ATS[selectedIndex12] }} + + + + + + + + 事件发生时的管制类型: + + + {{ ATC[selectedIndex13] }} + + + + + + + + 事件发生的管制空域为: + + + {{ controlledairspace[selectedIndex16] }} + + + + + + + 航空器一: + + + + + 事件航空器种类: + + + {{ ACFT[selectedIndex5] }} + + + + + + + + 本次飞行任务: + + + {{ task[selectedIndex7] }} + + + + + + + + 本次飞行计划: + + + {{ plan[selectedIndex8] }} + + + + + + + + 事件发生时的飞行阶段: + + + {{ phase[selectedIndex9] }} + + + + + + + + 飞行高度为: + + + 千米 + + + + + + 天气条件: + + + {{ weather[selectedIndex10] }} + + + + + + + + 光线条件和能见度为: + + + {{ lv[selectedIndex11] }} + + + + + 云底高: + + + + + + 跑道视程: + + + + + + + + + 若为两机冲突,当时TCAS是否提出告警: + + + {{ TCAS[selectedIndex14] }} + + + + + + + + 是否提出建议: + + + {{ weather[selectedIndex15] }} + + + + + + + + + + 航空器二: + + + + + 事件航空器种类: + + + {{ ACFT[selectedIndex100] }} + + + + + + + + 本次飞行任务: + + + {{ task[selectedIndex101] }} + + + + + + + + 本次飞行计划: + + + {{ plan[selectedIndex102] }} + + + + + + + + 事件发生时的飞行阶段: + + + {{ phase[selectedIndex103] }} + + + + + + + + 飞行高度为: + + + 千米 + + + + + + 天气条件: + + + {{ weather[selectedIndex104] }} + + + + + + + + 光线条件和能见度为: + + + {{ lv[selectedIndex105] }} + + + + + 云底高: + + + + + + 跑道视程: + + + + + + + + + 若为两机冲突,当时TCAS是否提出告警: + + + {{ TCAS[selectedIndex106] }} + + + + + + + + 是否提出建议: + + + {{ weather[selectedIndex107] }} + + + + + + + 请您尽可能完整地描述事件经过:(如事件过程、原因、建议等) + + + + + + + + 民航不安全事件管理系统欢迎全行业所有人员做安全“吹哨人”!感谢您积极主动参与改善航空安全行动和自愿报告安全风险隐患信息!我们欢迎您本着诚信原则报送有关安全信息,同时建议您留一个有效的联系方式,以方便该信息得到有效处理、应用、反馈和奖励。我们承诺对每一位员工、每一家单位的报告信息严格保密,谢谢! + + + + + + + 姓名: + + + + + + + + 电话: + + + + + + + + 邮箱: + + + + + + + + + + + diff --git a/Airtraffic/Airtraffic.wxss b/Airtraffic/Airtraffic.wxss new file mode 100644 index 0000000..b0977ec --- /dev/null +++ b/Airtraffic/Airtraffic.wxss @@ -0,0 +1,138 @@ +/* pages/Airtraffic/Airtraffic.wxss */ +.container { + display: block; + box-sizing: border-box; + width: 90%; + border: 1px solid gray; + border-bottom:0px ; + padding: 5px; + margin: auto; + position: relative; +} +.one{ + margin-top:0px; + font-weight: bold; + font-size: 21px; + display: block; + margin-left: 10px; +} +.two { + font-weight: bold; + font-size: 18px; + display: block; + margin-left: 2px; +} +.three{ + font-weight: bold; + font-size: 15px; + color: red; +} +.four{ + align-items: center; + font-size: 15px; + color: red; +} +.five1{ + margin: 5px; + margin-left: 2px; + display: block; + font-size: 15px; + margin-right: 0px; + overflow-wrap: break-word; +} +.five{ + margin: 5px; + margin-left: 2px; + margin-right: 120px; + word-wrap: break-word; + word-break: break-all; + font-size: 15px; + display: block; +} +.container1{ + display: flex; + position: relative; + align-items: center; +} +.choose1{ + margin-left: 20px; +} +.choose{ + position: absolute; + right:0; + text-overflow: ellipsis; +} +.picker { + text-align: center; + width: 100px; + height: auto; + font-size: 15px; + border: 1px solid #ccc; + padding: 3px; + margin: 10px; + +} +.input-box { + width: 25%; + padding: 0px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; + margin: 3px; +} +.input-box2 { + width: 250px; + padding: 4px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; +} +.container3 { + display: block; + box-sizing: border-box; + width: 98%; + margin: 2px; + padding: 3px; + border: 1px solid black; +} +.scroll-input { + width: 100%; + height: 150px; + padding: 10px; + font-size: 15px; + border: 1px solid black; + overflow-y: auto; + overflow-x: hidden; + resize: none; + box-sizing: border-box; +} +.container4 { + display: block; + box-sizing: border-box; + width: 90%; + border: 1px solid gray; + padding: 5px; + margin: auto; + position: relative; + margin-bottom: 20px; +} +.container5{ + border: white; + padding-top: 10px; + padding-bottom:10px; +} +.input-box1 { + width: 109px; + padding: 4px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; +} +.input-box3 { + width: 68px; + padding: 4px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; +} + diff --git a/Aviation/Aviation.js b/Aviation/Aviation.js new file mode 100644 index 0000000..8181049 --- /dev/null +++ b/Aviation/Aviation.js @@ -0,0 +1,325 @@ +// pages/Aviation/Aviation.js +Page({ + data: { + name:'Aviation', + selectedTime: '--时--分', + selectedDate: '--年--月--日', + selectedIndex1: 0, + selectedIndex2: 0, + selectedIndex4: 0, + selectedIndex9: 0, + selectedIndex22: 0, + inputValue1: '', + inputValue2: '', + inputValue3: '', + inputValue9: '', + inputValue10: '', + inputValue11: '', + inputValue12: '', + inputValue13: '', + inputValue14: '', + inputValue15: '', + inputValue16: '', + inputValue20: '', + inputValue21: '', + inputValue22: '', + inputValue23: '', + timezones: ['请选择','UTC-12:00', 'UTC-11:00', 'UTC-10:00', 'UTC-9:00', 'UTC-8:00', 'UTC-7:00', 'UTC-6:00', 'UTC-5:00', 'UTC-4:00', 'UTC-3:00', 'UTC-2:00', 'UTC-1:00', 'UTC+0:00', 'UTC+1:00', 'UTC+2:00', 'UTC+3:00', 'UTC+4:00', 'UTC+5:00', 'UTC+6:00', 'UTC+7:00', 'UTC+8:00', 'UTC+9:00', 'UTC+10:00', 'UTC+11:00', 'UTC+12:00'], + position:['请选择','安检员','乘务员','飞行员','机务人员','保安员','管制员','机场地面服务人员','其他'], + phase:['请选择','值机','安检','候机','登机','滑行','停靠','起飞','航路','着陆','其它'], + License:['请选择','私用驾驶员执照','商用驾驶员执照','航线运输驾驶员执照','临时执照','无','其它'], + involve:['请选择','是','否'] + }, + //时间选择 + onTimeChange: function (event) { + this.setData({ + selectedTime: event.detail.value + }); + }, + onTimezoneChange: function (event) { + this.setData({ + selectedIndex1: event.detail.value + }); + }, + onDateChange: function(e) { + this.setData({ + selectedDate: e.detail.value + }); + }, + //工作时间选择 + onInput1: function(event) { + this.setData({ + inputValue1: event.detail.value + }); + }, + onInput2: function(event) { + this.setData({ + inputValue2: event.detail.value + }); + }, + onInput3: function(event) { + this.setData({ + inputValue3: event.detail.value + }); + }, + //岗位选择 + onposition: function (event) { + this.setData({ + selectedIndex2: event.detail.value + }); + }, + //执照选择 + onLicense: function(event) { + this.setData({ + selectedIndex4: event.detail.value + }); + }, + //工作经验 + onInput15: function(event) { + this.setData({ + inputValue15: event.detail.value + }); + }, + onInput16: function(event) { + this.setData({ + inputValue16: event.detail.value + }); + }, + //飞行区间 + onInput9: function(event) { + this.setData({ + inputValue9: event.detail.value + }); + }, + onInput10: function(event) { + this.setData({ + inputValue10: event.detail.value + }); + }, + //人员情况 + onInput11: function(event) { + this.setData({ + inputValue11: event.detail.value + }); + }, + onInput12: function(event) { + this.setData({ + inputValue12: event.detail.value + }); + }, + onInput13: function(event) { + this.setData({ + inputValue13: event.detail.value + }); + }, + onInput14: function(event) { + this.setData({ + inputValue14: event.detail.value + }); + }, + //飞行阶段 + onphase: function(event) { + this.setData({ + selectedIndex9: event.detail.value + }); + }, + //是否设计航空器 + oninvolve: function(event) { + this.setData({ + selectedIndex22: event.detail.value + }); + }, + //事件经过 + onInput20: function(event) { + this.setData({ + inputValue20: event.detail.value + }); + }, + //个人信息//姓名电话邮箱 + onInput21: function(event) { + this.setData({ + inputValue21: event.detail.value + }); + }, + onInput22: function(event) { + this.setData({ + inputValue22: event.detail.value + }); + }, + onInput23: function(event) { + this.setData({ + inputValue23: event.detail.value + }); + }, + //提交与重写 + onReset() { + this.setData({ + selectedTime: '--时--分', + selectedDate: '--年--月--日', + selectedIndex1: 0, + selectedIndex2: 0, + selectedIndex4: 0, + selectedIndex9: 0, + selectedIndex22: 0, + inputValue1: '', + inputValue2: '', + inputValue3: '', + inputValue9: '', + inputValue10: '', + inputValue11: '', + inputValue12: '', + inputValue13: '', + inputValue14: '', + inputValue15: '', + inputValue16: '', + inputValue20: '', + inputValue21: '', + inputValue22: '', + inputValue23: '', + },() => { + console.log('Form has been reset'); + }) + }, + // 提交数据 + onSubmit: function () { + // 获取存储中的 token + const token = wx.getStorageSync('token'); + + if (!token) { + console.log('Token 不存在,请先登录'); + wx.showToast({ + title: '请先登录', + icon: 'none' + }); + return; // 终止提交 + } + const data = this.data; + + // 获取各选择项的实际文本值 + const timezoneText = data.timezones[data.selectedIndex1]; // 获取时区的实际文本 + const workPositionText = data.position[data.selectedIndex2]; // 获取岗位的实际文本 + const licenseText = data.License[data.selectedIndex4]; // 获取执照类型的实际文本 + const phaseText = data.phase[data.selectedIndex9]; // 获取飞行阶段的实际文本 + const involveText = data.involve[data.selectedIndex22]; // 获取是否设计航空器的实际文本 + + // 提交数据到后端 + wx.request({ + url: 'http://192.168.137.1:8080/report/add', + method: 'POST', + header: { + 'Authorization': `${token}`, + 'content-type': 'application/json' + }, + data: { + selectedTime: data.selectedTime, + selectedDate: data.selectedDate, + timezone: timezoneText, // 提交时区的实际文本 + workPosition: workPositionText, // 提交岗位的实际文本 + license: licenseText, // 提交执照类型的实际文本 + phase: phaseText, // 提交飞行阶段的实际文本 + involve: involveText, // 提交是否设计航空器的实际文本 + inputValue1: data.inputValue1, + inputValue2: data.inputValue2, + inputValue3: data.inputValue3, + inputValue9: data.inputValue9, + inputValue10: data.inputValue10, + inputValue11: data.inputValue11, + inputValue12: data.inputValue12, + inputValue13: data.inputValue13, + inputValue14: data.inputValue14, + inputValue15: data.inputValue15, + inputValue16: data.inputValue16, + inputValue20: data.inputValue20, + inputValue21: data.inputValue21, + inputValue22: data.inputValue22, + inputValue23: data.inputValue23, + name: data.name, + }, + success: function(res) { + console.log('Data submitted successfully:', res); + }, + fail: function(err) { + console.error('Error submitting data:', err); + } + }); + // 使用腾讯混元智能体的 API 调用 + wx.request({ + url: 'https://yuanqi.tencent.com/openapi/v1/agent/chat/completions', + method: 'POST', + header: { + 'X-Source': 'openapi', + 'Content-Type': 'application/json', + 'Authorization': 'Bearer jSNTZONSnnzJ2uuQT7IEgXlPzfE4lX5f' // 替换为你的实际 Bearer Token + }, + data: { + assistant_id: 'ty1W9unZM9IY', // 替换为实际的 assistant_id + user_id: '123456', // 替换为实际的用户ID + stream: false, + messages: [ + { + role: 'user', + content: [ + { + type: 'text', + text: JSON.stringify(data) // 将用户填写的数据转换为字符串 + } + ] + } + ] + }, + success: function (res) { + console.log('API 调用成功: ', res); // 打印完整的 API 响应 + console.log('API 返回的 choices:', res.data.choices); // 检查数据结构 + + // 检查选择项并从中提取智能体回复 + if (res.data && res.data.choices && res.data.choices.length > 0) { + // 确保 message 字段的内容可以被访问 + const messageContent = res.data.choices[0].message?.content; + let agentReply; + + // 如果 messageContent 存在并且是一个数组,则提取内容 + if (Array.isArray(messageContent) && messageContent.length > 0) { + agentReply = messageContent[0].text; // 假设内容在数组的第一个元素中 + } else { + agentReply = messageContent || '无法获取智能体的回复'; + } + + // 跳转到详情页面并传递数据和智能体的回复 + wx.navigateTo({ + url: '/pages/FlightCrewDetails/FlightCrewDetails', + success: function (navRes) { + navRes.eventChannel.emit('sendData', { + details: data, // 用户输入的数据 + agentReply: agentReply // 智能体的回复 + }); + } + }); + } else { + console.log('API 响应中没有 choices'); + } + }, + fail: function (err) { + console.log('智能体调用失败', err); + } + }); + }, + onLoad(options) { + }, + onReady() { + + }, + onShow() { + }, + onHide() { + }, + onUnload() { + }, + onPullDownRefresh() { + + }, + onReachBottom() { + + }, + onShareAppMessage() { + } +}) \ No newline at end of file diff --git a/Aviation/Aviation.json b/Aviation/Aviation.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/Aviation/Aviation.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/Aviation/Aviation.wxml b/Aviation/Aviation.wxml new file mode 100644 index 0000000..286b95d --- /dev/null +++ b/Aviation/Aviation.wxml @@ -0,0 +1,198 @@ + + + + + + 空防安全事件 (Aviation securityincident) + + + + 欢迎您为民航不安全事件管理系统提供事件信息,请您仔细填写适用条目: + (红色字体为必填项) + + + + 事件发生时的当地时间: + + 时间: + + + {{selectedDate}} + + + + + {{ selectedTime }} + + + + 时区: + + + {{ timezones[selectedIndex1] }} + + + + + + 事件发生前您的工作时间: + + 过去一个月的工作天数: + + + + + + 过去一星期的工作天数: + + + + + + 过去24小时的工作时长: + + + 小时 + + + + + + 事件发生时您的岗位: + + + {{ position[selectedIndex2] }} + + + + + + + + 您的执照类型: + + + {{ License[selectedIndex4] }} + + + + + + + 您的工作经历是: + + 工作经验: + + + + + + 在此岗位工作了: + + + + + + + + + 事件发生时的飞行阶段: + + + {{ phase[selectedIndex9] }} + + + + + + + + 事件是否涉及航空器: + + + {{ involve[selectedIndex22] }} + + + + + + + 飞行区间是: + + + + + + + + + + + + + 机上的人员情况是: + + 飞行机组 + + + + 乘务员 + + + + + 空中保安 + + + + 共有旅客 + + + + + + + 请您尽可能完整地描述事件经过:(如事件过程、原因、建议等) + + + + + + + + 民航不安全事件管理系统欢迎全行业所有人员做安全“吹哨人”!感谢您积极主动参与改善航空安全行动和自愿报告安全风险隐患信息!我们欢迎您本着诚信原则报送有关安全信息,同时建议您留一个有效的联系方式,以方便该信息得到有效处理、应用、反馈和奖励。我们承诺对每一位员工、每一家单位的报告信息严格保密,谢谢! + + + + + + + 姓名: + + + + + + + + 电话: + + + + + + + + 邮箱: + + + + + + + + + + + + diff --git a/Aviation/Aviation.wxss b/Aviation/Aviation.wxss new file mode 100644 index 0000000..f9694f3 --- /dev/null +++ b/Aviation/Aviation.wxss @@ -0,0 +1,139 @@ +/* pages/Aviation/Aviation.wxss */ +/* pages/Airtraffic/Airtraffic.wxss */ +.container { + display: block; + box-sizing: border-box; + width: 90%; + border: 1px solid gray; + border-bottom:0px ; + padding: 5px; + margin: auto; + position: relative; +} +.one{ + margin-top:0px; + font-weight: bold; + font-size: 21px; + display: block; + margin-left: 10px; +} +.two { + font-weight: bold; + font-size: 18px; + display: block; + margin-left: 2px; +} +.three{ + font-weight: bold; + font-size: 15px; + color: red; +} +.four{ + align-items: center; + font-size: 15px; + color: red; +} +.five1{ + margin: 5px; + margin-left: 2px; + display: block; + font-size: 15px; + margin-right: 0px; + overflow-wrap: break-word; +} +.five{ + margin: 5px; + margin-left: 2px; + margin-right: 120px; + word-wrap: break-word; + word-break: break-all; + font-size: 15px; + display: block; +} +.container1{ + display: flex; + position: relative; + align-items: center; +} +.choose1{ + margin-left: 20px; +} +.choose{ + position: absolute; + right:0; + text-overflow: ellipsis; +} +.picker { + text-align: center; + width: 100px; + height: auto; + font-size: 15px; + border: 1px solid #ccc; + padding: 3px; + margin: 10px; + +} +.input-box { + width: 25%; + padding: 0px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; + margin: 3px; +} +.input-box2 { + width: 250px; + padding: 4px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; +} +.container3 { + display: block; + box-sizing: border-box; + width: 98%; + margin: 2px; + padding: 3px; + border: 1px solid black; +} +.scroll-input { + width: 100%; + height: 150px; + padding: 10px; + font-size: 15px; + border: 1px solid black; + overflow-y: auto; + overflow-x: hidden; + resize: none; + box-sizing: border-box; +} +.container4 { + display: block; + box-sizing: border-box; + width: 90%; + border: 1px solid gray; + padding: 5px; + margin: auto; + position: relative; + margin-bottom: 20px; +} +.container5{ + border: white; + padding-top: 10px; + padding-bottom:10px; +} +.input-box1 { + width: 100px; + padding: 0px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; +} +.input-box3 { + width: 68px; + padding: 4px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; +} + diff --git a/Crew/Crew.js b/Crew/Crew.js new file mode 100644 index 0000000..ede9af3 --- /dev/null +++ b/Crew/Crew.js @@ -0,0 +1,313 @@ +// pages/Crew/Crew.js +Page({ + data: { + name:'Crew', + selectedTime: '--时--分', + selectedDate: '--年--月--日', + selectedIndex1: 0, + selectedIndex2: 0, + selectedIndex5: 0, + selectedIndex9: 0, + inputValue1: '', + inputValue2: '', + inputValue3: '', + inputValue4: '', + inputValue5: '', + inputValue9: '', + inputValue10: '', + inputValue11: '', + inputValue12: '', + inputValue13: '', + inputValue14: '', + inputValue20: '', + inputValue21: '', + inputValue22: '', + inputValue23: '', + timezones: ['请选择','UTC-12:00', 'UTC-11:00', 'UTC-10:00', 'UTC-9:00', 'UTC-8:00', 'UTC-7:00', 'UTC-6:00', 'UTC-5:00', 'UTC-4:00', 'UTC-3:00', 'UTC-2:00', 'UTC-1:00', 'UTC+0:00', 'UTC+1:00', 'UTC+2:00', 'UTC+3:00', 'UTC+4:00', 'UTC+5:00', 'UTC+6:00', 'UTC+7:00', 'UTC+8:00', 'UTC+9:00', 'UTC+10:00', 'UTC+11:00', 'UTC+12:00'], + position:['请选择','乘务员','主任乘务长','乘务教员','乘务检查员','保安员','其他'], + ACFT:['请选择','飞机','直升机','滑翔机','其它'], + phase:['请选择','地面/滑行','起飞','爬升','巡航/作业','下降','进近','复飞','着陆','其它'], + }, + //时间选择 + onTimeChange: function (event) { + this.setData({ + selectedTime: event.detail.value + }); + }, + onTimezoneChange: function (event) { + this.setData({ + selectedIndex1: event.detail.value + }); + }, + onDateChange: function(e) { + this.setData({ + selectedDate: e.detail.value + }); + }, + //工作时间选择 + onInput1: function(event) { + this.setData({ + inputValue1: event.detail.value + }); + }, + onInput2: function(event) { + this.setData({ + inputValue2: event.detail.value + }); + }, + onInput3: function(event) { + this.setData({ + inputValue3: event.detail.value + }); + }, + //岗位选择 + onposition: function (event) { + this.setData({ + selectedIndex2: event.detail.value + }); + }, + //飞行经历 + onInput4: function(event) { + this.setData({ + inputValue4: event.detail.value + }); + }, + onInput5: function(event) { + this.setData({ + inputValue5: event.detail.value + }); + }, + //飞行区间 + onInput9: function(event) { + this.setData({ + inputValue9: event.detail.value + }); + }, + onInput10: function(event) { + this.setData({ + inputValue10: event.detail.value + }); + }, + //航空器种类 + onACFT: function(event) { + this.setData({ + selectedIndex5: event.detail.value + }); + }, + //人员情况 + onInput11: function(event) { + this.setData({ + inputValue11: event.detail.value + }); + }, + onInput12: function(event) { + this.setData({ + inputValue12: event.detail.value + }); + }, + onInput13: function(event) { + this.setData({ + inputValue13: event.detail.value + }); + }, + onInput14: function(event) { + this.setData({ + inputValue14: event.detail.value + }); + }, + //飞行阶段 + onphase: function(event) { + this.setData({ + selectedIndex9: event.detail.value + }); + }, + //事件经过 + onInput20: function(event) { + this.setData({ + inputValue20: event.detail.value + }); + }, + //个人信息//姓名电话邮箱 + onInput21: function(event) { + this.setData({ + inputValue21: event.detail.value + }); + }, + onInput22: function(event) { + this.setData({ + inputValue22: event.detail.value + }); + }, + onInput23: function(event) { + this.setData({ + inputValue23: event.detail.value + }); + }, + //提交与重写 + onReset() { + this.setData({ + selectedTime: '--时--分', + selectedDate: '--年--月--日', + selectedIndex1: 0, + selectedIndex2: 0, + selectedIndex5: 0, + selectedIndex9: 0, + inputValue1: '', + inputValue2: '', + inputValue3: '', + inputValue4: '', + inputValue5: '', + inputValue9: '', + inputValue10: '', + inputValue11: '', + inputValue12: '', + inputValue13: '', + inputValue14: '', + inputValue20: '', + inputValue21: '', + inputValue22: '', + inputValue23: '', + },() => { + console.log('Form has been reset'); + }) + }, + // 提交数据 + onSubmit: function () { + // 获取存储中的 token + const token = wx.getStorageSync('token'); + + if (!token) { + console.log('Token 不存在,请先登录'); + wx.showToast({ + title: '请先登录', + icon: 'none' + }); + return; // 终止提交 + } + const data = this.data; + // 获取各选择项的实际文本值 + const timezoneText = data.timezones[data.selectedIndex1]; // 获取时区的实际文本 + const workPositionText = data.position[data.selectedIndex2]; // 获取岗位的实际文本 + const acftText = data.ACFT[data.selectedIndex5]; // 获取航空器类型的实际文本 + const phaseText = data.phase[data.selectedIndex9]; // 获取飞行阶段的实际文本 + + // 提交数据到后端 + wx.request({ + url: 'http://192.168.137.1:8080/report/add', + method: 'POST', + header: { + 'Authorization': `${token}`, + 'content-type': 'application/json' + }, + data: { + selectedTime: data.selectedTime, + selectedDate: data.selectedDate, + timezone: timezoneText, // 提交时区的实际文本 + workPosition: workPositionText,// 提交岗位的实际文本 + acftType: acftText, // 提交航空器类型的实际文本 + phase: phaseText, // 提交飞行阶段的实际文本 + inputValue1: data.inputValue1, + inputValue2: data.inputValue2, + inputValue3: data.inputValue3, + inputValue4: data.inputValue4, + inputValue5: data.inputValue5, + inputValue9: data.inputValue9, + inputValue10: data.inputValue10, + inputValue11: data.inputValue11, + inputValue12: data.inputValue12, + inputValue13: data.inputValue13, + inputValue14: data.inputValue14, + inputValue20: data.inputValue20, + inputValue21: data.inputValue21, + inputValue22: data.inputValue22, + inputValue23: data.inputValue23, + name: data.name, + }, + success: function(res) { + console.log('Data submitted successfully:', res); + }, + fail: function(err) { + console.error('Error submitting data:', err); + } + }); + // 使用腾讯混元智能体的 API 调用 + wx.request({ + url: 'https://yuanqi.tencent.com/openapi/v1/agent/chat/completions', + method: 'POST', + header: { + 'X-Source': 'openapi', + 'Content-Type': 'application/json', + 'Authorization': 'Bearer jSNTZONSnnzJ2uuQT7IEgXlPzfE4lX5f' // 替换为你的实际 Bearer Token + }, + data: { + assistant_id: 'ty1W9unZM9IY', // 替换为实际的 assistant_id + user_id: '123456', // 替换为实际的用户ID + stream: false, + messages: [ + { + role: 'user', + content: [ + { + type: 'text', + text: JSON.stringify(data) // 将用户填写的数据转换为字符串 + } + ] + } + ] + }, + success: function (res) { + console.log('API 调用成功: ', res); // 打印完整的 API 响应 + console.log('API 返回的 choices:', res.data.choices); // 检查数据结构 + + // 检查选择项并从中提取智能体回复 + if (res.data && res.data.choices && res.data.choices.length > 0) { + // 确保 message 字段的内容可以被访问 + const messageContent = res.data.choices[0].message?.content; + let agentReply; + + // 如果 messageContent 存在并且是一个数组,则提取内容 + if (Array.isArray(messageContent) && messageContent.length > 0) { + agentReply = messageContent[0].text; // 假设内容在数组的第一个元素中 + } else { + agentReply = messageContent || '无法获取智能体的回复'; + } + + // 跳转到详情页面并传递数据和智能体的回复 + wx.navigateTo({ + url: '/pages/FlightCrewDetails/FlightCrewDetails', + success: function (navRes) { + navRes.eventChannel.emit('sendData', { + details: data, // 用户输入的数据 + agentReply: agentReply // 智能体的回复 + }); + } + }); + } else { + console.log('API 响应中没有 choices'); + } + }, + fail: function (err) { + console.log('智能体调用失败', err); + } + }); + }, + onLoad(options) { + }, + onReady() { + + }, + onShow() { + }, + onHide() { + }, + onUnload() { + }, + onPullDownRefresh() { + + }, + onReachBottom() { + + }, + onShareAppMessage() { + } +}) \ No newline at end of file diff --git a/Crew/Crew.json b/Crew/Crew.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/Crew/Crew.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/Crew/Crew.wxml b/Crew/Crew.wxml new file mode 100644 index 0000000..566c7db --- /dev/null +++ b/Crew/Crew.wxml @@ -0,0 +1,187 @@ + + + + + + (乘务事件使用 Crew member) + + + + 欢迎您为民航不安全事件管理系统提供事件信息,请您仔细填写适用条目: + (红色字体为必填项) + + + + 事件发生时的当地时间: + + 时间: + + + {{selectedDate}} + + + + + {{ selectedTime }} + + + + 时区: + + + {{ timezones[selectedIndex1] }} + + + + + + 事件发生前您的工作时间: + + 过去一个月的工作天数: + + + + + + 过去一星期的工作天数: + + + + + + 过去24小时的工作时长: + + + 小时 + + + + + + 事件发生时您的岗位: + + + {{ position[selectedIndex2] }} + + + + + + + 您所具有的飞行经历是: + + 飞行小时数: + + + 小时 + + + 本机型小时: + + + 小时 + + + + + 飞行区间是: + + + + + + + + + + + + + + 事件航空器种类: + + + {{ ACFT[selectedIndex5] }} + + + + + + + 机上的人员情况是: + + 飞行机组 + + + + 乘务员 + + + + + 空中保安 + + + + 共有旅客 + + + + + + + + 事件发生时的飞行阶段: + + + {{ phase[selectedIndex9] }} + + + + + + + 请您尽可能完整地描述事件经过:(如事件过程、原因、建议等) + + + + + + + + 民航不安全事件管理系统欢迎全行业所有人员做安全“吹哨人”!感谢您积极主动参与改善航空安全行动和自愿报告安全风险隐患信息!我们欢迎您本着诚信原则报送有关安全信息,同时建议您留一个有效的联系方式,以方便该信息得到有效处理、应用、反馈和奖励。我们承诺对每一位员工、每一家单位的报告信息严格保密,谢谢! + + + + + + + 姓名: + + + + + + + + 电话: + + + + + + + + 邮箱: + + + + + + + + + + + + diff --git a/Crew/Crew.wxss b/Crew/Crew.wxss new file mode 100644 index 0000000..641ddff --- /dev/null +++ b/Crew/Crew.wxss @@ -0,0 +1,138 @@ +/* pages/Airtraffic/Airtraffic.wxss */ +.container { + display: block; + box-sizing: border-box; + width: 90%; + border: 1px solid gray; + border-bottom:0px ; + padding: 5px; + margin: auto; + position: relative; +} +.one{ + margin-top:0px; + font-weight: bold; + font-size: 21px; + display: block; + margin-left: 10px; +} +.two { + font-weight: bold; + font-size: 18px; + display: block; + margin-left: 2px; +} +.three{ + font-weight: bold; + font-size: 15px; + color: red; +} +.four{ + align-items: center; + font-size: 15px; + color: red; +} +.five1{ + margin: 5px; + margin-left: 2px; + display: block; + font-size: 15px; + margin-right: 0px; + overflow-wrap: break-word; +} +.five{ + margin: 5px; + margin-left: 2px; + margin-right: 120px; + word-wrap: break-word; + word-break: break-all; + font-size: 15px; + display: block; +} +.container1{ + display: flex; + position: relative; + align-items: center; +} +.choose1{ + margin-left: 20px; +} +.choose{ + position: absolute; + right:0; + text-overflow: ellipsis; +} +.picker { + text-align: center; + width: 100px; + height: auto; + font-size: 15px; + border: 1px solid #ccc; + padding: 3px; + margin: 10px; + +} +.input-box { + width: 25%; + padding: 0px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; + margin: 3px; +} +.input-box2 { + width: 250px; + padding: 4px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; +} +.container3 { + display: block; + box-sizing: border-box; + width: 98%; + margin: 2px; + padding: 3px; + border: 1px solid black; +} +.scroll-input { + width: 100%; + height: 150px; + padding: 10px; + font-size: 15px; + border: 1px solid black; + overflow-y: auto; + overflow-x: hidden; + resize: none; + box-sizing: border-box; +} +.container4 { + display: block; + box-sizing: border-box; + width: 90%; + border: 1px solid gray; + padding: 5px; + margin: auto; + position: relative; + margin-bottom: 20px; +} +.container5{ + border: white; + padding-top: 10px; + padding-bottom:10px; +} +.input-box1 { + width: 100px; + padding: 0px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; +} +.input-box3 { + width: 68px; + padding: 4px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; +} + diff --git a/FlightCrew/FlightCrew.js b/FlightCrew/FlightCrew.js new file mode 100644 index 0000000..330558f --- /dev/null +++ b/FlightCrew/FlightCrew.js @@ -0,0 +1,404 @@ +// pages/FlightCrew/FlightCrew.js +Page({ +  data: { +    name:'FlightCrew', +    selectedTime: '--时--分', +    selectedDate: '--年--月--日', +    selectedIndex1: 0,  +    selectedIndex2: 0,  +    selectedIndex3: 0,  +    selectedIndex4: 0,  +    selectedIndex5: 0, +    selectedIndex6: 0, +    selectedIndex7: 0,  +    selectedIndex8: 0, +    selectedIndex9: 0, +    selectedIndex10: 0, +    selectedIndex11: 0, +    selectedIndex12: 0, +    selectedIndex13: 0, +    selectedIndex14: 0, +    selectedIndex15: 0, +    inputValue1: '', +    inputValue2: '', +    inputValue3: '', +    inputValue4: '', +    inputValue5: '', +    inputValue6: '', +    inputValue7: '', +    inputValue8: '', +    inputValue20: '', +    inputValue21: '', +    inputValue22: '', +    inputValue23: '', +    timezones: ['请选择','UTC-12:00', 'UTC-11:00', 'UTC-10:00', 'UTC-9:00', 'UTC-8:00', 'UTC-7:00', 'UTC-6:00', 'UTC-5:00', 'UTC-4:00', 'UTC-3:00', 'UTC-2:00', 'UTC-1:00', 'UTC+0:00', 'UTC+1:00', 'UTC+2:00', 'UTC+3:00', 'UTC+4:00', 'UTC+5:00', 'UTC+6:00', 'UTC+7:00', 'UTC+8:00', 'UTC+9:00', 'UTC+10:00', 'UTC+11:00', 'UTC+12:00'], +    workposition:['请选择','机长','副驾驶','责任机长','教员','学员','其他'], +    controll: ['请选择','是','否'], +    License:['请选择','私用驾驶员执照','商用驾驶员执照','航线运输驾驶员执照','临时执照','无','其它'], +    ACFT:['请选择','飞机','直升机','滑翔机','其它'], +    company:['请选择','运输航空公司','通用航空公司','公务航空公司','飞行训练机构','其它'], +    task:['请选择','客运','货运','训练','检查','调机','通用飞行','其它'], +    plan:['请选择','目视飞行计划','仪表飞行计划','其它'], +    phase:['请选择','地面/滑行','起飞','爬升','巡航/作业','下降','进近','复飞','着陆','其它'], +    weather:['请选择','IMC','VMC','雷暴','风切变','紊流','结冰','雨','雪','雾','多云','其它'], +    lv:['请选择','黎明','昼间','黄昏/曙暮光','夜间/月光','夜间/黑暗','未知'], +    ATS:['请选择','地面','塔台','进近','区调','其它'], +    ATC:['请选择','雷达管制','程序管制','雷达监视下的程序管制','其它'], +    TCAS:['请选择','是','否'], +    Advise:['请选择','是','否'], +  }, +  //时间选择 +  onTimeChange: function (event) { +    this.setData({ +      selectedTime: event.detail.value +    }); +  }, +  onTimezoneChange: function (event) { +    this.setData({ +      selectedIndex1: event.detail.value +    }); +  }, +  onDateChange: function(e) { +    this.setData({ +      selectedDate: e.detail.value +    }); +  }, +  //工作时间选择 +  onInput1: function(event) { +    this.setData({ +      inputValue1: event.detail.value +    }); +  }, +  onInput2: function(event) { +    this.setData({ +      inputValue2: event.detail.value +    }); +  }, +  onInput3: function(event) { +    this.setData({ +      inputValue3: event.detail.value +    }); +  }, +  //岗位选择 +  onworkposition: function (event) { +    this.setData({ +      selectedIndex2: event.detail.value +    }); +  }, +  //控制器选择 +  oncontroll: function(event) { +    this.setData({ +      selectedIndex3: event.detail.value +    }); +  }, +  //执照选择 +  onLicense: function(event) { +    this.setData({ +      selectedIndex4: event.detail.value +    }); +  }, +  //工作经验 +  onInput4: function(event) { +    this.setData({ +      inputValue4: event.detail.value +    }); +  }, +  onInput5: function(event) { +    this.setData({ +      inputValue5: event.detail.value +    }); +  }, +  //航空器种类 +  onACFT: function(event) { +    this.setData({ +      selectedIndex5: event.detail.value +    }); +  }, +  //工作单位种类 +  oncompany: function(event) { +    this.setData({ +      selectedIndex6: event.detail.value +    }); +  }, +  //任务 +  ontask: function(event) { +    this.setData({ +      selectedIndex7: event.detail.value +    }); +  }, +  //计划 +  onplan: function(event) { +    this.setData({ +      selectedIndex8: event.detail.value +    }); +  }, +  //飞行阶段 +  onphase: function(event) { +    this.setData({ +      selectedIndex9: event.detail.value +    }); +  }, +  //飞行高度 +  onInput6: function(event) { +    this.setData({ +      inputValue6: event.detail.value +    }); +  }, +  //天气 +  onweather: function(event) { +    this.setData({ +      selectedIndex10: event.detail.value +    }); +  }, +  //光线条件和能见度 +  onlv: function(event) { +    this.setData({ +      selectedIndex11: event.detail.value +    }); +  }, +  onInput7: function(event) { +    this.setData({ +      inputValue7: event.detail.value +    }); +  }, +  onInput8: function(event) { +    this.setData({ +      inputValue8: event.detail.value +    }); +  }, +  //ATS +  onATS: function (event) { +    this.setData({ +      selectedIndex12: event.detail.value +    }); +  }, +  //ATC +  onATC: function (event) { +    this.setData({ +      selectedIndex13: event.detail.value +    }); +  }, +  //TCAS +  onTCAS: function (event) { +    this.setData({ +      selectedIndex14: event.detail.value +    }); +  }, +  //Advise +  onAdvise: function (event) { +    this.setData({ +      selectedIndex15: event.detail.value +    }); +  }, +  //个人信息//姓名电话邮箱 +  onInput21: function(event) { +    this.setData({ +      inputValue21: event.detail.value +    }); +  }, +  onInput22: function(event) { +    this.setData({ +      inputValue22: event.detail.value +    }); +  }, +  onInput23: function(event) { +    this.setData({ +      inputValue23: event.detail.value +    }); +  }, +  //事件经过 +  onInput20: function(event) { +    this.setData({ +      inputValue20: event.detail.value +    }); +  }, +  //提交与重写 +  onReset() { +    this.setData({ +      selectedTime: '--时--分', +      selectedDate: '--年--月--日', +      selectedIndex1: 0, +      selectedIndex2: 0, +      selectedIndex3: 0, +      selectedIndex4: 0, +      selectedIndex5: 0, +      selectedIndex6: 0, +      selectedIndex7: 0, +      selectedIndex8: 0, +      selectedIndex9: 0, +      selectedIndex10: 0, +      selectedIndex11: 0, +      selectedIndex12: 0, +      selectedIndex13: 0, +      selectedIndex14: 0, +      selectedIndex15: 0, +      inputValue1: '', +      inputValue2: '', +      inputValue3: '', +      inputValue4: '', +      inputValue5: '', +      inputValue6: '', +      inputValue7: '', +      inputValue8: '', +      inputValue20: '', +      inputValue21: '', +      inputValue22: '', +      inputValue23: '' +    },() => { +      console.log('Form has been reset'); +    }) +  }, +  // 提交数据 +onSubmit: function () { + // 获取存储中的 token + const token = wx.getStorageSync('token'); + + if (!token) { + console.log('Token 不存在,请先登录'); + wx.showToast({ + title: '请先登录', + icon: 'none' + }); + return; // 终止提交 + } + + const data = this.data; + const timezoneText = data.timezones[data.selectedIndex1]; + const workPositionText = data.workposition[data.selectedIndex2]; + const licenseText = data.License[data.selectedIndex4]; + const acftText = data.ACFT[data.selectedIndex5]; + const taskText = data.task[data.selectedIndex7]; + const phaseText = data.phase[data.selectedIndex9]; + const weatherText = data.weather[data.selectedIndex10]; + const lvText = data.lv[data.selectedIndex11]; + const ats = data.ATS[data.selectedIndex12]; + const atc = data.ATC[data.selectedIndex13]; + const tcas = data.TCAS[data.selectedIndex14]; + const advise = data.Advise[data.selectedIndex15]; + + wx.request({ + url: 'http://192.168.144.1:8080/report/add', + method: 'POST', + header: { + 'Authorization': `${token}`, + 'content-type': 'application/json' + }, + data: { + selectedTime: data.selectedTime, + selectedDate: data.selectedDate, + timezone: timezoneText, + workPosition: workPositionText, + license: licenseText, + acft: acftText, + task: taskText, + phase: phaseText, + weather: weatherText, + lv: lvText, + ats: ats, + atc: atc, + tcas: tcas, + advise: advise, + inputValue1: data.inputValue1, + inputValue2: data.inputValue2, + inputValue3: data.inputValue3, + inputValue4: data.inputValue4, + inputValue5: data.inputValue5, + inputValue6: data.inputValue6, + inputValue7: data.inputValue7, + inputValue8: data.inputValue8, + inputValue20: data.inputValue20, + inputValue21: data.inputValue21, + inputValue22: data.inputValue22, + inputValue23: data.inputValue23, + name: data.name, + }, + success: function(res) { + console.log('Data submitted successfully:', res); + }, + fail: function(err) { + console.error('Error submitting data:', err); + } + }); + // 使用腾讯混元智能体的 API 调用 + wx.request({ + url: 'https://yuanqi.tencent.com/openapi/v1/agent/chat/completions', + method: 'POST', + header: { + 'X-Source': 'openapi', + 'Content-Type': 'application/json', + 'Authorization': 'Bearer jSNTZONSnnzJ2uuQT7IEgXlPzfE4lX5f' // 替换为你的实际 Bearer Token + }, + data: { + assistant_id: 'ty1W9unZM9IY', // 替换为实际的 assistant_id + user_id: '123456', // 替换为实际的用户ID + stream: false, + messages: [ + { + role: 'user', + content: [ + { + type: 'text', + text: JSON.stringify(data) // 将用户填写的数据转换为字符串 + } + ] + } + ] + }, + success: function (res) { + console.log('API 调用成功: ', res); // 打印完整的 API 响应 + console.log('API 返回的 choices:', res.data.choices); // 检查数据结构 + + // 检查选择项并从中提取智能体回复 + if (res.data && res.data.choices && res.data.choices.length > 0) { + // 确保 message 字段的内容可以被访问 + const messageContent = res.data.choices[0].message?.content; + let agentReply; + + // 如果 messageContent 存在并且是一个数组,则提取内容 + if (Array.isArray(messageContent) && messageContent.length > 0) { + agentReply = messageContent[0].text; // 假设内容在数组的第一个元素中 + } else { + agentReply = messageContent || '无法获取智能体的回复'; + } + + // 跳转到详情页面并传递数据和智能体的回复 + wx.navigateTo({ + url: '/pages/FlightCrewDetails/FlightCrewDetails', + success: function (navRes) { + navRes.eventChannel.emit('sendData', { + details: data, // 用户输入的数据 + agentReply: agentReply // 智能体的回复 + }); + } + }); + } else { + console.log('API 响应中没有 choices'); + } + }, + fail: function (err) { + console.log('智能体调用失败', err); + } + }); +}, + +  onLoad(options) { +  }, +  onReady() { + +  }, +  onShow() { +  }, +  onHide() { +  }, +  onUnload() { +  }, +  onPullDownRefresh() { + +  }, +  onReachBottom() { + +  }, +  onShareAppMessage() { +  } +}) +   diff --git a/FlightCrew/FlightCrew.json b/FlightCrew/FlightCrew.json new file mode 100644 index 0000000..c77dc7a --- /dev/null +++ b/FlightCrew/FlightCrew.json @@ -0,0 +1,4 @@ +{ + "usingComponents": { + } +} diff --git a/FlightCrew/FlightCrew.wxml b/FlightCrew/FlightCrew.wxml new file mode 100644 index 0000000..34ae9f8 --- /dev/null +++ b/FlightCrew/FlightCrew.wxml @@ -0,0 +1,292 @@ + + + + + + 飞行事件使用 (Flight crew report) + + + + 欢迎您为民航不安全事件管理系统提供事件信息,请您仔细填写适用条目: + (红色字体为必填项) + + + + 事件发生时的当地时间: + + 时间: + + + {{selectedDate}} + + + + + {{ selectedTime }} + + + + 时区: + + + {{ timezones[selectedIndex1] }} + + + + + + 事件发生前您的工作时间: + + 过去一个月的工作天数: + + + + + + 过去一星期的工作天数: + + + + + + 过去24小时的工作时长: + + + 小时 + + + + + + 事件发生时您的岗位: + + + {{ workposition[selectedIndex2] }} + + + + + + + + 当时您是否控制航空器: + + + {{ controll[selectedIndex3] }} + + + + + + + + 您的执照类型: + + + {{ License[selectedIndex4] }} + + + + + + + 您的驾驶经验: + + 飞行小时数: + + + 小时 + + + 本机型小时: + + + 小时 + + + + + + 事件航空器种类: + + + {{ ACFT[selectedIndex5] }} + + + + + + + + 您的工作单位的种类: + + + {{ company[selectedIndex6] }} + + + + + + + + 本次飞行任务: + + + {{ task[selectedIndex7] }} + + + + + + + + 本次飞行计划: + + + {{ plan[selectedIndex8] }} + + + + + + + + 事件发生时的飞行阶段: + + + {{ phase[selectedIndex9] }} + + + + + + + + 飞行高度为: + + + 千米 + + + + + + 天气条件: + + + {{ weather[selectedIndex10] }} + + + + + + + + 光线条件和能见度为: + + + {{ lv[selectedIndex11] }} + + + + + 云底高: + + + + + + 跑道视程: + + + + + + + + + 事件发生时的空中交通管制单位为: + + + {{ ATS[selectedIndex12] }} + + + + + + + + 管制类型: + + + {{ ATC[selectedIndex13] }} + + + + + + + + 若为两机冲突,当时TCAS是否提出告警: + + + {{ TCAS[selectedIndex14] }} + + + + + + + + 是否提出建议: + + + {{ weather[selectedIndex15] }} + + + + + + + 请您尽可能完整地描述事件经过:(如事件过程、原因、建议等) + + + + + + + + 民航不安全事件管理系统欢迎全行业所有人员做安全“吹哨人”!感谢您积极主动参与改善航空安全行动和自愿报告安全风险隐患信息!我们欢迎您本着诚信原则报送有关安全信息,同时建议您留一个有效的联系方式,以方便该信息得到有效处理、应用、反馈和奖励。我们承诺对每一位员工、每一家单位的报告信息严格保密,谢谢! + + + + + + + 姓名: + + + + + + + + 电话: + + + + + + + + 邮箱: + + + + + + + + + + diff --git a/FlightCrew/FlightCrew.wxss b/FlightCrew/FlightCrew.wxss new file mode 100644 index 0000000..7fbe498 --- /dev/null +++ b/FlightCrew/FlightCrew.wxss @@ -0,0 +1,144 @@ +/* pages/Airtraffic/Airtraffic.wxss */ +.container { + display: block; + box-sizing: border-box; + width: 90%; + border: 1px solid gray; + border-bottom:0px ; + padding: 5px; + margin: auto; + position: relative; +} +.one{ + margin-top:0px; + font-weight: bold; + font-size: 21px; + display: block; + margin-left: 10px; +} +.two { + font-weight: bold; + font-size: 18px; + display: block; + margin-left: 2px; +} +.three{ + font-weight: bold; + font-size: 15px; + color: red; +} +.four{ + align-items: center; + font-size: 15px; + color: red; +} +.five1{ + margin: 5px; + margin-left: 2px; + display: block; + font-size: 15px; + margin-right: 0px; + overflow-wrap: break-word; +} +.five{ + margin: 5px; + margin-left: 2px; + margin-right: 120px; + word-wrap: break-word; + word-break: break-all; + font-size: 15px; + display: block; +} +.container1{ + display: flex; + position: relative; + align-items: center; +} +.choose1{ + margin-left: 20px; +} +.choose{ + position: absolute; + right:0; + text-overflow: ellipsis; +} +.picker { + text-align: center; + width: 100px; + height: auto; + font-size: 15px; + border: 1px solid #ccc; + padding: 3px; + margin: 10px; + +} +.input-box { + width: 25%; + padding: 0px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; + margin: 3px; +} +.input-box2 { + width: 250px; + padding: 4px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; +} +.container3 { + display: block; + box-sizing: border-box; + width: 98%; + margin: 2px; + padding: 3px; + border: 1px solid black; +} +.scroll-input { + width: 100%; + height: 150px; + padding: 10px; + font-size: 15px; + border: 1px solid black; + overflow-y: auto; + overflow-x: hidden; + resize: none; + box-sizing: border-box; +} +.container4 { + display: block; + box-sizing: border-box; + width: 90%; + border: 1px solid gray; + padding: 5px; + margin: auto; + position: relative; + margin-bottom: 20px; +} +.container5{ + border: white; + padding-top: 10px; + padding-bottom:10px; +} +.input-box1 { + width: 109px; + padding: 4px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; +} +.input-box3 { + width: 68px; + padding: 4px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; +} + + + +ec-canvas { + width: 100%; + height: 400px; +} \ No newline at end of file diff --git a/FlightCrewDetails/FlightCrewDetails.js b/FlightCrewDetails/FlightCrewDetails.js new file mode 100644 index 0000000..a80010e --- /dev/null +++ b/FlightCrewDetails/FlightCrewDetails.js @@ -0,0 +1,25 @@ +Page({ + data: { + details: {}, // 用户填写的数据 + agentReply: '' // 智能体的回复 + }, + onLoad(options) { + const eventChannel = this.getOpenerEventChannel(); + + // 监听并接收来自 FlightCrew.js 传递的数据 + eventChannel.on('sendData', (data) => { + console.log('接收到的数据: ', data); // 打印接收到的数据,便于调试 + this.setData({ + details: data.details, // 用户的详细数据 + agentReply: data.agentReply // 智能体的回复 + }); + }); + }, + // 回到首页的函数 + goToHome() { + wx.switchTab({ + url: '/pages/home/home', // 'home' Tab 页的路径 + }); + } +}); + diff --git a/FlightCrewDetails/FlightCrewDetails.json b/FlightCrewDetails/FlightCrewDetails.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/FlightCrewDetails/FlightCrewDetails.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/FlightCrewDetails/FlightCrewDetails.wxml b/FlightCrewDetails/FlightCrewDetails.wxml new file mode 100644 index 0000000..1d3d7fc --- /dev/null +++ b/FlightCrewDetails/FlightCrewDetails.wxml @@ -0,0 +1,2 @@ +智能分析: {{agentReply}} + \ No newline at end of file diff --git a/FlightCrewDetails/FlightCrewDetails.wxss b/FlightCrewDetails/FlightCrewDetails.wxss new file mode 100644 index 0000000..cce8dcb --- /dev/null +++ b/FlightCrewDetails/FlightCrewDetails.wxss @@ -0,0 +1,9 @@ +.home-button { + margin-top: 20px; + background-color: #007aff; + color: #ffffff; + padding: 10px 15px; + border-radius: 5px; + text-align: center; + font-size: 16px; +} diff --git a/Students/students.js b/Students/students.js new file mode 100644 index 0000000..56094b6 --- /dev/null +++ b/Students/students.js @@ -0,0 +1,221 @@ +// pages/Students/students.js +Page({ + data: { + name:'Students', + selectedTime: '--时--分', + selectedDate: '--年--月--日', + selectedIndex1: 0, + selectedIndex9: 0, + selectedIndex22: 0, + selectedIndex23: 0, + inputValue20: '', + inputValue21: '', + inputValue22: '', + inputValue23: '', + timezones: ['请选择','UTC-12:00', 'UTC-11:00', 'UTC-10:00', 'UTC-9:00', 'UTC-8:00', 'UTC-7:00', 'UTC-6:00', 'UTC-5:00', 'UTC-4:00', 'UTC-3:00', 'UTC-2:00', 'UTC-1:00', 'UTC+0:00', 'UTC+1:00', 'UTC+2:00', 'UTC+3:00', 'UTC+4:00', 'UTC+5:00', 'UTC+6:00', 'UTC+7:00', 'UTC+8:00', 'UTC+9:00', 'UTC+10:00', 'UTC+11:00', 'UTC+12:00'], + phase:['请选择','场外维护','加油','装载食品/货物','登机','推飞机','发动机开车/试车','滑行','其它'], + involve:['请选择','是','否'], + student:['请选择','飞行学生','地面学生','其它'] + }, + //时间选择 + onTimeChange: function (event) { + this.setData({ + selectedTime: event.detail.value + }); + }, + onTimezoneChange: function (event) { + this.setData({ + selectedIndex1: event.detail.value + }); + }, + onDateChange: function(e) { + this.setData({ + selectedDate: e.detail.value + }); + }, + //学生类型 + onstudent: function(event) { + this.setData({ + selectedIndex23: event.detail.value + }); + }, + //飞行阶段 + onphase: function(event) { + this.setData({ + selectedIndex9: event.detail.value + }); + }, + //是否涉及航空器 + oninvolve: function(event) { + this.setData({ + selectedIndex22: event.detail.value + }); + }, + //事件经过 + onInput20: function(event) { + this.setData({ + inputValue20: event.detail.value + }); + }, + //个人信息//姓名电话邮箱 + onInput21: function(event) { + this.setData({ + inputValue21: event.detail.value + }); + }, + onInput22: function(event) { + this.setData({ + inputValue22: event.detail.value + }); + }, + onInput23: function(event) { + this.setData({ + inputValue23: event.detail.value + }); + }, + //提交与重写 + onReset() { + this.setData({ + selectedTime: '--时--分', + selectedDate: '--年--月--日', + selectedIndex1: 0, + selectedIndex22: 0, + selectedIndex23: 0, + selectedIndex9: 0, + inputValue20: '', + inputValue21: '', + inputValue22: '', + inputValue23: '', + },() => { + console.log('Form has been reset'); + }) + }, + // 提交数据 + onSubmit: function () { + // 获取存储中的 token + const token = wx.getStorageSync('token'); + + if (!token) { + console.log('Token 不存在,请先登录'); + wx.showToast({ + title: '请先登录', + icon: 'none' + }); + return; // 终止提交 + } + + const data = this.data; + // 获取用户选择的实际文本值 + const timezoneText = this.data.timezones[data.selectedIndex1]; // 获取时区文本 + const phaseText = this.data.phase[data.selectedIndex9]; // 获取飞行阶段文本 + const involveText = this.data.involve[data.selectedIndex22]; // 获取是否涉及航空器的文本 + const studentText = this.data.student[data.selectedIndex23]; // 获取学生类型的文本 + // 提交的数据中只包含实际选择的文本内容 + wx.request({ + url: 'http://192.168.137.1:8080/report/add', + method: 'POST', + header: { + 'Authorization': `${token}`, + 'content-type': 'application/json' + }, + data: { + selectedTime: data.selectedTime, + selectedDate: data.selectedDate, + timezone: timezoneText, // 时区对应的文本 + phase: phaseText, // 飞行阶段对应的文本 + involve: involveText, // 是否涉及航空器对应的文本 + studentType: studentText, // 学生类型对应的文本 + inputValue20: data.inputValue20, + inputValue21: data.inputValue21, + inputValue22: data.inputValue22, + inputValue23: data.inputValue23, + name: data.name + }, + success: function(res) { + console.log('Data submitted successfully:', res); + }, + fail: function(err) { + console.error('Error submitting data:', err); + } + }); + // 使用腾讯混元智能体的 API 调用 + wx.request({ + url: 'https://yuanqi.tencent.com/openapi/v1/agent/chat/completions', + method: 'POST', + header: { + 'X-Source': 'openapi', + 'Content-Type': 'application/json', + 'Authorization': 'Bearer jSNTZONSnnzJ2uuQT7IEgXlPzfE4lX5f' // 替换为你的实际 Bearer Token + }, + data: { + assistant_id: 'ty1W9unZM9IY', // 替换为实际的 assistant_id + user_id: '123456', // 替换为实际的用户ID + stream: false, + messages: [ + { + role: 'user', + content: [ + { + type: 'text', + text: JSON.stringify(data) // 将用户填写的数据转换为字符串 + } + ] + } + ] + }, + success: function (res) { + console.log('API 调用成功: ', res); // 打印完整的 API 响应 + console.log('API 返回的 choices:', res.data.choices); // 检查数据结构 + + // 检查选择项并从中提取智能体回复 + if (res.data && res.data.choices && res.data.choices.length > 0) { + // 确保 message 字段的内容可以被访问 + const messageContent = res.data.choices[0].message?.content; + let agentReply; + + // 如果 messageContent 存在并且是一个数组,则提取内容 + if (Array.isArray(messageContent) && messageContent.length > 0) { + agentReply = messageContent[0].text; // 假设内容在数组的第一个元素中 + } else { + agentReply = messageContent || '无法获取智能体的回复'; + } + + // 跳转到详情页面并传递数据和智能体的回复 + wx.navigateTo({ + url: '/pages/FlightCrewDetails/FlightCrewDetails', + success: function (navRes) { + navRes.eventChannel.emit('sendData', { + details: data, // 用户输入的数据 + agentReply: agentReply // 智能体的回复 + }); + } + }); + } else { + console.log('API 响应中没有 choices'); + } + }, + fail: function (err) { + console.log('智能体调用失败', err); + } + }); + }, + onLoad(options) { + }, + onReady() { + + }, + onShow() { + }, + onHide() { + }, + onUnload() { + }, + onPullDownRefresh() { + + }, + onReachBottom() { + + }, + onShareAppMessage() { + } +}) \ No newline at end of file diff --git a/Students/students.json b/Students/students.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/Students/students.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/Students/students.wxml b/Students/students.wxml new file mode 100644 index 0000000..b124300 --- /dev/null +++ b/Students/students.wxml @@ -0,0 +1,114 @@ + + + + + + 学生学员使用 (Students) + + + + 欢迎您为民航不安全事件管理系统提供事件信息,请您仔细填写适用条目: + (红色字体为必填项) + + + + 事件发生时的当地时间: + + 时间: + + + {{selectedDate}} + + + + + {{ selectedTime }} + + + + 时区: + + + {{ timezones[selectedIndex1] }} + + + + + + + 学生学员类型: + + + {{ student[selectedIndex23] }} + + + + + + + + 事件发生时的飞行阶段: + + + {{ phase[selectedIndex9] }} + + + + + + + + 事件是否涉及航空器: + + + {{ involve[selectedIndex22] }} + + + + + + + 请您尽可能完整地描述事件经过:(如事件过程、原因、建议等) + + + + + + + + 民航不安全事件管理系统欢迎全行业所有人员做安全“吹哨人”!感谢您积极主动参与改善航空安全行动和自愿报告安全风险隐患信息!我们欢迎您本着诚信原则报送有关安全信息,同时建议您留一个有效的联系方式,以方便该信息得到有效处理、应用、反馈和奖励。我们承诺对每一位员工、每一家单位的报告信息严格保密,谢谢! + + + + + + + 姓名: + + + + + + + + 电话: + + + + + + + + 邮箱: + + + + + + + + + + + + diff --git a/Students/students.wxss b/Students/students.wxss new file mode 100644 index 0000000..9c2a584 --- /dev/null +++ b/Students/students.wxss @@ -0,0 +1,140 @@ +/* pages/Students/students.wxss */ +/* pages/Aviation/Aviation.wxss */ +/* pages/Airtraffic/Airtraffic.wxss */ +.container { + display: block; + box-sizing: border-box; + width: 90%; + border: 1px solid gray; + border-bottom:0px ; + padding: 5px; + margin: auto; + position: relative; +} +.one{ + margin-top:0px; + font-weight: bold; + font-size: 21px; + display: block; + margin-left: 10px; +} +.two { + font-weight: bold; + font-size: 18px; + display: block; + margin-left: 2px; +} +.three{ + font-weight: bold; + font-size: 15px; + color: red; +} +.four{ + align-items: center; + font-size: 15px; + color: red; +} +.five1{ + margin: 5px; + margin-left: 2px; + display: block; + font-size: 15px; + margin-right: 0px; + overflow-wrap: break-word; +} +.five{ + margin: 5px; + margin-left: 2px; + margin-right: 120px; + word-wrap: break-word; + word-break: break-all; + font-size: 15px; + display: block; +} +.container1{ + display: flex; + position: relative; + align-items: center; +} +.choose1{ + margin-left: 20px; +} +.choose{ + position: absolute; + right:0; + text-overflow: ellipsis; +} +.picker { + text-align: center; + width: 100px; + height: auto; + font-size: 15px; + border: 1px solid #ccc; + padding: 3px; + margin: 10px; + +} +.input-box { + width: 25%; + padding: 0px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; + margin: 3px; +} +.input-box2 { + width: 250px; + padding: 4px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; +} +.container3 { + display: block; + box-sizing: border-box; + width: 98%; + margin: 2px; + padding: 3px; + border: 1px solid black; +} +.scroll-input { + width: 100%; + height: 150px; + padding: 10px; + font-size: 15px; + border: 1px solid black; + overflow-y: auto; + overflow-x: hidden; + resize: none; + box-sizing: border-box; +} +.container4 { + display: block; + box-sizing: border-box; + width: 90%; + border: 1px solid gray; + padding: 5px; + margin: auto; + position: relative; + margin-bottom: 20px; +} +.container5{ + border: white; + padding-top: 10px; + padding-bottom:10px; +} +.input-box1 { + width: 100px; + padding: 0px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; +} +.input-box3 { + width: 68px; + padding: 4px; + border: 1px solid #ccc; + font-size: 15px; + text-align: center; +} + diff --git a/admin/admin.js b/admin/admin.js new file mode 100644 index 0000000..6b0e48d --- /dev/null +++ b/admin/admin.js @@ -0,0 +1,20 @@ +Page({ + // 跳转到查看上报页面 + goToViewReports() { + wx.navigateTo({ + url: '/pages/viewReports/viewReports', // 这里是查看上报的页面路径 + }); + }, + // 跳转到智能统计分析页面 + goToDataAnalysis() { + wx.navigateTo({ + url: '/pages/dataAnalysis/dataAnalysis', // 这里是智能统计分析的页面路径 + }); + }, + // 跳转到智能统计分析页面 + goTologin() { + wx.navigateTo({ + url: '/pages/login/login', // 这里是智能统计分析的页面路径 + }); + } +}); diff --git a/admin/admin.json b/admin/admin.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/admin/admin.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/admin/admin.wxml b/admin/admin.wxml new file mode 100644 index 0000000..25f219e --- /dev/null +++ b/admin/admin.wxml @@ -0,0 +1,17 @@ + + + + 管理员界面 + + + + + + + + + + + + + diff --git a/admin/admin.wxss b/admin/admin.wxss new file mode 100644 index 0000000..8285257 --- /dev/null +++ b/admin/admin.wxss @@ -0,0 +1,35 @@ +/* pages/admin/admin.wxss */ +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + height: 100%; +} + +.header { + margin-bottom: 100rpx; +} + +.title { + font-size: 70rpx; + font-weight: bold; +} + +.buttons { + display: flex; + flex-direction: column; + justify-content: space-around; + align-items: center; +} + +.action-btn { + width: 400rpx; + height: 100rpx; + margin: 35rpx 0; + background-color: #007aff; + color: white; + font-size: 40rpx; + text-align: center; + border-radius: 20rpx; +} diff --git a/app.js b/app.js new file mode 100644 index 0000000..a36fc27 --- /dev/null +++ b/app.js @@ -0,0 +1,6 @@ +// app.js +App({ + globalData: { + token: null + } +}); diff --git a/app.json b/app.json new file mode 100644 index 0000000..1f0e0e5 --- /dev/null +++ b/app.json @@ -0,0 +1,55 @@ +{ + "pages": [ + "pages/register/register", + "pages/login/login", + "pages/admin/admin", + "pages/home/home", + "pages/message/message", + "pages/profile/profile", + "pages/FlightCrew/FlightCrew", + "pages/Crew/Crew", + "pages/Aviation/Aviation", + "pages/AirportGround/AirportGround", + "pages/Airtraffic/Airtraffic", + "pages/Students/students", + "pages/Fast/Fast", + "pages/AircraftMaintenance/AircraftMaintenance", + "pages/FlightCrewDetails/FlightCrewDetails", + "pages/viewReports/viewReports", + "pages/userview/usereview", + "pages/dataAnalysis/dataAnalysis", + "pages/z1/z1", + "pages/z2/z2", + "pages/z3/z3" + ], + "window": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "民航不安全事件上报", + "navigationBarBackgroundColor": "#fff" + }, + "tabBar": { + "list": [ + { + "pagePath": "pages/home/home", + "iconPath": "image/首页.png", + "selectedIconPath": "image/首页 (2).png", + "text": "首页" + }, + { + "pagePath": "pages/message/message", + "iconPath": "image/人工智能大脑.png", + "selectedIconPath": "image/人工智能大脑 (1).png", + "text": "AI对话" + }, + { + "pagePath": "pages/profile/profile", + "iconPath": "image/我的.png", + "selectedIconPath": "image/我的-copy.png", + "text": "个人中心" + } + ] + }, + "componentFramework": "glass-easel", + "sitemapLocation": "sitemap.json", + "lazyCodeLoading": "requiredComponents" +} \ No newline at end of file diff --git a/app.wxss b/app.wxss new file mode 100644 index 0000000..06c6fc9 --- /dev/null +++ b/app.wxss @@ -0,0 +1,10 @@ +/**app.wxss**/ +.container { + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; + padding: 200rpx 0; + box-sizing: border-box; +} diff --git a/dataAnalysis/dataAnalysis.js b/dataAnalysis/dataAnalysis.js new file mode 100644 index 0000000..286fdc9 --- /dev/null +++ b/dataAnalysis/dataAnalysis.js @@ -0,0 +1,31 @@ +Page({ + data: { + predictResult: { + pre_data: [ + { dt: '2024-9', idx: 130 }, + { dt: '2024-8', idx: 140 }, + { dt: '2024-7', idx: 145 }, + { dt: '2024-6', idx: 150 }, + { dt: '2024-5', idx: 400 }, + { dt: '2024-4', idx:200 } + ] + } + }, + + onLoad: function () { + // 模拟获取数据(可以替换成网络请求) + const preData = [ + { dt: '2024-9', idx: 500 }, + { dt: '2024-8', idx: 670 }, + { dt: '2024-7', idx: 345 }, + { dt: '2024-6', idx: 150 }, + { dt: '2024-5', idx: 400 }, + { dt: '2024-4', idx:100 } + ]; + + // 将数据设置到页面的 data 中 + this.setData({ + 'predictResult.pre_data': preData + }); + } +}); diff --git a/dataAnalysis/dataAnalysis.json b/dataAnalysis/dataAnalysis.json new file mode 100644 index 0000000..9120626 --- /dev/null +++ b/dataAnalysis/dataAnalysis.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "ec-canvas": "../../echarts-for-weixin/ec-canvas/ec-canvas" + } +} \ No newline at end of file diff --git a/dataAnalysis/dataAnalysis.wxml b/dataAnalysis/dataAnalysis.wxml new file mode 100644 index 0000000..86cc626 --- /dev/null +++ b/dataAnalysis/dataAnalysis.wxml @@ -0,0 +1,42 @@ + +    2024年不安全事件上报的汇总 +   + + + + 日期 + + 上报数量 + + + {{item.dt}} + + + + + 150 + 300 + 450 + 600 + 750 + 900 + | + | + | + | + | + | + + + + {{item.idx}} + + + + + + + +    2024年事件上报情况-柱状图 +   \ No newline at end of file diff --git a/dataAnalysis/dataAnalysis.wxss b/dataAnalysis/dataAnalysis.wxss new file mode 100644 index 0000000..ad0556f --- /dev/null +++ b/dataAnalysis/dataAnalysis.wxss @@ -0,0 +1,110 @@ +.indexGraph { + display: flex; + width: 100%; + height: 800rpx; + background-color: #eee; + border-radius: 15rpx; + box-shadow: 2px 2px 5px 1px rgba(0, 0, 0, 0.5); +} +.left { + width: 120rpx; +} +.leftTop { + width: 100%; + height: 150rpx; + /* background-color: pink; */ +} +.date { + position: absolute; + top: 18%; + left: 1%; +} +.slice { + margin-top: -100rpx; + width: 200rpx; + height: 200rpx; + position: absolute; + left: 5%; + rotate: 45deg; + border-bottom: 3px solid rgba(0, 0, 0, 0.5); +} +.idx { + position: absolute; + top: 13%; + left: 6%; +} +.yAxis { + display: flex; + /* background-color: pink; */ + flex-direction: column; + align-items: center; + justify-content: space-around; + height: 650rpx; +} +.right { + flex: 1; +} +.graph { + position: absolute; + width: 592.5rpx; + padding-top: 30rpx; + height: 650rpx; + background-color: skyblue; + border-radius: 0 0 15rpx 0; + border-left: 2px solid rgb(0, 0, 0, 0.8); + border-top: 2px solid rgb(0, 0, 0, 0.8); +} +.colarea { + display: flex; + flex-direction: column; + justify-content: space-around; + height: 650rpx; + /* background-color: skyblue; */ +} + +.col { + padding-right: 10rpx; + height: 40rpx; + background-color: rgb(139, 0, 139); + text-align: right; + color: white; +} +.xAxis { + display: flex; + flex-wrap: wrap; + justify-content: space-evenly; + height: 120rpx; + +} +.deg { + width: 98.75rpx; + text-align: center; +} +.deg:nth-child(-n+6) { + line-height: 48px; + font-size: 20px; +} +.deg:nth-child(n+7) { + font-size: 10px; + line-height: 10px; +} + +.info { + font-size: 18px; +} + +.module { + display: flex; + flex-direction: column; + align-items: center; /* 图片和文字居中 */ + border-bottom: 2px solid #ccc; /* 分界线 */ + padding: 4px 0; /* 上下内边距 */ + width: 100%; /* 确保模块宽度一致 */ +} + + +.caption { + text-align: center; /* 文字居中 */ +} + + diff --git a/home/home.js b/home/home.js new file mode 100644 index 0000000..abe0d40 --- /dev/null +++ b/home/home.js @@ -0,0 +1,26 @@ +Page({ + data: { + }, + swiperItemTap: function(event) { + const pagePath = event.currentTarget.dataset.url; + wx.navigateTo({ + url: pagePath + }); + }, + onLoad(options) { + }, + onReady() { + }, + onShow() { + }, + onHide() { + }, + onUnload() { + }, + onPullDownRefresh() { + }, + onReachBottom() { + }, + onShareAppMessage() { + }, +}) \ No newline at end of file diff --git a/home/home.json b/home/home.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/home/home.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/home/home.wxml b/home/home.wxml new file mode 100644 index 0000000..aa87a16 --- /dev/null +++ b/home/home.wxml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + 上报中心 + + + + + + 飞行事件 + + + + 乘务事件 + + + + 空管事件 + + + + 机务事件 + + + + 地勤事件 + + + + 空防事件 + + + + 学生事件 + + + + 快速上报 + + + + + \ No newline at end of file diff --git a/home/home.wxss b/home/home.wxss new file mode 100644 index 0000000..4e93cdb --- /dev/null +++ b/home/home.wxss @@ -0,0 +1,65 @@ +/*轮播图*/ +.swiper1 { + width: 100%; + height: 450rpx; +} +.slide-image { + width: 100%; + height: 100%; + display: block; +} + +/* 容器样式 */ +.grid-container { + display: grid; + grid-template-columns: repeat(4, 1fr); /* 4列布局 */ + gap: 15rpx; /* 项目之间的间距 */ + padding: 20rpx; /* 容器内边距 */ + justify-items: center; /* 项目居中 */ +} + +/* 每个项目的样式 */ +.grid-item { + display: flex; + flex-direction: column; + align-items: center; + text-align: center; +} + +/* 图片样式 */ +.grid-item image { + width: 160rpx; /* 调整图片大小 */ + height: 160rpx; + margin-bottom: 10rpx; /* 图片和文字之间的间距 */ + border-radius: 10rpx; /* 圆角效果 */ + box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.1); /* 图片阴影效果 */ +} + +/* 文字样式 */ +.grid-item text { + font-size: 30rpx; + color: #333; /* 设置文字颜色 */ + font-weight: bold; /* 加粗字体 */ + margin:20rpx +} + +/* 容器自适应 */ +@media screen and (max-width: 375px) { + .grid-container { + grid-template-columns: repeat(2, 1fr); /* 当屏幕宽度较小(如手机端)时,改为2列布局 */ + } +} + +.three{ + margin-top: 20px; +} +.four { + display: flex; /* 使用 Flexbox 布局 */ + justify-content: center; /* 水平居中 */ + align-items: center; /* 垂直居中 */ + height: 100rpx; /* 设置高度,以便垂直居中 */ + font-size: 60rpx; /* 字体大小 */ + color: #333; /* 字体颜色 */ + font-weight: bold; /* 加粗字体 */ + margin: 20rpx; +} diff --git a/image/乘务人员.png b/image/乘务人员.png new file mode 100644 index 0000000..e8dd42e Binary files /dev/null and b/image/乘务人员.png differ diff --git a/image/人工智能大脑 (1).png b/image/人工智能大脑 (1).png new file mode 100644 index 0000000..b17bbaf Binary files /dev/null and b/image/人工智能大脑 (1).png differ diff --git a/image/人工智能大脑.png b/image/人工智能大脑.png new file mode 100644 index 0000000..b96c029 Binary files /dev/null and b/image/人工智能大脑.png differ diff --git a/image/化工专家.png b/image/化工专家.png new file mode 100644 index 0000000..609349f Binary files /dev/null and b/image/化工专家.png differ diff --git a/image/地勤人员.png b/image/地勤人员.png new file mode 100644 index 0000000..52c6399 Binary files /dev/null and b/image/地勤人员.png differ diff --git a/image/基础折线图.png b/image/基础折线图.png new file mode 100644 index 0000000..5c1a0e5 Binary files /dev/null and b/image/基础折线图.png differ diff --git a/image/基础漏斗图.png b/image/基础漏斗图.png new file mode 100644 index 0000000..8f752fb Binary files /dev/null and b/image/基础漏斗图.png differ diff --git a/image/学生学员.png b/image/学生学员.png new file mode 100644 index 0000000..6271bcf Binary files /dev/null and b/image/学生学员.png differ diff --git a/image/快速上报.png b/image/快速上报.png new file mode 100644 index 0000000..6443e4d Binary files /dev/null and b/image/快速上报.png differ diff --git a/image/我的-copy.png b/image/我的-copy.png new file mode 100644 index 0000000..2f7c179 Binary files /dev/null and b/image/我的-copy.png differ diff --git a/image/我的.png b/image/我的.png new file mode 100644 index 0000000..0dbf09d Binary files /dev/null and b/image/我的.png differ diff --git a/image/机务人员.jpg b/image/机务人员.jpg new file mode 100644 index 0000000..5e436b4 Binary files /dev/null and b/image/机务人员.jpg differ diff --git a/image/空管人员.png b/image/空管人员.png new file mode 100644 index 0000000..bd1aa32 Binary files /dev/null and b/image/空管人员.png differ diff --git a/image/空防事件.png b/image/空防事件.png new file mode 100644 index 0000000..e390d33 Binary files /dev/null and b/image/空防事件.png differ diff --git a/image/轮播图1.jpg b/image/轮播图1.jpg new file mode 100644 index 0000000..a6a0c8d Binary files /dev/null and b/image/轮播图1.jpg differ diff --git a/image/轮播图2.jpg b/image/轮播图2.jpg new file mode 100644 index 0000000..d5bde5f Binary files /dev/null and b/image/轮播图2.jpg differ diff --git a/image/轮播图3.jpg b/image/轮播图3.jpg new file mode 100644 index 0000000..40166ac Binary files /dev/null and b/image/轮播图3.jpg differ diff --git a/image/面积饼图.png b/image/面积饼图.png new file mode 100644 index 0000000..4883277 Binary files /dev/null and b/image/面积饼图.png differ diff --git a/image/飞行人员.png b/image/飞行人员.png new file mode 100644 index 0000000..120f58a Binary files /dev/null and b/image/飞行人员.png differ diff --git a/image/首页 (2).png b/image/首页 (2).png new file mode 100644 index 0000000..d1b6bf4 Binary files /dev/null and b/image/首页 (2).png differ diff --git a/image/首页.png b/image/首页.png new file mode 100644 index 0000000..12e8f19 Binary files /dev/null and b/image/首页.png differ diff --git a/login/login.js b/login/login.js new file mode 100644 index 0000000..7a234e7 --- /dev/null +++ b/login/login.js @@ -0,0 +1,127 @@ +// pages/login/login.js +Page({ + data: { + ID: '', // 用户输入的 ID + password: '', // 用户输入的密码 + errorMessage: '' // 错误信息提示 + }, + + // 处理 ID 输入 + onIDInput(e) { + this.setData({ + ID: e.detail.value // 将输入的ID存储到 data 中 + }); + this.clearErrorMessage(); // 清除错误提示 + }, + + // 处理密码输入 + onPasswordInput(e) { + this.setData({ + password: e.detail.value // 将输入的密码存储到 data 中 + }); + this.clearErrorMessage(); // 清除错误提示 + }, + + // 清除错误信息 + clearErrorMessage() { + if (this.data.errorMessage) { + this.setData({ errorMessage: '' }); + } + }, + + // 检查管理员状态 + checkAdminStatus() { + const token = getApp().globalData.token || wx.getStorageSync('token'); + if (!token) { + this.setData({ errorMessage: 'Token 丢失,请重新登录' }); + return; + } + console.log("Checking admin status with token:", token); // 输出 token 确认 + + wx.request({ + header: { + 'Authorization': `${token}`, // 使用存储的 token + 'content-type': 'application/x-www-form-urlencoded' + }, + url: 'http://192.168.144.1:8080/user/is_admin', // 管理员状态查询接口 + method: 'GET', + success: (res) => { + console.log("Admin status response:", res); // 输出请求返回数据 + if (res.data.data) { + wx.navigateTo({ + url: '/pages/admin/admin' // 管理员页面 + }); + } else { + wx.switchTab({ + url: '/pages/home/home' // 普通用户主页 + }); + } + }, + fail: (error) => { + console.log("Admin status check failed", error); + this.setData({ + errorMessage: '无法验证管理员状态,请稍后再试' + }); + } + }); + }, + + submitUserInfo() { + const { ID, password } = this.data; + + if (!ID || !password) { + this.setData({ + errorMessage: 'ID和密码不能为空' + }); + return; + } + + wx.request({ + header: { + 'content-type': 'application/x-www-form-urlencoded' + }, + url: 'http://192.168.144.1:8080/user/login', + method: 'POST', + data: { + 'username': ID, + 'password': password + }, + success: (res) => { + if (res.data.code == 0) { + wx.showToast({ + title: '登录成功', + icon: 'success' + }); + + // 检查 getApp() 和 globalData 是否定义 + const appInstance = getApp(); + if (appInstance && appInstance.globalData) { + appInstance.globalData.token = res.data.data; + wx.setStorageSync('token', res.data.data); + } else { + console.error("App instance or globalData is not initialized"); + } + + this.checkAdminStatus(); + } else { + this.setData({ + errorMessage: res.data.message || '登录失败,请检查ID和密码' + }); + } + }, + fail: (error) => { + console.log('登录失败', error); + this.setData({ + errorMessage: '网络请求失败,请稍后再试' + }); + } + }); + }, + + // 跳转到注册页面 + goToRegister() { + wx.redirectTo({ + url: '/pages/register/register' // 跳转到注册页面 + }); + } +}); diff --git a/login/login.json b/login/login.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/login/login.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/login/login.wxml b/login/login.wxml new file mode 100644 index 0000000..ad5f9dc --- /dev/null +++ b/login/login.wxml @@ -0,0 +1,31 @@ + + + 登录 + + + + + + + + + {{errorMessage}} + + + + + + + 还没有账号?点击注册 + + diff --git a/login/login.wxss b/login/login.wxss new file mode 100644 index 0000000..919e6f3 --- /dev/null +++ b/login/login.wxss @@ -0,0 +1,80 @@ +/* pages/login/login.wxss */ +page { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 100vh; + background-color: #f8f8f8; +} + +.container { + width: 90%; + max-width: 400px; + background-color: #fff; + border-radius: 10px; + padding: 20px; + box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); +} + +.title { + text-align: center; + font-size: 24px; + font-weight: bold; + color: #333; + margin-bottom: 20px; +} + +input { + width: 100%; + height: 40px; + padding: 0 10px; + margin-bottom: 15px; + border: 1px solid #ddd; + border-radius: 5px; + background-color: #fafafa; +} + +input:focus { + border-color: #007aff; + background-color: #fff; +} + +button { + width: 100%; + height: 45px; + background-color: #007aff; + color: #fff; + border: none; + border-radius: 5px; + font-size: 16px; + text-align: center; + line-height: 45px; + margin-top: 10px; +} + +button:active { + background-color: #005bb5; +} + +.admin-section { + margin-bottom: 15px; +} + +.error { + color: red; + font-size: 14px; + margin-top: 5px; +} + +.message { + margin-top: 10px; + text-align: center; + color: #666; +} + +.link { + color: #007aff; + text-decoration: underline; + cursor: pointer; +} diff --git a/message/message.js b/message/message.js new file mode 100644 index 0000000..fad4a41 --- /dev/null +++ b/message/message.js @@ -0,0 +1,97 @@ +Page({ + data: { + messages: [], // 用于存储消息内容 + inputVal: '', // 用户输入的内容 + }, + + // 生成唯一ID函数 + generateUniqueId() { + return 'msg_' + new Date().getTime() + Math.floor(Math.random() * 1000); + }, + + // 发送用户消息 + sendMessage() { + const that = this; + + // 检查输入框内容是否为空 + if (this.data.inputVal === '') { + wx.showToast({ + title: '请输入内容', + icon: 'none' + }); + return; + } + + // 添加用户消息,并生成唯一ID + const userMessage = { + id: this.generateUniqueId(), + role: 'user', + content: this.data.inputVal + }; + + // 更新消息列表,并清空输入框内容 + this.setData({ + messages: [...this.data.messages, userMessage], + inputVal: '' // 清空输入框内容 + }); + + // 调用腾讯混元 API 获取回复,传递所有消息历史 + wx.request({ + url: 'https://yuanqi.tencent.com/openapi/v1/agent/chat/completions', // API地址 + method: 'POST', + data: { + assistant_id: 'XEpMRFLn0yqm', // 替换为你的 assistant_id + user_id: '', // 替换为实际的用户ID + stream: false, + messages: that.data.messages.map(msg => ({ + role: msg.role, + content: [ + { + type: 'text', + text: msg.content + } + ] + })) + }, + header: { + 'X-Source': 'openapi', // 必需的X-Source头部 + 'Content-Type': 'application/json', + 'Authorization': 'Bearer K8xhMFEsRpO00MKFKRUqeyideA0Ego3a' // 替换为你的API密钥 + }, + success(res) { + if (res.data && res.data.choices && res.data.choices.length > 0) { + const assistantMessage = { + id: that.generateUniqueId(), // 为助手消息生成唯一ID + role: 'assistant', + content: res.data.choices[0].message.content + }; + + // 添加助手消息 + that.setData({ + messages: [...that.data.messages, assistantMessage] + }); + } else { + wx.showToast({ + title: 'API返回异常', + icon: 'none' + }); + } + }, + + fail(response) { + console.log('请求失败:', response); // 输出失败信息用于调试 + wx.showToast({ + title: '请求失败,请检查网络或API密钥', + icon: 'none' + }); + } + }); + }, + + // 处理用户输入 + bindKeyInput(e) { + this.setData({ + inputVal: e.detail.value + }); + } +}); diff --git a/message/message.json b/message/message.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/message/message.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/message/message.wxml b/message/message.wxml new file mode 100644 index 0000000..a4d6481 --- /dev/null +++ b/message/message.wxml @@ -0,0 +1,24 @@ + + + AI助手 + + + + + + + + {{item.content}} + + + {{item.content}} + + + + + + + + + + diff --git a/message/message.wxss b/message/message.wxss new file mode 100644 index 0000000..8731775 --- /dev/null +++ b/message/message.wxss @@ -0,0 +1,107 @@ +/* 全局容器样式 */ +.container { + display: flex; + flex-direction: column; + height: 106vh; + background-color: #ffffff; /* 背景为纯白色 */ + color: #333333; /* 深色文本,和白色背景形成对比 */ + margin-top: -100px; + margin-bottom: -60px; +} +/* 标题区域 */ +.header { + padding: 10px; /* 调整内边距 */ + text-align: center; /* 标题左对齐 */ + border-bottom: 1px solid #e0e0e0; /* 边框为浅灰色 */ +} + +.title { + color: black; /* 深灰色标题 */ + font-size: 24px; + font-weight: bold; + text-transform: uppercase; /* 大写标题 */ +} + +/* 聊天区域 */ +.chat-area { + flex: 1; + background-color: #ffffff; /* 白色背景 */ + overflow-y: auto; /* 允许滚动 */ + border-top: 1px solid #e0e0e0; /* 边框线 */ +} + +/* 消息气泡 */ +.message { + margin: 10px 10px; + display: flex; + flex-direction: row; /* 水平排列 */ +} + +.user-message, .assistant-message { + padding: 10px; + border-radius: 15px; + border: 1px solid #dddddd; + color: #333333; + word-wrap: break-word; /* 自动换行 */ + word-break: break-all; /* 长单词自动拆分换行 */ + white-space: pre-wrap; /* 保留空白符并换行 */ + max-width: 80%; /* 最大宽度为70% */ + font-family: 'Arial', sans-serif; +} + +.user-message { + margin-left: auto; + background-color: #f0f0f0; /* 用户消息为浅灰色背景 */ + border-radius: 15px 15px 0 15px; /* 圆角气泡 */ +} + +.assistant-message { + margin-right: auto; + background-color: #e8e8e8; /* AI消息背景色为稍深灰色 */ + border-radius: 15px 15px 15px 0; /* 圆角气泡 */ +} + +/* 输入区域 */ +.input-area { + display: flex; + padding: 10px 15px; + background-color: white; /* 输入区为浅灰色背景 */ + border-top: 1px solid #dddddd; /* 上方的分隔线 */ + position: sticky; /* 固定输入框在底部 */ + bottom: 0; +} + +.input-box { + flex: 1; + padding: 10px; + border: 1px solid #cccccc; /* 边框为浅灰色 */ + border-radius: 5px; /* 圆角输入框 */ + background-color: #ffffff; /* 输入框为白色 */ + color: #333333; + margin-right: 10px; + font-family: 'Arial', sans-serif; + word-wrap: break-word; /* 输入框内长内容自动换行 */ + word-break: break-all; +} + +/* 发送按钮样式 */ +.send-btn { + padding: 6px 12px; /* 调整为更小的内边距 */ + background-color: #4a90e2; /* 亮蓝色 */ + color: #ffffff; + border-radius: 5px; /* 保持圆角 */ + border: none; + font-weight: bold; + font-size: 14px; /* 缩小字体大小 */ + cursor: pointer; + transition: background-color 0.3s ease; +} + +.send-btn:hover { + background-color: #357ABD; /* 悬停时颜色加深 */ +} + +/* 图标颜色和输入框样式 */ +input::placeholder { + color: #aaaaaa; /* 输入框提示符为浅灰色 */ +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..38455b1 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,75 @@ +{ + "name": "unsafe-pro", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "unsafe-pro", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@vant/weapp": "^1.11.6", + "echarts-for-weixin": "^1.0.2", + "miniprogram-api-typings": "^3.12.2", + "var": "^0.4.0" + } + }, + "node_modules/@vant/weapp": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@vant/weapp/-/weapp-1.11.6.tgz", + "integrity": "sha512-a3heReWYT2gNdsyj6x1hBwsM8V8NrjcPAmle86NH2CD2V/i/h0le75piW6KntSfOPCwekVWMBKhysNrBpJeKdw==" + }, + "node_modules/echarts": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/echarts/-/echarts-5.5.1.tgz", + "integrity": "sha512-Fce8upazaAXUVUVsjgV6mBnGuqgO+JNDlcgF79Dksy4+wgGpQB2lmYoO4TSweFg/mZITdpGHomw/cNBJZj1icA==", + "peer": true, + "dependencies": { + "tslib": "2.3.0", + "zrender": "5.6.0" + } + }, + "node_modules/echarts-for-weixin": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/echarts-for-weixin/-/echarts-for-weixin-1.0.2.tgz", + "integrity": "sha512-cEk4yFMCJDQpvAgVRKbGvMjXvuW965iEUootJffRFHwJwCq0/GIeoRTTAEuj50PKMMtLTW4DmBPmvPja3sH2jQ==", + "peerDependencies": { + "echarts": "^5.1.2" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/miniprogram-api-typings": { + "version": "3.12.2", + "resolved": "https://registry.npmjs.org/miniprogram-api-typings/-/miniprogram-api-typings-3.12.2.tgz", + "integrity": "sha512-OJB2uVAfhycX4teG/zEVpoThushQqLOx946XACDpVc6OQydiJWjn7djVzvNCbv0VOA7sbHGPQp/RkXD9vMCDEw==" + }, + "node_modules/tslib": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz", + "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==", + "peer": true + }, + "node_modules/var": { + "version": "0.4.0", + "resolved": "https://registry.npmmirror.com/var/-/var-0.4.0.tgz", + "integrity": "sha512-olxlLAssnt9UPL5UAErYTaCJhpwaDfkuSxOEB5eUclEJbl4xi7EhOIaOh6Y8KTQHIKUnyd2DygRLSnTaXtXuGg==", + "dependencies": { + "lodash": "^4.17.4" + } + }, + "node_modules/zrender": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/zrender/-/zrender-5.6.0.tgz", + "integrity": "sha512-uzgraf4njmmHAbEUxMJ8Oxg+P3fT04O+9p7gY+wJRVxo8Ge+KmYv0WJev945EH4wFuc4OY2NLXz46FZrWS9xJg==", + "peer": true, + "dependencies": { + "tslib": "2.3.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..14359f1 --- /dev/null +++ b/package.json @@ -0,0 +1,18 @@ +{ + "name": "unsafe-pro", + "version": "1.0.0", + "main": ".eslintrc.js", + "dependencies": { + "@vant/weapp": "^1.11.6", + "echarts-for-weixin": "^1.0.2", + "miniprogram-api-typings": "^3.12.2", + "var": "^0.4.0" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "description": "" +} diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 8bf2ac0..0000000 --- a/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 3.2.3 - - - com.sa - bigevent - 0.0.1-SNAPSHOT - bigevent - bigevent - - 17 - - - - org.springframework.boot - spring-boot-starter-web - - - org.mybatis.spring.boot - mybatis-spring-boot-starter - 3.0.3 - - - - com.mysql - mysql-connector-j - runtime - - - org.springframework.boot - spring-boot-starter-test - test - - - org.mybatis.spring.boot - mybatis-spring-boot-starter-test - 3.0.3 - test - - - org.projectlombok - lombok - annotationProcessor - - - org.springframework.boot - spring-boot-starter-validation - - - com.auth0 - java-jwt - 4.4.0 - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - diff --git a/profile/profile.js b/profile/profile.js new file mode 100644 index 0000000..c885722 --- /dev/null +++ b/profile/profile.js @@ -0,0 +1,24 @@ +Page({ + data: { + avatarUrl: '/image/化工专家.png', // 默认头像 + }, + viewLogs: function() { + wx.navigateTo({ + url: '/pages/userview/usereview', + }); + }, + logout: function() { + wx.showModal({ + title: '退出登录', + content: '你确定要退出登录吗?', + success: (res) => { + if (res.confirm) { + wx.clearStorage(); // 清除本地存储的用户数据 + wx.redirectTo({ + url: '/pages/login/login' // 跳转到登录页面 + }); + } + } + }); + } +}); diff --git a/profile/profile.json b/profile/profile.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/profile/profile.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/profile/profile.wxml b/profile/profile.wxml new file mode 100644 index 0000000..6b527dc --- /dev/null +++ b/profile/profile.wxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/profile/profile.wxss b/profile/profile.wxss new file mode 100644 index 0000000..d8effee --- /dev/null +++ b/profile/profile.wxss @@ -0,0 +1,53 @@ +.profile-page { + padding: 20px; + background-color: white; /* 整体背景色 */ + margin-top: 100px; +} +.profile-header { + display: flex; + align-items: center; + padding: 20px; + background-color: #fff; + border-radius: 10px; + margin-bottom: 20px; + flex-direction: column; + align-items: center; /* 水平居中 */ + padding: 20px; +} + +.avatar-container { + width: 125px; + height: 125px; + margin-right: 15px; + border-radius: 50%; + overflow: hidden; +} + +.avatar { + width: 100%; + height: 100%; + object-fit: cover; /* 确保图片不变形 */ +} + +.actions { + background-color: #fff; + padding: 40px; + border-radius: 10px; + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); +} + +.action-btn { + height: 50px; + width: 100%; + padding: 5px; + background-color: #007aff; + color: white; + text-align: center; + border-radius: 5px; + margin-bottom: 15px; + font-size: 16px; +} + +.logout-btn { + background-color: #ff3b30; /* 红色背景,用于突出退出按钮 */ +} diff --git a/project.config.json b/project.config.json new file mode 100644 index 0000000..228eb3d --- /dev/null +++ b/project.config.json @@ -0,0 +1,28 @@ +{ + "appid": "wxdb7149e7addd81c6", + "compileType": "miniprogram", + "libVersion": "3.4.6", + "packOptions": { + "ignore": [], + "include": [] + }, + "setting": { + "coverView": true, + "es6": true, + "postcss": true, + "minified": true, + "enhance": true, + "showShadowRootInWxmlPanel": true, + "packNpmRelationList": [], + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + } + }, + "condition": {}, + "editorSetting": { + "tabIndent": "insertSpaces", + "tabSize": 2 + } +} \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json new file mode 100644 index 0000000..2dd5162 --- /dev/null +++ b/project.private.config.json @@ -0,0 +1,148 @@ +{ + "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", + "projectname": "%E4%B8%8D%E5%AE%89%E5%85%A8%E4%BA%8B%E4%BB%B6%E7%AE%A1%E7%90%86%E5%BC%80%E5%8F%91", + "setting": { + "compileHotReLoad": true, + "skylineRenderEnable": true, + "urlCheck": false + }, + "condition": { + "miniprogram": { + "list": [ + { + "name": "echarts-for-weixin\\pages\\bar\\index", + "pathName": "echarts-for-weixin\\pages\\bar\\index", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/z9/z9", + "pathName": "pages/z9/z9", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/z5/z5", + "pathName": "pages/z5/z5", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/z10/z10", + "pathName": "pages/z10/z10", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/z4/z4", + "pathName": "pages/z4/z4", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/viewdetail/viewdetail", + "pathName": "pages/viewdetail/viewdetail", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/userview/usereview", + "pathName": "pages/userview/usereview", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/userview/usereview", + "pathName": "pages/userview/usereview", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/profile/profile", + "pathName": "pages/profile/profile", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/FlightCrew/FlightCrew", + "pathName": "pages/FlightCrew/FlightCrew", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/login/login", + "pathName": "pages/login/login", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/admin/admin", + "pathName": "pages/admin/admin", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/profile/profile", + "pathName": "pages/profile/profile", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/dataAnalysis/dataAnalysis", + "pathName": "pages/dataAnalysis/dataAnalysis", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/viewReports/viewReports", + "pathName": "pages/viewReports/viewReports", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/home/home", + "pathName": "pages/home/home", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/contact/contact", + "pathName": "pages/contact/contact", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/message/message", + "pathName": "pages/message/message", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/register/register", + "pathName": "pages/register/register", + "query": "", + "launchMode": "default", + "scene": null + } + ] + } + } +} \ No newline at end of file diff --git a/register/register.js b/register/register.js new file mode 100644 index 0000000..32bf028 --- /dev/null +++ b/register/register.js @@ -0,0 +1,66 @@ +// pages/register/register.js +Page({ + data: { + ID: '', + password: '', + errorMessage: '' + }, + + // 处理ID输入 + onIDInput(e) { + this.setData({ + ID: e.detail.value + }); + }, + + // 处理密码输入 + onPasswordInput(e) { + this.setData({ + password: e.detail.value + }); + }, + + // 处理注册逻辑 + submitUserInfo() { + const { ID, password } = this.data; + + // 验证 ID 和密码是否为空 + if (!ID || !password) { + this.setData({ + errorMessage: '账号ID和密码不能为空' + }); + return; + } + + // 发起注册请求,使用 x-www-form-urlencoded + wx.request({ + header: { + 'content-type': 'application/x-www-form-urlencoded' // 设置请求头 + }, + url: 'http://192.168.144.1:8080/user/register', // 替换为你的后端API地址 + method: 'POST', + data: { + 'username': ID, + 'password': password + }, + success(res) { + console.log('注册成功', res); + wx.showToast({ + title: '注册成功', + icon: 'success' + }); + // 注册成功后跳转到登录页面 + wx.redirectTo({ + url: '/pages/login/login' + }); + }, + }); + }, + + // 跳转到登录页面 + goToLogin() { + wx.redirectTo({ + url: '/pages/login/login' // 登录页面的路径 + }); + } +}); diff --git a/register/register.json b/register/register.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/register/register.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/register/register.wxml b/register/register.wxml new file mode 100644 index 0000000..de3e8c4 --- /dev/null +++ b/register/register.wxml @@ -0,0 +1,32 @@ + + + + 注册 + + + + + + + + + {{errorMessage}} + + + + + + + 已有账号?点击登录 + + diff --git a/register/register.wxss b/register/register.wxss new file mode 100644 index 0000000..bfe364c --- /dev/null +++ b/register/register.wxss @@ -0,0 +1,76 @@ +/* pages/register/register.wxss */ +page { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 100vh; + background-color: #f8f8f8; +} + +.container { + width: 90%; + max-width: 400px; + background-color: #fff; + border-radius: 10px; + padding: 20px; + box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); +} + +.title { + text-align: center; + font-size: 24px; + font-weight: bold; + color: #333; + margin-bottom: 20px; +} + +input { + width: 100%; + height: 40px; + padding: 0 10px; + margin-bottom: 15px; + border: 1px solid #ddd; + border-radius: 5px; + background-color: #fafafa; +} + +input:focus { + border-color: #007aff; + background-color: #fff; +} + +button { + width: 100%; + height: 45px; + background-color: #007aff; + color: #fff; + border: none; + border-radius: 5px; + font-size: 16px; + text-align: center; + line-height: 45px; + margin-top: 10px; +} + +button:active { + background-color: #005bb5; +} + +.error { + color: red; + font-size: 14px; + margin-top: 5px; +} + +.message { + margin-top: 10px; + text-align: center; + color: #666; +} + +.link { + color: #007aff; + text-decoration: underline; + cursor: pointer; +} diff --git a/sitemap.json b/sitemap.json new file mode 100644 index 0000000..cd24f35 --- /dev/null +++ b/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file diff --git a/sql.txt b/sql.txt deleted file mode 100644 index e70b73d..0000000 --- a/sql.txt +++ /dev/null @@ -1,61 +0,0 @@ -CREATE TABLE reports ( - id BIGINT AUTO_INCREMENT PRIMARY KEY, - name TEXT, - selectedTime TEXT, - selectedDate TEXT, - license TEXT, - acftType TEXT, - fixstage TEXT, - fixcheck TEXT, - aarcstatus TEXT, - phase TEXT, - wether TEXT, - lightCondition TEXT, - carone TEXT, - cartwo TEXT, - workPosition TEXT, - task TEXT, - plan TEXT, - ats TEXT, - atc TEXT, - tcas TEXT, - advise TEXT, - involve TEXT, - tudentType TEXT, - acft0Type TEXT, - task0 TEXT, - plan0 TEXT, - phase0 TEXT, - wether0 TEXT, - lightCondition0 TEXT, - ats0 TEXT, - atc0 TEXT, - tcas0 TEXT, - advise0 TEXT, - inputValue1 TEXT, - inputValue2 TEXT, - inputValue3 TEXT, - inputValue4 TEXT, - inputValue5 TEXT, - inputValue6 TEXT, - inputValue7 TEXT, - inputValue8 TEXT, - inputValue9 TEXT, - inputValue10 TEXT, - inputValue11 TEXT, - inputValue12 TEXT, - inputValue13 TEXT, - inputValue14 TEXT, - inputValue15 TEXT, - inputValue16 TEXT, - inputValue17 TEXT, - inputValue18 TEXT, - inputValue19 TEXT, - inputValue20 TEXT, - inputValue21 TEXT, - inputValue22 TEXT, - inputValue23 TEXT, - inputValue100 TEXT, - inputValue101 TEXT, - inputValue102 TEXT -); \ No newline at end of file diff --git a/src/main/java/com/sa/unsafeincidents/UnsafeincidentsApplication.java b/src/main/java/com/sa/unsafeincidents/UnsafeincidentsApplication.java deleted file mode 100644 index 90965b6..0000000 --- a/src/main/java/com/sa/unsafeincidents/UnsafeincidentsApplication.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.sa.unsafeincidents; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class UnsafeincidentsApplication { - - public static void main(String[] args) { - - SpringApplication.run(UnsafeincidentsApplication.class, args); - - } - -} diff --git a/src/main/java/com/sa/unsafeincidents/config/webconfig.java b/src/main/java/com/sa/unsafeincidents/config/webconfig.java deleted file mode 100644 index f03e229..0000000 --- a/src/main/java/com/sa/unsafeincidents/config/webconfig.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.sa.unsafeincidents.config; - -import com.sa.unsafeincidents.interceptors.LoginInterceptor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -@Configuration -public class webconfig implements WebMvcConfigurer { - - @Autowired - private LoginInterceptor loginInterceptor; - - @Override - public void addInterceptors(InterceptorRegistry registry) { - registry.addInterceptor(loginInterceptor).excludePathPatterns("/user/login", "/user/register"); - } -} diff --git a/src/main/java/com/sa/unsafeincidents/controller/ReportController.java b/src/main/java/com/sa/unsafeincidents/controller/ReportController.java deleted file mode 100644 index 518ba93..0000000 --- a/src/main/java/com/sa/unsafeincidents/controller/ReportController.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.sa.unsafeincidents.controller; -import com.sa.unsafeincidents.pojo.Report; -import com.sa.unsafeincidents.pojo.Result; -import com.sa.unsafeincidents.pojo.User; -import com.sa.unsafeincidents.service.ReportService; -import com.sa.unsafeincidents.service.UserService; -import com.sa.unsafeincidents.utils.ThreadLocalUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.List; -import java.util.Map; - -@RestController -@RequestMapping("/report") -public class ReportController { - @Autowired - ReportService reportService; - - @Autowired - UserService userService; - - @PostMapping("/add") - public Result add(@RequestBody Report form) { - reportService.add(form); - System.out.println("test"); - return Result.success(); - } - - @GetMapping("/get") - public Result get(Integer id) { - return Result.success(reportService.findByID(id)); - } - - @PostMapping("/reply") - public Result reply(Integer id, String reply) { - reportService.reply(id, reply); - return Result.success(); - } - - @GetMapping("/list") - public Result> list() { - Map claims = ThreadLocalUtil.get(); - String username = (String) claims.get("username"); - User user = userService.findByUsername(username); - if (user.getPermissions() == 1) { - return Result.success(reportService.list()); - } else { - List reports = reportService.list(username); - return Result.success(reports); - } - } -} diff --git a/src/main/java/com/sa/unsafeincidents/controller/UserController.java b/src/main/java/com/sa/unsafeincidents/controller/UserController.java deleted file mode 100644 index 9ef5212..0000000 --- a/src/main/java/com/sa/unsafeincidents/controller/UserController.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.sa.unsafeincidents.controller; - - -import com.sa.unsafeincidents.pojo.Result; -import com.sa.unsafeincidents.pojo.User; -import com.sa.unsafeincidents.service.UserService; -import com.sa.unsafeincidents.utils.JwtUtil; -import com.sa.unsafeincidents.utils.Md5Util; -import com.sa.unsafeincidents.utils.ThreadLocalUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.HashMap; -import java.util.Map; - -@RestController -@RequestMapping("/user") -public class UserController { - @Autowired - UserService userService; - - @PostMapping("/register") - public Result register(String username, String password) { - User user = userService.findByUsername(username); - - if (user == null) { - userService.register(username, password); - return Result.success(); - } else { - return Result.error("用户已存在"); - } - } - - @GetMapping("/is_admin") - public Result is_admin() { - Map claims = ThreadLocalUtil.get(); - String username = (String) claims.get("username"); -// System.out.println(username); - User user = userService.findByUsername(username); - if (user.getPermissions() == 1) return Result.success(true); - return Result.success(false); - } - - @PostMapping("/login") - public Result login(String username,String password) { - User loginuser = userService.findByUsername(username); - -// System.out.println(username + ' ' + password); - - if (loginuser == null || !loginuser.getPassword().equals(Md5Util.getMD5String(password))) { - return Result.error("用户名或密码错误"); - } else { - Map claims = new HashMap<>(); - claims.put("id",loginuser.getId()); - claims.put("username",loginuser.getUsername()); - String token = JwtUtil.genToken(claims); - return Result.success(token); - } - } -} diff --git a/src/main/java/com/sa/unsafeincidents/exception/GlobalExceptionHandle.java b/src/main/java/com/sa/unsafeincidents/exception/GlobalExceptionHandle.java deleted file mode 100644 index 0ebc07d..0000000 --- a/src/main/java/com/sa/unsafeincidents/exception/GlobalExceptionHandle.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.sa.unsafeincidents.exception; - - -import com.sa.unsafeincidents.pojo.Result; -import org.springframework.util.StringUtils; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.RestControllerAdvice; - -@RestControllerAdvice -public class GlobalExceptionHandle { - - - @ExceptionHandler(Exception.class) - public Result HandleException(Exception e) { - e.printStackTrace(); - return Result.error(StringUtils.hasLength(e.getMessage())? e.getMessage():"操作失败"); - } -} diff --git a/src/main/java/com/sa/unsafeincidents/interceptors/LoginInterceptor.java b/src/main/java/com/sa/unsafeincidents/interceptors/LoginInterceptor.java deleted file mode 100644 index 1d95aca..0000000 --- a/src/main/java/com/sa/unsafeincidents/interceptors/LoginInterceptor.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.sa.unsafeincidents.interceptors; - -import com.sa.unsafeincidents.utils.JwtUtil; -import com.sa.unsafeincidents.utils.ThreadLocalUtil; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import org.springframework.stereotype.Component; -import org.springframework.web.servlet.HandlerInterceptor; -import org.springframework.web.servlet.ModelAndView; - -@Component -public class LoginInterceptor implements HandlerInterceptor { - - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { - String token = request.getHeader("Authorization"); - try { - ThreadLocalUtil.set(JwtUtil.parseToken(token)); - return true; - } catch (Exception e) { - response.setStatus(401); - return false; - } - } - - - @Override - public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { - ThreadLocalUtil.remove(); - } -} \ No newline at end of file diff --git a/src/main/java/com/sa/unsafeincidents/mapper/ReportMapper.java b/src/main/java/com/sa/unsafeincidents/mapper/ReportMapper.java deleted file mode 100644 index 7ed06ba..0000000 --- a/src/main/java/com/sa/unsafeincidents/mapper/ReportMapper.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.sa.unsafeincidents.mapper; - -import com.sa.unsafeincidents.pojo.Report; -import org.apache.ibatis.annotations.*; - -import java.util.ArrayList; - -@Mapper -public interface ReportMapper { - - @Insert("INSERT INTO reports (username, name, selectedTime, selectedDate, license, acftType, fixstage, " + - "fixcheck, aarcstatus, phase, wether, lightCondition, carone, cartwo, workPosition, task, plan, ats, atc, tcas, " + - "advise, involve, tudentType, acft0Type, task0, plan0, phase0, wether0, lightCondition0, ats0, atc0, tcas0, " + - "advise0, inputValue1, inputValue2, inputValue3, inputValue4, inputValue5, inputValue6, inputValue7, " + - "inputValue8, inputValue9, inputValue10, inputValue11, inputValue12, inputValue13, inputValue14, inputValue15, " + - "inputValue16, inputValue17, inputValue18, inputValue19, inputValue20, inputValue21, inputValue22, " + - "inputValue23, inputValue100, inputValue101, inputValue102, reply) " + - "VALUES (#{username}, #{name}, #{selectedTime}, #{selectedDate}, #{license}, #{acftType}, #{fixstage}, " + - "#{fixcheck}, #{aarcstatus}, #{phase}, #{wether}, #{lightCondition}, #{carone}, #{cartwo}, #{workPosition}, " + - "#{task}, #{plan}, #{ats}, #{atc}, #{tcas}, #{advise}, #{involve}, #{tudentType}, #{acft0Type}, #{task0}, " + - "#{plan0}, #{phase0}, #{wether0}, #{lightCondition0}, #{ats0}, #{atc0}, #{tcas0}, #{advise0}, " + - "#{inputValue1}, #{inputValue2}, #{inputValue3}, #{inputValue4}, #{inputValue5}, #{inputValue6}, " + - "#{inputValue7}, #{inputValue8}, #{inputValue9}, #{inputValue10}, #{inputValue11}, #{inputValue12}, " + - "#{inputValue13}, #{inputValue14}, #{inputValue15}, #{inputValue16}, #{inputValue17}, #{inputValue18}, " + - "#{inputValue19}, #{inputValue20}, #{inputValue21}, #{inputValue22}, #{inputValue23}, #{inputValue100}, " + - "#{inputValue101}, #{inputValue102}, #{reply})") - void add(Report report); - - @Delete("DELETE FROM reports WHERE id = #{id}") - void deleteById(Long id); - - @Select("select * from reports where name=#{name}") - ArrayList findByName(String name); - - @Select("select * from reports") - ArrayList list(); - - @Select("select * from reports where id=#{id}") - Report findByID(Integer id); - - @Update("UPDATE reports SET " + - "name = #{name}, " + - "selectedTime = #{selectedTime}, " + - "selectedDate = #{selectedDate}, " + - "license = #{license}, " + - "acftType = #{acftType}, " + - "fixstage = #{fixstage}, " + - "fixcheck = #{fixcheck}, " + - "aarcstatus = #{aarcstatus}, " + - "phase = #{phase}, " + - "wether = #{wether}, " + - "lightCondition = #{lightCondition}, " + - "carone = #{carone}, " + - "cartwo = #{cartwo}, " + - "workPosition = #{workPosition}, " + - "task = #{task}, " + - "plan = #{plan}, " + - "ats = #{ats}, " + - "atc = #{atc}, " + - "tcas = #{tcas}, " + - "advise = #{advise}, " + - "involve = #{involve}, " + - "tudentType = #{tudentType}, " + - "acft0Type = #{acft0Type}, " + - "task0 = #{task0}, " + - "plan0 = #{plan0}, " + - "phase0 = #{phase0}, " + - "wether0 = #{wether0}, " + - "lightCondition0 = #{lightCondition0}, " + - "ats0 = #{ats0}, " + - "atc0 = #{atc0}, " + - "tcas0 = #{tcas0}, " + - "advise0 = #{advise0}, " + - "inputValue1 = #{inputValue1}, " + - "inputValue2 = #{inputValue2}, " + - "inputValue3 = #{inputValue3}, " + - "inputValue4 = #{inputValue4}, " + - "inputValue5 = #{inputValue5}, " + - "inputValue6 = #{inputValue6}, " + - "inputValue7 = #{inputValue7}, " + - "inputValue8 = #{inputValue8}, " + - "inputValue9 = #{inputValue9}, " + - "inputValue10 = #{inputValue10}, " + - "inputValue11 = #{inputValue11}, " + - "inputValue12 = #{inputValue12}, " + - "inputValue13 = #{inputValue13}, " + - "inputValue14 = #{inputValue14}, " + - "inputValue15 = #{inputValue15}, " + - "inputValue16 = #{inputValue16}, " + - "inputValue17 = #{inputValue17}, " + - "inputValue18 = #{inputValue18}, " + - "inputValue19 = #{inputValue19}, " + - "inputValue20 = #{inputValue20}, " + - "inputValue21 = #{inputValue21}, " + - "inputValue22 = #{inputValue22}, " + - "inputValue23 = #{inputValue23}, " + - "inputValue100 = #{inputValue100}, " + - "inputValue101 = #{inputValue101}, " + - "inputValue102 = #{inputValue102}, " + - "reply = #{reply} " + - "WHERE id = #{id}") - void update(Integer id,Report report); - -} \ No newline at end of file diff --git a/src/main/java/com/sa/unsafeincidents/mapper/UserMapper.java b/src/main/java/com/sa/unsafeincidents/mapper/UserMapper.java deleted file mode 100644 index 4c5519e..0000000 --- a/src/main/java/com/sa/unsafeincidents/mapper/UserMapper.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.sa.unsafeincidents.mapper; - -import com.sa.unsafeincidents.pojo.User; -import org.apache.ibatis.annotations.Insert; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Select; - -@Mapper -public interface UserMapper { - - @Select("select * from users where username = #{username}") - User findByUsername(String username); - - - @Insert("INSERT INTO users (username, password, create_time, update_time) " + - "VALUES (#{username}, #{md5Password}, NOW(), NOW())") - void register(String username, String md5Password); -} diff --git a/src/main/java/com/sa/unsafeincidents/pojo/Image.java b/src/main/java/com/sa/unsafeincidents/pojo/Image.java deleted file mode 100644 index 36817c4..0000000 --- a/src/main/java/com/sa/unsafeincidents/pojo/Image.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.sa.unsafeincidents.pojo; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import lombok.Data; - -@Data -public class Image { - private Integer id; //图片id - private String image; //图片url - private String link; //图片跳转链接 - private String content; //图片文本 - @JsonIgnore - private String category; //图片类别,图片用在什么地方 -} diff --git a/src/main/java/com/sa/unsafeincidents/pojo/Report.java b/src/main/java/com/sa/unsafeincidents/pojo/Report.java deleted file mode 100644 index d192a44..0000000 --- a/src/main/java/com/sa/unsafeincidents/pojo/Report.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.sa.unsafeincidents.pojo; - -import lombok.Data; - -@Data -public class Report { - private Integer id; - private String username; - private String name; - private String selectedTime; - private String selectedDate; - private String license; - private String acftType; - private String fixstage; - private String fixcheck; - private String aarcstatus; - private String phase; - private String wether; - private String lightCondition; - private String carone; - private String cartwo; - private String workPosition; - private String task; - private String plan; - private String ats; - private String atc; - private String tcas; - private String advise; - private String involve; - private String tudentType; - private String acft0Type; - private String task0; - private String plan0; - private String phase0; - private String wether0; - private String lightCondition0; - private String ats0; - private String atc0; - private String tcas0; - private String advise0; - private String inputValue1; - private String inputValue2; - private String inputValue3; - private String inputValue4; - private String inputValue5; - private String inputValue6; - private String inputValue7; - private String inputValue8; - private String inputValue9; - private String inputValue10; - private String inputValue11; - private String inputValue12; - private String inputValue13; - private String inputValue14; - private String inputValue15; - private String inputValue16; - private String inputValue17; - private String inputValue18; - private String inputValue19; - private String inputValue20; - private String inputValue21; - private String inputValue22; - private String inputValue23; - private String inputValue100; - private String inputValue101; - private String inputValue102; - private String reply; -} diff --git a/src/main/java/com/sa/unsafeincidents/pojo/Result.java b/src/main/java/com/sa/unsafeincidents/pojo/Result.java deleted file mode 100644 index 7ec81c4..0000000 --- a/src/main/java/com/sa/unsafeincidents/pojo/Result.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.sa.unsafeincidents.pojo; - - -//统一响应结果 - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@NoArgsConstructor -@AllArgsConstructor -@Data -public class Result { - private Integer code;//业务状态码 0-成功 1-失败 - private String message;//提示信息 - private T data;//响应数据 - - //快速返回操作成功响应结果(带响应数据) - public static Result success(E data) { - return new Result<>(0, "操作成功", data); - } - - //快速返回操作成功响应结果 - public static Result success() { - return new Result(0, "操作成功", null); - } - - public static Result error(String message) { - return new Result(1, message, null); - } -} diff --git a/src/main/java/com/sa/unsafeincidents/pojo/User.java b/src/main/java/com/sa/unsafeincidents/pojo/User.java deleted file mode 100644 index 19af14f..0000000 --- a/src/main/java/com/sa/unsafeincidents/pojo/User.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.sa.unsafeincidents.pojo; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import lombok.Data; - -import java.time.LocalDateTime; - -@Data -public class User { - private Integer id;//主键ID - private String username;//用户名 - @JsonIgnore - private String password;//密码 - private Integer permissions; - private LocalDateTime createTime;//创建时间 - private LocalDateTime updateTime;//更新时间 -} \ No newline at end of file diff --git a/src/main/java/com/sa/unsafeincidents/service/ReportService.java b/src/main/java/com/sa/unsafeincidents/service/ReportService.java deleted file mode 100644 index 0e49667..0000000 --- a/src/main/java/com/sa/unsafeincidents/service/ReportService.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.sa.unsafeincidents.service; - -import com.sa.unsafeincidents.pojo.Report; - -import java.util.ArrayList; - -public interface ReportService { - - void add(Report form); - - ArrayList list(String name); - ArrayList list(); - - Report findByID(Integer id); - - void reply(Integer id, String reply); -} diff --git a/src/main/java/com/sa/unsafeincidents/service/UserService.java b/src/main/java/com/sa/unsafeincidents/service/UserService.java deleted file mode 100644 index 1b5a60f..0000000 --- a/src/main/java/com/sa/unsafeincidents/service/UserService.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.sa.unsafeincidents.service; - -import com.sa.unsafeincidents.pojo.User; - -public interface UserService { - - User findByUsername(String username); - - void register(String username, String password); -} diff --git a/src/main/java/com/sa/unsafeincidents/service/impl/ReportServiceImpl.java b/src/main/java/com/sa/unsafeincidents/service/impl/ReportServiceImpl.java deleted file mode 100644 index dbca8d5..0000000 --- a/src/main/java/com/sa/unsafeincidents/service/impl/ReportServiceImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.sa.unsafeincidents.service.impl; - -import com.sa.unsafeincidents.mapper.ReportMapper; - -import com.sa.unsafeincidents.pojo.Report; -import com.sa.unsafeincidents.service.ReportService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; - -@Service -public class ReportServiceImpl implements ReportService { - - @Autowired - ReportMapper reportMapper; - - @Override - public void add(Report form) { - reportMapper.add(form); - } - - @Override - public ArrayList list(String name){ - return reportMapper.findByName(name); - }; - - @Override - public ArrayList list(){ - return reportMapper.list(); - }; - - @Override - public Report findByID(Integer id) { - return reportMapper.findByID(id); - } - - @Override - public void reply(Integer id,String reply) { - Report report = reportMapper.findByID(id); - report.setReply(reply); - reportMapper.update(id, report); - } - - -} diff --git a/src/main/java/com/sa/unsafeincidents/service/impl/UserServiceImpl.java b/src/main/java/com/sa/unsafeincidents/service/impl/UserServiceImpl.java deleted file mode 100644 index a6e7583..0000000 --- a/src/main/java/com/sa/unsafeincidents/service/impl/UserServiceImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.sa.unsafeincidents.service.impl; - -import com.sa.unsafeincidents.mapper.UserMapper; -import com.sa.unsafeincidents.pojo.User; -import com.sa.unsafeincidents.service.UserService; -import com.sa.unsafeincidents.utils.Md5Util; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class UserServiceImpl implements UserService { - - @Autowired - UserMapper userMapper; - - @Override - public User findByUsername(String username) { - return userMapper.findByUsername(username); - } - - @Override - public void register(String username, String password) { - String md5Password = Md5Util.getMD5String(password); - - userMapper.register(username,md5Password); - } - - -} diff --git a/src/main/java/com/sa/unsafeincidents/utils/JwtUtil.java b/src/main/java/com/sa/unsafeincidents/utils/JwtUtil.java deleted file mode 100644 index b682f0f..0000000 --- a/src/main/java/com/sa/unsafeincidents/utils/JwtUtil.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.sa.unsafeincidents.utils; - -import com.auth0.jwt.JWT; -import com.auth0.jwt.algorithms.Algorithm; - -import java.util.Date; -import java.util.Map; - -public class JwtUtil { - - private static final String KEY = "sa"; - - //接收业务数据,生成token并返回 - public static String genToken(Map claims) { - return JWT.create() - .withClaim("claims", claims) - .withExpiresAt(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 12)) - .sign(Algorithm.HMAC256(KEY)); - } - - //接收token,验证token,并返回业务数据 - public static Map parseToken(String token) { - return JWT.require(Algorithm.HMAC256(KEY)) - .build() - .verify(token) - .getClaim("claims") - .asMap(); - } - -} diff --git a/src/main/java/com/sa/unsafeincidents/utils/Md5Util.java b/src/main/java/com/sa/unsafeincidents/utils/Md5Util.java deleted file mode 100644 index 1e5bc60..0000000 --- a/src/main/java/com/sa/unsafeincidents/utils/Md5Util.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.sa.unsafeincidents.utils; - - -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -public class Md5Util { - /** - * 默认的密码字符串组合,用来将字节转换成 16 进制表示的字符,apache校验下载的文件的正确性用的就是默认的这个组合 - */ - protected static char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; - - protected static MessageDigest messagedigest = null; - - static { - try { - messagedigest = MessageDigest.getInstance("MD5"); - } catch (NoSuchAlgorithmException nsaex) { - System.err.println(Md5Util.class.getName() + "初始化失败,MessageDigest不支持MD5Util。"); - nsaex.printStackTrace(); - } - } - - /** - * 生成字符串的md5校验值 - * - * @param s - * @return - */ - public static String getMD5String(String s) { - return getMD5String(s.getBytes()); - } - - /** - * 判断字符串的md5校验码是否与一个已知的md5码相匹配 - * - * @param password 要校验的字符串 - * @param md5PwdStr 已知的md5校验码 - * @return - */ - public static boolean checkPassword(String password, String md5PwdStr) { - String s = getMD5String(password); - return s.equals(md5PwdStr); - } - - - public static String getMD5String(byte[] bytes) { - messagedigest.update(bytes); - return bufferToHex(messagedigest.digest()); - } - - private static String bufferToHex(byte bytes[]) { - return bufferToHex(bytes, 0, bytes.length); - } - - private static String bufferToHex(byte bytes[], int m, int n) { - StringBuffer stringbuffer = new StringBuffer(2 * n); - int k = m + n; - for (int l = m; l < k; l++) { - appendHexPair(bytes[l], stringbuffer); - } - return stringbuffer.toString(); - } - - private static void appendHexPair(byte bt, StringBuffer stringbuffer) { - char c0 = hexDigits[(bt & 0xf0) >> 4];// 取字节中高 4 位的数字转换, >>> - // 为逻辑右移,将符号位一起右移,此处未发现两种符号有何不同 - char c1 = hexDigits[bt & 0xf];// 取字节中低 4 位的数字转换 - stringbuffer.append(c0); - stringbuffer.append(c1); - } - -} diff --git a/src/main/java/com/sa/unsafeincidents/utils/ThreadLocalUtil.java b/src/main/java/com/sa/unsafeincidents/utils/ThreadLocalUtil.java deleted file mode 100644 index 536a77e..0000000 --- a/src/main/java/com/sa/unsafeincidents/utils/ThreadLocalUtil.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.sa.unsafeincidents.utils; - -/** - * ThreadLocal 工具类 - */ -@SuppressWarnings("all") -public class ThreadLocalUtil { - //提供ThreadLocal对象, - private static final ThreadLocal THREAD_LOCAL = new ThreadLocal(); - - //根据键获取值 - public static T get(){ - return (T) THREAD_LOCAL.get(); - } - - //存储键值对 - public static void set(Object value){ - THREAD_LOCAL.set(value); - } - - - //清除ThreadLocal 防止内存泄漏 - public static void remove(){ - THREAD_LOCAL.remove(); - } -} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml deleted file mode 100644 index 62795d5..0000000 --- a/src/main/resources/application.yml +++ /dev/null @@ -1,11 +0,0 @@ -server: - port: 8080 -spring: - datasource: - driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://localhost:3306/unsafeincidents - username: root - password: 200408 -mybatis: - configuration: - map-underscore-to-camel-case: true diff --git a/src/main/resources/static/index.html b/src/main/resources/static/index.html deleted file mode 100644 index 89bb8ba..0000000 --- a/src/main/resources/static/index.html +++ /dev/null @@ -1,6 +0,0 @@ - - -

hello word!!!

-

this is a html page

- - \ No newline at end of file diff --git a/src/test/java/com/sa/unsafeincidents/UnsafeincidentsApplicationTests.java b/src/test/java/com/sa/unsafeincidents/UnsafeincidentsApplicationTests.java deleted file mode 100644 index 257ab46..0000000 --- a/src/test/java/com/sa/unsafeincidents/UnsafeincidentsApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.sa.unsafeincidents; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class UnsafeincidentsApplicationTests { - - @Test - void contextLoads() { - } - -} diff --git a/userview/usereview.js b/userview/usereview.js new file mode 100644 index 0000000..31820ea --- /dev/null +++ b/userview/usereview.js @@ -0,0 +1,14 @@ +Page({ +   data: { +     record: {},  // 选中的上报记录 +     list: []     // 转换后的键值对列表,用于页面展示 +   }, +   // 在页面的 onLoad 方法中接收数据 + onLoad: function (options) { +   const eventChannel = this.getOpenerEventChannel(); +   eventChannel.on('sendDetailData', (data) => { +     console.log(data.records);  // 这里可以使用传递过来的记录 +     // 处理 data.records +   }); + } + }); \ No newline at end of file diff --git a/userview/usereview.json b/userview/usereview.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/userview/usereview.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/userview/usereview.wxml b/userview/usereview.wxml new file mode 100644 index 0000000..5b45ee7 --- /dev/null +++ b/userview/usereview.wxml @@ -0,0 +1,13 @@ + +   +     +     +       +         +        {{item.selectedDate}}-{{item.selectedTime}} - {{item.name}} +         +        点击查看详细信息... +       +     +   + \ No newline at end of file diff --git a/userview/usereview.wxss b/userview/usereview.wxss new file mode 100644 index 0000000..4f5df83 --- /dev/null +++ b/userview/usereview.wxss @@ -0,0 +1,17 @@ +.container{ + margin-top: -95px; +} +.message-item { + padding: 10px; + border-bottom: 1px solid #e5e5e5; +} + +.message-item text { + display: block; +} + +.message-summary { + color: #888; + font-size: 12px; + margin-top: 4px; +} diff --git a/viewReports/viewReports.js b/viewReports/viewReports.js new file mode 100644 index 0000000..31820ea --- /dev/null +++ b/viewReports/viewReports.js @@ -0,0 +1,14 @@ +Page({ +   data: { +     record: {},  // 选中的上报记录 +     list: []     // 转换后的键值对列表,用于页面展示 +   }, +   // 在页面的 onLoad 方法中接收数据 + onLoad: function (options) { +   const eventChannel = this.getOpenerEventChannel(); +   eventChannel.on('sendDetailData', (data) => { +     console.log(data.records);  // 这里可以使用传递过来的记录 +     // 处理 data.records +   }); + } + }); \ No newline at end of file diff --git a/viewReports/viewReports.json b/viewReports/viewReports.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/viewReports/viewReports.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/viewReports/viewReports.wxml b/viewReports/viewReports.wxml new file mode 100644 index 0000000..5b45ee7 --- /dev/null +++ b/viewReports/viewReports.wxml @@ -0,0 +1,13 @@ + +   +     +     +       +         +        {{item.selectedDate}}-{{item.selectedTime}} - {{item.name}} +         +        点击查看详细信息... +       +     +   + \ No newline at end of file diff --git a/viewReports/viewReports.wxss b/viewReports/viewReports.wxss new file mode 100644 index 0000000..4f5df83 --- /dev/null +++ b/viewReports/viewReports.wxss @@ -0,0 +1,17 @@ +.container{ + margin-top: -95px; +} +.message-item { + padding: 10px; + border-bottom: 1px solid #e5e5e5; +} + +.message-item text { + display: block; +} + +.message-summary { + color: #888; + font-size: 12px; + margin-top: 4px; +}