hcy
hcy 7 months ago
parent 2273319a02
commit cb07f43f85

@ -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: {},
}

33
.gitignore vendored

@ -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/

@ -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() {
}
})

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,402 @@
<!--pages/Airtraffic/Airtriffic.wxml-->
<!--标题部分-->
<view class="container5">
<view class="container">
<view class="one">
空中交通管制人员使用 (Air traffic controller
</view>
</view>
<view class="container">
<text class="two">欢迎您为民航不安全事件管理系统提供事件信息,请您仔细填写适用条目:</text>
<text class="three">(红色字体为必填项)</text>
</view>
<!--时间选择-->
<view class="container">
<text class="four">事件发生时的当地时间:</text>
<view class="container1">
<text class="five1">时间:</text>
<picker class="choose1" mode="date" value="{{selectedDate}}" bindchange="onDateChange">
<view class="picker">
{{selectedDate}}
</view>
</picker>
<picker class="choose" mode="time" value="{{ selectedTime }}" bindchange="onTimeChange">
<view class="picker">
{{ selectedTime }}
</view>
</picker>
</view>
<view class="container1"> <text class="five">时区:</text>
<picker class="choose" mode="selector" range="{{ timezones }}" value="{{ selectedIndex1 }}" bindchange="onTimezoneChange">
<view class="picker">
{{ timezones[selectedIndex1] }}
</view>
</picker></view>
</view>
<!--工作时间-->
<view class="container">
<text class="five">事件发生前您的工作时间:</text>
<view class="container1">
<text class="five1">过去一个月的工作天数:</text>
<view style="width: 35px;"></view>
<input class="input-box" type="text" value="{{inputValue1}}" placeholder="请输入" bindinput="onInput1" />
<text class="five1">天</text>
</view>
<view class="container1">
<text class="five1">过去一星期的工作天数:</text>
<view style="width: 35px;"></view>
<input class="input-box" type="text" value="{{inputValue2}}" placeholder="请输入" bindinput="onInput2" />
<text class="five1">天</text>
</view>
<view class="container1">
<text class="five1">过去24小时的工作时长:</text>
<view style="width: 33px;"></view>
<input class="input-box" type="text" value="{{inputValue3}}" placeholder="请输入" bindinput="onInput3" />
<text class="five1">小时</text>
</view>
</view>
<!--事件发生时您的岗位-->
<view class="container">
<view class="container1">
<text class="five">事件发生时您的岗位:</text>
<picker class="choose" mode="selector" range="{{ workposition }}" value="{{ selectedIndex2 }}" bindchange="onworkposition">
<view class="picker">
{{ workposition[selectedIndex2] }}
</view>
</picker>
</view>
</view>
<!--工作经历-->
<view class="container">
<text class="five">您的工作经历是:</text>
<view class="container1">
<text class="five1">工作经验:</text>
<view style="width: 125px;"></view>
<input class="input-box" type="text" value="{{inputValue15}}" placeholder="请输入" bindinput="onInput15" />
<text class="five1">年</text>
</view>
<view class="container1">
<text class="five1">在此岗位工作了:</text>
<view style="width: 80px;"></view>
<input class="input-box" type="text" value="{{inputValue16}}" placeholder="请输入" bindinput="onInput16" />
<text class="five1">年</text>
</view>
</view>
<!--您的执照类型 License:-->
<view class="container">
<view class="container1">
<text class="five">您的执照类型:</text>
<picker class="choose" mode="selector" range="{{ License }}" value="{{ selectedIndex4 }}" bindchange="onLicense">
<view class="picker">
{{ License[selectedIndex4] }}
</view>
</picker>
</view>
</view>
<!--事件发生时您的管制席位 ATS unit-->
<view class="container">
<view class="container1">
<text class="five">事件发生时您的管制席位</text>
<picker class="choose" mode="selector" range="{{ ATS }}" value="{{ selectedIndex12 }}" bindchange="onATS">
<view class="picker">
{{ ATS[selectedIndex12] }}
</view>
</picker>
</view>
</view>
<!--事件发生时的管制类型 Type of ATC-->
<view class="container">
<view class="container1">
<text class="five">事件发生时的管制类型:</text>
<picker class="choose" mode="selector" range="{{ ATC }}" value="{{ selectedIndex13 }}" bindchange="onATC">
<view class="picker">
{{ ATC[selectedIndex13] }}
</view>
</picker>
</view>
</view>
<!--事件发生的管制空域为:-->
<view class="container">
<view class="container1">
<text class="five">事件发生的管制空域为:</text>
<picker class="choose" mode="selector" range="{{ controlledairspace }}" value="{{ selectedIndex16 }}" bindchange="onControlledairspace">
<view class="picker">
{{ controlledairspace[selectedIndex16] }}
</view>
</picker>
</view>
</view>
<!--航空器一:-->
<view class="container">
<text class="five">航空器一:</text>
</view>
<!--事件航空器种类 ACFT-->
<view class="container">
<view class="container1">
<text class="five">事件航空器种类:</text>
<picker class="choose" mode="selector" range="{{ ACFT }}" value="{{ selectedIndex5 }}" bindchange="onACFT">
<view class="picker">
{{ ACFT[selectedIndex5] }}
</view>
</picker>
</view>
</view>
<!--本次飞行任务 Task-->
<view class="container">
<view class="container1">
<text class="five">本次飞行任务:</text>
<picker class="choose" mode="selector" range="{{ task }}" value="{{ selectedIndex7 }}" bindchange="ontask">
<view class="picker">
{{ task[selectedIndex7] }}
</view>
</picker>
</view>
</view>
<!--本次飞行计划 Flight plan-->
<view class="container">
<view class="container1">
<text class="five">本次飞行计划:</text>
<picker class="choose" mode="selector" range="{{ plan }}" value="{{ selectedIndex8 }}" bindchange="onplan">
<view class="picker">
{{ plan[selectedIndex8] }}
</view>
</picker>
</view>
</view>
<!--事件发生时的飞行阶段 Phase of flight -->
<view class="container">
<view class="container1">
<text class="five">事件发生时的飞行阶段:</text>
<picker class="choose" mode="selector" range="{{ phase }}" value="{{ selectedIndex9 }}" bindchange="onphase">
<view class="picker">
{{ phase[selectedIndex9] }}
</view>
</picker>
</view>
</view>
<!--飞行高度为 Altitude/height-->
<view class="container">
<view class="container1">
<text class="five1">飞行高度为:</text>
<view style="width: 110px;"></view>
<input class="input-box" type="text" value="{{inputValue6}}" placeholder="请输入" bindinput="onInput6" />
<text class="five1">千米</text>
</view>
</view>
<!--天气条件 Weather-->
<view class="container">
<view class="container1">
<text class="five">天气条件:</text>
<picker class="choose" mode="selector" range="{{ weather }}" value="{{ selectedIndex10 }}" bindchange="onweather">
<view class="picker">
{{ weather[selectedIndex10] }}
</view>
</picker>
</view>
</view>
<!--光线条件和能见度为Light and visibility:-->
<view class="container">
<view class="container1">
<text class="five">光线条件和能见度为:</text>
<picker class="choose" mode="selector" range="{{ lv }}" value="{{ selectedIndex11 }}" bindchange="onlv">
<view class="picker">
{{ lv[selectedIndex11] }}
</view>
</picker>
</view>
<view class="container1">
<text class="five1">云底高:</text>
<view style="width: 140px;"></view>
<input class="input-box" type="text" value="{{inputValue7}}" placeholder="请输入" bindinput="onInput7" />
<text class="five1">米</text>
</view>
<view class="container1">
<text class="five1">跑道视程:</text>
<view style="width: 125px;"></view>
<input class="input-box" type="text" value="{{inputValue8}}" placeholder="请输入" bindinput="onInput8" />
<text class="five1">米</text>
</view>
</view>
<!--若为两机冲突当时TCAS是否提出告警 TCAS alert-->
<view class="container">
<view class="container1">
<text class="five">若为两机冲突当时TCAS是否提出告警:</text>
<picker class="choose" mode="selector" range="{{ TCAS }}" value="{{ selectedIndex14 }}" bindchange="onTCAS">
<view class="picker">
{{ TCAS[selectedIndex14] }}
</view>
</picker>
</view>
</view>
<!--是否提出建议 Advise-->
<view class="container">
<view class="container1">
<text class="five">是否提出建议:</text>
<picker class="choose" mode="selector" range="{{ Advise }}" value="{{ selectedIndex15 }}" bindchange="onAdvise">
<view class="picker">
{{ weather[selectedIndex15] }}
</view>
</picker>
</view>
</view>
<!--航空器二:-->
<view class="container">
<text class="five">航空器二:</text>
</view>
<!--事件航空器种类 ACFT-->
<view class="container">
<view class="container1">
<text class="five">事件航空器种类:</text>
<picker class="choose" mode="selector" range="{{ ACFT }}" value="{{ selectedIndex100 }}" bindchange="onACFT0">
<view class="picker">
{{ ACFT[selectedIndex100] }}
</view>
</picker>
</view>
</view>
<!--本次飞行任务 Task-->
<view class="container">
<view class="container1">
<text class="five">本次飞行任务:</text>
<picker class="choose" mode="selector" range="{{ task }}" value="{{ selectedIndex101 }}" bindchange="ontask0">
<view class="picker">
{{ task[selectedIndex101] }}
</view>
</picker>
</view>
</view>
<!--本次飞行计划 Flight plan-->
<view class="container">
<view class="container1">
<text class="five">本次飞行计划:</text>
<picker class="choose" mode="selector" range="{{ plan }}" value="{{ selectedIndex102 }}" bindchange="onplan0">
<view class="picker">
{{ plan[selectedIndex102] }}
</view>
</picker>
</view>
</view>
<!--事件发生时的飞行阶段 Phase of flight -->
<view class="container">
<view class="container1">
<text class="five">事件发生时的飞行阶段:</text>
<picker class="choose" mode="selector" range="{{ phase }}" value="{{ selectedIndex103 }}" bindchange="onphase0">
<view class="picker">
{{ phase[selectedIndex103] }}
</view>
</picker>
</view>
</view>
<!--飞行高度为 Altitude/height-->
<view class="container">
<view class="container1">
<text class="five1">飞行高度为:</text>
<view style="width: 110px;"></view>
<input class="input-box" type="text" value="{{inputValue100}}" placeholder="请输入" bindinput="onInput100" />
<text class="five1">千米</text>
</view>
</view>
<!--天气条件 Weather-->
<view class="container">
<view class="container1">
<text class="five">天气条件:</text>
<picker class="choose" mode="selector" range="{{ weather }}" value="{{ selectedIndex104 }}" bindchange="onweather0">
<view class="picker">
{{ weather[selectedIndex104] }}
</view>
</picker>
</view>
</view>
<!--光线条件和能见度为Light and visibility:-->
<view class="container">
<view class="container1">
<text class="five">光线条件和能见度为:</text>
<picker class="choose" mode="selector" range="{{ lv }}" value="{{ selectedIndex105 }}" bindchange="onlv0">
<view class="picker">
{{ lv[selectedIndex105] }}
</view>
</picker>
</view>
<view class="container1">
<text class="five1">云底高:</text>
<view style="width: 140px;"></view>
<input class="input-box" type="text" value="{{inputValue101}}" placeholder="请输入" bindinput="onInput101" />
<text class="five1">米</text>
</view>
<view class="container1">
<text class="five1">跑道视程:</text>
<view style="width: 125px;"></view>
<input class="input-box" type="text" value="{{inputValue102}}" placeholder="请输入" bindinput="onInput102" />
<text class="five1">米</text>
</view>
</view>
<!--若为两机冲突当时TCAS是否提出告警 TCAS alert-->
<view class="container">
<view class="container1">
<text class="five">若为两机冲突当时TCAS是否提出告警:</text>
<picker class="choose" mode="selector" range="{{ TCAS }}" value="{{ selectedIndex106 }}" bindchange="onTCAS0">
<view class="picker">
{{ TCAS[selectedIndex106] }}
</view>
</picker>
</view>
</view>
<!--是否提出建议 Advise-->
<view class="container">
<view class="container1">
<text class="five">是否提出建议:</text>
<picker class="choose" mode="selector" range="{{ Advise }}" value="{{ selectedIndex107 }}" bindchange="onAdvise0">
<view class="picker">
{{ weather[selectedIndex107] }}
</view>
</picker>
</view>
</view>
<!--描述事件-->
<view class="container">
<text class="four">请您尽可能完整地描述事件经过:(如事件过程、原因、建议等)</text>
<view class="container3">
<textarea class="scroll-input" value="{{inputValue20}}" placeholder="请输入内容(1000字以内)..." maxlength="1000" bindinput="onInput20"></textarea>
</view>
</view>
<!--感谢:-->
<view class="container">
<view class="container1">
<text class="five1"> 民航不安全事件管理系统欢迎全行业所有人员做安全“吹哨人”!感谢您积极主动参与改善航空安全行动和自愿报告安全风险隐患信息!我们欢迎您本着诚信原则报送有关安全信息,同时建议您留一个有效的联系方式,以方便该信息得到有效处理、应用、反馈和奖励。我们承诺对每一位员工、每一家单位的报告信息严格保密,谢谢!
</text>
</view>
</view>
<!--姓名Name:-->
<view class="container">
<view class="container1">
<text class="five1">姓名:</text>
<view style="width: 10px;"></view>
<input class="input-box2" type="text" value="{{inputValue21}}" placeholder="请输入" bindinput="onInput21" />
</view>
</view>
<!--电话Tel-->
<view class="container">
<view class="container1">
<text class="five1">电话:</text>
<view style="width: 10px;"></view>
<input class="input-box2" type="text" value="{{inputValue22}}" placeholder="请输入" bindinput="onInput22" />
</view>
</view>
<!--E-mail-->
<view class="container">
<view class="container1">
<text class="five1">邮箱:</text>
<view style="width: 10px;"></view>
<input class="input-box2" type="text" value="{{inputValue23}}" placeholder="请输入" bindinput="onInput23" />
</view>
</view>
<!--提交与重写-->
<view class="container4">
<button class="reset-button" bindtap="onReset">全部重写</button>
<button class="submit-button" bindtap="onSubmit">提交</button>
</view>
</view>

@ -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;
}

@ -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() {
}
})

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,198 @@
<!--pages/Aviation/Aviation.wxml-->
<!--标题部分-->
<view class="container5">
<view class="container">
<view class="one">
空防安全事件 (Aviation securityincident
</view>
</view>
<view class="container">
<text class="two">欢迎您为民航不安全事件管理系统提供事件信息,请您仔细填写适用条目:</text>
<text class="three">(红色字体为必填项)</text>
</view>
<!--时间选择-->
<view class="container">
<text class="four">事件发生时的当地时间:</text>
<view class="container1">
<text class="five1">时间:</text>
<picker class="choose1" mode="date" value="{{selectedDate}}" bindchange="onDateChange">
<view class="picker">
{{selectedDate}}
</view>
</picker>
<picker class="choose" mode="time" value="{{ selectedTime }}" bindchange="onTimeChange">
<view class="picker">
{{ selectedTime }}
</view>
</picker>
</view>
<view class="container1"> <text class="five">时区:</text>
<picker class="choose" mode="selector" range="{{ timezones }}" value="{{ selectedIndex1 }}" bindchange="onTimezoneChange">
<view class="picker">
{{ timezones[selectedIndex1] }}
</view>
</picker></view>
</view>
<!--工作时间-->
<view class="container">
<text class="five">事件发生前您的工作时间:</text>
<view class="container1">
<text class="five1">过去一个月的工作天数:</text>
<view style="width: 35px;"></view>
<input class="input-box" type="text" value="{{inputValue1}}" placeholder="请输入" bindinput="onInput1" />
<text class="five1">天</text>
</view>
<view class="container1">
<text class="five1">过去一星期的工作天数:</text>
<view style="width: 35px;"></view>
<input class="input-box" type="text" value="{{inputValue2}}" placeholder="请输入" bindinput="onInput2" />
<text class="five1">天</text>
</view>
<view class="container1">
<text class="five1">过去24小时的工作时长:</text>
<view style="width: 33px;"></view>
<input class="input-box" type="text" value="{{inputValue3}}" placeholder="请输入" bindinput="onInput3" />
<text class="five1">小时</text>
</view>
</view>
<!--事件发生时您的岗位-->
<view class="container">
<view class="container1">
<text class="five">事件发生时您的岗位:</text>
<picker class="choose" mode="selector" range="{{ position }}" value="{{ selectedIndex2 }}" bindchange="onposition">
<view class="picker">
{{ position[selectedIndex2] }}
</view>
</picker>
</view>
</view>
<!--您的执照类型 License:-->
<view class="container">
<view class="container1">
<text class="five">您的执照类型:</text>
<picker class="choose" mode="selector" range="{{ License }}" value="{{ selectedIndex4 }}" bindchange="onLicense">
<view class="picker">
{{ License[selectedIndex4] }}
</view>
</picker>
</view>
</view>
<!--工作经历-->
<view class="container">
<text class="five">您的工作经历是:</text>
<view class="container1">
<text class="five1">工作经验:</text>
<view style="width: 125px;"></view>
<input class="input-box" type="text" value="{{inputValue15}}" placeholder="请输入" bindinput="onInput15" />
<text class="five1">年</text>
</view>
<view class="container1">
<text class="five1">在此岗位工作了:</text>
<view style="width: 80px;"></view>
<input class="input-box" type="text" value="{{inputValue16}}" placeholder="请输入" bindinput="onInput16" />
<text class="five1">年</text>
</view>
</view>
<!--事件发生时的飞行阶段 Phase of flight -->
<view class="container">
<view class="container1">
<text class="five">事件发生时的飞行阶段:</text>
<picker class="choose" mode="selector" range="{{ phase }}" value="{{ selectedIndex9 }}" bindchange="onphase">
<view class="picker">
{{ phase[selectedIndex9] }}
</view>
</picker>
</view>
</view>
<!--事件是否涉及航空器:-->
<view class="container">
<view class="container1">
<text class="five">事件是否涉及航空器:</text>
<picker class="choose" mode="selector" range="{{ involve }}" value="{{ selectedIndex5 }}" bindchange="oninvolve">
<view class="picker">
{{ involve[selectedIndex22] }}
</view>
</picker>
</view>
</view>
<!--飞行区间是Flight segment-->
<view class="container">
<text class="five">飞行区间是:</text>
<view class="container1">
<text class="five1">从</text>
<view style="width: 20px;"></view>
<input class="input-box1" type="text" value="{{inputValue9}}" placeholder="请输入" bindinput="onInput9" />
<view style="width:20px;"></view>
<text class="five1">到</text>
<view style="width: 20px;"></view>
<input class="input-box1" type="text" value="{{inputValue10}}" placeholder="请输入" bindinput="onInput10" />
</view>
</view>
<!--机上的人员情况是People on board-->
<view class="container">
<text class="five">机上的人员情况是:</text>
<view class="container1">
<text class="five1">飞行机组</text>
<view style="width: 2px;"></view>
<input class="input-box" type="text" value="{{inputValue11}}" placeholder="请输入" bindinput="onInpu11" />
<view style="width: 18px;"></view>
<text class="five1">乘务员</text>
<view style="width: 2px;"></view>
<input class="input-box" type="text" value="{{inputValue12}}" placeholder="请输入" bindinput="onInput12" />
</view>
<view class="container1">
<text class="five1">空中保安</text>
<view style="width: 2px;"></view>
<input class="input-box" type="text" value="{{inputValue13}}" placeholder="请输入" bindinput="onInput13" />
<view style="width: 4px;"></view>
<text class="five1">共有旅客</text>
<view style="width: 2px;"></view>
<input class="input-box" type="text" value="{{inputValue14}}" placeholder="请输入" bindinput="onInput14" />
</view>
</view>
<!--描述事件-->
<view class="container">
<text class="four">请您尽可能完整地描述事件经过:(如事件过程、原因、建议等)</text>
<view class="container3">
<textarea class="scroll-input" value="{{inputValue20}}" placeholder="请输入内容(1000字以内)..." maxlength="1000" bindinput="onInput20"></textarea>
</view>
</view>
<!--感谢:-->
<view class="container">
<view class="container1">
<text class="five1"> 民航不安全事件管理系统欢迎全行业所有人员做安全“吹哨人”!感谢您积极主动参与改善航空安全行动和自愿报告安全风险隐患信息!我们欢迎您本着诚信原则报送有关安全信息,同时建议您留一个有效的联系方式,以方便该信息得到有效处理、应用、反馈和奖励。我们承诺对每一位员工、每一家单位的报告信息严格保密,谢谢!
</text>
</view>
</view>
<!--姓名Name:-->
<view class="container">
<view class="container1">
<text class="five1">姓名:</text>
<view style="width: 10px;"></view>
<input class="input-box2" type="text" value="{{inputValue21}}" placeholder="请输入" bindinput="onInput21" />
</view>
</view>
<!--电话Tel-->
<view class="container">
<view class="container1">
<text class="five1">电话:</text>
<view style="width: 10px;"></view>
<input class="input-box2" type="text" value="{{inputValue22}}" placeholder="请输入" bindinput="onInputt22" />
</view>
</view>
<!--E-mail-->
<view class="container">
<view class="container1">
<text class="five1">邮箱:</text>
<view style="width: 10px;"></view>
<input class="input-box2" type="text" value="{{inputValue23}}" placeholder="请输入" bindinput="onInput23" />
</view>
</view>
<!--提交与重写-->
<view class="container4">
<button class="reset-button" bindtap="onReset">全部重写</button>
<button class="submit-button" bindtap="onSubmit">提交</button>
</view>
</view>

@ -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;
}

@ -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() {
}
})

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,187 @@
<!--pages/Crew/Crew.wxml-->
<!--标题部分-->
<view class="container5">
<view class="container">
<view class="one">
(乘务事件使用 Crew member
</view>
</view>
<view class="container">
<text class="two">欢迎您为民航不安全事件管理系统提供事件信息,请您仔细填写适用条目:</text>
<text class="three">(红色字体为必填项)</text>
</view>
<!--时间选择-->
<view class="container">
<text class="four">事件发生时的当地时间:</text>
<view class="container1">
<text class="five1">时间:</text>
<picker class="choose1" mode="date" value="{{selectedDate}}" bindchange="onDateChange">
<view class="picker">
{{selectedDate}}
</view>
</picker>
<picker class="choose" mode="time" value="{{ selectedTime }}" bindchange="onTimeChange">
<view class="picker">
{{ selectedTime }}
</view>
</picker>
</view>
<view class="container1"> <text class="five">时区:</text>
<picker class="choose" mode="selector" range="{{ timezones }}" value="{{ selectedIndex1 }}" bindchange="onTimezoneChange">
<view class="picker">
{{ timezones[selectedIndex1] }}
</view>
</picker></view>
</view>
<!--工作时间-->
<view class="container">
<text class="five">事件发生前您的工作时间:</text>
<view class="container1">
<text class="five1">过去一个月的工作天数:</text>
<view style="width: 35px;"></view>
<input class="input-box" type="text" value="{{inputValue1}}" placeholder="请输入" bindinput="onInput1" />
<text class="five1">天</text>
</view>
<view class="container1">
<text class="five1">过去一星期的工作天数:</text>
<view style="width: 35px;"></view>
<input class="input-box" type="text" value="{{inputValue2}}" placeholder="请输入" bindinput="onInput2" />
<text class="five1">天</text>
</view>
<view class="container1">
<text class="five1">过去24小时的工作时长:</text>
<view style="width: 33px;"></view>
<input class="input-box" type="text" value="{{inputValue3}}" placeholder="请输入" bindinput="onInput3" />
<text class="five1">小时</text>
</view>
</view>
<!--事件发生时您的岗位-->
<view class="container">
<view class="container1">
<text class="five">事件发生时您的岗位:</text>
<picker class="choose" mode="selector" range="{{ position }}" value="{{ selectedIndex2 }}" bindchange="onposition">
<view class="picker">
{{ position[selectedIndex2] }}
</view>
</picker>
</view>
</view>
<!--您所具有的飞行经历是You experience-->
<view class="container">
<text class="five">您所具有的飞行经历是:</text>
<view class="container1">
<text class="five1">飞行小时数:</text>
<view style="width: 110px;"></view>
<input class="input-box" type="text" value="{{inputValue4}}" placeholder="请输入" bindinput="onInput4" />
<text class="five1">小时</text>
</view>
<view class="container1">
<text class="five1">本机型小时:</text>
<view style="width: 110px;"></view>
<input class="input-box" type="text" value="{{inputValue5}}" placeholder="请输入" bindinput="onInput5" />
<text class="five1">小时</text>
</view>
</view>
<!--飞行区间是Flight segment-->
<view class="container">
<text class="five">飞行区间是:</text>
<view class="container1">
<text class="five1">从</text>
<view style="width: 20px;"></view>
<input class="input-box1" type="text" value="{{inputValue9}}" placeholder="请输入" bindinput="onInput9" />
<view style="width:20px;"></view>
<text class="five1">到</text>
<view style="width: 20px;"></view>
<input class="input-box1" type="text" value="{{inputValue10}}" placeholder="请输入" bindinput="onInput10" />
</view>
</view>
<!--事件航空器种类 ACFT-->
<view class="container">
<view class="container1">
<text class="five">事件航空器种类:</text>
<picker class="choose" mode="selector" range="{{ ACFT }}" value="{{ selectedIndex5 }}" bindchange="onACFT">
<view class="picker">
{{ ACFT[selectedIndex5] }}
</view>
</picker>
</view>
</view>
<!--机上的人员情况是People on board-->
<view class="container">
<text class="five">机上的人员情况是:</text>
<view class="container1">
<text class="five1">飞行机组</text>
<view style="width: 2px;"></view>
<input class="input-box" type="text" value="{{inputValue11}}" placeholder="请输入" bindinput="onInput11" />
<view style="width: 18px;"></view>
<text class="five1">乘务员</text>
<view style="width: 2px;"></view>
<input class="input-box" type="text" value="{{inputValue12}}" placeholder="请输入" bindinput="onInput12" />
</view>
<view class="container1">
<text class="five1">空中保安</text>
<view style="width: 2px;"></view>
<input class="input-box" type="text" value="{{inputValue13}}" placeholder="请输入" bindinput="onInput13" />
<view style="width: 4px;"></view>
<text class="five1">共有旅客</text>
<view style="width: 2px;"></view>
<input class="input-box" type="text" value="{{inputValue14}}" placeholder="请输入" bindinput="onInput14" />
</view>
</view>
<!--事件发生时的飞行阶段 Phase of flight -->
<view class="container">
<view class="container1">
<text class="five">事件发生时的飞行阶段:</text>
<picker class="choose" mode="selector" range="{{ phase }}" value="{{ selectedIndex9 }}" bindchange="onphase">
<view class="picker">
{{ phase[selectedIndex9] }}
</view>
</picker>
</view>
</view>
<!--描述事件-->
<view class="container">
<text class="four">请您尽可能完整地描述事件经过:(如事件过程、原因、建议等)</text>
<view class="container3">
<textarea class="scroll-input" value="{{inputValue20}}" placeholder="请输入内容(1000字以内)..." maxlength="1000" bindinput="onInput20"></textarea>
</view>
</view>
<!--感谢:-->
<view class="container">
<view class="container1">
<text class="five1"> 民航不安全事件管理系统欢迎全行业所有人员做安全“吹哨人”!感谢您积极主动参与改善航空安全行动和自愿报告安全风险隐患信息!我们欢迎您本着诚信原则报送有关安全信息,同时建议您留一个有效的联系方式,以方便该信息得到有效处理、应用、反馈和奖励。我们承诺对每一位员工、每一家单位的报告信息严格保密,谢谢!
</text>
</view>
</view>
<!--姓名Name:-->
<view class="container">
<view class="container1">
<text class="five1">姓名:</text>
<view style="width: 10px;"></view>
<input class="input-box2" type="text" value="{{inputValue21}}" placeholder="请输入" bindinput="onInput21" />
</view>
</view>
<!--电话Tel-->
<view class="container">
<view class="container1">
<text class="five1">电话:</text>
<view style="width: 10px;"></view>
<input class="input-box2" type="text" value="{{inputValue22}}" placeholder="请输入" bindinput="onInput22" />
</view>
</view>
<!--E-mail-->
<view class="container">
<view class="container1">
<text class="five1">邮箱:</text>
<view style="width: 10px;"></view>
<input class="input-box2" type="text" value="{{inputValue23}}" placeholder="请输入" bindinput="onInput23" />
</view>
</view>
<!--提交与重写-->
<view class="container4">
<button class="reset-button" bindtap="onReset">全部重写</button>
<button class="submit-button" bindtap="onSubmit">提交</button>
</view>
</view>

@ -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;
}

@ -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() {
  }
})
  

@ -0,0 +1,4 @@
{
"usingComponents": {
}
}

@ -0,0 +1,292 @@
<!--pages/FlightCrew/FlightCrew.wxml-->
<!--标题部分-->
<view class="container5">
<view class="container">
<view class="one">
飞行事件使用 (Flight crew report)
</view>
</view>
<view class="container">
<text class="two">欢迎您为民航不安全事件管理系统提供事件信息,请您仔细填写适用条目:</text>
<text class="three">(红色字体为必填项)</text>
</view>
<!--时间选择-->
<view class="container">
<text class="four">事件发生时的当地时间:</text>
<view class="container1">
<text class="five1">时间:</text>
<picker class="choose1" mode="date" value="{{selectedDate}}" bindchange="onDateChange">
<view class="picker">
{{selectedDate}}
</view>
</picker>
<picker class="choose" mode="time" value="{{ selectedTime }}" bindchange="onTimeChange">
<view class="picker">
{{ selectedTime }}
</view>
</picker>
</view>
<view class="container1"> <text class="five">时区:</text>
<picker class="choose" mode="selector" range="{{ timezones }}" value="{{ selectedIndex1 }}" bindchange="onTimezoneChange">
<view class="picker">
{{ timezones[selectedIndex1] }}
</view>
</picker></view>
</view>
<!--工作时间-->
<view class="container">
<text class="five">事件发生前您的工作时间:</text>
<view class="container1">
<text class="five1">过去一个月的工作天数:</text>
<view style="width: 35px;"></view>
<input class="input-box" type="text" value="{{inputValue1}}" placeholder="请输入" bindinput="onInput1" />
<text class="five1">天</text>
</view>
<view class="container1">
<text class="five1">过去一星期的工作天数:</text>
<view style="width: 35px;"></view>
<input class="input-box" type="text" value="{{inputValue2}}" placeholder="请输入" bindinput="onInput2" />
<text class="five1">天</text>
</view>
<view class="container1">
<text class="five1">过去24小时的工作时长:</text>
<view style="width: 33px;"></view>
<input class="input-box" type="text" value="{{inputValue3}}" placeholder="请输入" bindinput="onInput3" />
<text class="five1">小时</text>
</view>
</view>
<!--事件发生时您的岗位-->
<view class="container">
<view class="container1">
<text class="five">事件发生时您的岗位:</text>
<picker class="choose" mode="selector" range="{{ workposition }}" value="{{ selectedIndex2 }}" bindchange="onworkposition">
<view class="picker">
{{ workposition[selectedIndex2] }}
</view>
</picker>
</view>
</view>
<!--当时您是否控制航空器 Do you fly the ACFT-->
<view class="container">
<view class="container1">
<text class="five">当时您是否控制航空器:</text>
<picker class="choose" mode="selector" range="{{ controll }}" value="{{ selectedIndex3 }}" bindchange="oncontroll">
<view class="picker">
{{ controll[selectedIndex3] }}
</view>
</picker>
</view>
</view>
<!--您的执照类型 License:-->
<view class="container">
<view class="container1">
<text class="five">您的执照类型:</text>
<picker class="choose" mode="selector" range="{{ License }}" value="{{ selectedIndex4 }}" bindchange="onLicense">
<view class="picker">
{{ License[selectedIndex4] }}
</view>
</picker>
</view>
</view>
<!--您的驾驶经验You experience-->
<view class="container">
<text class="five">您的驾驶经验:</text>
<view class="container1">
<text class="five1">飞行小时数:</text>
<view style="width: 110px;"></view>
<input class="input-box" type="text" value="{{inputValue4}}" placeholder="请输入" bindinput="onInput4" />
<text class="five1">小时</text>
</view>
<view class="container1">
<text class="five1">本机型小时:</text>
<view style="width: 110px;"></view>
<input class="input-box" type="text" value="{{inputValue5}}" placeholder="请输入" bindinput="onInput5" />
<text class="five1">小时</text>
</view>
</view>
<!--事件航空器种类 ACFT-->
<view class="container">
<view class="container1">
<text class="five">事件航空器种类:</text>
<picker class="choose" mode="selector" range="{{ ACFT }}" value="{{ selectedIndex5 }}" bindchange="onACFT">
<view class="picker">
{{ ACFT[selectedIndex5] }}
</view>
</picker>
</view>
</view>
<!--您的工作单位的种类 You company-->
<view class="container">
<view class="container1">
<text class="five">您的工作单位的种类:</text>
<picker class="choose" mode="selector" range="{{ company }}" value="{{ selectedIndex6 }}" bindchange="oncompany">
<view class="picker">
{{ company[selectedIndex6] }}
</view>
</picker>
</view>
</view>
<!--本次飞行任务 Task-->
<view class="container">
<view class="container1">
<text class="five">本次飞行任务:</text>
<picker class="choose" mode="selector" range="{{ task }}" value="{{ selectedIndex7 }}" bindchange="ontask">
<view class="picker">
{{ task[selectedIndex7] }}
</view>
</picker>
</view>
</view>
<!--本次飞行计划 Flight plan-->
<view class="container">
<view class="container1">
<text class="five">本次飞行计划:</text>
<picker class="choose" mode="selector" range="{{ plan }}" value="{{ selectedIndex8 }}" bindchange="onplan">
<view class="picker">
{{ plan[selectedIndex8] }}
</view>
</picker>
</view>
</view>
<!--事件发生时的飞行阶段 Phase of flight -->
<view class="container">
<view class="container1">
<text class="five">事件发生时的飞行阶段:</text>
<picker class="choose" mode="selector" range="{{ phase }}" value="{{ selectedIndex9 }}" bindchange="onphase">
<view class="picker">
{{ phase[selectedIndex9] }}
</view>
</picker>
</view>
</view>
<!--飞行高度为 Altitude/height-->
<view class="container">
<view class="container1">
<text class="five1">飞行高度为:</text>
<view style="width: 110px;"></view>
<input class="input-box" type="text" value="{{inputValue6}}" placeholder="请输入" bindinput="onInput6" />
<text class="five1">千米</text>
</view>
</view>
<!--天气条件 Weather-->
<view class="container">
<view class="container1">
<text class="five">天气条件:</text>
<picker class="choose" mode="selector" range="{{ weather }}" value="{{ selectedIndex10 }}" bindchange="onweather">
<view class="picker">
{{ weather[selectedIndex10] }}
</view>
</picker>
</view>
</view>
<!--光线条件和能见度为Light and visibility:-->
<view class="container">
<view class="container1">
<text class="five">光线条件和能见度为:</text>
<picker class="choose" mode="selector" range="{{ lv }}" value="{{ selectedIndex11 }}" bindchange="onlv">
<view class="picker">
{{ lv[selectedIndex11] }}
</view>
</picker>
</view>
<view class="container1">
<text class="five1">云底高:</text>
<view style="width: 140px;"></view>
<input class="input-box" type="text" value="{{inputValue7}}" placeholder="请输入" bindinput="onInput7" />
<text class="five1">米</text>
</view>
<view class="container1">
<text class="five1">跑道视程:</text>
<view style="width: 125px;"></view>
<input class="input-box" type="text" value="{{inputValue8}}" placeholder="请输入" bindinput="onInput8" />
<text class="five1">米</text>
</view>
</view>
<!--事件发生时的空中交通管制单位为 ATS unit-->
<view class="container">
<view class="container1">
<text class="five">事件发生时的空中交通管制单位为:</text>
<picker class="choose" mode="selector" range="{{ ATS }}" value="{{ selectedIndex12 }}" bindchange="onATS">
<view class="picker">
{{ ATS[selectedIndex12] }}
</view>
</picker>
</view>
</view>
<!--管制类型 Type of ATC-->
<view class="container">
<view class="container1">
<text class="five">管制类型:</text>
<picker class="choose" mode="selector" range="{{ ATC }}" value="{{ selectedIndex13 }}" bindchange="onATC">
<view class="picker">
{{ ATC[selectedIndex13] }}
</view>
</picker>
</view>
</view>
<!--若为两机冲突当时TCAS是否提出告警 TCAS alert-->
<view class="container">
<view class="container1">
<text class="five">若为两机冲突当时TCAS是否提出告警:</text>
<picker class="choose" mode="selector" range="{{ TCAS }}" value="{{ selectedIndex14 }}" bindchange="onTCAS">
<view class="picker">
{{ TCAS[selectedIndex14] }}
</view>
</picker>
</view>
</view>
<!--是否提出建议 Advise-->
<view class="container">
<view class="container1">
<text class="five">是否提出建议:</text>
<picker class="choose" mode="selector" range="{{ Advise }}" value="{{ selectedIndex15 }}" bindchange="onAdvise">
<view class="picker">
{{ weather[selectedIndex15] }}
</view>
</picker>
</view>
</view>
<!--描述事件-->
<view class="container">
<text class="four">请您尽可能完整地描述事件经过:(如事件过程、原因、建议等)</text>
<view class="container3">
<textarea class="scroll-input" value="{{inputValue20}}" placeholder="请输入内容(1000字以内)..." maxlength="1000" bindinput="onInput20"></textarea>
</view>
</view>
<!--感谢:-->
<view class="container">
<view class="container1">
<text class="five1"> 民航不安全事件管理系统欢迎全行业所有人员做安全“吹哨人”!感谢您积极主动参与改善航空安全行动和自愿报告安全风险隐患信息!我们欢迎您本着诚信原则报送有关安全信息,同时建议您留一个有效的联系方式,以方便该信息得到有效处理、应用、反馈和奖励。我们承诺对每一位员工、每一家单位的报告信息严格保密,谢谢!
</text>
</view>
</view>
<!--姓名Name:-->
<view class="container">
<view class="container1">
<text class="five1">姓名:</text>
<view style="width: 10px;"></view>
<input class="input-box2" type="text" value="{{inputValue21}}" placeholder="请输入" bindinput="onInput21" />
</view>
</view>
<!--电话Tel-->
<view class="container">
<view class="container1">
<text class="five1">电话:</text>
<view style="width: 10px;"></view>
<input class="input-box2" type="text" value="{{inputValue22}}" placeholder="请输入" bindinput="onInput22" />
</view>
</view>
<!--E-mail-->
<view class="container">
<view class="container1">
<text class="five1">邮箱:</text>
<view style="width: 10px;"></view>
<input class="input-box2" type="text" value="{{inputValue23}}" placeholder="请输入" bindinput="onInput23" />
</view>
</view>
<!--提交与重写-->
<view class="container4">
<button class="reset-button" bindtap="onReset">全部重写</button>
<button class="submit-button" bindtap="onSubmit">提交</button>
</view>
</view>

@ -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;
}

@ -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 页的路径
});
}
});

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,2 @@
<text>智能分析: {{agentReply}}</text>
<button bindtap="goToHome" class="home-button">回到首页</button>

@ -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;
}

@ -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() {
}
})

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,114 @@
<!--pages/Students/students.wxml-->
<!--标题部分-->
<view class="container5">
<view class="container">
<view class="one">
学生学员使用 (Students
</view>
</view>
<view class="container">
<text class="two">欢迎您为民航不安全事件管理系统提供事件信息,请您仔细填写适用条目:</text>
<text class="three">(红色字体为必填项)</text>
</view>
<!--时间选择-->
<view class="container">
<text class="four">事件发生时的当地时间:</text>
<view class="container1">
<text class="five1">时间:</text>
<picker class="choose1" mode="date" value="{{selectedDate}}" bindchange="onDateChange">
<view class="picker">
{{selectedDate}}
</view>
</picker>
<picker class="choose" mode="time" value="{{ selectedTime }}" bindchange="onTimeChange">
<view class="picker">
{{ selectedTime }}
</view>
</picker>
</view>
<view class="container1"> <text class="five">时区:</text>
<picker class="choose" mode="selector" range="{{ timezones }}" value="{{ selectedIndex1 }}" bindchange="onTimezoneChange">
<view class="picker">
{{ timezones[selectedIndex1] }}
</view>
</picker></view>
</view>
<!--学生学员类型:-->
<view class="container">
<view class="container1">
<text class="five">学生学员类型:</text>
<picker class="choose" mode="selector" range="{{ student }}" value="{{ selectedIndex23 }}" bindchange="onstudent">
<view class="picker">
{{ student[selectedIndex23] }}
</view>
</picker>
</view>
</view>
<!--事件发生时的飞行阶段 Phase of flight -->
<view class="container">
<view class="container1">
<text class="five">事件发生时的飞行阶段:</text>
<picker class="choose" mode="selector" range="{{ phase }}" value="{{ selectedIndex9 }}" bindchange="onphase">
<view class="picker">
{{ phase[selectedIndex9] }}
</view>
</picker>
</view>
</view>
<!--事件是否涉及航空器:-->
<view class="container">
<view class="container1">
<text class="five">事件是否涉及航空器:</text>
<picker class="choose" mode="selector" range="{{ involve }}" value="{{ selectedIndex22 }}" bindchange="oninvolve">
<view class="picker">
{{ involve[selectedIndex22] }}
</view>
</picker>
</view>
</view>
<!--描述事件-->
<view class="container">
<text class="four">请您尽可能完整地描述事件经过:(如事件过程、原因、建议等)</text>
<view class="container3">
<textarea class="scroll-input" value="{{inputValue20}}" placeholder="请输入内容(1000字以内)..." maxlength="1000" bindinput="onInput20"></textarea>
</view>
</view>
<!--感谢:-->
<view class="container">
<view class="container1">
<text class="five1"> 民航不安全事件管理系统欢迎全行业所有人员做安全“吹哨人”!感谢您积极主动参与改善航空安全行动和自愿报告安全风险隐患信息!我们欢迎您本着诚信原则报送有关安全信息,同时建议您留一个有效的联系方式,以方便该信息得到有效处理、应用、反馈和奖励。我们承诺对每一位员工、每一家单位的报告信息严格保密,谢谢!
</text>
</view>
</view>
<!--姓名Name:-->
<view class="container">
<view class="container1">
<text class="five1">姓名:</text>
<view style="width: 10px;"></view>
<input class="input-box2" type="text" value="{{inputValue21}}" placeholder="请输入" bindinput="onInput21" />
</view>
</view>
<!--电话Tel-->
<view class="container">
<view class="container1">
<text class="five1">电话:</text>
<view style="width: 10px;"></view>
<input class="input-box2" type="text" value="{{inputValue22}}" placeholder="请输入" bindinput="onInput22" />
</view>
</view>
<!--E-mail-->
<view class="container">
<view class="container1">
<text class="five1">邮箱:</text>
<view style="width: 10px;"></view>
<input class="input-box2" type="text" value="{{inputValue23}}" placeholder="请输入" bindinput="onInput23" />
</view>
</view>
<!--提交与重写-->
<view class="container4">
<button class="reset-button" bindtap="onReset">全部重写</button>
<button class="submit-button" bindtap="onSubmit">提交</button>
</view>
</view>

@ -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;
}

@ -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', // 这里是智能统计分析的页面路径
});
}
});

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,17 @@
<!--pages/admin/admin.wxml-->
<view class="container">
<view class="header">
<text class="title">管理员界面</text>
</view>
<view class="buttons">
<!-- 查看上报按钮 -->
<button bindtap="goToViewReports" class="action-btn">查看上报</button>
<!-- 智能统计分析按钮 -->
<button bindtap="goToDataAnalysis" class="action-btn">智能统计分析</button>
</view>
<view>
<!-- 返回登录界面按钮 -->
<button bindtap="goTologin" class="action-btn">返回登录界面</button>
</view>
</view>

@ -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;
}

@ -0,0 +1,6 @@
// app.js
App({
globalData: {
token: null
}
});

@ -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"
}

@ -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;
}

@ -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
});
}
});

@ -0,0 +1,5 @@
{
"usingComponents": {
"ec-canvas": "../../echarts-for-weixin/ec-canvas/ec-canvas"
}
}

@ -0,0 +1,42 @@
<view class="module">
    <text class="caption">2024年不安全事件上报的汇总</text>
 </view>
  
<view class="indexGraph">
<view class="left">
<view class="leftTop">
<view class="date">日期</view>
<view class="slice"></view>
<view class="idx">上报数量</view>
</view>
<view class="yAxis">
<view wx:for="{{predictResult.pre_data}}" wx:key="*this">{{item.dt}}</view>
</view>
</view>
<view class="right">
<view class="xAxis">
<view class="deg">150</view>
<view class="deg">300</view>
<view class="deg">450</view>
<view class="deg">600</view>
<view class="deg">750</view>
<view class="deg">900</view>
<view class="deg">|</view>
<view class="deg">|</view>
<view class="deg">|</view>
<view class="deg">|</view>
<view class="deg">|</view>
<view class="deg">|</view>
</view>
<view class="graph">
<view class="colarea">
<view class="col" wx:for="{{predictResult.pre_data}}" wx:key="*this" style="width: {{item.idx/1.7}}rpx; background-color: rgb(17, 145, 0);">{{item.idx}}</view>
</view>
</view>
</view>
</view>
<view class="module">
    <text class="caption">2024年事件上报情况-柱状图</text>
  </view>

@ -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; /* 文字居中 */
}

@ -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() {
},
})

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,63 @@
<!-- 轮播图 -->
<swiper
class="swiper1"
autoplay="true"
interval="3000"
circular="true"
indicator-dots="true"
indicator-color="white"
indicator-active-color="brown"
>
<swiper-item>
<image src="/image/轮播图1.jpg" class="slide-image" bindtap="swiperItemTap" data-url="/pages/z1/z1"/>
</swiper-item>
<swiper-item>
<image src="/image/轮播图2.jpg" class="slide-image" bindtap="swiperItemTap" data-url="/pages/z2/z2"/>
</swiper-item>
<swiper-item>
<image src="/image/轮播图3.jpg" class="slide-image" bindtap="swiperItemTap" data-url="/pages/z3/z3"/>
</swiper-item>
</swiper>
<!-- 页面跳转链接 -->
<view class="three">
<text class="four">上报中心</text>
<view>
<scroll-view class="container1" scroll-x="true" enable-flex="true">
<view class="grid-container">
<navigator class="grid-item" url="/pages/FlightCrew/FlightCrew">
<image src="/image/飞行人员.png"></image>
<text>飞行事件</text>
</navigator>
<navigator class="grid-item" url="/pages/Crew/Crew">
<image src="/image/乘务人员.png"></image>
<text>乘务事件</text>
</navigator>
<navigator class="grid-item" url="/pages/Airtraffic/Airtraffic">
<image src="/image/空管人员.png"></image>
<text>空管事件</text>
</navigator>
<navigator class="grid-item" url="/pages/AircraftMaintenance/AircraftMaintenance">
<image src="/image/机务人员.jpg"></image>
<text>机务事件</text>
</navigator>
<navigator class="grid-item" url="/pages/AirportGround/AirportGround">
<image src="/image/地勤人员.png"></image>
<text>地勤事件</text>
</navigator>
<navigator class="grid-item" url="/pages/Aviation/Aviation">
<image src="/image/空防事件.png"></image>
<text>空防事件</text>
</navigator>
<navigator class="grid-item" url="/pages/Students/students">
<image src="/image/学生学员.png"></image>
<text>学生事件</text>
</navigator>
<navigator class="grid-item" url="/pages/Fast/Fast">
<image src="/image/快速上报.png"></image>
<text>快速上报</text>
</navigator>
</view>
</scroll-view>
</view>
</view>

@ -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;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

@ -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' // 跳转到注册页面
});
}
});

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,31 @@
<!-- pages/login/login.wxml -->
<view class="container">
<view class="title">登录</view>
<!-- 输入账号ID -->
<input
type="text"
placeholder="请输入账号ID"
bindinput="onIDInput"
value="{{ID}}"
/>
<!-- 输入密码 -->
<input
type="password"
placeholder="请输入密码"
bindinput="onPasswordInput"
value="{{password}}"
/>
<!-- 显示错误信息 -->
<view class="error">{{errorMessage}}</view>
<!-- 登录按钮 -->
<button bindtap="submitUserInfo">登录</button>
<!-- 跳转到注册页面 -->
<view class="message">
还没有账号?<text class="link" bindtap="goToRegister">点击注册</text>
</view>
</view>

@ -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;
}

@ -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: '<userid>', // 替换为实际的用户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
});
}
});

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,24 @@
<!-- 标题 -->
<view class="header">
<text class="title">AI助手</text>
</view>
<view class="container">
<!-- 消息显示区域 -->
<scroll-view class="chat-area" scroll-y>
<block wx:for="{{messages}}" wx:key="id">
<view class="message" wx:if="{{item.role === 'user'}}">
<view class="user-message">{{item.content}}</view>
</view>
<view class="message" wx:if="{{item.role === 'assistant'}}">
<view class="assistant-message">{{item.content}}</view>
</view>
</block>
</scroll-view>
</view>
<!-- 输入框与发送按钮 -->
<view class="input-area">
<input class="input-box" placeholder="请输入问题..." bindinput="bindKeyInput" value="{{inputVal}}" />
<button class="send-btn" bindtap="sendMessage">发送</button>
</view>

@ -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; /* 输入框提示符为浅灰色 */
}

75
package-lock.json generated

@ -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"
}
}
}
}

@ -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": ""
}

@ -1,71 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.sa</groupId>
<artifactId>bigevent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>bigevent</name>
<description>bigevent</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter-test</artifactId>
<version>3.0.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>annotationProcessor</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>4.4.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

@ -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' // 跳转到登录页面
});
}
}
});
}
});

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,13 @@
<view class="profile-page">
<!-- 个人信息展示部分,仅显示头像 -->
<view class="profile-header">
<view class="avatar-container">
<image class="avatar" src="{{avatarUrl}}" mode="aspectFill" />
</view>
</view>
<!-- 功能按钮,仅保留查看上报和退出登录功能 -->
<view class="actions">
<button class="action-btn" bindtap="viewLogs">查看上报</button>
<button class="action-btn logout-btn" bindtap="logout">退出登录</button>
</view>
</view>

@ -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; /* 红色背景,用于突出退出按钮 */
}

@ -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
}
}

@ -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
}
]
}
}
}

@ -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' // 登录页面的路径
});
}
});

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,32 @@
<!-- pages/register/register.wxml -->
<view class="container">
<!-- 注册标题 -->
<view class="title">注册</view>
<!-- 输入账号ID号 -->
<input
type="text"
placeholder="请输入账号ID"
bindinput="onIDInput"
value="{{phone}}"
/>
<!-- 输入密码 -->
<input
type="password"
placeholder="请输入密码"
bindinput="onPasswordInput"
value="{{password}}"
/>
<!-- 显示错误信息 -->
<view class="error">{{errorMessage}}</view>
<!-- 注册按钮 -->
<button bindtap="submitUserInfo">注册</button>
<!-- 提示跳转到登录页面 -->
<view class="message">
已有账号?<text class="link" bindtap="goToLogin">点击登录</text>
</view>
</view>

@ -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;
}

@ -0,0 +1,7 @@
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}

@ -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
);

@ -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);
}
}

@ -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");
}
}

@ -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<Report> 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<Report>> list() {
Map<String,Object> 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<Report> reports = reportService.list(username);
return Result.success(reports);
}
}
}

@ -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<String,Object> 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<String,Object> claims = new HashMap<>();
claims.put("id",loginuser.getId());
claims.put("username",loginuser.getUsername());
String token = JwtUtil.genToken(claims);
return Result.success(token);
}
}
}

@ -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():"操作失败");
}
}

@ -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();
}
}

@ -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<Report> findByName(String name);
@Select("select * from reports")
ArrayList<Report> 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);
}

@ -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);
}

@ -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; //图片类别,图片用在什么地方
}

@ -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;
}

@ -1,31 +0,0 @@
package com.sa.unsafeincidents.pojo;
//统一响应结果
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@NoArgsConstructor
@AllArgsConstructor
@Data
public class Result<T> {
private Integer code;//业务状态码 0-成功 1-失败
private String message;//提示信息
private T data;//响应数据
//快速返回操作成功响应结果(带响应数据)
public static <E> Result<E> 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);
}
}

@ -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;//更新时间
}

@ -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<Report> list(String name);
ArrayList<Report> list();
Report findByID(Integer id);
void reply(Integer id, String reply);
}

@ -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);
}

@ -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<Report> list(String name){
return reportMapper.findByName(name);
};
@Override
public ArrayList<Report> 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);
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save