|
|
@@ -0,0 +1,240 @@
|
|
|
+<template>
|
|
|
+ <div id="video-container">
|
|
|
+ <el-input
|
|
|
+ id="video_search_bar"
|
|
|
+ placeholder="输入您的视频分析ID"
|
|
|
+ v-model="video_id"
|
|
|
+ style="width: 300px; margin-bottom: 20px"
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ slot="suffix"
|
|
|
+ round
|
|
|
+ plain
|
|
|
+ @click="getVideoAnalysis"
|
|
|
+ size="small"
|
|
|
+ style="margin-top: 4px"
|
|
|
+ >
|
|
|
+ 获取分析结果
|
|
|
+ </el-button>
|
|
|
+ </el-input>
|
|
|
+ <el-card id="video_visualizer" class="video_result">
|
|
|
+ <div slot="header" class="clearfix" style="float: left">
|
|
|
+ <span>1. 运动3D还原</span>
|
|
|
+ </div>
|
|
|
+ <video
|
|
|
+ id="reconstructed_video"
|
|
|
+ controls
|
|
|
+ style="display: block; margin: auto; width: 1000px; height: 400px"
|
|
|
+ v-show="video_3d_analyze_status"
|
|
|
+ ></video>
|
|
|
+ </el-card>
|
|
|
+ <el-card id="video_analyze" class="video_result">
|
|
|
+ <div slot="header" class="clearfix" style="float: left">
|
|
|
+ <span>2. 运动分析结果</span>
|
|
|
+ </div>
|
|
|
+ <div class="video_analyze_content">
|
|
|
+ <el-card
|
|
|
+ id="capability_container"
|
|
|
+ style="width: 100%; height: 300px; margin-right:20px"
|
|
|
+ >
|
|
|
+ <span style="float: left">
|
|
|
+ <i class="el-icon-data-analysis"></i>
|
|
|
+ 运动能力评估
|
|
|
+ </span>
|
|
|
+ </el-card>
|
|
|
+ <el-card
|
|
|
+ id="advice_container"
|
|
|
+ style="width: 100%; height: 300px; margin: auto"
|
|
|
+ >
|
|
|
+ <span style="display: block; text-align: left; margin-bottom: 6px"
|
|
|
+ >
|
|
|
+ <i class="el-icon-s-order"></i>
|
|
|
+ 运动建议
|
|
|
+ </span
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ id="advice"
|
|
|
+ v-show="show_advice"
|
|
|
+ style="
|
|
|
+ display: block;
|
|
|
+ text-align: left;
|
|
|
+ border-radius: 4px;
|
|
|
+ height: 200px;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <i class="el-icon-s-order"></i>
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { httpUrl, requestUrl } from "@/util/request.js";
|
|
|
+import axios from "axios";
|
|
|
+import DataSet from "@antv/data-set";
|
|
|
+import { Chart } from "@antv/g2";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "visualizer",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ requestUrl: requestUrl,
|
|
|
+ httpUrl: httpUrl,
|
|
|
+ video_id: "",
|
|
|
+ analyzed_data: [
|
|
|
+ { item: "Design", a: 70 },
|
|
|
+ { item: "Development", a: 60 },
|
|
|
+ { item: "Marketing", a: 50 },
|
|
|
+ { item: "Users", a: 40 },
|
|
|
+ { item: "Test", a: 60 },
|
|
|
+ { item: "Language", a: 70 },
|
|
|
+ { item: "Technology", a: 50 },
|
|
|
+ { item: "Support", a: 30 },
|
|
|
+ { item: "Sales", a: 60 },
|
|
|
+ { item: "UX", a: 50 },
|
|
|
+ ],
|
|
|
+ video_3d_analyze_status: false,
|
|
|
+ show_advice: false,
|
|
|
+ advice: "",
|
|
|
+ };
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.show_advice = false
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ draw_chart() {
|
|
|
+ const { DataView } = DataSet;
|
|
|
+ const dv = new DataView().source(this.analyzed_data);
|
|
|
+ dv.transform({
|
|
|
+ type: "fold",
|
|
|
+ fields: ["a"], // 展开字段集
|
|
|
+ key: "user", // key字段
|
|
|
+ value: "score", // value字段
|
|
|
+ });
|
|
|
+
|
|
|
+ const chart = new Chart({
|
|
|
+ container: "capability_container",
|
|
|
+ autoFit: true,
|
|
|
+ // height: 500,
|
|
|
+ // width: 500,
|
|
|
+ });
|
|
|
+ chart.data(dv.rows);
|
|
|
+ chart.scale("score", {
|
|
|
+ min: 0,
|
|
|
+ max: 4,
|
|
|
+ });
|
|
|
+ chart.coordinate("polar", {
|
|
|
+ radius: 0.8,
|
|
|
+ });
|
|
|
+ chart.tooltip({
|
|
|
+ shared: true,
|
|
|
+ showCrosshairs: true,
|
|
|
+ crosshairs: {
|
|
|
+ line: {
|
|
|
+ style: {
|
|
|
+ lineDash: [4, 4],
|
|
|
+ stroke: "#333",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ });
|
|
|
+ chart.axis("item", {
|
|
|
+ line: null,
|
|
|
+ tickLine: null,
|
|
|
+ grid: {
|
|
|
+ line: {
|
|
|
+ style: {
|
|
|
+ lineDash: null,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ });
|
|
|
+ chart.axis("score", {
|
|
|
+ line: null,
|
|
|
+ tickLine: null,
|
|
|
+ grid: {
|
|
|
+ line: {
|
|
|
+ type: "line",
|
|
|
+ style: {
|
|
|
+ lineDash: null,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ chart.line().position("item*score").color("user").size(1);
|
|
|
+ chart
|
|
|
+ .point()
|
|
|
+ .position("item*score")
|
|
|
+ .color("user")
|
|
|
+ .shape("circle")
|
|
|
+ .size(4)
|
|
|
+ .style({
|
|
|
+ stroke: "#fff",
|
|
|
+ lineWidth: 1,
|
|
|
+ fillOpacity: 1,
|
|
|
+ });
|
|
|
+ chart.area().position("item*score").color("user");
|
|
|
+ chart.render();
|
|
|
+ },
|
|
|
+ async getVideoAnalysis() {
|
|
|
+ let id = this.video_id;
|
|
|
+ let _this = this;
|
|
|
+ let formData = new FormData();
|
|
|
+ formData.append("id", id);
|
|
|
+ // _this.draw_chart();
|
|
|
+ await axios.post(requestUrl + "query_3D", formData).then((response) => {
|
|
|
+ const data = response.data;
|
|
|
+ // _this.information = JSON.parse(data.data);
|
|
|
+ // // if (data.status == "processing") {
|
|
|
+ // // this.$message({
|
|
|
+ // // showClose: true,
|
|
|
+ // // message: "您的视频仍在分析中,请稍等...",
|
|
|
+ // // });
|
|
|
+ // // _this.video_3d_analyze_status = false;
|
|
|
+
|
|
|
+ // // } else {
|
|
|
+ let video_obj = document.getElementById("reconstructed_video");
|
|
|
+ video_obj.src = data.url;
|
|
|
+ _this.video_3d_analyze_status = true;
|
|
|
+ // }
|
|
|
+ });
|
|
|
+ // _this.draw_chart();
|
|
|
+ await axios
|
|
|
+ .post(requestUrl + "query_video", formData)
|
|
|
+ .then((response) => {
|
|
|
+ const data = response.data;
|
|
|
+ console.log(response.data);
|
|
|
+ _this.analyzed_data = data["analyzed_data"];
|
|
|
+ _this.draw_chart();
|
|
|
+ let ad_obj = document.getElementById("advice");
|
|
|
+ ad_obj.innerText = data["advice"];
|
|
|
+ _this.show_advice = true;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+/* #video_visualizer{
|
|
|
+ display: grid;
|
|
|
+ grid-template-columns: 1fr;
|
|
|
+} */
|
|
|
+#video_search_bar {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+}
|
|
|
+.video_analyze_content {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+.video_result {
|
|
|
+ /* width: 700px; */
|
|
|
+ margin-bottom: 20px;
|
|
|
+}
|
|
|
+</style>
|