Compare commits

..

No commits in common. 'master' and 'zqqdev' have entirely different histories.

  1. 13
      src/api/server.js
  2. 2
      src/common/js/route-list.js
  3. 30
      src/common/js/utils.js
  4. 21
      src/main.js
  5. 7
      src/router/index.js
  6. 4
      src/views/Home.vue
  7. 2
      src/views/TrainHome.vue
  8. 90
      src/views/YyyfLogin.vue
  9. 108
      src/views/train/case-detail.vue
  10. 18
      src/views/train/case-list.vue

@ -45,7 +45,7 @@ export const Train = new (class {
//实训案例管理列表 //实训案例管理列表
getCaseList(params) { getCaseList(params) {
return axios return axios
.post(this.getCaseListApi, qs.stringify(params)/*, {headers: {requestType: "noToken"}}*/) .post(this.getCaseListApi, qs.stringify(params), {headers: {requestType: "noToken"}})
.then(res => res.data); .then(res => res.data);
} }
//添加 //添加
@ -309,7 +309,6 @@ export const Login = new (class {
this.loginPublicKey = loginApi + "/login/getPublicKey"; //获取公钥 this.loginPublicKey = loginApi + "/login/getPublicKey"; //获取公钥
this.sendLoginCodeApi = loginApi + "/login/sendLoginCode"; //获取验证码 this.sendLoginCodeApi = loginApi + "/login/sendLoginCode"; //获取验证码
this.exitLogin = loginApi + "/login/exit"; //系统用户退出登录 this.exitLogin = loginApi + "/login/exit"; //系统用户退出登录
this.yyyfLoginBack = loginApi + "/yyyfLogin/login";//以渔有方用户登录
} }
sendLoginCode(params) { sendLoginCode(params) {
@ -345,16 +344,6 @@ export const Login = new (class {
.then(res => res.data); .then(res => res.data);
} }
yyyfLogin(params) {
return axios.get(this.yyyfLoginBack, {
params: params,
headers: {
requestType: "noToken"
}
})
.then(res => res.data);
}
logout() { logout() {
return axios.get(this.exitLogin, { return axios.get(this.exitLogin, {
headers: { headers: {

@ -1232,7 +1232,7 @@ export default {
component: CooutAccount, component: CooutAccount,
name: 'CooutAccount', name: 'CooutAccount',
meta: { meta: {
Name: '币账户设置' Name: '币账户设置'
} }
}, },
'CoinAccount': { 'CoinAccount': {

@ -330,36 +330,6 @@ class Utils {
}, false); }, false);
reader.readAsDataURL(file); reader.readAsDataURL(file);
} }
/**
* 解析请求路径返回路径参数
* @returns {{}}
*/
parseUrl() {
let params = {};//定义数组
let url = decodeURIComponent(location.href);
let paramsIndex = url.indexOf("?")
if (paramsIndex != -1) {
paramsIndex = paramsIndex + 1;
let paramsStr = url.substring(paramsIndex);
let paramsAttr = paramsStr.split("&");
for (let x in paramsAttr) {
let y = paramsAttr[x].split("=");
if (y[0] == undefined || y[0] == "") {
continue;
}
if (y[1] != undefined) {
let value = "";
let len = y.length;
for (let j = 1; j < len; j++) {
value += y[j] == '' && paramsAttr[x].charAt(value.length + y[0].length + 1) != '' ? '=' : y[j];
}
params[y[0]] = value;
}
}
}
return params;
}
} }
export default new Utils(); export default new Utils();

@ -41,29 +41,20 @@ Vue.use(Vuex)
//NProgress.configure({ showSpinner: false }); //NProgress.configure({ showSpinner: false });
const router = new VueRouter({ const router = new VueRouter({
//base: '/vue-admin/', //build时需要加上
routes routes
}) })
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' && !/yyyfLoginBack/.test(to.path)) { if (!user && to.path != '/login') {
next({path: '/login'}) if(/train/.test(to.path)){//暂时这么写,user是需要有值的,这里先方便页面
} 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 { }else{
next({name: 'Index'}) next({ path: '/login' })
} }
} else if (user && (user.userType == 1 || user.userType == 2) && to.path == '/') { }else if(user && to.path =='/login'){
next({path: '/yyyfLoginBack'})//next({path: '/login'}) next({name:'Index'})
} else { } else {
next() next()
} }

@ -1,6 +1,5 @@
import curRoutes from '@/common/js/testR.js'; //用户当前路由 测试 import curRoutes from '@/common/js/testR.js'; //用户当前路由 测试
import Utils from '@/common/js/utils.js'; import Utils from '@/common/js/utils.js';
import YyyfLogin from "../views/YyyfLogin";
// 实训案例管理主页 // 实训案例管理主页
const TrainHome = resolve => require(['@/views/TrainHome.vue'], resolve) const TrainHome = resolve => require(['@/views/TrainHome.vue'], resolve)
@ -105,12 +104,6 @@ let routes = [
name: 'Login', name: 'Login',
hidden: true hidden: true
}, },
{
path: '/yyyfLoginBack',
component: YyyfLogin,
name: 'YyyfLogin',
hidden: true
},
{ {
path: '/train', path: '/train',
component: TrainHome, component: TrainHome,

@ -14,7 +14,7 @@
<el-dropdown trigger="hover"> <el-dropdown trigger="hover">
<span class="el-dropdown-link userinfo-inner">用户 {{account}}<i class="el-icon-arrow-down el-icon--right"></i></span> <span class="el-dropdown-link userinfo-inner">用户 {{account}}<i class="el-icon-arrow-down el-icon--right"></i></span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<!--<el-dropdown-item divided @click.native="updateMyself">修改个人信息</el-dropdown-item>--> <el-dropdown-item divided @click.native="updateMyself">修改个人信息</el-dropdown-item>
<el-dropdown-item divided @click.native="logout">退出登录</el-dropdown-item> <el-dropdown-item divided @click.native="logout">退出登录</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
@ -145,7 +145,7 @@
} }
.userinfo { .userinfo {
// text-align: right; // text-align: right;
//padding-right: 35px; padding-right: 35px;
float: right; float: right;
.userinfo-inner { .userinfo-inner {
cursor: pointer; cursor: pointer;

@ -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">

@ -1,90 +0,0 @@
<template>
<section>
<h2>欢迎访问智信链管理系统</h2>
</section>
</template>
<script>
import Utils from '@/common/js/utils.js';
import {Login} from '@/api/server.js';
export default {
name: "YyyfLogin",
created() {
let loading = this.openLoading();
this.initLogin();
this.closeLoading(loading);
},
methods: {
/**
* 教师 学校管理员 超管 http://localhost:8080/#/yyyfLoginBack?userId=1&userName=eWFuZmEwMw%3D%3D&userType=1
* 1教师 2超管 ==> 案例管理
* 3学校管理员 ==> 后台管理
*/
initLogin() {
let params = Utils.parseUrl();
let self = this;
//
if (params!==undefined && params !=null && params.userId != undefined && params.userType != undefined) {
let userType = params.userType;
Login.yyyfLogin(params).then(res => {
let {msg, code} = res;
if (code !== 200) {
self.$message({
message: msg,
type: 'error'
});
} else {
sessionStorage.setItem('user', JSON.stringify(res.data));
sessionStorage.setItem('account',res.data.account);
sessionStorage.setItem('token', res.data.token);
if (userType == 1 || userType == 2) {//
self.$router.push({path: '/train'});
}else{
window.location.reload();
}
}
});
} else {
self.$alert('参数错误', '提示', {
type: 'error',
showClose: false,
confirmButtonText: '确定',
confirmButtonClass: 'btn-self-style',
callback: action => {
self.closeWindow()
}
});
}
},
//Loading
openLoading() {
const loading = this.$loading({
lock: true,
text: '正在跳转,请稍后!',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
return loading;
},
closeLoading(loading){
loading.close();
},
closeWindow: function () {
if (navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Chrome") != -1) {
window.location.href = "about:blank";
window.close();
} else {
window.opener = null;
window.open("", "_self");
window.close();
}
},
}
}
</script>
<style scoped>
</style>

@ -1,58 +1,20 @@
<template> <template>
<div class="caseInputForm"> <div class="caseInputForm">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" class="demo-form-inline" label-width="150px"> <el-form :model="dataForm" :rules="dataRule" ref="dataForm" class="demo-form-inline" label-width="90px">
<el-card class="box-card"> <el-card class="box-card">
<div slot="header"> <div slot="header">
<span class="item-title-font"><i class="el-icon-minus icon-minus-rotated"></i>实训信息</span> <span class="item-title-font"><i class="el-icon-minus icon-minus-rotated"></i>实训信息</span>
<el-button type="primary" style="float: right;" size="medium" @click="goBackList">返回</el-button> <el-button type="primary" style="float: right;" size="medium" @click="goBackList">返回</el-button>
</div> </div>
<el-row :gutter="2" type="flex"> <el-form-item label="实训名称" prop="name">
<el-col :span="12"> <el-input v-model.trim="dataForm.name" :disabled="formAction==2" placeholder="实训名称" style="width: 360px;"></el-input>
<el-form-item label="实训名称" prop="name"> </el-form-item>
<el-input v-model.trim="dataForm.name" :disabled="formAction==2" placeholder="实训名称" maxlength="30" style="max-width: 360px;"></el-input> <el-form-item label="实训用途" prop="type">
</el-form-item> <el-select v-model="dataForm.type" placeholder="实训用途" :disabled="formAction==2" style="width: 360px;">
</el-col> <el-option label="考核" value="1"></el-option>
<el-col :span="12"> <el-option label="练习" value="2"></el-option>
<el-form-item label="实训用途" prop="type"> </el-select>
<el-select v-model="dataForm.type" placeholder="实训用途" :disabled="formAction==2" style="max-width: 360px;width: 100%"> </el-form-item>
<el-option label="考核" value="1"></el-option>
<el-option label="练习" value="2"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="2" type="flex">
<el-col :span="12">
<el-form-item label="微信账户初始资金" prop="wechatInitMoney">
<el-input v-model.trim="dataForm.wechatInitMoney" :disabled="formAction==2" placeholder="微信账户初始资金" maxlength="12" style="max-width: 360px;">
<i slot="suffix"></i>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="支付宝账户初始资金" prop="alipayInitMoney">
<el-input v-model.trim="dataForm.alipayInitMoney" :disabled="formAction==2" placeholder="支付宝账户初始资金" style="max-width: 360px;">
<i slot="suffix"></i>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="2" type="flex">
<el-col :span="12">
<el-form-item label="银行卡账户初始资金" prop="bankcardInitMoney">
<el-input v-model.trim="dataForm.bankcardInitMoney" :disabled="formAction==2" placeholder="银行卡账户初始资金" style="max-width: 360px;">
<i slot="suffix"></i>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数字钱包初始资产">
<el-input v-model.trim="dataForm.digitwalletInitMoney" :disabled="true" placeholder="数字钱包初始资产" style="max-width: 360px;">
<i slot="suffix"></i>
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-card> </el-card>
<el-card class="box-card"> <el-card class="box-card">
<div slot="header"> <div slot="header">
@ -89,7 +51,7 @@
<el-form-item :prop="'taskList.'+scope.$index+'.taskOperate'" :rules="dataRule.taskOperate" class="score-input" > <el-form-item :prop="'taskList.'+scope.$index+'.taskOperate'" :rules="dataRule.taskOperate" class="score-input" >
<el-select v-model="scope.row.taskOperate" size="small" :disabled="formAction == 2" style="width: 100px;"> <el-select v-model="scope.row.taskOperate" size="small" :disabled="formAction == 2" style="width: 100px;">
<el-option label="大于" value="1"></el-option> <el-option label="大于" value="1"></el-option>
<el-option label="小于" value="-1"></el-option> <el-option label="小于" value="2"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -150,19 +112,8 @@
var validateTaskRate = (rule, value, callback) => { var validateTaskRate = (rule, value, callback) => {
if (!value) { if (!value) {
callback(new Error('请输入任务目标')); callback(new Error('请输入任务目标'));
} else if (!(/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/.test(value)) || value > 100) { } else if (!(/^(([1-9][0-9]*)|(([0]\.\d|[1-9][0-9]*\.\d)))$/.test(value)) || value > 100) {
callback(new Error('请输入100以内最多2位小数的正数')); callback(new Error('请输入100以内最多一位小数的正数'));
} else {
callback();
}
};
var validateMoney = (rule, value, callback) => {
if (!value) {
callback(new Error('请输入初始资金'));
} else if (!(/^[0-9]\d{0,8}(\.\d{1,2})?$/.test(value))) {
callback(new Error('请输入整数位最多9位,小数位最多2位的数字'));
} else if (value <= 0) {
callback(new Error('请输入大于0的数字'));
} else { } else {
callback(); callback();
} }
@ -173,10 +124,6 @@
id: '', id: '',
type: '', type: '',
name: '', name: '',
wechatInitMoney: '',
alipayInitMoney: '',
bankcardInitMoney: '',
digitwalletInitMoney: 0,
taskList: [], taskList: [],
isAdmin: 1, // isAdmin: 1, //
}, },
@ -189,18 +136,6 @@
type: [ type: [
{ required: true, message: '请选择实训用途', trigger: 'change' } { required: true, message: '请选择实训用途', trigger: 'change' }
], ],
wechatInitMoney: [
{ required: true, message: '请输入初始资金', trigger: 'change' },
{validator: validateMoney, trigger: 'blur'}
],
alipayInitMoney: [
{ required: true, message: '请输入初始资金', trigger: 'change' },
{validator: validateMoney, trigger: 'blur'}
],
bankcardInitMoney: [
{ required: true, message: '请输入初始资金', trigger: 'change' },
{validator: validateMoney, trigger: 'blur'}
],
taskOperate: [ taskOperate: [
{ required: true, message: '请选择设置项', trigger: 'change' } { required: true, message: '请选择设置项', trigger: 'change' }
], ],
@ -430,14 +365,13 @@
self.$message.error("判分设置模块总分不足100分!"); self.$message.error("判分设置模块总分不足100分!");
return; return;
} }
let user = JSON.parse(sessionStorage.getItem('user')); // userType 0 1 2
// userType 1 2 // if (self.formAction == 0 && self.$store.state.app.user.userType) {
if (self.formAction == 0 && user) { // self.dataForm.isAdmin = self.$store.state.app.user.userType == 1 ? 0 : 1;
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.status == 1) { if (res.code == 200) {
// 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();
@ -447,9 +381,9 @@
}).catch(error => { }).catch(error => {
self.$message.error(error); self.$message.error(error);
}); });
}else if(self.formAction == 1){// }else if(this.formAction == 1){//
Train.updateCase(self.dataForm).then(res => { Train.updateCase(self.dataForm).then(res => {
if (res.status == 1) { if (res.code == 200) {
self.$message.success("操作成功!"); self.$message.success("操作成功!");
self.goBackList(); self.goBackList();
} else { } else {

@ -100,14 +100,14 @@
}); });
}, },
isShowEditOrDelBtn(row) { isShowEditOrDelBtn(row) {
let userType = JSON.parse(sessionStorage.getItem('user')).userType; // let userType = this.$store.state.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.status == 1) { if (res.code == 200) {
this.$message.success('删除成功!'); this.$message.success('删除成功!');
this.initList(); this.initList();
} else { } else {

Loading…
Cancel
Save