first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
<template>
<div id="app">
<router-view />
</div>
</template>
<style lang="stylus">
@import "~@page/clear.styl";
</style>

View File

@@ -0,0 +1,2 @@
@import "public/_.styl";

View File

@@ -0,0 +1,2 @@
h2
color red500

View File

@@ -0,0 +1,451 @@
/*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */
/**
* 1. Change the default font family in all browsers (opinionated).
* 2. Prevent adjustments of font size after orientation changes in IE and iOS.
*/
html {
font-family: sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/**
* Remove the margin in all browsers (opinionated).
*/
body {
margin: 0;
padding 0;
}
h1,h2,h3,h4,h5,h6,ul,li,p {
margin: 0;
padding: 0;
}
// element ui
.el-header {
padding 0
position fixed
left 0
top 0
width 100%
z-index 9999
}
.left-aside
position fixed
left 0
width 200px
z-index 999
top 60px
height 100%
.el-menu
height 100%
.el-main {
margin-left: 200px;
margin-top: 60px;
}
/* HTML5 display definitions
========================================================================== */
/**
* Add the correct display in IE 9-.
* 1. Add the correct display in Edge, IE, and Firefox.
* 2. Add the correct display in IE.
*/
article,
aside,
details, /* 1 */
figcaption,
figure,
footer,
header,
main, /* 2 */
menu,
nav,
section,
summary { /* 1 */
display: block;
}
/**
* Add the correct display in IE 9-.
*/
audio,
canvas,
progress,
video {
display: inline-block;
}
/**
* Add the correct display in iOS 4-7.
*/
audio:not([controls]) {
display: none;
height: 0;
}
/**
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
vertical-align: baseline;
}
/**
* Add the correct display in IE 10-.
* 1. Add the correct display in IE.
*/
template, /* 1 */
[hidden] {
display: none;
}
/* Links
========================================================================== */
/**
* 1. Remove the gray background on active links in IE 10.
* 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
*/
a {
background-color: transparent; /* 1 */
-webkit-text-decoration-skip: objects; /* 2 */
}
/**
* Remove the outline on focused links when they are also active or hovered
* in all browsers (opinionated).
*/
a:active,
a:hover {
outline-width: 0;
}
/* Text-level semantics
========================================================================== */
/**
* 1. Remove the bottom border in Firefox 39-.
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
text-decoration: underline dotted; /* 2 */
}
/**
* Prevent the duplicate application of `bolder` by the next rule in Safari 6.
*/
b,
strong {
font-weight: inherit;
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
font-weight: bolder;
}
/**
* Add the correct font style in Android 4.3-.
*/
dfn {
font-style: italic;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/**
* Add the correct background and color in IE 9-.
*/
mark {
background-color: #ff0;
color: #000;
}
/**
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/* Embedded content
========================================================================== */
/**
* Remove the border on images inside links in IE 10-.
*/
img {
border-style: none;
}
/**
* Hide the overflow in IE.
*/
svg:not(:root) {
overflow: hidden;
}
/* Grouping content
========================================================================== */
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
pre,
samp {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
* Add the correct margin in IE 8.
*/
figure {
margin: 1em 40px;
}
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
}
/* Forms
========================================================================== */
/**
* 1. Change font properties to `inherit` in all browsers (opinionated).
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
select,
textarea {
font: inherit; /* 1 */
margin: 0; /* 2 */
}
/**
* Restore the font weight unset by the previous rule.
*/
optgroup {
font-weight: bold;
}
/**
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
button,
input { /* 1 */
overflow: visible;
}
/**
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
button,
select { /* 1 */
text-transform: none;
}
/**
* 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
* controls in Android 4.
* 2. Correct the inability to style clickable types in iOS and Safari.
*/
button,
html [type="button"], /* 1 */
[type="reset"],
[type="submit"] {
-webkit-appearance: button; /* 2 */
}
/**
* Remove the inner border and padding in Firefox.
*/
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
/**
* Restore the focus styles unset by the previous rule.
*/
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
/**
* Change the border, margin, and padding in all browsers (opinionated).
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/**
* 1. Correct the text wrapping in Edge and IE.
* 2. Correct the color inheritance from `fieldset` elements in IE.
* 3. Remove the padding so developers are not caught out when they zero out
* `fieldset` elements in all browsers.
*/
legend {
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
padding: 0; /* 3 */
white-space: normal; /* 1 */
}
/**
* Remove the default vertical scrollbar in IE.
*/
textarea {
overflow: auto;
}
/**
* 1. Add the correct box sizing in IE 10-.
* 2. Remove the padding in IE 10-.
*/
[type="checkbox"],
[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
[type="search"] {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
* Remove the inner padding and cancel buttons in Chrome and Safari on OS X.
*/
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* Correct the text style of placeholders in Chrome, Edge, and Safari.
*/
::-webkit-input-placeholder {
color: inherit;
opacity: 0.54;
}
/**
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}

View File

@@ -0,0 +1,3 @@
@import "color.styl";
@import "mixins.styl";
@import "vars.styl";

View File

@@ -0,0 +1,304 @@
red50 = #ffebee;
red100 = #ffcdd2;
red200 = #ef9a9a;
red300 = #e57373;
red400 = #ef5350;
red500 = #f44336;
red600 = #e53935;
red700 = #d32f2f;
red800 = #c62828;
red900 = #b71c1c;
redA100 = #ff8a80;
redA200 = #ff5252;
redA400 = #ff1744;
redA700 = #d50000;
red = red500;
pink50 = #fce4ec;
pink100 = #f8bbd0;
pink200 = #f48fb1;
pink300 = #f06292;
pink400 = #ec407a;
pink500 = #e91e63;
pink600 = #d81b60;
pink700 = #c2185b;
pink800 = #ad1457;
pink900 = #880e4f;
pinkA100 = #ff80ab;
pinkA200 = #ff4081;
pinkA400 = #f50057;
pinkA700 = #c51162;
pink = pink500;
purple50 = #f3e5f5;
purple100 = #e1bee7;
purple200 = #ce93d8;
purple300 = #ba68c8;
purple400 = #ab47bc;
purple500 = #9c27b0;
purple600 = #8e24aa;
purple700 = #7b1fa2;
purple800 = #6a1b9a;
purple900 = #4a148c;
purpleA100 = #ea80fc;
purpleA200 = #e040fb;
purpleA400 = #d500f9;
purpleA700 = #aa00ff;
purple = purple500;
deepPurple50 = #ede7f6;
deepPurple100 = #d1c4e9;
deepPurple200 = #b39ddb;
deepPurple300 = #9575cd;
deepPurple400 = #7e57c2;
deepPurple500 = #673ab7;
deepPurple600 = #5e35b1;
deepPurple700 = #512da8;
deepPurple800 = #4527a0;
deepPurple900 = #311b92;
deepPurpleA100 = #b388ff;
deepPurpleA200 = #7c4dff;
deepPurpleA400 = #651fff;
deepPurpleA700 = #6200ea;
deepPurple = deepPurple500;
indigo50 = #e8eaf6;
indigo100 = #c5cae9;
indigo200 = #9fa8da;
indigo300 = #7986cb;
indigo400 = #5c6bc0;
indigo500 = #3f51b5;
indigo600 = #3949ab;
indigo700 = #303f9f;
indigo800 = #283593;
indigo900 = #1a237e;
indigoA100 = #8c9eff;
indigoA200 = #536dfe;
indigoA400 = #3d5afe;
indigoA700 = #304ffe;
indigo = indigo500;
blue50 = #e3f2fd;
blue100 = #bbdefb;
blue200 = #90caf9;
blue300 = #64b5f6;
blue400 = #42a5f5;
blue500 = #2196f3;
blue600 = #1e88e5;
blue700 = #1976d2;
blue800 = #1565c0;
blue900 = #0d47a1;
blueA100 = #82b1ff;
blueA200 = #448aff;
blueA400 = #2979ff;
blueA700 = #2962ff;
blue = blue500;
lightBlue50 = #e1f5fe;
lightBlue100 = #b3e5fc;
lightBlue200 = #81d4fa;
lightBlue300 = #4fc3f7;
lightBlue400 = #29b6f6;
lightBlue500 = #03a9f4;
lightBlue600 = #039be5;
lightBlue700 = #0288d1;
lightBlue800 = #0277bd;
lightBlue900 = #01579b;
lightBlueA100 = #80d8ff;
lightBlueA200 = #40c4ff;
lightBlueA400 = #00b0ff;
lightBlueA700 = #0091ea;
lightBlue = lightBlue500;
cyan50 = #e0f7fa;
cyan100 = #b2ebf2;
cyan200 = #80deea;
cyan300 = #4dd0e1;
cyan400 = #26c6da;
cyan500 = #00bcd4;
cyan600 = #00acc1;
cyan700 = #0097a7;
cyan800 = #00838f;
cyan900 = #006064;
cyanA100 = #84ffff;
cyanA200 = #18ffff;
cyanA400 = #00e5ff;
cyanA700 = #00b8d4;
cyan = cyan500;
teal50 = #e0f2f1;
teal100 = #b2dfdb;
teal200 = #80cbc4;
teal300 = #4db6ac;
teal400 = #26a69a;
teal500 = #009688;
teal600 = #00897b;
teal700 = #00796b;
teal800 = #00695c;
teal900 = #004d40;
tealA100 = #a7ffeb;
tealA200 = #64ffda;
tealA400 = #1de9b6;
tealA700 = #00bfa5;
teal = teal500;
green50 = #e8f5e9;
green100 = #c8e6c9;
green200 = #a5d6a7;
green300 = #81c784;
green400 = #66bb6a;
green500 = #4caf50;
green600 = #43a047;
green700 = #388e3c;
green800 = #2e7d32;
green900 = #1b5e20;
greenA100 = #b9f6ca;
greenA200 = #69f0ae;
greenA400 = #00e676;
greenA700 = #00c853;
green = green500;
lightGreen50 = #f1f8e9;
lightGreen100 = #dcedc8;
lightGreen200 = #c5e1a5;
lightGreen300 = #aed581;
lightGreen400 = #9ccc65;
lightGreen500 = #8bc34a;
lightGreen600 = #7cb342;
lightGreen700 = #689f38;
lightGreen800 = #558b2f;
lightGreen900 = #33691e;
lightGreenA100 = #ccff90;
lightGreenA200 = #b2ff59;
lightGreenA400 = #76ff03;
lightGreenA700 = #64dd17;
lightGreen = lightGreen500;
lime50 = #f9fbe7;
lime100 = #f0f4c3;
lime200 = #e6ee9c;
lime300 = #dce775;
lime400 = #d4e157;
lime500 = #cddc39;
lime600 = #c0ca33;
lime700 = #afb42b;
lime800 = #9e9d24;
lime900 = #827717;
limeA100 = #f4ff81;
limeA200 = #eeff41;
limeA400 = #c6ff00;
limeA700 = #aeea00;
lime = lime500;
yellow50 = #fffde7;
yellow100 = #fff9c4;
yellow200 = #fff59d;
yellow300 = #fff176;
yellow400 = #ffee58;
yellow500 = #ffeb3b;
yellow600 = #fdd835;
yellow700 = #fbc02d;
yellow800 = #f9a825;
yellow900 = #f57f17;
yellowA100 = #ffff8d;
yellowA200 = #ffff00;
yellowA400 = #ffea00;
yellowA700 = #ffd600;
yellow = yellow500;
amber50 = #fff8e1;
amber100 = #ffecb3;
amber200 = #ffe082;
amber300 = #ffd54f;
amber400 = #ffca28;
amber500 = #ffc107;
amber600 = #ffb300;
amber700 = #ffa000;
amber800 = #ff8f00;
amber900 = #ff6f00;
amberA100 = #ffe57f;
amberA200 = #ffd740;
amberA400 = #ffc400;
amberA700 = #ffab00;
amber = amber500;
orange50 = #fff3e0;
orange100 = #ffe0b2;
orange200 = #ffcc80;
orange300 = #ffb74d;
orange400 = #ffa726;
orange500 = #ff9800;
orange600 = #fb8c00;
orange700 = #f57c00;
orange800 = #ef6c00;
orange900 = #e65100;
orangeA100 = #ffd180;
orangeA200 = #ffab40;
orangeA400 = #ff9100;
orangeA700 = #ff6d00;
orange = orange500;
deepOrange50 = #fbe9e7;
deepOrange100 = #ffccbc;
deepOrange200 = #ffab91;
deepOrange300 = #ff8a65;
deepOrange400 = #ff7043;
deepOrange500 = #ff5722;
deepOrange600 = #f4511e;
deepOrange700 = #e64a19;
deepOrange800 = #d84315;
deepOrange900 = #bf360c;
deepOrangeA100 = #ff9e80;
deepOrangeA200 = #ff6e40;
deepOrangeA400 = #ff3d00;
deepOrangeA700 = #dd2c00;
deepOrange = deepOrange500;
brown50 = #efebe9;
brown100 = #d7ccc8;
brown200 = #bcaaa4;
brown300 = #a1887f;
brown400 = #8d6e63;
brown500 = #795548;
brown600 = #6d4c41;
brown700 = #5d4037;
brown800 = #4e342e;
brown900 = #3e2723;
brown = brown500;
blueGrey50 = #eceff1;
blueGrey100 = #cfd8dc;
blueGrey200 = #b0bec5;
blueGrey300 = #90a4ae;
blueGrey400 = #78909c;
blueGrey500 = #607d8b;
blueGrey600 = #546e7a;
blueGrey700 = #455a64;
blueGrey800 = #37474f;
blueGrey900 = #263238;
blueGrey = blueGrey500;
grey50 = #fafafa;
grey100 = #f5f5f5;
grey200 = #eeeeee;
grey300 = #e0e0e0;
grey400 = #bdbdbd;
grey500 = #9e9e9e;
grey600 = #757575;
grey700 = #616161;
grey800 = #424242;
grey900 = #212121;
grey = grey500;
black = #000000;
white = #ffffff;
transparent = rgba(0, 0, 0, 0);
fullBlack = rgba(0, 0, 0, 1);
darkBlack = rgba(0, 0, 0, 0.87);
lightBlack = rgba(0, 0, 0, 0.54);
minBlack = rgba(0, 0, 0, 0.26);
faintBlack = rgba(0, 0, 0, 0.12);
fullWhite = rgba(255, 255, 255, 1);
darkWhite = rgba(255, 255, 255, 0.87);
lightWhite = rgba(255, 255, 255, 0.54);

View File

@@ -0,0 +1,43 @@
@import "./color.styl";
fontFamily = Roboto, Lato, sans-serif;
// primary and accent
primaryColor = blue; //
secondaryColor = pinkA200;
successColor = green;
warningColor = yellow600;
errorColor = red;
infoColor = blue;
trackColor = grey400;
// textColor or borderColor
textColor = darkBlack;
secondaryTextColor = fade(fullBlack, 54%);
alternateTextColor = white;
borderColor = fade(fullBlack, 12%);
disabledColor = fade(fullBlack, 38%);
// background
backgroundColor = grey50;
dialogBackgroundColor = white; // dialogs or cards
chipBackgroundColor = grey300;
// icon color
activeIconColor = fade(fullBlack, 54%);
inActiveIconColor = fade(fullBlack, 38%);
// spaceing
iconSize = 24px;
desktopGutter = 24px;
desktopGutterMore = 32px;
desktopGutterLess = 16px;
desktopGutterMini = 8px;
desktopKeylineIncrement = 64px;
desktopDropDownMenuItemHeight = 32px;
desktopDropDownMenuFontSize = 15px;
desktopDrawerMenuItemHeight = 48px;
desktopSubheaderHeight = 48px;
desktopToolbarHeight = 56px;
// animate
easeOutFunction = cubic-bezier(0.23, 1, 0.32, 1);
easeInOutFunction = cubic-bezier(0.445, 0.05, 0.55, 0.95);

View File

@@ -0,0 +1,39 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br />
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener"
>vue-cli documentation</a
>.
</p>
<h3>Installed CLI Plugins</h3>
</div>
</template>
<script>
export default {
name: "HelloWorld",
props: {
msg: String,
},
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="stylus">
h3
margin 40px 0 0
ul
list-style-type none
padding 0
li
display inline-block
margin 0 10px
a
color #42b983
</style>

View File

@@ -0,0 +1,27 @@
import ElementUI from 'element-ui';
export default {
devBaseUrl: 'http://www.geekhelp.cn/bmy/api/admin',
testBaseUrl: 'http://47.114.153.249:3000/api/json',
prodBaseUrl: 'http://47.114.153.249:3000/api/json',
ApiList: {
login: '/adminLogin',
allCourse: '/getAllCourse',
getUploadToken: '/token'
},
VuePlugIn: [ ElementUI ],
getUrl () {
switch (process.env.NODE_ENV) {
case 'development':
return this.devBaseUrl
// eslint-disable-next-line no-unreachable
break
case 'test':
return this.testBaseUrl
break
case 'production':
return this.prodBaseUrl
break
}
}
}

View File

@@ -0,0 +1,72 @@
import axios from "axios";
import config from "../config";
import { Notification } from "element-ui";
class Http {
constructor() {
axios.defaults.baseURL = config.getUrl();
this.interceptors();
}
async get(option) {
return await axios.get(option.url, {
params: option.data,
headers: Object.assign(
{
token: localStorage.getItem("token"),
},
option.headers
),
});
}
async post(option) {
return await axios.post(option.url, option.data, {
headers: Object.assign(
{
token: localStorage.getItem("token"),
},
option.headers
),
});
}
interceptors() {
// 添加请求拦截器
axios.interceptors.request.use(
function (config) {
// 在发送请求之前做些什么
return config;
},
function (error) {
// 对请求错误做些什么
return Promise.reject(error);
}
);
// 添加响应拦截器
axios.interceptors.response.use(
function (response) {
var data = response.data;
switch (data.status) {
case 200:
return data.result;
case 404:
Notification.error({
title: "接口错误",
message: `错误信息为:${data.result}`,
});
throw new Error(data.result);
break;
}
},
function (error) {
// 对响应错误做点什么
return Promise.reject(error);
}
);
}
}
export default new Http();

View File

@@ -0,0 +1,18 @@
import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import config from './config';
import http from './service/_';
import utils from './utils';
Vue.config.productionTip = false;
Vue.prototype.$http = http;
Vue.prototype.$utils = utils;
config.VuePlugIn.forEach(v => Vue.use(v))
new Vue({
router,
render: (h) => h(App),
}).$mount("#app");

View File

@@ -0,0 +1,8 @@
export default {
data() {
return {
page: 1,
totalPage: 0
}
},
}

View File

@@ -0,0 +1,87 @@
import Vue from "vue";
import VueRouter from "vue-router";
import utils from '../utils';
Vue.use(VueRouter);
const routes = [
{
path: "/",
component: () => import(/* webpackChunkName: "home" */ "../views/Layout.vue"),
redirect: '/home',
children: [
{
path: "/home",
name: "Home",
meta: {
isLogin: true
},
component: () => import(/* webpackChunkName: "home" */ "../views/Home.vue"),
},
{
path: "/CourseManage/pushCourse",
name: "pushCourse",
meta: {
isLogin: true
},
component: () => import(/* webpackChunkName: "PushCourse" */ "../views/CourseManage/PushCourse.vue"),
},
{
path: "/CourseManage/allCourse",
name: "allCourse",
meta: {
isLogin: true
},
component: () => import(/* webpackChunkName: "AllCourse" */ "../views/CourseManage/AllCourse.vue"),
}
]
},
{
path: "/login",
name: "login",
meta: {
isLogin: false
},
component: () => import(/* webpackChunkName: "login" */ "../views/User/Login.vue"),
},
{
path: "/reg",
name: "reg",
meta: {
isLogin: false
},
component: () => import(/* webpackChunkName: "reg" */ "../views/User/Reg.vue"),
}
];
const router = new VueRouter({
routes,
});
// 解决刷新时候重新生成路由
if (localStorage.getItem("role") !== null) {
router.addRoutes(utils.createdRouterConfig())
}
router.beforeEach((to, from, next) => {
if (to.meta.isLogin) {
if (localStorage.getItem("token") !== null) {
next()
} else {
next({
path: '/login'
})
}
} else {
if (to.name == 'login') {
if (localStorage.getItem("token") !== null) {
router.go(-1)
} else {
next()
}
} else {
next()
}
}
});
export default router;

View File

@@ -0,0 +1,30 @@
import http from '../http'
import config from '../config'
export default class IndexService {
async radio (data = {}, header = {}) {
// eslint-disable-next-line no-return-await
return await http.get({
url: config.ApiList.radio,
data: data,
headers: header
})
}
async allCourse (data = {}, header = {}) {
return await http.post({
url: config.ApiList.allCourse,
data: data,
headers: header
})
}
async getUploadToken (data = {}, header = {}) {
return await http.post({
url: config.ApiList.getUploadToken,
data: data,
headers: header
})
}
}

View File

@@ -0,0 +1,12 @@
import http from '../http'
import config from '../config'
export default class UserService {
async login (data = {}, header = {}) {
return await http.post({
url: config.ApiList.login,
data: data,
headers: header
})
}
}

View File

@@ -0,0 +1,7 @@
import IndexService from './IndexService'
import UserService from './UserService'
export default {
index: new IndexService(),
user: new UserService(),
}

View File

@@ -0,0 +1,35 @@
class Utils {
createdRouterConfig() {
var roleArr = localStorage.getItem("role") == null ? [] : JSON.parse( localStorage.getItem("role"));
var config = [
{
path: "/",
component: () => import("../views/Layout.vue"),
meta: {
isLogin: true
},
children: []
}
];
roleArr.forEach((v) => {
v.children.forEach(item => {
console.log(`../views${v.path}/${item.component}.vue`)
config[0].children.push({
path: v.path + item.path,
name: item.path.replace("/",""),
meta: {
isLogin: true
},
component: () => import(`../views${v.path}/${item.component}.vue`),
})
});
});
return config;
}
}
export default new Utils();

View File

@@ -0,0 +1,5 @@
<template>
<div class="about">
<h1>This is an about page</h1>
</div>
</template>

View File

@@ -0,0 +1,106 @@
<template>
<div class="allcourse">
<el-page-header content="所有课程"></el-page-header>
<el-table
:data="allCourse"
style="width: 100%">
<el-table-column
label="操作"
width="400">
<template slot-scope="scope">
<el-button type="primary">
修改
<i class="el-icon-edit"></i>
</el-button>
<el-button type="primary">
更新
<i class="el-icon-upload"></i>
</el-button>
<el-button type="primary" @click="deleteCourse(scope.row)">
删除
<i class="el-icon-delete"></i>
</el-button>
</template>
</el-table-column>
<el-table-column
prop="courseTitle"
label="课程名称">
</el-table-column>
<el-table-column
label="课程缩略图">
<template slot-scope="scope">
<img style="width: 100%;" :src="scope.row.courseImageUrl" alt="">
</template>
</el-table-column>
<el-table-column
prop="courseDesc"
width="300"
label="课程介绍">
</el-table-column>
<el-table-column
prop="courseClass"
label="课程分类">
</el-table-column>
<el-table-column
prop="createdAt"
label="发布时间">
</el-table-column>
<el-table-column
label="是否付费">
<template slot-scope="scope">
<el-tag :type="scope.row.coursePrice == 0 ? 'success' : 'danger' ">
{{ scope.row.coursePrice == 0 ? '免费': '收费' }}
</el-tag>
</template>
</el-table-column>
<el-table-column
prop="coursePrice"
label="价格(元)">
</el-table-column>
<el-table-column
prop="courseResource"
label="难易度">
</el-table-column>
</el-table>
</div>
</template>
<script>
export default {
data() {
return {
allCourse: []
}
},
created() {
this.getAllCourse()
},
methods: {
async getAllCourse() {
this.allCourse = await this.$http.index.allCourse();
console.log(this.allCourse)
},
deleteCourse(item) {
console.log(s)
}
}
}
</script>
<style lang="stylus" scoped>
</style>

View File

@@ -0,0 +1,87 @@
<template>
<div class="pushcourse">
<el-page-header content="发布课程"></el-page-header>
<el-upload
class="avatar-uploader"
action="http://upload.qiniu.com/"
:show-file-list="false"
:data="UploadFileData"
:on-success="handleSuccess"
:before-upload="beforeUpload">
<img v-if="imageUrl.length != 0" :src="imageUrl" alt="">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</div>
</template>
<script>
export default {
data() {
return {
imageUrl: '',
UploadFileData: {
token: null,
key: null
}
}
},
created() { },
methods: {
test() {
// var f = this.$refs.files.files[0]
//
//
// var reader = new FileReader();
// reader.readAsDataURL(f);
//
// reader.onload = function(e){
// console.log(e.target.result);
//
// };
//
// var a = new FormData()
// a.append("file", f);
//
// console.log(a)
},
handleSuccess(response, file) {
this.imageUrl = "http://static.geekhelp.cn/" + response.key
console.log("response: ", response)
console.log("file: ", file)
},
async beforeUpload(file) {
let res = await this.$http.index.getUploadToken();
this.UploadFileData.token = res.token;
this.UploadFileData.key = file.name;
console.log(this.UploadFileData)
},
}
}
</script>
<style lang="stylus" scoped>
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409EFF;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
.avatar {
width: 178px;
height: 178px;
display: block;
}
</style>

View File

@@ -0,0 +1,23 @@
<template lang="pug">
.home
h2 首页
h2 首页
h2 首页
</template>
<script>
export default {
name: "Home",
data() {
return {};
},
async created() {
let res = await this.$http.index.radio();
console.log(res);
},
};
</script>
<style lang="stylus" scoped>
@import "~@page/Home.styl"
</style>

View File

@@ -0,0 +1,92 @@
<template>
<div class="layout">
<el-container>
<el-header>
<el-menu
:default-active="1"
class="el-menu-demo"
mode="horizontal"
background-color="#545c64"
text-color="#fff"
active-text-color="#ffd04b">
<el-menu-item index="1">处理中心</el-menu-item>
<el-submenu index="2">
<template slot="title">我的工作台</template>
<el-menu-item index="2-1">选项1</el-menu-item>
<el-menu-item index="2-2">选项2</el-menu-item>
<el-menu-item index="2-3">选项3</el-menu-item>
<el-submenu index="2-4">
<template slot="title">选项4</template>
<el-menu-item index="2-4-1">选项1</el-menu-item>
<el-menu-item index="2-4-2">选项2</el-menu-item>
<el-menu-item index="2-4-3">选项3</el-menu-item>
</el-submenu>
</el-submenu>
<el-menu-item index="3" disabled>消息中心</el-menu-item>
<el-menu-item index="4"><a href="https://www.ele.me" target="_blank">订单管理</a></el-menu-item>
</el-menu>
</el-header>
<el-container>
<el-aside class="left-aside" width="200px">
<el-menu
router
class="el-menu-vertical-demo">
<el-submenu>
<template slot="title">
<i class="el-icon-location"></i>
<span>课程管理</span>
</template>
<el-menu-item-group>
<el-menu-item index="/CourseManage/allCourse">所有课程</el-menu-item>
<el-menu-item index="/CourseManage/pushCourse">发布课程</el-menu-item>
</el-menu-item-group>
</el-submenu>
<el-submenu>
<template slot="title">
<i class="el-icon-location"></i>
<span>分类管理</span>
</template>
<el-menu-item-group>
<el-menu-item index="1-1">所有分类</el-menu-item>
</el-menu-item-group>
</el-submenu>
</el-menu>
</el-aside>
<el-main>
<router-view />
</el-main>
</el-container>
</el-container>
</div>
</template>
<script>
export default {
data() {
return {
roleArr: localStorage.getItem("role") == null ? [] : JSON.parse( localStorage.getItem("role"))
}
},
created() {
console.log()
this.$router.addRoutes(this.$utils.createdRouterConfig())
},
methods: {
}
}
</script>
<style lang="stylus" scoped>
</style>

View File

@@ -0,0 +1,62 @@
<template>
<div class="login">
<h1>管理员</h1>
<el-form :model="userInfo" :rules="rules"
ref="ruleForm" label-width="100px">
<el-form-item label="用户名" prop="username">
<el-input v-model="userInfo.username"></el-input>
</el-form-item>
<el-form-item label="密码" prop="userpassword">
<el-input v-model="userInfo.userpassword"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitLogin()"> </el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
data() {
return {
userInfo: {
username: '',
userpassword: ''
},
rules: {
username: [
{ required: true, message: '请输入用户名', trigger: 'blur' },
{ min: 3, max: 20, message: '长度在 3 到 20 个字符', trigger: 'blur' }
],
userpassword: [
{ required: true, message: '请输入密码', trigger: 'blur' },
{ min: 3, max: 10, message: '长度在 3 到 10 个字符', trigger: 'blur' }
],
}
}
},
methods: {
submitLogin() {
this.$refs.ruleForm.validate(async (valid) => {
if (valid) {
let res = await this.$http.user.login(this.userInfo);
console.log(res)
localStorage.setItem("token", JSON.stringify(res));
this.$router.replace("/")
}
});
},
}
}
</script>
<style lang="stylus" scoped>
</style>

View File

@@ -0,0 +1,13 @@
<template>
<div class="reg">
<h1>注册</h1>
</div>
</template>
<script>
export default {}
</script>
<style lang="stylus" scoped>
</style>