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

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) => { router.beforeEach((to, from, next) => {
//NProgress.start(); //NProgress.start();
let user = JSON.parse(sessionStorage.getItem('user')); let user = JSON.parse(sessionStorage.getItem('user'));
if (!user && to.path != '/login') { if (!user && to.path != '/login' && !/yyyfLoginBack/.test(to.path)) {
if (/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() next()
// } else if (/train/.test(to.path)) {//暂时这么写,user是需要有值的,这里先方便页面
// next()
} else { } else {
next({path: '/login'}) next({name: 'Index'})
} }
}else if(user && to.path =='/login'){ } else if (user && (user.userType == 1 || user.userType == 2) && to.path == '/') {
next({name:'Index'}) next({path: '/yyyfLoginBack'})//next({path: '/login'})
} else if (user && user.userType == 3 && to.path == '/yyyfLoginBack') {
next({name: 'Index'})
} else { } else {
next() next()
} }

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

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

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

Loading…
Cancel
Save