husq
2023-10-09 4fb0c56fe4c98ef38bc4cfee497ff10301121d5d
Merge branch 'demo' of http://s16s652780.51mypc.cn:49896/r/yskj/iot_drone_web into demo
13 files modified
75 ■■■■■ changed files
src/api/http/request.ts 4 ●●●● patch | view | raw | blame | history
src/api/wayline.ts 6 ●●●●● patch | view | raw | blame | history
src/components/g-map/use-drone-control-ws-event.ts 4 ●●●● patch | view | raw | blame | history
src/components/livestream-agora.vue 8 ●●●● patch | view | raw | blame | history
src/components/livestream-others.vue 4 ●●●● patch | view | raw | blame | history
src/components/task/CreatePlan.vue 7 ●●●● patch | view | raw | blame | history
src/pages/page-pilot/pilot-bind.vue 2 ●●● patch | view | raw | blame | history
src/pages/page-pilot/pilot-home.vue 6 ●●●● patch | view | raw | blame | history
src/pages/page-pilot/pilot-index.vue 4 ●●●● patch | view | raw | blame | history
src/pages/page-web/projects/Firmwares.vue 20 ●●●● patch | view | raw | blame | history
src/pages/page-web/projects/devices.vue 4 ●●●● patch | view | raw | blame | history
src/pages/page-web/projects/wayline.vue 2 ●●● patch | view | raw | blame | history
src/types/task.ts 4 ●●●● patch | view | raw | blame | history
src/api/http/request.ts
@@ -65,11 +65,11 @@
    }
    // @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 = '/'
src/api/wayline.ts
@@ -76,8 +76,14 @@
  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>> {
src/components/g-map/use-drone-control-ws-event.ts
@@ -14,12 +14,12 @@
  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}.`)
    }
  }
src/components/livestream-agora.vue
@@ -209,7 +209,7 @@
  }
  // 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)
@@ -223,7 +223,7 @@
  })
  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)
@@ -364,7 +364,7 @@
}
const onUpdateQuality = () => {
  if (!livePara.liveState) {
    message.info('Please turn on the livestream first.')
    message.info('请先打开直播')
    return
  }
  setLivestreamQuality({
@@ -379,7 +379,7 @@
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({
src/components/livestream-others.vue
@@ -335,7 +335,7 @@
const onUpdateQuality = () => {
  if (!liveState.value) {
    message.info('Please turn on the livestream first.')
    message.info('请先打开直播')
    return
  }
  setLivestreamQuality({
@@ -400,7 +400,7 @@
}
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({
src/components/task/CreatePlan.vue
@@ -283,6 +283,7 @@
} 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()
@@ -317,7 +318,6 @@
  rep_fre_val: 1,
  rep_fre_type: 3,
  rep_rule_type: 1,
})
const executeTimeRepeatArr = ref([
@@ -379,6 +379,8 @@
      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米之间')
        }
      },
    }
@@ -496,6 +498,9 @@
    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
src/pages/page-pilot/pilot-bind.vue
@@ -43,7 +43,7 @@
  }
  bindDevice(bindParam).then(bindRes => {
    if (bindRes.code !== 0) {
      message.error('bind failed:' + bindRes.message)
      message.error('绑定失败:' + bindRes.message)
      console.error(bindRes.message)
      return
    }
src/pages/page-pilot/pilot-home.vue
@@ -264,7 +264,7 @@
  }
  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
  }
@@ -389,7 +389,7 @@
  if (isInstalled) {
    window.open('https://www.dji.com')
  } else {
    message.error(packageName + ' is not installed.')
    message.error(packageName + ' 未安装.')
  }
}
@@ -481,7 +481,7 @@
}
function moduleUninstall (m: any) {
  message.info('uninstall ' + m.module)
  message.info('卸载 ' + m.module)
  apiPilot.unloadComponent(m.module)
  refreshStatus()
}
src/pages/page-pilot/pilot-index.vue
@@ -81,7 +81,7 @@
        })
        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)
@@ -97,7 +97,7 @@
  await login(formState)
    .then(res => {
      if (!isVerified.value) {
        message.error('Please verify the license firstly.')
        message.error('请先核实许可证.')
        return
      }
      console.log('login res:', res)
src/pages/page-web/projects/Firmwares.vue
@@ -202,8 +202,8 @@
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;
@@ -221,7 +221,7 @@
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]
@@ -240,7 +240,7 @@
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 () => {
@@ -261,22 +261,22 @@
    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,
        })
src/pages/page-web/projects/devices.vue
@@ -314,8 +314,8 @@
      } 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
          })
        }
src/pages/page-web/projects/wayline.vue
@@ -166,7 +166,7 @@
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
src/types/task.ts
@@ -18,8 +18,8 @@
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] },
]
// 频率类型