Commit 3970053c authored by 朱松文's avatar 朱松文

使用体验优化及bug修复

parent 3991e7c1
...@@ -35,10 +35,17 @@ import BaseVue from "@/types/baseVue"; ...@@ -35,10 +35,17 @@ import BaseVue from "@/types/baseVue";
export default class Camera extends BaseVue { export default class Camera extends BaseVue {
@Prop() private detail!: CameraItem[]; @Prop() private detail!: CameraItem[];
@Prop() private cameraLocation!: string; @Prop() private cameraLocation!: string;
@Prop() private groupIndex!: number;
showCarmera = true; showCarmera = true;
activeId = ""; activeId = "";
mounted() {
if (this.groupIndex === 0 && this.detail && this.detail.length > 0) {
this.activeId = this.detail[0].cameraId;
}
}
hideCameras(): void { hideCameras(): void {
this.showCarmera = !this.showCarmera; this.showCarmera = !this.showCarmera;
} }
......
export interface DogData { export interface DogData {
id: string; id: number;
cameraId: string; cameraId: string;
startTimeInDay?: string; startTimeInDay?: string;
endTimeInDay?: string; endTimeInDay?: string;
......
...@@ -81,7 +81,7 @@ import BaseVue from "@/types/baseVue"; ...@@ -81,7 +81,7 @@ import BaseVue from "@/types/baseVue";
@Component({ components: { Icon } }) @Component({ components: { Icon } })
export default class DogInfo extends BaseVue { export default class DogInfo extends BaseVue {
@Prop() private dog: DogData; @Prop() private dog: DogData;
@Prop() private isActive = false; @Prop() private isActive!: boolean;
play(): void { play(): void {
this.$emit("play", this.dog); this.$emit("play", this.dog);
......
...@@ -49,6 +49,10 @@ class DogTrack extends Component { ...@@ -49,6 +49,10 @@ class DogTrack extends Component {
if (this.processing || this.trackData.length === 0 || !this.myel) return if (this.processing || this.trackData.length === 0 || !this.myel) return
this.processing = true this.processing = true
const currentTime = this.player_.currentTime() * 1000 const currentTime = this.player_.currentTime() * 1000
const maxPlayTime = this.trackData[this.trackData.length - 1].FrameIndex * 40
if (currentTime > maxPlayTime) {
this.player_.pause()
}
//假如调整的播放时间则初始数组索引 //假如调整的播放时间则初始数组索引
if (currentTime - this.preCurrentTime <= 0) { if (currentTime - this.preCurrentTime <= 0) {
this.dispose() this.dispose()
...@@ -56,6 +60,7 @@ class DogTrack extends Component { ...@@ -56,6 +60,7 @@ class DogTrack extends Component {
//上次播放时间 //上次播放时间
this.preCurrentTime = currentTime this.preCurrentTime = currentTime
const firstFrameIndex = this.trackData[0].FrameIndex * 40 const firstFrameIndex = this.trackData[0].FrameIndex * 40
for (let i = this.arrayIndex; i < this.trackData.length; i++) { for (let i = this.arrayIndex; i < this.trackData.length; i++) {
const d = this.trackData[i] const d = this.trackData[i]
if (firstFrameIndex <= currentTime && currentTime <= d.FrameIndex * 40) { if (firstFrameIndex <= currentTime && currentTime <= d.FrameIndex * 40) {
......
...@@ -45,7 +45,7 @@ export function pageDogInfo(data: any) { ...@@ -45,7 +45,7 @@ export function pageDogInfo(data: any) {
export function getLabelInfo(fileName: string) { export function getLabelInfo(fileName: string) {
return fetch( return fetch(
`${api.skyNet}/video/getLabelInfo?path=${fileName}`, `${api.skyNet}video/getLabelInfo?path=${fileName}`,
{ headers: { "Accept-Encoding": "gzip" } } { headers: { "Accept-Encoding": "gzip" } }
) )
.then((response) => { .then((response) => {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="camera-list"> <div class="camera-list">
<div> <div>
<div class="title">摄像头选择</div> <div class="title">摄像头选择</div>
<Search @search="queryCamera" @dateChange="handleDateChange" /> <Search @search="handleSearch" @dateChange="handleDateChange" />
</div> </div>
<div class="cameras"> <div class="cameras">
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
:key="index" :key="index"
:cameraLocation="key" :cameraLocation="key"
:detail="value" :detail="value"
@clickCamera="queryDogInfo" :groupIndex="index"
@clickCamera="handleClickCamera"
/> />
</div> </div>
<div v-show="!cameras" class="no-data"> <div v-show="!cameras" class="no-data">
...@@ -23,7 +24,7 @@ ...@@ -23,7 +24,7 @@
</div> </div>
<div class="player" ref="player-container"> <div class="player" ref="player-container">
<MyVideo <MyVideo
ref="myVideo" ref="my-video"
v-if="width > 0 && videoUrl" v-if="width > 0 && videoUrl"
:src="videoUrl" :src="videoUrl"
:trackData="trackData" :trackData="trackData"
...@@ -49,7 +50,8 @@ ...@@ -49,7 +50,8 @@
<div class="paging"> <div class="paging">
<el-pagination <el-pagination
background background
layout="total,prev, pager, next,jumper" small
layout="total,prev, pager, next"
:current-page.sync="queryCameryParam.current" :current-page.sync="queryCameryParam.current"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:total="dogTotal" :total="dogTotal"
...@@ -60,7 +62,7 @@ ...@@ -60,7 +62,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component } from "vue-property-decorator"; import { Component, Watch } from "vue-property-decorator";
import Camera from "@/components/Camera/index.vue"; import Camera from "@/components/Camera/index.vue";
import DogInfo from "@/components/DogInfo/index.vue"; import DogInfo from "@/components/DogInfo/index.vue";
import Search from "@/components/Camera/search.vue"; import Search from "@/components/Camera/search.vue";
...@@ -96,10 +98,16 @@ export default class Dashboard extends BaseVue { ...@@ -96,10 +98,16 @@ export default class Dashboard extends BaseVue {
size: 10, size: 10,
}; };
dogTotal = 0; dogTotal = 0;
currentDogId = ""; currentDogId = 0;
async created(): Promise<void> { async created(): Promise<void> {
this.queryCamera(this.queryCameryParam); this.queryCamera();
}
@Watch("dogData")
dogDataChange(newValue) {
//初始第一条视频
this.handlePlay(newValue[0]);
} }
mounted() { mounted() {
...@@ -113,45 +121,42 @@ export default class Dashboard extends BaseVue { ...@@ -113,45 +121,42 @@ export default class Dashboard extends BaseVue {
} }
async handlePlay(dog: DogData): Promise<void> { async handlePlay(dog: DogData): Promise<void> {
if (!dog) return;
console.log("dogInfo", dog); console.log("dogInfo", dog);
this.currentDogId = dog.id; this.currentDogId = dog.id;
this.videoUrl = dog.fileName; //dog.videoUrl; this.videoUrl = dog.fileName; //dog.videoUrl;
//play video const this_ = this;
const myVideo = this.$refs["myVideo"]; //用异步是为了防止my-vidoe控件还没有挂载好
//@ts-ignore setTimeout(async () => {
myVideo.onSrcChange(this.videoUrl); //play video
const myVideo = this_.$refs["my-video"];
const track = await getLabelInfo(dog.labelFileName); //@ts-ignore
console.log("track", track); myVideo.onSrcChange(this_.videoUrl);
// // this.trackData = track.filter((d) => d.DogId === dog.id); // const track = await getLabelInfo(dog.labelFileName);
// // const aa = await getLabelInfo("6-CL006-det.res.txt"); // this.trackData = track.filter((d) => d.DogId === dog.id);
this.trackData = dogTrackData.filter(
// this.trackData = dogTrackData.filter((d) => d.DogId === dog.id); (d) => d.DogId === "1440845582095753223" //this.dogData[0].id
// //@ts-ignore );
// myVideo.onTrackDataChange(this.videoUrl, this.trackData); //@ts-ignore
myVideo.onTrackDataChange(this_.trackData);
}, 100);
} }
async queryDogInfo(query) { async queryDogInfo() {
const rp = await pageDogInfo({ const rp = await pageDogInfo({
...this.queryDogParam, ...this.queryDogParam,
...this.queryCameryParam,
...query,
}); });
//@ts-ignore //@ts-ignore
this.dogData = rp.data.records; this.dogData = rp.data.records;
this.dogTotal = rp.data.total; this.dogTotal = rp.data.total;
//初始第一条视频
if (this.dogData && this.dogData.length > 0) {
this.videoUrl = this.dogData[0].fileName; //"1440845582095753223"
//todo:
this.trackData = dogTrackData.filter(
(d) => d.DogId === "1440845582095753223" //this.dogData[0].id
);
}
} }
async queryCamera(query) { handleClickCamera({ cameraId }) {
this.queryDogParam.cameraId = cameraId;
this.queryDogInfo();
}
async queryCamera() {
//查询摄像头数据 //查询摄像头数据
const data = await getCameraDogFormate({ ...query }); const data = await getCameraDogFormate({ ...this.queryCameryParam });
this.cameras = data; this.cameras = data;
if (!this.cameras) { if (!this.cameras) {
this.dogData = []; this.dogData = [];
...@@ -161,10 +166,8 @@ export default class Dashboard extends BaseVue { ...@@ -161,10 +166,8 @@ export default class Dashboard extends BaseVue {
//默认查询第一个摄像头狗的数据 //默认查询第一个摄像头狗的数据
for (const item in this.cameras) { for (const item in this.cameras) {
if (this.cameras[item] && this.cameras[item].length > 0) { if (this.cameras[item] && this.cameras[item].length > 0) {
await this.queryDogInfo({ this.queryDogParam.cameraId = this.cameras[item][0].cameraId;
...query, await this.queryDogInfo();
cameraId: this.cameras[item][0].cameraId,
});
break; break;
} }
} }
...@@ -175,7 +178,12 @@ export default class Dashboard extends BaseVue { ...@@ -175,7 +178,12 @@ export default class Dashboard extends BaseVue {
handleCurrentChange(val) { handleCurrentChange(val) {
this.queryDogParam.current = val; this.queryDogParam.current = val;
this.queryDogInfo({}); this.queryDogInfo();
}
handleSearch(query) {
this.queryCameryParam = { ...this.queryCamera, ...query };
this.queryCamera();
} }
} }
</script> </script>
...@@ -239,5 +247,9 @@ export default class Dashboard extends BaseVue { ...@@ -239,5 +247,9 @@ export default class Dashboard extends BaseVue {
text-align: center; text-align: center;
padding-top: 20px; padding-top: 20px;
} }
.el-pagination__total {
color: #d7d7d7 !important;
}
} }
</style> </style>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div :class="`${prefixCls}-search`"> <div :class="`${prefixCls}-search`">
<div class="item">摄像头名称</div> <div class="item">摄像头名称</div>
<div class="item"> <div class="item">
<el-input size="mini" v-model="queryData.name"></el-input> <el-input size="mini" v-model="queryData.cameraName"></el-input>
</div> </div>
<div class="item">分组</div> <div class="item">分组</div>
<div class="item"> <div class="item">
...@@ -26,7 +26,7 @@ export default class Search extends BaseVue { ...@@ -26,7 +26,7 @@ export default class Search extends BaseVue {
@Prop() private isDisabled!: boolean; @Prop() private isDisabled!: boolean;
queryData = { queryData = {
name: "", cameraName: "",
groupName: "", groupName: "",
}; };
...@@ -34,7 +34,7 @@ export default class Search extends BaseVue { ...@@ -34,7 +34,7 @@ export default class Search extends BaseVue {
this.$emit("queryevent", { ...this.queryData }); this.$emit("queryevent", { ...this.queryData });
} }
handleClean(): void { handleClean(): void {
this.queryData.name = ""; this.queryData.cameraName = "";
this.queryData.groupName = ""; this.queryData.groupName = "";
this.$emit("queryevent", { ...this.queryData }); this.$emit("queryevent", { ...this.queryData });
} }
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
:class="{'odd-row':i % 2 === 1,'even-row':i % 2 === 0}" :class="{'odd-row':i % 2 === 1,'even-row':i % 2 === 0}"
> >
<td> <td>
<div>{{item.name}}</div> <div>{{item.cameraName}}</div>
</td> </td>
<td> <td>
<div>{{item.groupName}}</div> <div>{{item.groupName}}</div>
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<el-dialog title="新增/编辑摄像头" :visible.sync="dialogVisible" width="500px"> <el-dialog title="新增/编辑摄像头" :visible.sync="dialogVisible" width="500px">
<el-form ref="form" :rules="formRules" :model="form" label-width="120px"> <el-form ref="form" :rules="formRules" :model="form" label-width="120px">
<el-form-item label="摄像头名称" prop="name"> <el-form-item label="摄像头名称" prop="name">
<el-input v-model="form.name"></el-input> <el-input v-model="form.cameraName"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="分组" prop="groupName"> <el-form-item label="分组" prop="groupName">
<el-input v-model="form.groupName"></el-input> <el-input v-model="form.groupName"></el-input>
...@@ -135,11 +135,53 @@ export default class SysSetting extends BaseVue { ...@@ -135,11 +135,53 @@ export default class SysSetting extends BaseVue {
currentId = ""; currentId = "";
total = 0; total = 0;
form: CameraData = {}; form: CameraData = {};
aaaa = "";
formRules = { formRules = {
name: [{ required: true, message: "请输入活动名称", trigger: "blur" }], cameraName: [
{ required: true, message: "请输入摄像头名称", trigger: "blur" },
],
groupName: [{ required: true, message: "请输入分组", trigger: "blur" }], groupName: [{ required: true, message: "请输入分组", trigger: "blur" }],
longitude: [{ required: true, message: "经纬度不能为空", trigger: "blur" }], longitude: [
latitude: [{ required: true, message: "请输入视频路径", trigger: "blur" }], { required: true, message: "经度不能为空", trigger: "blur" },
{
validator: (rule, value, callback) => {
const n = value * 1;
setTimeout(() => {
if (!Number.isInteger(n)) {
callback(new Error("请输入数字值"));
} else {
if (n < -180 || n > 180) {
callback(new Error("经度范围是(-180~180)"));
} else {
callback();
}
}
}, 1000);
},
trigger: "blur",
},
],
latitude: [
{ required: true, message: "请输入视频路径", trigger: "blur" },
{
validator: (rule, value, callback) => {
const n = value * 1;
setTimeout(() => {
if (!Number.isInteger(n)) {
callback(new Error("请输入数字值"));
} else {
if (n < -85 || n > 85) {
callback(new Error("纬度范围是(-85~85)"));
} else {
callback();
}
}
}, 1000);
},
trigger: "blur",
},
],
}; };
queryData = { queryData = {
current: 1, current: 1,
...@@ -338,6 +380,9 @@ export default class SysSetting extends BaseVue { ...@@ -338,6 +380,9 @@ export default class SysSetting extends BaseVue {
.el-form-item__content { .el-form-item__content {
text-align: right; text-align: right;
} }
.el-pagination__total {
color: #d7d7d7;
}
} }
.confirm-del { .confirm-del {
font-size: 16px; font-size: 16px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment