Merge branch 'demo' of http://s16s652780.51mypc.cn:49896/r/yskj/iot_drone_web into demo
| | |
| | | } |
| | | // @See: https://github.com/axios/axios/issues/383 |
| | | if (!err.response || !err.response.status) { |
| | | message.error('The network is abnormal, please check the backend service and try again') |
| | | message.error('网络异常,请检查后端服务后重试') |
| | | return |
| | | } |
| | | if (err.response?.status !== 200) { |
| | | message.error(`ERROR_CODE: ${err.response?.status}`) |
| | | message.error(`错误码: ${err.response?.status}`) |
| | | } |
| | | // if (err.response?.status === 403) { |
| | | // // window.location.href = '/' |
| | |
| | | rth_altitude: number // 相对机场返航高度 20 - 500 |
| | | out_of_control_action: OutOfControlAction // 失控动作 |
| | | |
| | | |
| | | //重复频率类型 |
| | | rep_fre_type?:number |
| | | //重复频率值 |
| | | rep_fre_val?:number |
| | | // 重复规则值 |
| | | rep_rule_val?:[] |
| | | rep_rule_type?:number |
| | | } |
| | | // 新增计划 |
| | | export const createPlan = async function (workspaceId: string, plan: CreatePlan): Promise<IWorkspaceResponse<any>> { |
| | |
| | | function onControlSourceChange (data: ControlSourceChangeInfo) { |
| | | if (data.type === ControlSourceChangeType.Flight && data.sn === sn) { |
| | | droneControlSource.value = data.control_source |
| | | message.info(`Flight control is changed to ${droneControlSource.value}`) |
| | | message.info(`飞行控制改为 ${droneControlSource.value}`) |
| | | return |
| | | } |
| | | if (data.type === ControlSourceChangeType.Payload && data.sn === payloadSn) { |
| | | payloadControlSource.value = data.control_source |
| | | message.info(`Payload control is changed to ${payloadControlSource.value}.`) |
| | | message.info(`负载控制改为 ${payloadControlSource.value}.`) |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | // Subscribe when a remote user publishes a stream |
| | | agoraClient.on('user-joined', async (user: IAgoraRTCRemoteUser) => { |
| | | message.info('user[' + user.uid + '] join') |
| | | message.info('用户[' + user.uid + '] 加入') |
| | | }) |
| | | agoraClient.on('user-published', async (user: IAgoraRTCRemoteUser, mediaType: 'audio' | 'video') => { |
| | | await agoraClient.subscribe(user, mediaType) |
| | |
| | | }) |
| | | agoraClient.on('user-unpublished', async (user: any) => { |
| | | console.log('unpublish live:', user) |
| | | message.info('unpublish live') |
| | | message.info('取消发布') |
| | | }) |
| | | agoraClient.on('exception', async (e: any) => { |
| | | console.log(e) |
| | |
| | | } |
| | | const onUpdateQuality = () => { |
| | | if (!livePara.liveState) { |
| | | message.info('Please turn on the livestream first.') |
| | | message.info('请先打开直播') |
| | | return |
| | | } |
| | | setLivestreamQuality({ |
| | |
| | | |
| | | const onSwitch = () => { |
| | | if (dronePara.lensSelected === undefined || dronePara.lensSelected === nonSwitchable) { |
| | | message.info('The ' + nonSwitchable + ' lens cannot be switched, please select the lens to be switched.', 8) |
| | | message.info('当前 ' + nonSwitchable + ' 镜头无法切换,请选择要切换的镜头', 8) |
| | | return |
| | | } |
| | | changeLivestreamLens({ |
| | |
| | | |
| | | const onUpdateQuality = () => { |
| | | if (!liveState.value) { |
| | | message.info('Please turn on the livestream first.') |
| | | message.info('请先打开直播') |
| | | return |
| | | } |
| | | setLivestreamQuality({ |
| | |
| | | } |
| | | const onSwitch = () => { |
| | | if (lensSelected.value === undefined || lensSelected.value === nonSwitchable) { |
| | | message.info('The ' + nonSwitchable + ' lens cannot be switched, please select the lens to be switched.', 8) |
| | | message.info('当前 ' + nonSwitchable + ' 镜头无法切换,请选择要切换的镜头', 8) |
| | | return |
| | | } |
| | | changeLivestreamLens({ |
| | |
| | | } from '/@/types/task' |
| | | import moment, { Moment } from 'moment' |
| | | import { RuleObject } from 'ant-design-vue/es/form/interface' |
| | | import { getFlyTimeList } from '/@/utils/jobTime' |
| | | |
| | | const root = getRoot() |
| | | const store = useMyStore() |
| | |
| | | rep_fre_val: 1, |
| | | rep_fre_type: 3, |
| | | rep_rule_type: 1, |
| | | |
| | | }) |
| | | |
| | | const executeTimeRepeatArr = ref([ |
| | |
| | | validator: async (rule: RuleObject, value: string) => { |
| | | if (!/^[0-9]{1,}$/.test(value)) { |
| | | throw new Error('相对机场返航高度需为数字类型') |
| | | } else if (Number(value) < 20 || Number(value) > 500) { |
| | | throw new Error('返航高度需在20-500米之间') |
| | | } |
| | | }, |
| | | } |
| | |
| | | if (wayline.value && wayline.value.template_types && wayline.value.template_types.length > 0) { |
| | | createPlanBody.wayline_type = wayline.value.template_types[0] |
| | | } |
| | | |
| | | // getFlyTimeList(createPlanBody) |
| | | |
| | | createPlan(workspaceId, createPlanBody) |
| | | .then(res => { |
| | | disabled.value = false |
| | |
| | | } |
| | | bindDevice(bindParam).then(bindRes => { |
| | | if (bindRes.code !== 0) { |
| | | message.error('bind failed:' + bindRes.message) |
| | | message.error('绑定失败:' + bindRes.message) |
| | | console.error(bindRes.message) |
| | | return |
| | | } |
| | |
| | | } |
| | | device.data.gateway_sn = apiPilot.getRemoteControllerSN() |
| | | if (device.data.gateway_sn === EStatusValue.DISCONNECT.toString()) { |
| | | message.warn('Data is not available, please restart the remote control.') |
| | | message.warn('数据不可用,请重新启动遥控器') |
| | | return |
| | | } |
| | | |
| | |
| | | if (isInstalled) { |
| | | window.open('https://www.dji.com') |
| | | } else { |
| | | message.error(packageName + ' is not installed.') |
| | | message.error(packageName + ' 未安装.') |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | function moduleUninstall (m: any) { |
| | | message.info('uninstall ' + m.module) |
| | | message.info('卸载 ' + m.module) |
| | | apiPilot.unloadComponent(m.module) |
| | | refreshStatus() |
| | | } |
| | |
| | | }) |
| | | const jsres = apiPilot.loadComponent(EComponentName.Api, apiPilot.getComponentParam(EComponentName.Api)) |
| | | if (!jsres) { |
| | | message.error('Failed to load api module.') |
| | | message.error('加载api模块失败') |
| | | return |
| | | } |
| | | apiPilot.setToken(res.data.access_token) |
| | |
| | | await login(formState) |
| | | .then(res => { |
| | | if (!isVerified.value) { |
| | | message.error('Please verify the license firstly.') |
| | | message.error('请先核实许可证.') |
| | | return |
| | | } |
| | | console.log('login res:', res) |
| | |
| | | |
| | | const rules = { |
| | | status: [{ required: true }], |
| | | release_note: [{ required: true, message: 'Please input release note.' }], |
| | | device_name: [{ required: true, message: 'Please select which models this firmware belongs to.' }] |
| | | release_note: [{ required: true, message: '请输入发行说明' }], |
| | | device_name: [{ required: true, message: '请选择该固件属于哪个型号' }] |
| | | } |
| | | interface FileItem { |
| | | uid: string; |
| | |
| | | |
| | | function beforeUpload (file: FileItem) { |
| | | if (!file.name || !file.name?.endsWith('.zip')) { |
| | | message.error('Format error. Please select zip file.') |
| | | message.error('格式错误。请选择zip文件') |
| | | return false |
| | | } |
| | | fileList.value = [file] |
| | |
| | | |
| | | const uploadFile = async () => { |
| | | if (fileList.value.length === 0) { |
| | | message.error('Please select at least one file.') |
| | | message.error('请选择至少一个文件') |
| | | } |
| | | let uploading: string |
| | | formRef.value.validate().then(async () => { |
| | |
| | | uploading = (file.name ?? 'uploding') + timestamp |
| | | notification.open({ |
| | | key: uploading, |
| | | message: `Uploading ${moment().format()}`, |
| | | description: `[${file.name}] is uploading... `, |
| | | message: `上传中 ${moment().format()}`, |
| | | description: `[${file.name}] 正在上传... `, |
| | | duration: null |
| | | }) |
| | | importFirmareFile(workspaceId, fileData).then((res) => { |
| | | if (res.code === 0) { |
| | | notification.success({ |
| | | message: `Uploaded ${moment().format()}`, |
| | | description: `[${file.name}] file uploaded successfully. Duration: ${moment.duration(new Date().getTime() - timestamp).asSeconds()}`, |
| | | message: `上传完毕 ${moment().format()}`, |
| | | description: `[${file.name}] 文件上传完毕. 用时: ${moment.duration(new Date().getTime() - timestamp).asSeconds()}`, |
| | | duration: null |
| | | }) |
| | | getAllFirmwares(pageParam) |
| | | } else { |
| | | notification.error({ |
| | | message: `Failed to upload [${file.name}]. Check and try again.`, |
| | | description: `Error message: ${res.message} ${moment().format()}`, |
| | | message: `上传失败 [${file.name}]. 检查并重新上传`, |
| | | description: `错误信息: ${res.message} ${moment().format()}`, |
| | | style: { color: commonColor.FAIL }, |
| | | duration: null, |
| | | }) |
| | |
| | | } else { // 终态:成功,失败,超时 |
| | | if (status === DeviceCmdExecuteStatus.Failed || status === DeviceCmdExecuteStatus.Timeout) { |
| | | notification.error({ |
| | | message: `(${payload.sn}) Upgrade failed`, |
| | | description: `Error Code: ${payload.result}`, |
| | | message: `(${payload.sn}) 升级失败`, |
| | | description: `错误码: ${payload.result}`, |
| | | duration: null |
| | | }) |
| | | } |
| | |
| | | function deleteWayline () { |
| | | deleteWaylineFile(workspaceId.value, deleteWaylineId.value).then(res => { |
| | | if (res.code === 0) { |
| | | message.success('Wayline file deleted') |
| | | message.success('文件删除成功') |
| | | } |
| | | deleteWaylineId.value = '' |
| | | deleteTip.value = false |
| | |
| | | export const TaskTypeOptions = [ |
| | | { value: TaskType.Immediate, label: TaskTypeMap[TaskType.Immediate] }, |
| | | { value: TaskType.Timed, label: TaskTypeMap[TaskType.Timed] }, |
| | | { value: TaskType.Repeat, label: TaskTypeMap[TaskType.Repeat] }, |
| | | { value: TaskType.Continuous, label: TaskTypeMap[TaskType.Continuous] }, |
| | | // { value: TaskType.Repeat, label: TaskTypeMap[TaskType.Repeat] }, |
| | | // { value: TaskType.Continuous, label: TaskTypeMap[TaskType.Continuous] }, |
| | | ] |
| | | |
| | | // 频率类型 |