new-map
ihzero 2022-11-10 16:31:56 +08:00
parent 0bfaa3f9b5
commit 3e7dbd90c0
11 changed files with 107 additions and 16 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

View File

@ -86,22 +86,23 @@ export const useUserStore = defineStore({
params: LoginParams & { params: LoginParams & {
goHome?: boolean goHome?: boolean
mode?: ErrorMessageMode mode?: ErrorMessageMode
homeRouter?: string
}, },
): Promise<UserInfo | null> { ): Promise<UserInfo | null> {
try { try {
const { goHome = true, mode, ...loginParams } = params const { goHome = true, mode, homeRouter, ...loginParams } = params
const data = await loginApi(loginParams, mode) const data = await loginApi(loginParams, mode)
const { token } = data const { token } = data
this.setToken(token) this.setToken(token)
return this.afterLoginAction(goHome) return this.afterLoginAction(goHome, homeRouter)
} catch (error) { } catch (error) {
console.log(error) console.log(error)
return Promise.reject(error) return Promise.reject(error)
} }
}, },
async afterLoginAction(goHome?: boolean): Promise<UserInfo | null> { async afterLoginAction(goHome?: boolean, homeRouter?: string): Promise<UserInfo | null> {
if (!this.getToken) return null if (!this.getToken) return null
const userInfo = await this.getUserInfoAction() const userInfo = await this.getUserInfoAction()
@ -118,7 +119,7 @@ export const useUserStore = defineStore({
router.addRoute(PAGE_NOT_FOUND_ROUTE as unknown as RouteRecordRaw) router.addRoute(PAGE_NOT_FOUND_ROUTE as unknown as RouteRecordRaw)
permissionStore.setDynamicAddedRoute(true) permissionStore.setDynamicAddedRoute(true)
} }
goHome && (await router.replace(PageEnum.BASE_HOME)) goHome && (await router.replace(homeRouter ?? PageEnum.BASE_HOME))
} }
return userInfo return userInfo
}, },

View File

@ -46,7 +46,10 @@
<FormItem class="enter-x"> <FormItem class="enter-x">
<Button type="primary" size="large" block @click="handleLogin" :loading="loading"> <Button type="primary" size="large" block @click="handleLogin" :loading="loading">
{{ t('sys.login.loginButton') }} 登录后台
</Button>
<Button size="large" class="mt-4" block @click="handleLogin('/v')" :loading="loading">
登录大屏
</Button> </Button>
<!-- <Button size="large" class="mt-4 enter-x" block @click="handleRegister"> <!-- <Button size="large" class="mt-4 enter-x" block @click="handleRegister">
{{ t('sys.login.registerButton') }} {{ t('sys.login.registerButton') }}
@ -129,7 +132,7 @@
const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN) const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN)
async function handleLogin() { async function handleLogin(e) {
const data = await validForm() const data = await validForm()
if (!data) return if (!data) return
try { try {
@ -138,6 +141,7 @@
password: data.password, password: data.password,
username: data.account, username: data.account,
mode: 'none', // mode: 'none', //
homeRouter: e,
}) })
if (userInfo) { if (userInfo) {
notification.success({ notification.success({

View File

@ -78,6 +78,7 @@
}, },
}) })
}) })
legendData = obj.legendData legendData = obj.legendData
setOptions({ setOptions({
@ -134,7 +135,7 @@
series: obj.series, series: obj.series,
}) })
// chartAmi() chartAmi()
} }
let timer: any = null let timer: any = null

View File

@ -60,7 +60,7 @@
getData() getData()
} }
const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>) const { setOptions, getInstance } = useECharts(chartRef as Ref<HTMLDivElement>)
async function getData() { async function getData() {
const resData = await getMateriel({ const resData = await getMateriel({
@ -72,6 +72,8 @@
chartsInit() chartsInit()
} }
let legendData = [] as any
const chartsInit = () => { const chartsInit = () => {
const obj = { const obj = {
legendData: [] as any, legendData: [] as any,
@ -109,6 +111,8 @@
}) })
}) })
legendData = obj.legendData
setOptions({ setOptions({
grid: { left: '2%', right: '2%', top: '50px', bottom: '2%', containLabel: true }, grid: { left: '2%', right: '2%', top: '50px', bottom: '2%', containLabel: true },
legend: { legend: {
@ -180,6 +184,34 @@
], ],
series: obj.series, series: obj.series,
}) })
chartAmi()
}
let timer: any = null
function chartAmi() {
let index = 0
timer && clearInterval(timer)
timer = setInterval(() => {
const currentIndex = index % legendData.length
// getInstance()?.dispatchAction({
// type: 'legendUnSelect',
// name: legendData[currentIndex],
// })
// getInstance()?.dispatchAction({
// type: 'legendSelect',
// name: legendData[currentIndex],
// })
getInstance()?.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: currentIndex,
})
index++
}, 3000)
} }
watch( watch(

View File

@ -37,11 +37,18 @@
</div> </div>
<div class="grid grid-cols-3 gap-x-6px my-10px"> <div class="grid grid-cols-3 gap-x-6px my-10px">
<div class="h-66px" v-for="item in list" :key="item.id"> <div class="h-66px" v-for="item in list" :key="item.id">
<VideoFlv <!-- <VideoFlv
:url="item.url" :url="item.url"
:name="item.base_name" :name="item.base_name"
:screen="false" :screen="false"
@click.prevent.stop="onChangeVideo(item)" @click.prevent.stop="onChangeVideo(item)"
/> -->
<img
:src="item.img"
class="object-cover w-full h-full"
alt=""
srcset=""
@click.prevent.stop="onChangeVideo(item)"
/> />
</div> </div>
</div> </div>
@ -57,6 +64,9 @@
import { getAgriculturalDeviceBasic, getDevices } from '/@/api/sys/other' import { getAgriculturalDeviceBasic, getDevices } from '/@/api/sys/other'
import Box from './Box.vue' import Box from './Box.vue'
import VideoFlv from './VideoFlv.vue' import VideoFlv from './VideoFlv.vue'
import v01 from '../../../assets/images/v01.png'
import v02 from '../../../assets/images/v02.png'
import v03 from '../../../assets/images/v03.png'
export default defineComponent({ export default defineComponent({
components: { components: {
Box, Box,
@ -103,13 +113,13 @@
type: 1, type: 1,
status: 1, status: 1,
}) })
Data.list = resData.map((e) => { Data.list = resData.map((e, index) => {
// const { username, passage, ip, port, rtsp_url } = e.extends const { username, passage, ip, port, rtsp_url } = e.extends
// const url = `rtsp://${username}:${passage}@${ip}:${port}${rtsp_url}` const url = `rtsp://${username}:${passage}@${ip}:${port}${rtsp_url}`
const url = // const url = 'rtsp://admin:admin12345@183.222.79.115:9007/cam/realmonitor?channel=1&subtype=0'
'rtsp://admin:admin12345@183.222.79.115:9007/cam/realmonitor?channel=1&subtype=0'
return { return {
...e, ...e,
img: index == 0 ? v01 : index == 1 ? v02 : index == 2 ? v03 : v01,
url: `ws://127.0.0.1:8100/rtsp?url=${window.btoa(url)}`, url: `ws://127.0.0.1:8100/rtsp?url=${window.btoa(url)}`,
} }
}) })

View File

@ -25,11 +25,14 @@
const { rootEmitter } = useVContext() const { rootEmitter } = useVContext()
const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>) const { setOptions, getInstance } = useECharts(chartRef as Ref<HTMLDivElement>)
const visualizationStore = useVisualizationStore() const visualizationStore = useVisualizationStore()
let legendData = [] as any
function chatInit() { function chatInit() {
legendData = Data.list
setOptions({ setOptions({
grid: { left: '2%', right: '2%', top: '10%', bottom: '2%', containLabel: true }, grid: { left: '2%', right: '2%', top: '10%', bottom: '2%', containLabel: true },
tooltip: { tooltip: {
@ -97,6 +100,34 @@
}, },
], ],
}) })
chartAmi()
}
let timer: any = null
function chartAmi() {
let index = 0
timer && clearInterval(timer)
timer = setInterval(() => {
const currentIndex = index % legendData.length
// getInstance()?.dispatchAction({
// type: 'legendUnSelect',
// name: legendData[currentIndex],
// })
// getInstance()?.dispatchAction({
// type: 'legendSelect',
// name: legendData[currentIndex],
// })
getInstance()?.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: currentIndex,
})
index++
}, 3000)
} }
async function getData() { async function getData() {

View File

@ -321,4 +321,16 @@
.aim-spin { .aim-spin {
animation: spin 2s linear infinite; animation: spin 2s linear infinite;
} }
@keyframes spin {
from {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
</style> </style>

View File

@ -18,7 +18,7 @@
<DZWZ width="440px" height="353px" /> <DZWZ width="440px" height="353px" />
</div> </div>
</div> </div>
<div class="flex-1 flex ml-15px justify-between bg-[#162126] bg-opacity-60"> <div class="flex-1 flex ml-15px justify-between bg-[#162126] bg-opacity-40">
<div class="bg-[#10272f] bg-opacity-00"> <div class="bg-[#10272f] bg-opacity-00">
<NYQK /> <NYQK />
<NCZQS class="mt-20px" /> <NCZQS class="mt-20px" />