Browse Source

提交首页

master
陈志鹏 2 years ago
parent
commit
e660c097e9
  1. 4
      config/dev.env.js
  2. 4
      config/prod.env.js
  3. 137
      src/components/Home.vue
  4. 179
      src/components/Index.vue
  5. 1
      src/components/Login.vue
  6. 108
      src/components/heat.vue
  7. 115
      src/page/Home.vue
  8. 191
      src/page/Index.vue
  9. 1
      src/page/Login.vue
  10. 226
      src/page/coures/coures.vue
  11. 25
      src/router/index.js
  12. 2
      src/utils/api.js

4
config/dev.env.js

@ -3,5 +3,7 @@ const merge = require('webpack-merge') @@ -3,5 +3,7 @@ const merge = require('webpack-merge')
const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, {
NODE_ENV: '"development"'
NODE_ENV: '"development"',
VUE_APP_MODE: 'development',
VUE_APP_API_URL: 'https://api.zhongxuemall.com.cn'
})

4
config/prod.env.js

@ -1,4 +1,6 @@ @@ -1,4 +1,6 @@
'use strict'
module.exports = {
NODE_ENV: '"production"'
NODE_ENV: '"production"',
VUE_APP_MODE: 'production',
VUE_APP_API_URL: 'https://api.zhongxuemall.com.cn'
}

137
src/components/Home.vue

@ -1,137 +0,0 @@ @@ -1,137 +0,0 @@
<template>
<el-container class="home_container">
<el-header>
<div class="home_title">自研平台</div>
<div class="home_userinfoContainer">
<el-dropdown @command="handleCommand">
<span class="el-dropdown-link home_userinfo">
{{currentUserName}}<i class="el-icon-arrow-down el-icon--right home_userinfo"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="sysMsg">系统消息</el-dropdown-item>
<el-dropdown-item command="MyHome">个人主页</el-dropdown-item>
<el-dropdown-item command="logout" divided>退出登录</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</el-header>
<el-container>
<el-aside width="200px">
<el-menu
default-active="0"
class="el-menu-vertical-demo" style="background-color: #ECECEC" router>
<template v-for="(item,index) in this.$router.options.routes" v-if="!item.hidden">
<el-submenu :index="index+''" v-if="item.children.length>1" :key="index">
<template slot="title">
<i :class="item.iconCls"></i>
<span>{{item.name}}</span>
</template>
<el-menu-item v-for="child in item.children" v-if="!child.hidden" :index="child.path" :key="child.path">
{{child.name}}
</el-menu-item>
</el-submenu>
<template v-else>
<el-menu-item :index="item.children[0].path">
<i :class="item.children[0].iconCls"></i>
<span slot="title">{{item.children[0].name}}</span>
</el-menu-item>
</template>
</template>
</el-menu>
</el-aside>
<el-container>
<el-main>
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item :to="{ path: '/home' }"></el-breadcrumb-item>
<el-breadcrumb-item v-text="this.$router.currentRoute.name"></el-breadcrumb-item>
</el-breadcrumb>
<keep-alive>
<router-view v-if="this.$route.meta.keepAlive"></router-view>
</keep-alive>
<router-view v-if="!this.$route.meta.keepAlive">
</router-view>
</el-main>
</el-container>
</el-container>
</el-container>
</template>
<script>
import {getRequest} from '../utils/api'
export default{
methods: {
handleCommand(command){
var _this = this;
if (command == 'logout') {
this.$confirm('注销登录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
getRequest("/logout")
_this.currentUserName = '临时用户';
_this.$router.replace({path: '/'});
}, function () {
//
})
}
}
},
mounted: function () {
var _this = this;
getRequest("/currentUserName").then(function (msg) {
_this.currentUserName = msg.data;
}, function (msg) {
_this.currentUserName = '临时用户';
});
},
data(){
return {
currentUserName: ''
}
}
}
</script>
<style>
.home_container {
height: 100%;
position: absolute;
top: 0px;
left: 0px;
width: 100%;
}
.el-header {
background-color: dodgerblue;
color: #333;
text-align: center;
display: flex;
align-items: center;
justify-content: space-between;
}
.el-aside {
background-color: #ECECEC;
}
.el-main {
background-color: #fff;
color: #000;
text-align: center;
}
.home_title {
color: #fff;
font-size: 22px;
display: inline;
}
.home_userinfo {
color: #fff;
cursor: pointer;
}
.home_userinfoContainer {
display: inline;
margin-right: 20px;
}
</style>

179
src/components/Index.vue

@ -1,179 +0,0 @@ @@ -1,179 +0,0 @@
<template>
<div v-loading="loading">
<div>自研平台</div>
<div>
<img src="https://t7.baidu.com/it/u=2405382010,1555992666&fm=193&f=GIF" style="height: 800px">
</div>
</div>
</template>
<script>
import {getRequest} from '../utils/api'
import {putRequest} from '../utils/api'
import {deleteRequest} from '../utils/api'
export default{
mounted: function () {
this.loading = true;
this.loadUserList();
this.cardloading = Array.apply(null, Array(20)).map(function (item, i) {
return false;
});
this.eploading = Array.apply(null, Array(20)).map(function (item, i) {
return false;
});
},
methods: {
saveRoles(id, index){
var selRoles = this.roles;
if (this.cpRoles.length == selRoles.length) {
for (var i = 0; i < this.cpRoles.length; i++) {
for (var j = 0; j < selRoles.length; j++) {
if (this.cpRoles[i].id == selRoles[j]) {
selRoles.splice(j, 1);
break;
}
}
}
if (selRoles.length == 0) {
return;
}
}
var _this = this;
_this.cardloading.splice(index, 1, true)
putRequest("/admin/user/role", {rids: this.roles, id: id}).then(resp=> {
if (resp.status == 200 && resp.data.status == 'success') {
_this.$message({type: resp.data.status, message: resp.data.msg});
_this.loadOneUserById(id, index);
} else {
_this.cardloading.splice(index, 1, false)
_this.$message({type: 'error', message: '更新失败!'});
}
}, resp=> {
_this.cardloading.splice(index, 1, false)
if (resp.response.status == 403) {
var data = resp.response.data;
_this.$message({type: 'error', message: data});
}
});
},
showRole(aRoles, id, index){
this.cpRoles = aRoles;
this.roles = [];
this.loadRoles(index);
for (var i = 0; i < aRoles.length; i++) {
this.roles.push(aRoles[i].id);
}
},
deleteUser(id){
var _this = this;
this.$confirm('删除该用户, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
_this.loading = true;
deleteRequest("/admin/user/" + id).then(resp=> {
if (resp.status == 200 && resp.data.status == 'success') {
_this.$message({type: 'success', message: '删除成功!'})
_this.loadUserList();
return;
}
_this.loading = false;
_this.$message({type: 'error', message: '删除失败!'})
}, resp=> {
_this.loading = false;
_this.$message({type: 'error', message: '删除失败!'})
});
}).catch(() => {
_this.$message({
type: 'info',
message: '已取消删除'
});
});
},
enabledChange(enabled, id, index){
var _this = this;
_this.cardloading.splice(index, 1, true)
putRequest("/admin/user/enabled", {enabled: enabled, uid: id}).then(resp=> {
if (resp.status != 200) {
_this.$message({type: 'error', message: '更新失败!'})
_this.loadOneUserById(id, index);
return;
}
_this.cardloading.splice(index, 1, false)
_this.$message({type: 'success', message: '更新成功!'})
}, resp=> {
_this.$message({type: 'error', message: '更新失败!'})
_this.loadOneUserById(id, index);
});
},
loadRoles(index){
var _this = this;
_this.eploading.splice(index, 1, true)
getRequest("/admin/roles").then(resp=> {
_this.eploading.splice(index, 1, false)
if (resp.status == 200) {
_this.allRoles = resp.data;
} else {
_this.$message({type: 'error', message: '数据加载失败!'});
}
}, resp=> {
_this.eploading.splice(index, 1, false)
if (resp.response.status == 403) {
var data = resp.response.data;
_this.$message({type: 'error', message: data});
}
});
},
loadOneUserById(id, index){
var _this = this;
getRequest("/admin/user/" + id).then(resp=> {
_this.cardloading.splice(index, 1, false)
if (resp.status == 200) {
_this.users.splice(index, 1, resp.data);
} else {
_this.$message({type: 'error', message: '数据加载失败!'});
}
}, resp=> {
_this.cardloading.splice(index, 1, false)
if (resp.response.status == 403) {
var data = resp.response.data;
_this.$message({type: 'error', message: data});
}
});
},
loadUserList(){
var _this = this;
getRequest("/admin/user?nickname="+this.keywords).then(resp=> {
_this.loading = false;
if (resp.status == 200) {
_this.users = resp.data;
} else {
_this.$message({type: 'error', message: '数据加载失败!'});
}
}, resp=> {
_this.loading = false;
if (resp.response.status == 403) {
var data = resp.response.data;
_this.$message({type: 'error', message: data});
}
});
},
searchClick(){
this.loading = true;
this.loadUserList();
}
},
data(){
return {
loading: false,
eploading: [],
cardloading: [],
keywords: '',
users: [],
allRoles: [],
roles: [],
cpRoles: []
}
}
}
</script>

1
src/components/Login.vue

@ -47,7 +47,6 @@ @@ -47,7 +47,6 @@
password: this.loginForm.password,
role: 1}
}).then(resp=> {
console.log('111----', resp.data.success)
_this.loading = false;
if (resp.status === 200) {
//

108
src/components/heat.vue

@ -0,0 +1,108 @@ @@ -0,0 +1,108 @@
<template>
<div class="echart" id="mychart" :style="myChartStyle"></div>
</template>
<script>
import * as echarts from 'echarts'
export default {
data() {
return {
xData: ['2022/10/11', '2022/10/12', '2022/10/13', '2022/10/14', '2022/10/15', '2022/10/16', '2022/10/17'], //
yData: [23, 24, 18, 25, 27, 28, 25], //
myChartStyle: { float: 'left', width: '100%', height: '400px' }, //
}
},
mounted() {
this.initEcharts()
},
methods: {
initEcharts() {
//
const option = {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: '#00fffb' }, //0
{ offset: 1, color: '#0061ce' }, //1
]),
tooltip: {
trigger: 'item',
},
grid: {
left: '0%',
right: '3%',
bottom: '3%',
top: '3%',
// label grid
containLabel: true,
//
show: true,
//grid
borderColor: 'rgba(0, 240, 255, 0.3)',
},
xAxis: {
type: 'category',
data: this.xData,
axisTick: {
alignWithLabel: false,
// x
show: false,
},
axisLabel: {
color: '#4c9bfd',
},
// x线
axisLine: {
lineStyle: {
color: 'rgba(0, 240, 255, 0.3)',
// width: 3
},
},
},
yAxis: [
{
type: 'value',
axisTick: {
alignWithLabel: false,
// y
show: false,
},
axisLabel: {
color: '#4c9bfd',
},
// y线
axisLine: {
lineStyle: {
color: 'rgba(0, 240, 255, 0.3)',
// width: 3
},
},
// y线
splitLine: {
lineStyle: {
color: 'rgba(0, 240, 255, 0.3)',
},
},
},
],
legend: {
itemWidth: 14,
itemHeight: 10,
},
series: [
{
type: 'bar', //
data: this.yData,
barWidth: 20,
},
],
}
const myChart = echarts.init(document.getElementById('mychart'))
myChart.setOption(option)
//
window.addEventListener('resize', () => {
myChart.resize()
})
},
},
}
</script>

115
src/page/Home.vue

@ -1,25 +1,30 @@ @@ -1,25 +1,30 @@
<template>
<el-container class="home_container">
<el-header>
<div class="home_title">自研平台</div>
<div class="home_userinfoContainer">
<el-dropdown @command="handleCommand">
<div class="home_title">
<div style="float: left">
<img style="height: 25px;width: 25px;margin-top: 4px;margin-right: 3px;border-radius: 20px" src="https://img2.baidu.com/it/u=2698887226,1859091242&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500">
</div>
<span>{{shoolName}}</span>
<div class="home_userinfoContainer1">
<el-dropdown @command="handleCommand">
<span class="el-dropdown-link home_userinfo">
{{currentUserName}}<i class="el-icon-arrow-down el-icon--right home_userinfo"></i>
切换名称<i class="el-icon-arrow-down el-icon--right home_userinfo"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="sysMsg">系统消息</el-dropdown-item>
<el-dropdown-item command="MyHome">个人主页</el-dropdown-item>
<el-dropdown-item command="logout" divided>退出登录</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item><span @click="updateShoolName('清华')">清华</span></el-dropdown-item>
<el-dropdown-item><span @click="updateShoolName('北大')">北大</span></el-dropdown-item>
<el-dropdown-item><span @click="updateShoolName('复旦')">复旦</span></el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</div>
</el-header>
<div class="home_userinfoContainer">
<el-container>
<el-aside width="200px">
<el-aside width="900px" style="background-color: dodgerblue;">
<el-menu
default-active="0"
class="el-menu-vertical-demo" style="background-color: #ECECEC" router>
class="el-menu-vertical-demo" style="background-color: dodgerblue;display: flex" router>
<template v-for="(item,index) in this.$router.options.routes" v-if="!item.hidden">
<el-submenu :index="index+''" v-if="item.children.length>1" :key="index">
<template slot="title">
@ -33,32 +38,52 @@ @@ -33,32 +38,52 @@
<template v-else>
<el-menu-item :index="item.children[0].path">
<i :class="item.children[0].iconCls"></i>
<span slot="title">{{item.children[0].name}}</span>
<span style="color: #ffffff">{{item.children[0].name}}</span>
</el-menu-item>
</template>
</template>
</el-menu>
</el-aside>
<el-container>
<el-main>
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item :to="{ path: '/home' }"></el-breadcrumb-item>
<el-breadcrumb-item v-text="this.$router.currentRoute.name"></el-breadcrumb-item>
</el-breadcrumb>
<keep-alive>
<router-view v-if="this.$route.meta.keepAlive"></router-view>
</keep-alive>
<router-view v-if="!this.$route.meta.keepAlive">
</router-view>
</el-main>
</el-container>
</el-container>
</div>
<div class="home_userinfoContainer">
<el-dropdown @command="handleCommand">
<span class="el-dropdown-link home_userinfo">
{{currentUserName}}<i class="el-icon-arrow-down el-icon--right home_userinfo"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="sysMsg">系统消息</el-dropdown-item>
<el-dropdown-item command="MyHome">个人主页</el-dropdown-item>
<el-dropdown-item command="logout" divided>退出登录</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</el-header>
<el-container>
<el-main>
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item :to="{ path: '/home' }"></el-breadcrumb-item>
<el-breadcrumb-item v-text="this.$router.currentRoute.name"></el-breadcrumb-item>
</el-breadcrumb>
<keep-alive>
<router-view v-if="this.$route.meta.keepAlive"></router-view>
</keep-alive>
<router-view v-if="!this.$route.meta.keepAlive">
</router-view>
</el-main>
</el-container>
</el-container>
</template>
<script>
import {getRequest} from '../utils/api'
export default{
created () {
this.home()
},
methods: {
updateShoolName(e){
this.shoolName = e
},
handleCommand(command){
var _this = this;
if (command == 'logout') {
@ -74,19 +99,33 @@ @@ -74,19 +99,33 @@
//
})
}
}
},
home(){
//
this.$router.push({
path: "/index",
query: {
}
});
},
},
mounted: function () {
var _this = this;
getRequest("/currentUserName").then(function (msg) {
_this.currentUserName = msg.data;
getRequest("/p/v1/user/profile").then(function (msg) {
if(msg.data.data){
_this.currentUserName = msg.data.data.name;
}else{
_this.currentUserName = '临时用户';
}
home()
}, function (msg) {
_this.currentUserName = '临时用户';
});
},
data(){
return {
currentUserName: ''
currentUserName: '',
shoolName: '清华'
}
}
}
@ -110,7 +149,7 @@ @@ -110,7 +149,7 @@
}
.el-aside {
background-color: #ECECEC;
background-color: dodgerblue;
}
.el-main {
@ -126,7 +165,7 @@ @@ -126,7 +165,7 @@
}
.home_userinfo {
color: #fff;
color: #ffffff;
cursor: pointer;
}
@ -134,4 +173,14 @@ @@ -134,4 +173,14 @@
display: inline;
margin-right: 20px;
}
.home_userinfoContainer1 {
float: right;
margin-left: 10px;
}
.el-menu-item:focus, .el-menu-item:hover{
background-color: dodgerblue;
}
.el-menu-item.is-active {
color: #ffffff;
}
</style>

191
src/page/Index.vue

@ -1,167 +1,48 @@ @@ -1,167 +1,48 @@
<template>
<div v-loading="loading">
<div>自研平台</div>
<div>
<img src="https://t7.baidu.com/it/u=2405382010,1555992666&fm=193&f=GIF" style="height: 800px">
<div>
<div style="margin-top: 50px;width: 100%">
<div style="width: 300px;height: 200px;background-color: #8cc5ff;float: left;margin-left: 120px">
<div style="align-content: center">
<div style="padding-top: 60px;font-size: 30px;font-weight: bolder;color: #ffffff">10</div>
<div style="padding-top: 10px;color: #ffffff">开班班级</div>
</div>
</div>
<div style="width: 300px;height: 200px;background-color: #f9a7a7;float: left;margin-left: 100px">
<div style="align-content: center">
<div style="padding-top: 60px;font-size: 30px;font-weight: bolder;color: #ffffff">22</div>
<div style="padding-top: 10px;color: #ffffff">上架课程</div>
</div>
</div>
<div style="width: 300px;height: 200px;background-color: #a4da89;float: left;margin-left: 100px">
<div style="align-content: center">
<div style="padding-top: 60px;font-size: 30px;font-weight: bolder;color: #ffffff">1000</div>
<div style="padding-top: 10px;color: #ffffff">习题库</div>
</div>
</div>
<div style="width: 300px;height: 200px;background-color: #f0c78a;float: left;margin-left: 100px">
<div style="align-content: center">
<div style="padding-top: 60px;font-size: 30px;font-weight: bolder;color: #ffffff">3</div>
<div style="padding-top: 10px;color: #ffffff">进行中的考试</div>
</div>
</div>
</div>
<div style="width: 100%;float: left;margin-top: 50px;font-weight: bolder">
<div>课程统计信息统计</div>
<div style="margin-left: 50px">
<component is="heat"></component>
</div>
</div>
</div>
</template>
<script>
import {getRequest} from '../utils/api'
import {putRequest} from '../utils/api'
import {deleteRequest} from '../utils/api'
import heat from '../components/heat.vue'
export default{
components: {
heat
},
mounted: function () {
this.loading = true;
this.loadUserList();
this.cardloading = Array.apply(null, Array(20)).map(function (item, i) {
return false;
});
this.eploading = Array.apply(null, Array(20)).map(function (item, i) {
return false;
});
},
methods: {
saveRoles(id, index){
var selRoles = this.roles;
if (this.cpRoles.length == selRoles.length) {
for (var i = 0; i < this.cpRoles.length; i++) {
for (var j = 0; j < selRoles.length; j++) {
if (this.cpRoles[i].id == selRoles[j]) {
selRoles.splice(j, 1);
break;
}
}
}
if (selRoles.length == 0) {
return;
}
}
var _this = this;
_this.cardloading.splice(index, 1, true)
putRequest("/admin/user/role", {rids: this.roles, id: id}).then(resp=> {
if (resp.status == 200 && resp.data.status == 'success') {
_this.$message({type: resp.data.status, message: resp.data.msg});
_this.loadOneUserById(id, index);
} else {
_this.cardloading.splice(index, 1, false)
_this.$message({type: 'error', message: '更新失败!'});
}
}, resp=> {
_this.cardloading.splice(index, 1, false)
if (resp.response.status == 403) {
var data = resp.response.data;
_this.$message({type: 'error', message: data});
}
});
},
showRole(aRoles, id, index){
this.cpRoles = aRoles;
this.roles = [];
this.loadRoles(index);
for (var i = 0; i < aRoles.length; i++) {
this.roles.push(aRoles[i].id);
}
},
deleteUser(id){
var _this = this;
this.$confirm('删除该用户, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
_this.loading = true;
deleteRequest("/admin/user/" + id).then(resp=> {
if (resp.status == 200 && resp.data.status == 'success') {
_this.$message({type: 'success', message: '删除成功!'})
_this.loadUserList();
return;
}
_this.loading = false;
_this.$message({type: 'error', message: '删除失败!'})
}, resp=> {
_this.loading = false;
_this.$message({type: 'error', message: '删除失败!'})
});
}).catch(() => {
_this.$message({
type: 'info',
message: '已取消删除'
});
});
},
enabledChange(enabled, id, index){
var _this = this;
_this.cardloading.splice(index, 1, true)
putRequest("/admin/user/enabled", {enabled: enabled, uid: id}).then(resp=> {
if (resp.status != 200) {
_this.$message({type: 'error', message: '更新失败!'})
_this.loadOneUserById(id, index);
return;
}
_this.cardloading.splice(index, 1, false)
_this.$message({type: 'success', message: '更新成功!'})
}, resp=> {
_this.$message({type: 'error', message: '更新失败!'})
_this.loadOneUserById(id, index);
});
},
loadRoles(index){
var _this = this;
_this.eploading.splice(index, 1, true)
getRequest("/admin/roles").then(resp=> {
_this.eploading.splice(index, 1, false)
if (resp.status == 200) {
_this.allRoles = resp.data;
} else {
_this.$message({type: 'error', message: '数据加载失败!'});
}
}, resp=> {
_this.eploading.splice(index, 1, false)
if (resp.response.status == 403) {
var data = resp.response.data;
_this.$message({type: 'error', message: data});
}
});
},
loadOneUserById(id, index){
var _this = this;
getRequest("/admin/user/" + id).then(resp=> {
_this.cardloading.splice(index, 1, false)
if (resp.status == 200) {
_this.users.splice(index, 1, resp.data);
} else {
_this.$message({type: 'error', message: '数据加载失败!'});
}
}, resp=> {
_this.cardloading.splice(index, 1, false)
if (resp.response.status == 403) {
var data = resp.response.data;
_this.$message({type: 'error', message: data});
}
});
},
loadUserList(){
var _this = this;
getRequest("/admin/user?nickname="+this.keywords).then(resp=> {
_this.loading = false;
if (resp.status == 200) {
_this.users = resp.data;
} else {
_this.$message({type: 'error', message: '数据加载失败!'});
}
}, resp=> {
_this.loading = false;
if (resp.response.status == 403) {
var data = resp.response.data;
_this.$message({type: 'error', message: data});
}
});
},
searchClick(){
this.loading = true;
this.loadUserList();
}
},
data(){
return {

1
src/page/Login.vue

@ -48,7 +48,6 @@ @@ -48,7 +48,6 @@
var json = resp.data;
if (json.success) {
Vue.prototype.$global.token=json.data[0].token
console.log('111----', Vue.prototype.$global.token)
_this.$router.replace({path: '/home'});
} else {
_this.$alert('登录失败!', '失败!');

226
src/page/coures/coures.vue

@ -1,50 +1,94 @@ @@ -1,50 +1,94 @@
<template>
<div>
<el-container style="height: 100%; border: 1px solid #eee">
<el-aside width="180px" style="background-color: rgb(238, 241, 246)">
<el-menu :default-openeds="['1', '3']">
<el-button style="margin-top: 20px" size="mini" type="primary"
@click="">新建分类
</el-button>
<el-submenu index="1">
<template slot="title"><i class="el-icon-message"></i>所有科目</template>
<div v-for="(item,index) in typeList" :key="index">
<el-menu-item index='index' @click="submitClickType(item)">{{item.name}}</el-menu-item>
</div>
</el-submenu>
</el-menu>
</el-aside>
<el-container>
<div style="margin-top: 20px">
<el-card shadow="never">
<div class="crud__left">
<div style="display: flex;float: right">
<el-form :inline="true">
<el-form-item>
<el-button type="primary" size="mini"
<el-button type="primary"
@click="addCourse()">新建课程
</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" size="mini"
@click="">移动到分类
</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" size="mini"
@click="dyOpenTab">订阅信息
</el-button>
</el-form-item>
</el-form>
</div>
<div class="crud__right">
<div class="crud__left">
<el-form :inline="true">
<div style="float: right;">
<el-form-item style="float: left">
<el-input v-model="dataForm.name" size="mini"
<el-form-item style="float: left" label="课程名称:">
<el-input v-model="dataForm.name"
placeholder="课程名称" clearable></el-input>
</el-form-item>
<el-form-item style="float: right">
<el-button type="primary" size="mini"
<el-form-item style="float: left" label="课程类型:">
<el-select
clearable
v-model="dataForm.type"
placeholder="请选择"
>
<el-option
v-for="item in typeList"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item style="float: left" label="课程状态:">
<el-select
clearable
v-model="dataForm.status"
placeholder="请选择"
>
<el-option
v-for="item in statusList"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item style="float: left" label="课程科目:">
<el-select
clearable
v-model="dataForm.subject"
placeholder="请选择"
>
<el-option
v-for="item in subjectList"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item style="float: left" label="讲师姓名:">
<el-select
clearable
v-model="dataForm.teacherName"
placeholder="请选择"
>
<el-option
v-for="item in teacherList"
:key="item.id"
:label="item.displayName"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item style="float: left" label="创建时间:">
<el-date-picker
v-model="dataForm.time"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
style="width: 250px"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item style="float: right;">
<el-button type="primary"
@click="submitClick">查询
</el-button>
</el-form-item>
@ -53,20 +97,28 @@ @@ -53,20 +97,28 @@
</div>
<div>
<el-table :data="dataList" border>
<el-table-column prop="name" label="课程名称" fixed
header-align="center" align="left" width="250">
<el-table-column label="序号" fixed
header-align="center" align="center" width="50">
<template slot-scope="scope">
<span>
{{ scope.$index + 1 }}
</span>
</template>
</el-table-column>
<el-table-column prop="intro" label="分类" fixed
header-align="center" align="center" width="150">
<el-table-column prop="name" label="课程名称" fixed
header-align="center" align="center" width="200">
</el-table-column>
<el-table-column prop="type" label="类型" fixed
header-align="center" align="center" width="150">
</el-table-column>
<el-table-column prop="times" label="课程时长" fixed
<el-table-column prop="intro" label="科目" fixed
header-align="center" align="center" width="150">
</el-table-column>
<el-table-column prop="episodeCount" label="章节数" fixed
header-align="center" align="center" width="150">
<el-table-column prop="teacherName" label="讲师" fixed
header-align="center" align="center" width="120">
</el-table-column>
<el-table-column prop="subscribedCount" label="报名人数" fixed
header-align="center" align="center" width="120">
</el-table-column>
<el-table-column prop="createdBy" label="创建人" fixed
header-align="center" align="center" width="150">
@ -77,14 +129,24 @@ @@ -77,14 +129,24 @@
<el-table-column prop="updateTime" label="上次更新时间" fixed
header-align="center" align="center" width="200">
</el-table-column>
<el-table-column prop="status" label="状态" fixed
header-align="center" align="center" width="200">
<template slot-scope="scope">
<b v-if="scope.row.status==='DRAFT'">草稿</b>
<b v-else>上架</b>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" header-align="center" align="center"
width="120">
width="150">
<template slot-scope="scope">
<el-button type="text" size="mini"
@click="">学员管理
@click="">查看
</el-button>
<el-button type="text" size="mini"
@click="">编辑
<el-button type="text" size="mini" v-if="scope.row.status!=='DRAFT'"
@click="">下架
</el-button>
<el-button type="text" size="mini" v-if="scope.row.status==='DRAFT'"
@click="">上架
</el-button>
<el-button type="text" size="mini"
@click="">删除
@ -94,8 +156,6 @@ @@ -94,8 +156,6 @@
</el-table>
</div>
</el-card>
</el-container>
</el-container>
</div>
</template>
<script>
@ -105,13 +165,55 @@ export default { @@ -105,13 +165,55 @@ export default {
return {
activeName: 'first',
dataForm: {
name: ''
name: '',
teacherName: '',
type: '',
status: '',
time: '',
subjectIdList: []
},
typeList: [
{
id: '0',
name: '全部'
},
{
id: '1',
name: '视频课'
},
{
id: '2',
name: '直播课'
},
{
id: '3',
name: '现场课'
},
],
statusList: [
{
id: '0',
name: '全部'
},
{
id: '1',
name: '草稿'
},
{
id: '2',
name: '上架'
},
{
id: '3',
name: '已下架'
},
],
dataFormType: {
name: ''
},
dataList: [],
typeList: []
subjectList: [],
teacherList: []
}
},
activated () {
@ -121,6 +223,7 @@ export default { @@ -121,6 +223,7 @@ export default {
created () {
this.submitClick()
this.getTypeList()
this.getTeacherList()
},
mounted () {
},
@ -132,7 +235,6 @@ export default { @@ -132,7 +235,6 @@ export default {
filer: {name: this.dataForm.name},
pagination: {pageNo: 1,pageSize: 10}
}).then(resp=> {
console.log('111----', resp.data)
_this.loading = false;
if (resp.status === 200) {
this.dataList = resp.data.data.list
@ -147,11 +249,12 @@ export default { @@ -147,11 +249,12 @@ export default {
var _this = this;
this.loading = true;
var filter = {
filer: {name: this.dataForm.name},
filer: {
name: this.dataForm.name
},
pagination: {pageNo: 1,pageSize: 10}
}
postRequest('/edu/v1/pc/course3', JSON.stringify(filter)).then(resp=> {
console.log('111----', resp.data)
_this.loading = false;
if (resp.status === 200) {
this.dataList = resp.data.data.list
@ -168,10 +271,25 @@ export default { @@ -168,10 +271,25 @@ export default {
getRequest('/edu/v1/pc/subject/by/name', JSON.stringify({
mode: 'all',
})).then(resp=> {
console.log('111----', resp.data)
_this.loading = false;
if (resp.status === 200) {
this.typeList = resp.data.data
this.subjectList = resp.data.data
} else {
//
_this.$alert('');
}
}, resp=> {
});
},
getTeacherList: function () {
var _this = this;
this.loading = true;
getRequest('/edu/v1/pc/school/schoolTeacher', JSON.stringify({
scope: '10010',
})).then(resp=> {
_this.loading = false;
if (resp.status === 200) {
this.teacherList = resp.data.data
} else {
//
_this.$alert('');

25
src/router/index.js

@ -43,6 +43,7 @@ export default new Router({ @@ -43,6 +43,7 @@ export default new Router({
},
{
path: '/home',
hidden: true,
component: Home,
name: '用户管理',
children: [
@ -57,39 +58,39 @@ export default new Router({ @@ -57,39 +58,39 @@ export default new Router({
{
path: '/home',
component: Home,
name: '随堂练习',
name: '课程管理',
children: [
{
path: '/exercises',
path: '/coures',
iconCls: 'fa fa-user-o',
name: '随堂练习',
component: exercises
name: '课程管理',
component: coures
}
]
},
{
path: '/home',
component: Home,
name: '考试管理',
name: '随堂练习',
children: [
{
path: '/examination',
path: '/exercises',
iconCls: 'fa fa-user-o',
name: '考试管理',
component: examination
name: '随堂练习',
component: exercises
}
]
},
{
path: '/home',
component: Home,
name: '课程管理',
name: '考试管理',
children: [
{
path: '/coures',
path: '/examination',
iconCls: 'fa fa-user-o',
name: '课程管理',
component: coures
name: '考试管理',
component: examination
}
]
},

2
src/utils/api.js

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
import axios from 'axios'
import Vue from 'vue'
let base = '';
let base = 'https://api.zhongxuemall.com.cn';
export const postRequest = (url, params) => {
return axios({
method: 'post',

Loading…
Cancel
Save