fix: 资源库跳转

This commit is contained in:
100011797 2023-03-30 18:24:03 +08:00
parent d53f487d2c
commit 4e540b022d
3 changed files with 10 additions and 2 deletions

View File

@ -1,6 +1,7 @@
import { DeviceInstance, InstanceModel } from "@/views/device/Instance/typings" import { DeviceInstance, InstanceModel } from "@/views/device/Instance/typings"
import { defineStore } from "pinia" import { defineStore } from "pinia"
import { detail } from '@/api/device/instance' import { detail } from '@/api/device/instance'
import { onlyMessage } from "@/utils/comm"
export const useInstanceStore = defineStore({ export const useInstanceStore = defineStore({
id: 'device', id: 'device',
@ -15,10 +16,14 @@ export const useInstanceStore = defineStore({
this.detail = current this.detail = current
}, },
async refresh(id: string) { async refresh(id: string) {
const resp = await detail(id) const resp: any = await detail(id).catch((err) => {
onlyMessage(err.response.data.message, 'error')
})
if(resp.status === 200){ if(resp.status === 200){
this.current = resp.result this.current = resp.result
this.detail = resp.result this.detail = resp.result
} else {
onlyMessage(resp?.message, 'error')
} }
}, },
setTabActiveKey(key: string) { setTabActiveKey(key: string) {

View File

@ -328,6 +328,7 @@ const jumpProduct = () => {
}; };
onUnmounted(() => { onUnmounted(() => {
instanceStore.current = {} as any
statusRef.value && statusRef.value.unsubscribe(); statusRef.value && statusRef.value.unsubscribe();
}); });
</script> </script>

View File

@ -51,7 +51,9 @@
> >
<template #img> <template #img>
<img <img
:src=" :width="88"
:height="88"
:src="slotProps?.photoUrl ||
getImage('/device/instance/device-card.png') getImage('/device/instance/device-card.png')
" "
/> />