场景添加三维场景,实训中可根据url打开三维场景(待测试)
This commit is contained in:
parent
0c5bba7c0f
commit
dc2165733e
@ -44,7 +44,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div style="text-align: center;margin-top: 15px;">
|
<div style="text-align: center;margin-top: 15px;">
|
||||||
<el-button v-show="nowData.ruleId" v-loading="loading" type="primary" @click="showScoreRule">评分表</el-button>
|
<el-button v-show="nowData.ruleId" v-loading="loading" type="primary" @click="showScoreRule">评分表</el-button>
|
||||||
<el-button v-show="nowData.sceneId&&nowData.scenetype!=='Video'" v-loading="loading" type="primary" @click="startTask">开始任务</el-button>
|
<el-button v-show="nowData.sceneId&&nowData.scenetype=='Local'" v-loading="loading" type="primary" @click="startTask">开始任务</el-button>
|
||||||
|
<el-button v-show="nowData.sceneId&&nowData.scenetype=='Link'" v-loading="loading" type="primary" @click="startThreeTask">开始任务</el-button>
|
||||||
<el-button v-show="nowData.sceneId&&nowData.scenetype=='Video'" type="primary" @click="playSceneVideo">播放视频</el-button>
|
<el-button v-show="nowData.sceneId&&nowData.scenetype=='Video'" type="primary" @click="playSceneVideo">播放视频</el-button>
|
||||||
<el-button v-loading="loading" type="primary" :disabled="nowKey === taskList.length-1" @click="nextTask">下一任务</el-button>
|
<el-button v-loading="loading" type="primary" :disabled="nowKey === taskList.length-1" @click="nextTask">下一任务</el-button>
|
||||||
</div>
|
</div>
|
||||||
@ -58,6 +59,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getTaskTree, getContextSenceDetail} from '@/api/contest';
|
import { getTaskTree, getContextSenceDetail} from '@/api/contest';
|
||||||
import { createSimulationNoFunction } from '@/api/simulation';
|
import { createSimulationNoFunction } from '@/api/simulation';
|
||||||
|
import { getToken } from '@/utils/auth';
|
||||||
import { getPublishMapInfo } from '@/api/jmap/map';
|
import { getPublishMapInfo } from '@/api/jmap/map';
|
||||||
import ScoreRule from './scoreRule';
|
import ScoreRule from './scoreRule';
|
||||||
import PlayVideo from './PlayVideo';
|
import PlayVideo from './PlayVideo';
|
||||||
@ -180,6 +182,17 @@ export default {
|
|||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
startThreeTask() {
|
||||||
|
this.loading = true;
|
||||||
|
getContextSenceDetail(this.nowData.sceneId).then((res) => {
|
||||||
|
const url = res.data.scene.url;
|
||||||
|
const token = getToken();
|
||||||
|
window.open(`${url}&token=${token}`, '_blank');
|
||||||
|
this.loading = false;
|
||||||
|
}).catch(error => {
|
||||||
|
this.$message.error(error.message);
|
||||||
|
});
|
||||||
|
},
|
||||||
showScoreRule() {
|
showScoreRule() {
|
||||||
this.$refs.scoreRule.doShow(this.nowData.ruleId);
|
this.$refs.scoreRule.doShow(this.nowData.ruleId);
|
||||||
},
|
},
|
||||||
|
@ -2,16 +2,18 @@
|
|||||||
<div>
|
<div>
|
||||||
<query-list-page ref="user" :card-padding="10" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
<query-list-page ref="user" :card-padding="10" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||||
<upload-Video ref="uploadVideo" @reloadTable="reloadTable" />
|
<upload-Video ref="uploadVideo" @reloadTable="reloadTable" />
|
||||||
|
<add-three ref="upThree" @reloadTable="reloadTable" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { queryContestSencePaged, deleteContestSence } from '@/api/contest';
|
import { queryContestSencePaged, deleteContestSence } from '@/api/contest';
|
||||||
import UploadVideo from './UploadVideo';
|
import UploadVideo from './UploadVideo';
|
||||||
|
import addThree from './addThree';
|
||||||
export default {
|
export default {
|
||||||
name: 'ContestSeasonManage',
|
name: 'ContestSeasonManage',
|
||||||
components: {
|
components: {
|
||||||
UploadVideo
|
UploadVideo, addThree
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -92,6 +94,13 @@ export default {
|
|||||||
return row.type == 'Video';
|
return row.type == 'Video';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: '编辑',
|
||||||
|
handleClick: this.doEditLink,
|
||||||
|
showControl: row => {
|
||||||
|
return row.type == 'Link';
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: '删 除',
|
name: '删 除',
|
||||||
handleClick: this.doDelete,
|
handleClick: this.doDelete,
|
||||||
@ -101,7 +110,8 @@ export default {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
actions: [
|
actions: [
|
||||||
{ text: '上 传', handler: this.doUpload }
|
{ text: '上 传', handler: this.doUpload },
|
||||||
|
{ text: '添 加', handler: this.doUpThree }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -116,6 +126,12 @@ export default {
|
|||||||
doEdit(index, row) {
|
doEdit(index, row) {
|
||||||
this.$refs.uploadVideo.doShow(row.id);
|
this.$refs.uploadVideo.doShow(row.id);
|
||||||
},
|
},
|
||||||
|
doUpThree() {
|
||||||
|
this.$refs.upThree.doShow();
|
||||||
|
},
|
||||||
|
doEditLink(index, row) {
|
||||||
|
this.$refs.upThree.doShow(row.id);
|
||||||
|
},
|
||||||
doDelete(index, row) {
|
doDelete(index, row) {
|
||||||
this.$confirm('该操作将删除竞赛场景,是否继续?', '提 示', {
|
this.$confirm('该操作将删除竞赛场景,是否继续?', '提 示', {
|
||||||
confirmButtonText: '确 定',
|
confirmButtonText: '确 定',
|
||||||
|
108
src/views/contestDataManage/contestSceneManage/addThree.vue
Normal file
108
src/views/contestDataManage/contestSceneManage/addThree.vue
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="500px" :before-close="handleClose" center :close-on-click-modal="false">
|
||||||
|
<el-form ref="ruleForm" :model="formModel" :rules="rules" label-width="100px">
|
||||||
|
<el-form-item label="场景名称:" prop="name">
|
||||||
|
<el-input v-model="formModel.name" style="width: 350px;" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="场景url:" prop="url">
|
||||||
|
<el-input v-model="formModel.url" type="textarea" style="width:350px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
|
||||||
|
<el-button @click="handleClose">{{ $t('global.cancel') }}</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { saveSceneVideo, editSceneVideo, getContextSenceDetail } from '@/api/contest';
|
||||||
|
export default {
|
||||||
|
name: 'AddContestTask',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dialogVisible: false,
|
||||||
|
formModel: {
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
url: ''
|
||||||
|
},
|
||||||
|
loading: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
rules() {
|
||||||
|
const crules = {
|
||||||
|
name: [
|
||||||
|
{ required: true, message: '请输入场景名称', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
url: [
|
||||||
|
{ required: true, message: '请输入场景url', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
};
|
||||||
|
return crules;
|
||||||
|
},
|
||||||
|
title() {
|
||||||
|
return this.formModel.id ? '修改三维场景' : '新建三维场景';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
doShow(sceneId) {
|
||||||
|
this.dialogVisible = true;
|
||||||
|
if (sceneId) {
|
||||||
|
this.formModel.id = sceneId;
|
||||||
|
getContextSenceDetail(sceneId).then((res) => {
|
||||||
|
this.formModel.name = res.data.name;
|
||||||
|
this.formModel.url = res.data.scene.url;
|
||||||
|
}).catch(error => {
|
||||||
|
this.$message.error(error.message);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.formModel = {
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
url: ''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleClose() {
|
||||||
|
this.formModel = {
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
url: ''
|
||||||
|
};
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
doSave() {
|
||||||
|
this.$refs.ruleForm.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.loading = true;
|
||||||
|
const data = { name:this.formModel.name, type:'Link',
|
||||||
|
scene:{url:this.formModel.url}};
|
||||||
|
if (this.formModel.id) {
|
||||||
|
editSceneVideo(this.formModel.id, data).then(() => {
|
||||||
|
this.$message.success('修改三维场景成功!');
|
||||||
|
this.handleClose();
|
||||||
|
this.$emit('reloadTable');
|
||||||
|
}).catch(error => {
|
||||||
|
this.$message.error(error.message);
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
saveSceneVideo(data).then(() => {
|
||||||
|
this.$message.success('创建三维场景成功!');
|
||||||
|
this.handleClose();
|
||||||
|
this.$emit('reloadTable');
|
||||||
|
}).catch(error => {
|
||||||
|
this.$message.error(error.message);
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user