lixin 1 год назад
Родитель
Сommit
49d89480a4
3 измененных файлов: 51 добавлений и 17 удалений
  1. +1
    -1
      .env.localhost
  2. +43
    -15
      src/views/dashboard/components/ControlPanel.vue
  3. +7
    -1
      src/views/dashboard/index.vue

+ 1
- 1
.env.localhost Просмотреть файл

@@ -5,7 +5,7 @@ VITE_PUBLIC_PATH = '/'
VITE_APP_USE_MOCK = false

# proxy
VITE_PROXY = [["/api-local","https://lcxj-test.t-aaron.com/api"],["/api-mock","http://127.0.0.1:8003"]]
VITE_PROXY = [["/api-local","http://127.0.0.1:8002/api"],["/api-mock","http://127.0.0.1:8003"]]

# base api
VITE_APP_GLOB_BASE_API = '/api-local'

+ 43
- 15
src/views/dashboard/components/ControlPanel.vue Просмотреть файл

@@ -30,13 +30,27 @@
</n-icon>
</div>
<div class="square__panel">
<n-icon size="24" color="#fff">
<PlusOutlined />
</n-icon>
<div
class="panel__button"
@mousedown="handleEvent('down',{yuntai:'05'})"
@mouseup="handleEvent('up',{yuntai:'05'})"
@mouseleave="handleEvent('leave',{yuntai:'05'})"
>
<n-icon size="24" color="#fff">
<PlusOutlined />
</n-icon>
</div>
<p>焦距</p>
<n-icon size="24" color="#fff">
<LineOutlined />
</n-icon>
<div
class="panel__button"
@mousedown="handleEvent('down',{yuntai:'06'})"
@mouseup="handleEvent('up',{yuntai:'06'})"
@mouseleave="handleEvent('leave',{yuntai:'06'})"
>
<n-icon size="24" color="#fff">
<LineOutlined />
</n-icon>
</div>
</div>
<div class="panel__title">云台控制</div>
</div>
@@ -72,10 +86,15 @@
</n-icon>
</div>
<div class="crcle__panel">
<div class="pannel__item item-1" @click="handleClick(1)" />
<div class="pannel__item item-2" @click="handleClick(1)" />
<div class="pannel__item item-3" @click="handleClick(1)" />
<div class="pannel__item item-4" @click="handleClick(1)" />
<div
v-for="(item,index) in moveList"
:key="index"
class="pannel__item"
:class="`item-${index+1}`"
@mousedown="handleEvent('down',item.list,item.key)"
@mouseup="handleEvent('up',item.list,item.key)"
@mouseleave="handleEvent('leave',item.list,item.key)"
/>
<n-icon class="top" size="24" color="#fff">
<UpOutlined />
</n-icon>
@@ -127,7 +146,7 @@ export default defineComponent({
default: () => ['camera', 'locus']
}
},
emits: ['start', 'reset'],
emits: ['instruct'],
setup(props, { emit }) {
const data = reactive({
cameraShow: true,
@@ -173,24 +192,24 @@ export default defineComponent({
let reset = {}
if (key) {
params.pwm = data.config[key]
reset = { yaogan: '12', pwm: '200' }
reset = { yaogan: '12', pwm: data.config.move }
} else {
reset = { yuntai: '09' }
}
switch (event) {
case 'down':
data.hasEvent = true
emit('start', params)
emit('instruct', params)
break
case 'up':
if (data.hasEvent) {
emit('reset', reset)
emit('instruct', reset)
data.hasEvent = false
}
break
case 'leave':
if (data.hasEvent) {
emit('reset', reset)
emit('instruct', reset)
data.hasEvent = false
}
break
@@ -272,6 +291,15 @@ export default defineComponent({
flex-direction: column;
justify-content: space-around;
align-items: center;
.panel__button{
width: 100%;
text-align: center;
cursor: pointer;
.n-icon{
pointer-events: none;
}
}

}
&.open{
transition: width 1s;

+ 7
- 1
src/views/dashboard/index.vue Просмотреть файл

@@ -3,6 +3,7 @@
<OneMap ref="Map" />
<Extend ref="extendRef" class="extend" @send="getmessage" />

<!-- <ControlPanel @instruct="handleInstruct" /> -->
</div>
</template>

@@ -10,10 +11,11 @@
import { useRouter } from 'vue-router'
import OneMap from './components/OneMap.vue'
import Extend from './components/Extend.vue'
import ControlPanel from './components/ControlPanel.vue'
import { ref, onMounted } from 'vue'
export default {
name: 'HomePage',
components: { OneMap, Extend },
components: { OneMap, Extend, ControlPanel },
setup(props) {
const router = useRouter()
const extendRef = ref()
@@ -34,12 +36,16 @@ export default {
onMounted(() => {
extendRef.value.handleClick(0)
})
// const handleInstruct = (params) => {
// console.log(params)
// }
return {
data,
toSystem,
extendRef,
getmessage,
Map
// handleInstruct
}
}
}

Загрузка…
Отмена
Сохранить