平台登录后台、案例同步到平台 改造

master
CherrysChang 5 years ago
parent fe00be0f6e
commit 60c0689f69
  1. 22
      src/main.js
  2. 2
      src/views/TrainHome.vue
  3. 17
      src/views/train/case-detail.vue
  4. 18
      src/views/train/case-list.vue

@ -47,18 +47,22 @@ const router = new VueRouter({
router.beforeEach((to, from, next) => {
//NProgress.start();
let user = JSON.parse(sessionStorage.getItem('user'));
if (!user && to.path != '/login') {
if (/yyyfLoginBack/.test(to.path)) {
if (!user && to.path != '/login' && !/yyyfLoginBack/.test(to.path)) {
next({path: '/login'})
} else if (user && to.path == '/login') {
if (user.userType == 3) {
next({name: 'Index'})
} else {
next({path: '/yyyfLoginBack'})//next()
}
} else if (user && user.userType == 3 && to.path == '/yyyfLoginBack') {//学校管理员
if (to.query && (to.query.userType == 1 || to.query.userType == 2)) {
next()
// } else if (/train/.test(to.path)) {//暂时这么写,user是需要有值的,这里先方便页面
// next()
} else {
next({path: '/login'})
next({name: 'Index'})
}
}else if(user && to.path =='/login'){
next({name:'Index'})
} else if (user && user.userType == 3 && to.path == '/yyyfLoginBack') {
next({name: 'Index'})
} else if (user && (user.userType == 1 || user.userType == 2) && to.path == '/') {
next({path: '/yyyfLoginBack'})//next({path: '/login'})
} else {
next()
}

@ -3,7 +3,7 @@
<el-col :span="24" class="header">
<el-col :span="20" class="logo">
<i class="iconfont iconset2 sys-icon"></i>
<span class="sys-name">智信链后台管理系统</span>
<span class="sys-name">区块链金融交易所仿真实训系统</span>
</el-col>
</el-col>
<el-col :span="24" class="menu">

@ -430,13 +430,14 @@
self.$message.error("判分设置模块总分不足100分!");
return;
}
// userType 0 1 2
// if (self.formAction == 0 && self.$store.state.app.user.userType) {
// self.dataForm.isAdmin = self.$store.state.app.user.userType == 1 ? 0 : 1;
// }
if(this.formAction == 0){//
let user = JSON.parse(sessionStorage.getItem('user'));
// userType 1 2
if (self.formAction == 0 && user) {
self.dataForm.isAdmin = user.userType == 1 ? 0 : 1;
}
if(self.formAction == 0){//
Train.insertCase(self.dataForm).then(res => {
if (res.code == 200) {
if (res.status == 1) {
// self.dataForm = Object.assign({}, self.dataForm, response.id);
self.$message.success("操作成功!");
self.goBackList();
@ -446,9 +447,9 @@
}).catch(error => {
self.$message.error(error);
});
}else if(this.formAction == 1){//
}else if(self.formAction == 1){//
Train.updateCase(self.dataForm).then(res => {
if (res.code == 200) {
if (res.status == 1) {
self.$message.success("操作成功!");
self.goBackList();
} else {

@ -100,14 +100,14 @@
});
},
isShowEditOrDelBtn(row) {
// let userType = this.$store.state.user.userType;
// let projectType = row.isAdmin;
// if (userType == 1 && projectType == 1) {//
// return false;
// }
// if(userType==2 && projectType==0 ) {//
// return false;
// }
let userType = JSON.parse(sessionStorage.getItem('user')).userType;
let projectType = row.isAdmin;
if (userType == 1 && projectType == 1) {//
return false;
}
if(userType== 2 && projectType==0 ) {//
return false;
}
return true;
},
doNew() {//
@ -120,7 +120,7 @@
type: 'warning'
}).then(() => {
Train.delCase({id: row.id}).then((res) => {
if (res.code == 200) {
if (res.status == 1) {
this.$message.success('删除成功!');
this.initList();
} else {

Loading…
Cancel
Save