2019-07-26 13:32:43 +08:00
|
|
|
<template>
|
2019-08-14 14:01:28 +08:00
|
|
|
<el-card v-loading="loading">
|
|
|
|
<div slot="header" style="text-align: center;">
|
2019-09-23 17:49:04 +08:00
|
|
|
<span><b>{{ $t('demonstration.simulationName') + courseModel.name }}</b></span>
|
2019-08-14 14:01:28 +08:00
|
|
|
</div>
|
2019-09-06 14:21:01 +08:00
|
|
|
<div>
|
2019-08-14 14:01:28 +08:00
|
|
|
<p class="list-item">
|
2019-08-23 14:24:30 +08:00
|
|
|
<span class="list-label">{{ $t('demonstration.productDescription') }}</span>
|
2019-08-14 14:01:28 +08:00
|
|
|
<span class="list-elem">{{ courseModel.remarks }}</span>
|
|
|
|
</p>
|
|
|
|
<p class="list-item">
|
2019-08-23 14:24:30 +08:00
|
|
|
<span class="list-label">{{ $t('global.permissionList') }}</span>
|
2019-08-14 14:01:28 +08:00
|
|
|
</p>
|
2019-09-23 17:49:04 +08:00
|
|
|
<limit-list :ref="`limit_${this.prodId}`" :course-model="courseModel" @initLoadPage="initLoadPage" />
|
2019-09-06 14:21:01 +08:00
|
|
|
</div>
|
2019-09-23 17:49:04 +08:00
|
|
|
<div class="btn-buy">
|
2019-09-02 11:04:23 +08:00
|
|
|
<el-button type="success" @click="buy">{{ $t('global.buy') }}</el-button>
|
|
|
|
<el-button v-if="hasPermssion" type="primary" @click="distribute">{{ $t('global.distributePermission') }}</el-button>
|
|
|
|
<el-button v-if="hasPermssion" type="primary" @click="transfer">{{ $t('global.transferQRCode') }}</el-button>
|
2019-08-23 14:24:30 +08:00
|
|
|
<el-button v-show="isStartDemon" :loading="buttonLoading" type="primary" @click="start">{{ $t('demonstration.startSimulation') }}</el-button>
|
|
|
|
<el-button v-show="isCreateRoom" :loading="buttonLoading" type="primary" @click="start">{{ $t('demonstration.createRoom') }}</el-button>
|
|
|
|
<el-button v-show="isInRoom" :loading="buttonLoading" type="primary" @click="joinRoom">{{ $t('demonstration.enterRoom') }}</el-button>
|
2019-08-14 14:01:28 +08:00
|
|
|
</div>
|
|
|
|
</el-card>
|
2019-07-26 13:32:43 +08:00
|
|
|
</template>
|
|
|
|
<script>
|
2019-08-14 14:01:28 +08:00
|
|
|
import { getPublishMapInfo } from '@/api/jmap/map';
|
|
|
|
import { getGoodsTryUse } from '@/api/management/goods';
|
|
|
|
import { getCommodityMapProduct, getMapProductDetail } from '@/api/management/mapprd';
|
|
|
|
import { PermissionType } from '@/scripts/ConstDic';
|
|
|
|
import { launchFullscreen } from '@/utils/screen';
|
|
|
|
import { queryPermissionSimulation } from '@/api/management/author';
|
|
|
|
import { postCreateRoom, getjointTraining, checkRoomExist } from '@/api/chat';
|
|
|
|
import { UrlConfig } from '@/router/index';
|
2019-08-30 09:00:36 +08:00
|
|
|
import { simulationNotify, schedulingNotify } from '@/api/simulation';
|
2019-08-14 14:01:28 +08:00
|
|
|
import LimitList from '@/views/components/limits/index';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-14 14:01:28 +08:00
|
|
|
export default {
|
|
|
|
name: 'ExamDetailList',
|
|
|
|
components: {
|
|
|
|
LimitList
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
tryTime: 0,
|
|
|
|
goodsId: '',
|
|
|
|
tryUser: 0,
|
|
|
|
loading: true,
|
2019-08-19 10:58:14 +08:00
|
|
|
buttonLoading: false,
|
2019-08-14 14:01:28 +08:00
|
|
|
currentLessonId: '',
|
|
|
|
currentPrdCode: '',
|
|
|
|
productList: [],
|
|
|
|
courseModel: {
|
|
|
|
id: '',
|
|
|
|
name: '',
|
|
|
|
mapId: '',
|
|
|
|
skinCode: '',
|
|
|
|
remarks: '',
|
|
|
|
prdType: '',
|
|
|
|
prdCode: '',
|
|
|
|
pmsList: []
|
|
|
|
},
|
|
|
|
jointShow: false,
|
|
|
|
jointGroup: ''
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
hasPermssion() {
|
|
|
|
let isShow = false;
|
2019-08-30 17:00:18 +08:00
|
|
|
if (this.courseModel.pmsList && this.courseModel.pmsList.length) {
|
2019-08-14 14:01:28 +08:00
|
|
|
isShow = true;
|
|
|
|
}
|
|
|
|
return isShow;
|
|
|
|
},
|
|
|
|
isStartDemon() {
|
|
|
|
return this.courseModel.prdType !== '03' && (this.hasPermssion || this.tryTime > 0);
|
|
|
|
},
|
|
|
|
isCreateRoom() {
|
|
|
|
return this.courseModel.prdType === '03' && this.hasPermssion && !this.jointShow;
|
|
|
|
},
|
|
|
|
isInRoom() {
|
|
|
|
return this.courseModel.prdType == '03' && this.hasPermssion && this.jointShow;
|
|
|
|
},
|
|
|
|
mapId() {
|
|
|
|
return this.$route.params.mapId;
|
2019-09-02 15:37:57 +08:00
|
|
|
},
|
2019-09-23 17:49:04 +08:00
|
|
|
prodId() {
|
|
|
|
return this.$route.params.prodId;
|
|
|
|
},
|
2019-09-02 15:37:57 +08:00
|
|
|
height() {
|
|
|
|
return this.$store.state.app.height - 50;
|
2019-08-14 14:01:28 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
'$route': function (val) {
|
|
|
|
this.loadInitData();
|
|
|
|
},
|
2019-09-23 17:49:04 +08:00
|
|
|
// 'currentPrdCode': function (code) {
|
|
|
|
// this.initLoadPage({ id: this.mapId, code: code });
|
|
|
|
// }
|
2019-08-14 14:01:28 +08:00
|
|
|
},
|
|
|
|
async mounted() {
|
|
|
|
this.loadInitData();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async loadInitData() {
|
2019-09-23 17:49:04 +08:00
|
|
|
this.loading = true;
|
|
|
|
this.currentPrdCode = this.prodId;
|
|
|
|
try {
|
|
|
|
const resp = await getMapProductDetail(this.prodId);
|
|
|
|
this.tryUser = 0;
|
|
|
|
this.loading = false;
|
|
|
|
this.courseModel = {
|
|
|
|
id: resp.data.id,
|
|
|
|
name: resp.data.name,
|
|
|
|
mapId: this.mapId,
|
|
|
|
skinCode: resp.data.skinCode,
|
|
|
|
remarks: resp.data.remarks,
|
|
|
|
prdType: resp.data.prdType,
|
|
|
|
prdCode: resp.data.code,
|
|
|
|
pmsList: resp.data.pmsList || [],
|
|
|
|
PermissionType: PermissionType.SIMULATION
|
|
|
|
};
|
|
|
|
const rest = await queryPermissionSimulation({ mapId: this.courseModel.mapId, prdCode: this.courseModel.prdCode });
|
|
|
|
this.courseModel.pmsList = rest.data;
|
|
|
|
if (!this.courseModel.pmsList) {
|
|
|
|
this.tryUser = 1;
|
|
|
|
const paras = {
|
|
|
|
mapId: this.mapId,
|
|
|
|
prdCode: this.prodId,
|
|
|
|
permissionType: PermissionType.SIMULATION
|
|
|
|
};
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-09-23 17:49:04 +08:00
|
|
|
try {
|
|
|
|
const resr = await getGoodsTryUse(paras);
|
|
|
|
if (resr.data.tryTime <= 0) {
|
|
|
|
this.tryTime = 0;
|
|
|
|
} else {
|
|
|
|
this.tryTime = resr.data.tryTime;
|
|
|
|
this.goodsId = resr.data.goodsId;
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
this.tryTime = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
this.loading = false;
|
|
|
|
this.$messageBox(this.$t('error.refreshFailed'));
|
|
|
|
}
|
2019-08-14 14:01:28 +08:00
|
|
|
},
|
|
|
|
async initLoadPage(data) {
|
|
|
|
this.loading = true;
|
|
|
|
if (data && parseInt(data.id) && data.code) {
|
|
|
|
try {
|
|
|
|
const resp = await getMapProductDetail(data.code);
|
|
|
|
this.tryUser = 0;
|
|
|
|
this.loading = false;
|
|
|
|
this.courseModel = {
|
|
|
|
id: resp.data.id,
|
|
|
|
name: resp.data.name,
|
|
|
|
mapId: data.id,
|
|
|
|
skinCode: resp.data.skinCode,
|
|
|
|
remarks: resp.data.remarks,
|
|
|
|
prdType: resp.data.prdType,
|
|
|
|
prdCode: resp.data.code,
|
|
|
|
pmsList: resp.data.pmsList || [],
|
|
|
|
PermissionType: PermissionType.SIMULATION
|
|
|
|
};
|
|
|
|
const rest = await queryPermissionSimulation({ mapId: this.courseModel.mapId, prdCode: this.courseModel.prdCode });
|
|
|
|
this.courseModel.pmsList = rest.data;
|
2019-08-30 17:00:18 +08:00
|
|
|
if (!this.courseModel.pmsList) {
|
2019-08-14 14:01:28 +08:00
|
|
|
this.tryUser = 1;
|
|
|
|
const paras = {
|
|
|
|
mapId: data.id,
|
2019-08-30 17:00:18 +08:00
|
|
|
prdCode: data.code,
|
|
|
|
permissionType: PermissionType.SIMULATION
|
2019-08-14 14:01:28 +08:00
|
|
|
};
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-14 14:01:28 +08:00
|
|
|
try {
|
|
|
|
const resr = await getGoodsTryUse(paras);
|
|
|
|
if (resr.data.tryTime <= 0) {
|
|
|
|
this.tryTime = 0;
|
|
|
|
} else {
|
|
|
|
this.tryTime = resr.data.tryTime;
|
|
|
|
this.goodsId = resr.data.goodsId;
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
this.tryTime = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (error) {
|
2019-09-23 17:49:04 +08:00
|
|
|
this.loading = false;
|
2019-08-21 13:54:53 +08:00
|
|
|
this.$messageBox(this.$t('error.refreshFailed'));
|
2019-08-14 14:01:28 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.loading = false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async joinRoom() {
|
|
|
|
await getjointTraining(this.jointGroup);
|
|
|
|
const query = { skinCode: this.courseModel.skinCode, group: this.jointGroup };
|
|
|
|
this.$router.push({ path: `/trainroom`, query: query });
|
|
|
|
},
|
2019-08-30 09:00:36 +08:00
|
|
|
async createRoom() {
|
|
|
|
try {
|
|
|
|
this.buttonLoading = true;
|
|
|
|
const param = {
|
|
|
|
mapId: Number(this.mapId),
|
|
|
|
prdCode: this.courseModel.prdCode
|
|
|
|
};
|
|
|
|
const res = await postCreateRoom(param);
|
|
|
|
if (res && res.code == 200) {
|
|
|
|
const query = { skinCode: this.courseModel.skinCode, group: res.data };
|
|
|
|
this.$router.push({ path: `/trainroom`, query: query });
|
2019-08-14 14:01:28 +08:00
|
|
|
}
|
2019-08-30 09:00:36 +08:00
|
|
|
} catch (error) {
|
|
|
|
this.buttonLoading = false;
|
|
|
|
if (error.code == 20001) {
|
|
|
|
this.$confirm(this.$t('tip.createRoomFailedHint'), this.$t('global.tips'), {
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {}).catch(() => {});
|
|
|
|
}
|
|
|
|
if (error.code == 500009) {
|
|
|
|
this.$messageBox(error.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async start() {
|
|
|
|
if (this.courseModel.prdType == '05') {
|
|
|
|
this.jumpScheduling();
|
|
|
|
} else if (this.courseModel.prdType == '03') {
|
|
|
|
this.createRoom();
|
2019-08-14 14:01:28 +08:00
|
|
|
} else {
|
2019-08-30 17:00:18 +08:00
|
|
|
if (this.courseModel.pmsList && this.courseModel.pmsList.length) {
|
2019-08-14 14:01:28 +08:00
|
|
|
this.jump();
|
|
|
|
} else {
|
|
|
|
if (this.tryTime <= 1) {
|
2019-08-21 13:54:53 +08:00
|
|
|
this.$confirm(this.$t('tip.noPermissionHint'), this.$t('global.tips'), {
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
2019-08-14 14:01:28 +08:00
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
this.buy();
|
2019-08-21 13:54:53 +08:00
|
|
|
}).catch(() => { this.buttonLoading = false; });
|
2019-08-14 14:01:28 +08:00
|
|
|
} else {
|
|
|
|
this.jump();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2019-08-30 09:00:36 +08:00
|
|
|
jumpScheduling() {
|
|
|
|
this.buttonLoading = true;
|
|
|
|
const data = { mapId: this.courseModel.mapId, code: this.currentPrdCode };
|
|
|
|
schedulingNotify(data).then(resp => {
|
|
|
|
const query = { skinCode: this.courseModel.skinCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, code: this.currentPrdCode, goodsId: this.goodsId, try: this.tryUser };
|
|
|
|
this.$router.push({ path: `${UrlConfig.display}/demon`, query: query });
|
|
|
|
launchFullscreen();
|
|
|
|
}).catch(error => {
|
|
|
|
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
|
|
|
|
this.buttonLoading = false;
|
|
|
|
});
|
|
|
|
},
|
2019-08-14 14:01:28 +08:00
|
|
|
jump() {
|
|
|
|
const data = { mapId: this.courseModel.mapId, code: this.currentPrdCode };
|
2019-08-19 10:58:14 +08:00
|
|
|
this.buttonLoading = true;
|
2019-08-14 14:01:28 +08:00
|
|
|
simulationNotify(data).then(resp => {
|
|
|
|
const query = { skinCode: this.courseModel.skinCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, code: this.currentPrdCode, goodsId: this.goodsId, try: this.tryUser };
|
|
|
|
this.$router.push({ path: `${UrlConfig.display}/demon`, query: query });
|
|
|
|
launchFullscreen();
|
|
|
|
}).catch(error => {
|
2019-08-21 13:54:53 +08:00
|
|
|
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
|
2019-08-23 14:24:30 +08:00
|
|
|
this.buttonLoading = false;
|
2019-08-14 14:01:28 +08:00
|
|
|
});
|
|
|
|
},
|
|
|
|
buy() {
|
2019-08-19 10:58:14 +08:00
|
|
|
this.buttonLoading = true;
|
2019-08-14 14:01:28 +08:00
|
|
|
this.$router.push({
|
|
|
|
path: `${UrlConfig.demonstration.pay}/${this.courseModel.id}`,
|
|
|
|
query: { permissionType: PermissionType.SIMULATION, prdCode: this.courseModel.prdCode, mapId: this.courseModel.mapId }
|
|
|
|
});
|
|
|
|
},
|
|
|
|
transfer() {
|
2019-08-19 10:58:14 +08:00
|
|
|
this.buttonLoading = false;
|
2019-08-14 14:01:28 +08:00
|
|
|
if (this.$refs) {
|
|
|
|
this.$refs[`limit_${this.currentPrdCode}`][0].transfer(this.courseModel);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
distribute() {
|
2019-08-19 10:58:14 +08:00
|
|
|
this.buttonLoading = false;
|
2019-08-14 14:01:28 +08:00
|
|
|
if (this.$refs) {
|
|
|
|
this.$refs[`limit_${this.currentPrdCode}`][0].distribute(this.courseModel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2019-07-26 13:32:43 +08:00
|
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
::-webkit-scrollbar {
|
|
|
|
width: 3px;
|
|
|
|
height: 3px;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<style>
|
|
|
|
.title {
|
|
|
|
font-weight: bold
|
|
|
|
}
|
|
|
|
|
|
|
|
.time-item {
|
|
|
|
font-size: 24px;
|
|
|
|
color: black !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.time-label {
|
|
|
|
display: -moz-inline-box;
|
|
|
|
display: inline-block;
|
|
|
|
text-align: right;
|
|
|
|
margin-left: 14px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.time-elem {
|
|
|
|
color: rgb(90, 89, 89) !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.list-item {
|
|
|
|
font-size: 16px;
|
|
|
|
margin-bottom: 20px;
|
|
|
|
padding: 0px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.list-label {
|
|
|
|
display: -moz-inline-box;
|
|
|
|
display: inline-block;
|
|
|
|
text-align: left;
|
|
|
|
}
|
|
|
|
|
|
|
|
.list-elem {
|
|
|
|
color: #808080 !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.btn-buy {
|
|
|
|
position: relative;
|
|
|
|
text-align: center;
|
|
|
|
justify-content: center;
|
|
|
|
transform: translateY(-20px);
|
2019-09-23 17:49:04 +08:00
|
|
|
margin-top: 30px;
|
2019-07-26 13:32:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.el-tabs--border-card>.el-tabs__header .el-tabs__item {
|
|
|
|
font-weight: bold !important;
|
|
|
|
}
|
2019-08-09 15:52:55 +08:00
|
|
|
</style>
|