提交 b27b91c1 authored 作者: 蔡芬's avatar 蔡芬

1

上级 6a7184fb
<template> <template>
<div id="app"> <div id="app" ref="appcontainer" :style="style">
<!-- <div id="nav"> <!-- <div id="nav">
<router-link to="/">Home</router-link> | <router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link> <router-link to="/about">About</router-link>
...@@ -7,30 +7,29 @@ ...@@ -7,30 +7,29 @@
<router-view /> <router-view />
</div> </div>
</template> </template>
<script>
<style lang="less"> export default {
#app { data() {
font-family: Avenir, Helvetica, Arial, sans-serif; return {
-webkit-font-smoothing: antialiased; style: { height: 'auto' }
-moz-osx-font-smoothing: grayscale; };
text-align: center; },
color: #2c3e50; mounted() {
} this.style.height = document.documentElement.clientHeight + 'px';
window.onresize = function temp() {
#nav { this.style.height = document.documentElement.clientHeight + 'px';
padding: 30px; };
a {
font-weight: bold;
color: #2c3e50;
&.router-link-exact-active {
color: #42b983;
}
} }
} }
</style> </script>
<style> <style>
@import './assets/css/normalize.css'; /*引入样式*/ @import './assets/css/normalize.css'; /*引入样式*/
</style>
<style lang="less">
#app {
}
@import './assets/css/common.less'; /*引入公共样式*/ @import './assets/css/common.less'; /*引入公共样式*/
</style> </style>
ul {
list-style:none;
margin: 0;
padding: 0;
}
.displaynone {display: none;}
.visiblehide {visibility: hidden;}
.flex {
display: flex;
&_jcbetween{justify-content: space-between;}
}
.botline {
&_eee1 {
position: relative;
width: inherit;
height: 100%;
&:after { display: block; content: ""; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 80%; height: 1px; background-color: #eee; }
}
}
.margin {
&_15_0 {margin: 15px 0;}
}
.border {
&_boteee1 {border-bottom: 1px solid #eee;}
}
.padding {
&_15 {padding: 15px;}
&_0_15 {padding: 0 15px;}
&_0_20 {padding: 0 20px;}
&_left15 {padding-left: 15px;}
}
.height {
&_100p {height: 100%;}
}
.bgc {
&_ccc {background-color: #ccc;}
}
<template>
<div class="li-item-container" @mouseenter="moveToggle('show')" @mouseleave="moveToggle('hide')">
<div class="li-item-operate">
<div ref="tools-control" class="li-item-tools displaynone">
<el-dropdown @command="handleCommand" >
<span class="el-dropdown-link">
<i class="el-icon-more" ></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="a">编辑</el-dropdown-item>
<el-dropdown-item command="b">更改封面图</el-dropdown-item>
<el-dropdown-item command="c" >重命名</el-dropdown-item>
<el-dropdown-item command="d" divided>预览课件</el-dropdown-item>
<el-dropdown-item command="e" >添加标签</el-dropdown-item>
<el-dropdown-item command="f" >复制</el-dropdown-item>
<el-dropdown-item command="g" divided>删除</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<div class="li-item-edit displaynone" ref="tools-control2" @click="tap('edit')">
<i class="el-icon-edit"></i>
</div>
</div>
<div>
<div></div>
<div></div>
</div>
</div>
</template>
<script>
export default {
props: {
id:[Number,String],
},
data() {
return {
};
},
methods: {
moveToggle(type) {
if(type === 'show') {
this.$refs['tools-control'].className = this.$refs['tools-control'].className.replace(/\s?displaynone/g,'');
this.$refs['tools-control2'].className = this.$refs['tools-control2'].className.replace(/\s?displaynone/g,'');
} else {
this.$refs['tools-control'].className = this.$refs['tools-control'].className.replace(/\s?displaynone/g,'')+ ' displaynone';
this.$refs['tools-control2'].className = this.$refs['tools-control2'].className.replace(/\s?displaynone/g,'')+ ' displaynone';
}
},
handleCommand(command) {
this.$emit('toolsEvent',{id:this.id,type:command})
},
tap(type) {
if(type === 'edit') this.$emit('toolsEvent',{id:this.id,type:'edit'})
},
},
}
</script>
<style lang="less" scoped>
.li-item-container {
border-radius: 3px;
border: 1px solid #eee;
max-width: 260px;
width: 100%;
height: 220px;
}
.li-item-operate {
position: relative;
height: 150px;
background-color: #ccc;
}
.li-item-tools {
position: absolute;
top: 0;
right: 0;
// padding: 5px 10px;
background-color: palegoldenrod;
cursor: pointer;
}
.el-dropdown-link {
display: inline-block;
padding: 5px 10px;
}
.li-item-edit {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
border-radius: 50%;
padding: 10px;
width: 20px;
height: 20px;
background-color: #fff;
cursor: pointer;
}
</style>
\ No newline at end of file
<template>
<div class="tool-item-container" @click="tap">
<i class="el-icon-camera-solid"></i>
<div class="tool-item-content">
<div>{{detail.title}}</div>
<span>{{detail.desc}}</span>
</div>
<i class="el-icon-plus"></i>
</div>
</template>
<script>
export default {
props:{
detail: {
type: Object,
default: function () {
return { title:"", desc:"", type: "" }
}
}
},
data() {
return {};
},
methods: {
tap() {
this.$emit("click", this.detail.type)
}
},
}
</script>
<style lang="less" scoped>
.tool-item-container {
display: flex;
align-items: center;
border-radius: 3px;
border: 1px solid #eee;
padding: 15px;
width: 280px;
cursor: pointer;
}
.tool-item-content {
display: flex;
flex-direction: column;
flex: 1;
}
</style>
\ No newline at end of file
...@@ -3,7 +3,7 @@ import App from "./App.vue"; ...@@ -3,7 +3,7 @@ import App from "./App.vue";
import router from "./router"; import router from "./router";
import store from "./store"; import store from "./store";
import { Button, Drawer, Message, MessageBox, Row, Col, Form, import { Button, Drawer, Message, MessageBox, Row, Col, Form,
FormItem, Input, Menu, MenuItem, Submenu } from 'element-ui'; FormItem, Input, Menu, MenuItem, Submenu, Dropdown, DropdownItem, DropdownMenu, Select, Option, Tabs, TabPane, Tree } from 'element-ui';
Vue.config.productionTip = false; Vue.config.productionTip = false;
...@@ -18,6 +18,14 @@ Vue.use(MenuItem); ...@@ -18,6 +18,14 @@ Vue.use(MenuItem);
Vue.use(Input); Vue.use(Input);
Vue.use(Row); Vue.use(Row);
Vue.use(Submenu); Vue.use(Submenu);
Vue.use(Dropdown);
Vue.use(DropdownItem);
Vue.use(DropdownMenu);
Vue.use(Select);
Vue.use(Option);
Vue.use(Tabs);
Vue.use(TabPane);
Vue.use(Tree);
Vue.prototype.$confirm = MessageBox.confirm; Vue.prototype.$confirm = MessageBox.confirm;
......
...@@ -28,6 +28,18 @@ const routes = [ ...@@ -28,6 +28,18 @@ const routes = [
// next(); // next();
// } // }
}, },
{
path: "/course",
name: "Course",
component: () =>
import(/* webpackChunkName: "about" */ "../views/Course/index.vue"),
},
{
path: "/course/:type",
name: "CourseCreate",
component: () =>
import(/* webpackChunkName: "about" */ "../views/Course/create.vue"),
},
]; ];
const router = new VueRouter({ const router = new VueRouter({
...@@ -38,10 +50,11 @@ let isAuthenticated = false; ...@@ -38,10 +50,11 @@ let isAuthenticated = false;
// 全局的路由守卫 // 全局的路由守卫
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
isAuthenticated = localStorage.getItem('feidao_creation_token'); // isAuthenticated = localStorage.getItem('feidao_creation_token');
if (to.name !== 'Login' && !isAuthenticated) next({ name: 'Login' }) // if (to.name !== 'Login' && !isAuthenticated) next({ name: 'Login' })
else next() // else next()
next();
}) })
export default router; export default router;
...@@ -52,10 +52,11 @@ export default { ...@@ -52,10 +52,11 @@ export default {
submitForm(formName) { submitForm(formName) {
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
loginApi({ username:this.ruleForm.username, password: this.ruleForm.pass }).then((res=>{ // loginApi({ username:this.ruleForm.username, password: this.ruleForm.pass }).then((res=>{
localStorage.setItem('feidao_creation_token',1); // localStorage.setItem('feidao_creation_token',1);
// this.$router.push({name:'Home'});
// })).catch((err)=>{});
this.$router.push({name:'Home'}); this.$router.push({name:'Home'});
})).catch((err)=>{});
} else { } else {
console.log('error submit!!'); console.log('error submit!!');
return false; return false;
......
<template>
<div class="height_100p course-create">
<!-- <el-button @click="$router.go(-1)">返回</el-button> -->
<el-tabs tab-position="left" v-model="activeName" type="card" @tab-click="handleClick" class="create-tabs">
<el-tab-pane label="页面" name="first">
<el-row :gutter="0" class="height_100p">
<el-col :xs="6" :sm="6" :md="6" :lg="6" :xl="6" class="course-treelist">
<el-input
placeholder="搜索"
v-model="filterText">
</el-input>
<el-tree
class="filter-tree"
:data="trees"
:props="defaultProps"
default-expand-all
:filter-node-method="filterNode"
icon-class="el-icon-folder"
ref="tree">
<span class="custom-tree-node" slot-scope="{ node, data }">
<span>{{ node.label }}</span>
<span>
<!-- <el-button
type="text"
size="mini"
@click="() => append(data)">
Append
</el-button> -->
<el-dropdown>
<span class="el-dropdown-link">
<i class="el-icon-more"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item icon="el-icon-document-add" v-if="data.children">内容页</el-dropdown-item>
<el-dropdown-item icon="el-icon-folder-add" v-if="data.children">主题页</el-dropdown-item>
<el-dropdown-item icon="el-icon-picture-outline">样式</el-dropdown-item>
<el-dropdown-item icon="el-icon-picture-outline" v-if="!data.children">设为首页</el-dropdown-item>
<el-dropdown-item icon="el-icon-check">完成条件</el-dropdown-item>
<el-dropdown-item icon="el-icon-copy-document">复制</el-dropdown-item>
<el-dropdown-item icon="el-icon-copy-document" v-if="!data.children">删除</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</span>
</span>
</el-tree>
</el-col>
<el-col :xs="18" :sm="18" :md="18" :lg="18" :xl="18">
<div class="course-edit-inner padding_15 height_100p">
</div>
</el-col>
</el-row>
</el-tab-pane>
<el-tab-pane label="主题" name="second">主题</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
let id = 1000;
export default {
data() {
return {
activeName: 'first',
filterText: "",
trees: [{
id: 1,
label: '首页',
isFolder:'folder',
children: [{
id: 4,
label: '页面标题',
isFolder:'folder',
children: [{
id: 9,
label: '内容页2',
isFolder:'file'
}, {
id: 10,
label: '内容页2',
isFolder:'file'
}]
},{
id: 4,
label: '内容页1',
isFolder:'file'
}]
}],
defaultProps: {
children: 'children',
label: 'label'
}
}
},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
}
},
mounted() {
},
methods: {
handleClick(tab, event) {
console.log(tab, event);
},
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
append(data) {
const newChild = { id: id++, label: 'testtest', children: [] };
if (!data.children) {
this.$set(data, 'children', []);
}
data.children.push(newChild);
},
}
}
</script>
<style lang="less" >
.create-tabs {
height: 100%;
.el-tabs__content,.el-tab-pane {
height: 100%
}
.el-col {
height: 100%
}
}
.el-tabs__header.is-left {
border-right: 1px solid #E4E7ED;
}
.course-create .el-tree-node__content {
box-sizing: border-box;
display: flex;
align-items: center;
width: 200px;
.custom-tree-node {
flex: 1;
display: flex;
justify-content: space-between;
align-items: center;
}
}
.el-tree-node__expand-icon.is-leaf.el-icon-folder:before {
color: #000;
content: "\e7b3";
}
.course-treelist {
height: 100%;
border-right: 1px solid #eee;
}
.course-edit-inner {
background-color: #f5f7fa;
}
</style>
\ No newline at end of file
<template>
<div>
课程列表
</div>
</template>
<script>
export default {
}
</script>
<style>
</style>
\ No newline at end of file
...@@ -22,9 +22,55 @@ ...@@ -22,9 +22,55 @@
</nav> </nav>
<el-row :gutter="0" class="grid-row"> <el-row :gutter="0" class="grid-row">
<el-col :xs="8" :sm="6" :md="4" :lg="4" :xl="4"> <el-col :xs="8" :sm="6" :md="4" :lg="4" :xl="4">
<div class="grid-content home-left-nav"></div> <div class="grid-content home-left-nav">
<ul class="">
<li @click="menuTo('course')" :class="{bgc_ccc:locationName === 'course'}">
<i class="el-icon-set-up"></i>
<span class="padding_left15">课程</span>
</li>
<li class="botline_eee1" @click="menuTo('media')" :class="{bgc_ccc:locationName === 'media'}">
<i class="el-icon-s-management"></i>
<span class="padding_left15">媒体</span>
</li>
<li class="botline_eee1" @click="menuTo('upgrade')" :class="{bgc_ccc:locationName === 'upgrade'}">
<div>
<i class="el-icon-upload"></i>
<span class="padding_left15">无限课程的升级计划</span>
</div>
<el-button class="margin_15_0">升级</el-button>
</li>
<li @click="menuTo('share')" :class="{bgc_ccc:locationName === 'share'}">
<i class="el-icon-s-management"></i>
<span class="padding_left15">分享</span>
</li>
</ul>
</div>
</el-col>
<el-col :xs="16" :sm="6" :md="20" :lg="20" :xl="20">
<div class="grid-content home-content">
<div class="home-course-operate">
<div v-for="item in toolList" :key="item.type">
<ToolItem :detail="item" @click="courseToolClick"></ToolItem>
</div>
</div>
<div class="home-course-toolbar flex_jcbetween">
<div class="flex">
<div><i class="el-icon-menu"></i></div>
<div><i class="el-icon-s-fold"></i></div>
</div>
<div class="home-tool-search">
<el-input placeholder="请输入" v-model="courseKeyword" class="input-with-select" >
<el-select v-model="select" slot="prepend" placeholder="请选择" @change="changeSelect">
<el-option label="课程名" value="1"></el-option>
<el-option label="作者名" value="2"></el-option>
</el-select>
<el-button slot="append" icon="el-icon-search"></el-button>
</el-input>
</div>
</div>
<li-item @toolsEvent="courseItemClick"></li-item>
</div>
</el-col> </el-col>
<el-col :xs="16" :sm="6" :md="20" :lg="20" :xl="20"><div class="grid-content home-content"></div></el-col>
</el-row> </el-row>
</div> </div>
</template> </template>
...@@ -32,18 +78,36 @@ ...@@ -32,18 +78,36 @@
<script> <script>
// @ is an alias to /src // @ is an alias to /src
import { loginApi } from "@/libs/request/api.js"; import { loginApi } from "@/libs/request/api.js";
import LiItem from "@/components/Home/li-item.vue";
import ToolItem from "@/components/Home/tool-item.vue";
export default { export default {
name: "Home", name: "Home",
components: { components: {
// HelloWorld, LiItem,
ToolItem
}, },
data() { data() {
return { return {
drawer: false, drawer: false,
direction: 'rtl', direction: 'rtl',
currentLang: 'cn', currentLang: 'cn',
locationName:'course',
courseKeyword: '',
toolList: [
{
title:"创建新课程",
desc:"设计新课程",
type:"create"
},
{
title:"导入文件",
desc:"包括媒体、图像、视频、音频",
type:"importMedia"
}
],
courseKeyword: '', courseKeyword: '',
select: "课程名"
}; };
}, },
computed: { computed: {
...@@ -64,6 +128,9 @@ export default { ...@@ -64,6 +128,9 @@ export default {
return langName; return langName;
}, },
}, },
mounted() {
console.log(this.$refs.appcontainer)
},
methods: { methods: {
handleClose(done) { handleClose(done) {
console.log('click me') console.log('click me')
...@@ -84,6 +151,35 @@ export default { ...@@ -84,6 +151,35 @@ export default {
this.currentLang = 'en'; this.currentLang = 'en';
break; break;
} }
},
menuTo(type) {
switch(type) {
case 'course':
this.$router.push({name:'Course'});
break;
case 'media':
// this.$router.push({name:'media'});
break;
case 'upgrade':
// this.$router.push({name:'upgrade'});
break;
case 'share':
// this.$router.push({name:'share'});
break;
}
this.locationName = type;
},
courseItemClick(obj) {
this.$message('click on item '+ obj.type)
},
changeSelect(value) {
if(value == 1) this.select = "课程名";
else this.select = "作者名";
// this.$forceUpdate()
},
courseToolClick(type) {
if(type === "create") this.$router.push('course/create');
else this.$router.push({name:'media'});
} }
} }
}; };
...@@ -97,8 +193,35 @@ export default { ...@@ -97,8 +193,35 @@ export default {
} }
.home-left-nav { .home-left-nav {
border-right: 1px solid #ccc; border-right: 1px solid #ccc;
li {
padding: 20px;
cursor: pointer;
}
} }
.home-content { .home-content {
padding: 20px;
}
.home-course-operate {
display: flex;
align-items: center;
> div:not(:last-child) {
margin-right: 20px;
}
}
.home-course-toolbar {
display: flex;
align-items: center;
}
.el-select .el-input {
width: 130px;
}
.input-with-select .el-select {
width: 100px;
}
.input-with-select .el-input-group__prepend {
background-color: #fff;
}
.home-tool-search {
width: 300px;
} }
</style> </style>
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论