|
@@ -92,6 +92,7 @@ function getInitData() {
|
|
|
if (res.code == 200) {
|
|
|
interactionVideoInfo.value = res.data.interactionVideoInfo;
|
|
|
graphData.value = transfromReturnGraphdata(res.data.rootNode);
|
|
|
+ videoSource.value = treeToArray(graphData.value);
|
|
|
console.log("graphData", graphData.value);
|
|
|
}
|
|
|
});
|
|
@@ -146,6 +147,7 @@ function formSubmit() {
|
|
|
// 视频预览
|
|
|
const videoViewOpen = ref(false);
|
|
|
const videoDetail = ref({});
|
|
|
+const videoSource = ref([]);
|
|
|
|
|
|
function videoView() {
|
|
|
videoDetail.value = graphData.value;
|
|
@@ -158,9 +160,26 @@ function videoView() {
|
|
|
}
|
|
|
// 点击选中选项
|
|
|
const onClickOption = (option) => {
|
|
|
- videoDetail.value = graphData.value.children.filter(
|
|
|
- (i) => i.id == option.nodeId
|
|
|
- )[0];
|
|
|
+ // 过滤出当前选中项的nodeId和视频资源的id相同的项
|
|
|
+ let videoData = videoSource.value.filter((i) => i.id == option.nodeId)[0];
|
|
|
+ // 如果筛选出的数据 节点类型时跳转节点的,需要特殊处理一下:筛选出视频资源中id和跳转jumpNodeId相同的数据
|
|
|
+ if (videoData.nodeType === "jump-node") {
|
|
|
+ videoData = videoSource.value.filter(
|
|
|
+ (i) => i.id == videoData.data.jumpNodeId
|
|
|
+ )[0];
|
|
|
+ }
|
|
|
+ videoDetail.value = videoData;
|
|
|
+};
|
|
|
+
|
|
|
+// 将树形数据转化为数组
|
|
|
+const treeToArray = (tree, arr = []) => {
|
|
|
+ arr.push(tree);
|
|
|
+ if (tree.children) {
|
|
|
+ for (let child of tree.children) {
|
|
|
+ treeToArray(child, arr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return arr;
|
|
|
};
|
|
|
|
|
|
const materialOpen = ref(false);
|