修改代码

This commit is contained in:
ival 2019-08-19 10:58:14 +08:00
parent d083482b10
commit 068dbdbbde
6 changed files with 51 additions and 35 deletions

View File

@ -30,12 +30,12 @@
</el-scrollbar>
</el-tab-pane>
<div v-if="hasProduct" class="btn-buy">
<el-button type="success" @click="buy">购买</el-button>
<el-button v-if="hasPermssion" type="primary" @click="distribute">权限分发</el-button>
<el-button v-if="hasPermssion" type="primary" @click="transfer">权限转赠</el-button>
<el-button v-show="isStartDemon" type="primary" @click="start">开始仿真</el-button>
<el-button v-show="isCreateRoom" type="primary" @click="start">创建房间</el-button>
<el-button v-show="isInRoom" type="primary" @click="joinRoom">进入房间</el-button>
<el-button v-loading="buttonLoading" type="success" @click="buy">购买</el-button>
<el-button v-if="hasPermssion" v-loading="buttonLoading" type="primary" @click="distribute">权限分发</el-button>
<el-button v-if="hasPermssion" v-loading="buttonLoading" type="primary" @click="transfer">权限转赠</el-button>
<el-button v-show="isStartDemon" v-loading="buttonLoading" type="primary" @click="start">开始仿真</el-button>
<el-button v-show="isCreateRoom" v-loading="buttonLoading" type="primary" @click="start">创建房间</el-button>
<el-button v-show="isInRoom" v-loading="buttonLoading" type="primary" @click="joinRoom">进入房间</el-button>
</div>
</el-tabs>
</el-card>
@ -81,6 +81,7 @@ export default {
goodsId: '',
tryUser: 0,
loading: true,
buttonLoading: false,
currentLessonId: '',
currentPrdCode: '',
productList: [],
@ -240,6 +241,7 @@ export default {
async start() {
if (this.courseModel.prdType == '03') {
try {
this.buttonLoading = true;
const param = {
mapId: Number(this.mapId),
prdCode: this.courseModel.prdCode
@ -250,6 +252,7 @@ export default {
this.$router.push({ path: `/trainroom`, query: query });
}
} catch (error) {
this.buttonLoading = false;
if (error.code == 20001) {
this.$confirm(`每个用户只能创建一个综合演练房间, 是否进入房间`, '提示', {
confirmButtonText: '确定',
@ -281,6 +284,7 @@ export default {
},
jump() {
const data = { mapId: this.courseModel.mapId, code: this.currentPrdCode };
this.buttonLoading = true;
simulationNotify(data).then(resp => {
// try 0
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 };
@ -292,17 +296,20 @@ export default {
});
},
buy() {
this.buttonLoading = true;
this.$router.push({
path: `${UrlConfig.demonstration.pay}/${this.courseModel.id}`,
query: { permissionType: PermissionType.SIMULATION, prdCode: this.courseModel.prdCode, mapId: this.courseModel.mapId }
});
},
transfer() {
this.buttonLoading = false;
if (this.$refs) {
this.$refs[`limit_${this.currentPrdCode}`][0].transfer(this.courseModel);
}
},
distribute() {
this.buttonLoading = false;
if (this.$refs) {
this.$refs[`limit_${this.currentPrdCode}`][0].distribute(this.courseModel);
}

View File

@ -35,9 +35,9 @@
</div>
<div class="btn-buy">
<el-button type="success" @click="buy">购买</el-button>
<el-button v-if="hasPermssion" type="primary" @click="distribute">权限分发(考试)</el-button>
<el-button v-if="hasPermssion" type="primary" @click="transfer">权限转赠</el-button>
<el-button v-if="isAddRule" type="primary" @click="checkCourse">查看课程试卷</el-button>
<el-button v-if="hasPermssion" v-loading="loading" type="primary" @click="distribute">权限分发(考试)</el-button>
<el-button v-if="hasPermssion" v-loading="loading" type="primary" @click="transfer">权限转赠</el-button>
<el-button v-if="isAddRule" v-loading="loading" type="primary" @click="checkCourse">查看课程试卷</el-button>
</div>
</el-card>
</template>
@ -57,6 +57,7 @@ export default {
data() {
return {
height: '',
loading: false,
courseModel: {
id: '',
name: '请选择课程',
@ -117,24 +118,28 @@ export default {
}
},
buy() {
this.loading = true;
this.$router.push({
path: `${UrlConfig.exam.pay}/${this.$route.params.lessonId}`,
query: { permissionType: PermissionType.EXAM, prdCode: this.courseModel.prdCode, mapId: this.courseModel.mapId }
});
},
checkCourse() {
this.loading = true;
this.$router.push({
path: `${UrlConfig.exam.examRuleManage}`,
query: { lessonId: this.courseModel.id }
});
},
transfer() {
this.loading = false;
if (this.$refs) {
this.activeName = 'second';
this.$refs.limitList.transfer(this.courseModel);
}
},
distribute() {
this.loading = false;
if (this.$refs) {
this.activeName = 'second';
this.$refs.limitList.distribute(this.courseModel);

View File

@ -43,7 +43,7 @@
</el-scrollbar>
</div>
<div class="btn-start">
<el-button type="primary" @click="exmaStart">开始考试</el-button>
<el-button v-loading="loading" type="primary" @click="exmaStart">开始考试</el-button>
</div>
</el-card>
</template>
@ -67,6 +67,7 @@ export default {
data() {
return {
height: '',
loading: false,
examDetails: {
lessonId: '',
name: '',
@ -156,11 +157,15 @@ export default {
}
},
buy() {
this.loading = true;
getPublishLessonDetail({ id: this.examDetails.lessonId }).then((res) => {
this.$router.push({
path: `${UrlConfig.exam.pay}/${this.examDetails.lessonId}`,
query: { permissionType: PermissionType.EXAM, prdCode: res.data.prdCode, mapId: res.data.mapId }
});
}).catch(() => {
this.$messageBox('获取课程详情失败');
this.loading = false;
});
},
@ -194,12 +199,7 @@ export default {
}
},
exmaStart() {
this.loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.loading = true;
this.examDetail();
if (this.examList.length) {
examNotify({ examId: this.$route.params.examId }).then(resp => {
@ -212,9 +212,11 @@ export default {
this.$router.push({ path: `${UrlConfig.display}/exam`, query: query });
launchFullscreen();
}).catch(error => {
this.loading = false;
this.$messageBox(`创建仿真失败: ${error.message}`);
this.loading.close();
});
} else {
this.loading = false;
}
}
}

View File

@ -22,8 +22,8 @@
</p>
<p>
<span class="list-label" />
<el-button type="primary" @click="start">开始考试</el-button>
<el-button type="danger" @click="back">放弃考试</el-button>
<el-button v-loading="loading" type="primary" @click="start">开始考试</el-button>
<el-button v-loading="loading" type="danger" @click="back">放弃考试</el-button>
</p>
</div>
</el-card>
@ -45,12 +45,10 @@ export default {
mixins: [
WindowResizeHandler
],
mixins: [
WindowResizeHandler
],
data() {
return {
height: '',
loading: false,
courseModel: {
id: '',
name: '',
@ -98,11 +96,13 @@ export default {
}
},
start() {
this.loading = true;
const query = { skinCode: this.$route.query.skinCode, trainingId: this.$route.query.trainingId, userExamId: this.$route.query.userExamId, examQuestionId: this.$route.params.examQuestionId };
this.$router.push({ path: '/display/exam', query: query });
launchFullscreen();
},
back() {
this.loading = true;
this.$confirm('此操作将放弃本次考试, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@ -112,7 +112,9 @@ export default {
setExamGive(this.$route.query.userExamId).then(() => {
this.$router.push({ path: '/exam/home' });
});
}).catch(() => { });
}).catch(() => {
this.loading = false;
});
}
}
};

View File

@ -42,8 +42,8 @@
</div>
<div class="btn-buy">
<el-button type="success" @click="buy">购买</el-button>
<el-button v-if="hasPermssion" type="primary" @click="distribute">权限分发(上课)</el-button>
<el-button v-if="hasPermssion" type="primary" @click="transfer">权限转赠</el-button>
<el-button v-if="hasPermssion" v-loading="loading" type="primary" @click="distribute">权限分发(上课)</el-button>
<el-button v-if="hasPermssion" v-loading="loading" type="primary" @click="transfer">权限转赠</el-button>
</div>
</el-card>
</template>
@ -65,6 +65,7 @@ export default {
return {
num: 5,
height: '',
loading: false,
WhetherTypeList: [],
EffectiveTypeList: [],
courseModel: {
@ -121,18 +122,21 @@ export default {
}
},
buy() {
this.loading = true;
this.$router.push({
path: `${UrlConfig.teach.pay}/${this.$route.params.lessonId}`,
query: { permissionType: PermissionType.LESSON, prdCode: this.courseModel.prdCode, mapId: this.courseModel.mapId }
});
},
transfer() {
this.loading = false;
if (this.$refs) {
this.activeName = 'second';
this.$refs.limitList.transfer(this.courseModel);
}
},
distribute() {
this.loading = false;
if (this.$refs) {
this.activeName = 'second';
this.$refs.limitList.distribute(this.courseModel);

View File

@ -20,7 +20,7 @@
</el-scrollbar>
</div>
<div class="btn-start">
<el-button type="primary" @click="start">开始实训</el-button>
<el-button v-loading="loading" type="primary" @click="start">开始实训</el-button>
</div>
</el-card>
</template>
@ -43,6 +43,7 @@ export default {
data() {
return {
height: '',
loading: false,
courseModel: {
id: '',
name: '',
@ -85,12 +86,7 @@ export default {
}
},
start() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.loading = true;
trainingNotify({ trainingId: this.$route.params.trainingId }).then(resp => {
const query = {
group: resp.data, trainingId: this.$route.params.trainingId, lessonId: this.$route.params.lessonId
@ -98,8 +94,8 @@ export default {
this.$router.push({ path: `${UrlConfig.display}/teach`, query: query });
launchFullscreen();
}).catch(error => {
this.loading = false;
this.$messageBox(`创建仿真失败: ${error.message}`);
loading.close();
});
}
}