Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
dc783bd2a8
@ -14,6 +14,9 @@
|
||||
<el-button size="mini" type="primary" @click="goLesson(scope.row)">
|
||||
{{ $t('exam.enterTheExam') }}
|
||||
</el-button>
|
||||
<el-button v-if="project.endsWith('gzb') && isTeacher" size="mini" type="danger" @click="handleDelete(scope.row)">
|
||||
删除课程
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -24,6 +27,9 @@
|
||||
<script>
|
||||
import { getSubSystemDetail } from '@/api/trainingPlatform';
|
||||
import { UrlConfig } from '@/scripts/ConstDic';
|
||||
import { delPublishLesson } from '@/api/jmap/lesson';
|
||||
import { getSessionStorage } from '@/utils/auth';
|
||||
import { lessonCreater } from '@/router/index_APP_TARGET';
|
||||
import localStore from 'storejs';
|
||||
|
||||
export default {
|
||||
@ -31,7 +37,9 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
tableData: [],
|
||||
loading: false
|
||||
loading: false,
|
||||
project: '',
|
||||
isTeacher: false
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
@ -41,6 +49,9 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.loadInitPage();
|
||||
this.project = getSessionStorage('project');
|
||||
this.isTeacher = this.$store.state.user.roles.includes(lessonCreater);
|
||||
console.log(this.$store.state.user.roles, lessonCreater, this.isTeacher);
|
||||
},
|
||||
methods: {
|
||||
loadInitPage() {
|
||||
@ -64,6 +75,21 @@ export default {
|
||||
goLesson(row) {
|
||||
localStore.set('examDetail' + this.$route.params.subSystem, `${UrlConfig.trainingPlatform.course}/${this.$route.params.subSystem}?lessonId=${row.id}`);
|
||||
this.$router.push({ path: `${UrlConfig.trainingPlatform.course}/${this.$route.params.subSystem}`, query: {lessonId: row.id}});
|
||||
},
|
||||
handleDelete(row) {
|
||||
this.$confirm('此操作将删除该类型, 是否继续?', this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
delPublishLesson(row.id).then(response => {
|
||||
this.$message.success(this.$t('publish.deleteSuccess'));
|
||||
this.loadInitPage();
|
||||
}).catch((error) => {
|
||||
this.loadInitPage();
|
||||
this.$messageBox(this.$t('error.deleteFailed') + ':' + error.message);
|
||||
});
|
||||
}).catch(() => { });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -14,6 +14,9 @@
|
||||
<el-button size="mini" type="primary" @click="goLesson(scope.row)">
|
||||
{{ $t('teach.enterTheCourse') }}
|
||||
</el-button>
|
||||
<el-button v-if="project.endsWith('gzb') && isTeacher" size="mini" type="danger" @click="handleDelete(scope.row)">
|
||||
删除课程
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -24,6 +27,9 @@
|
||||
<script>
|
||||
import { getSubSystemDetail } from '@/api/trainingPlatform';
|
||||
import { UrlConfig } from '@/scripts/ConstDic';
|
||||
import { delPublishLesson } from '@/api/jmap/lesson';
|
||||
import { getSessionStorage } from '@/utils/auth';
|
||||
import { lessonCreater } from '@/router/index_APP_TARGET';
|
||||
import localStore from 'storejs';
|
||||
|
||||
export default {
|
||||
@ -31,7 +37,9 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
tableData: [],
|
||||
loading: false
|
||||
loading: false,
|
||||
project: '',
|
||||
isTeacher: false
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
@ -41,6 +49,8 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.loadInitPage();
|
||||
this.project = getSessionStorage('project');
|
||||
this.isTeacher = this.$store.state.user.roles.includes(lessonCreater);
|
||||
},
|
||||
methods: {
|
||||
loadInitPage() {
|
||||
@ -66,6 +76,21 @@ export default {
|
||||
goLesson(row) {
|
||||
localStore.set('teachDetail' + this.$route.params.subSystem, `${UrlConfig.trainingPlatform.teachDetail}/${this.$route.params.subSystem}?lessonId=${row.id}&mapId=${row.mapId}&prdType=${row.prdType}`);
|
||||
this.$router.push({ path: `${UrlConfig.trainingPlatform.teachDetail}/${this.$route.params.subSystem}`, query: {lessonId: row.id, mapId: row.mapId, prdType: row.prdType}});
|
||||
},
|
||||
handleDelete(row) {
|
||||
this.$confirm('此操作将删除该类型, 是否继续?', this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
delPublishLesson(row.id).then(response => {
|
||||
this.$message.success(this.$t('publish.deleteSuccess'));
|
||||
this.loadInitPage();
|
||||
}).catch((error) => {
|
||||
this.loadInitPage();
|
||||
this.$messageBox(this.$t('error.deleteFailed') + ':' + error.message);
|
||||
});
|
||||
}).catch(() => { });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user