修改代码

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

View File

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

View File

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

View File

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

View File

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

View File

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