Commit 2e433086 authored by 杨培's avatar 杨培

最课堂发布界面

parent 1747e9f6
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "course".
*
* @property integer $id
* @property integer $cla_id
* @property string $name
* @property integer $price
* @property integer $free_time
* @property string $intro
* @property string $preview_pic
* @property integer $recommend
* @property integer $status
* @property string $create_at
* @property string $update_at
*
* @property BrowseRecord[] $browseRecords
* @property Classes $cla
* @property Courseware[] $coursewares
* @property Orders[] $orders
*/
class Course extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'course';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id', 'cla_id', 'name', 'price', 'free_time', 'intro', 'preview_pic', 'recommend', 'status', 'create_at', 'update_at'], 'required'],
[['id', 'cla_id', 'price', 'free_time', 'recommend', 'status'], 'integer'],
[['intro'], 'string'],
[['create_at', 'update_at'], 'safe'],
[['name'], 'string', 'max' => 32],
[['preview_pic'], 'string', 'max' => 64],
[['cla_id'], 'exist', 'skipOnError' => true, 'targetClass' => Classes::className(), 'targetAttribute' => ['cla_id' => 'id']],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'cla_id' => 'Cla ID',
'name' => 'Name',
'price' => 'Price',
'free_time' => 'Free Time',
'intro' => 'Intro',
'preview_pic' => 'Preview Pic',
'recommend' => 'Recommend',
'status' => 'Status',
'create_at' => 'Create At',
'update_at' => 'Update At',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getBrowseRecords()
{
return $this->hasMany(BrowseRecord::className(), ['cou_id' => 'id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getCla()
{
return $this->hasOne(Classes::className(), ['id' => 'cla_id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getCoursewares()
{
return $this->hasMany(Courseware::className(), ['cou_id' => 'id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getOrders()
{
return $this->hasMany(Orders::className(), ['cou_id' => 'id']);
}
}
<?php <?php
namespace frontend\assets; namespace frontend\assets;
use yii\web\AssetBundle; use yii\web\AssetBundle;
use yii\web\View; use yii\web\View;
use Yii; use \Yii;
/** /**
* Main frontend application asset bundle. * Main frontend application asset bundle.
*/ */
...@@ -12,15 +12,18 @@ class AppAsset extends AssetBundle ...@@ -12,15 +12,18 @@ class AppAsset extends AssetBundle
{ {
public $basePath = '@webroot/assets'; public $basePath = '@webroot/assets';
public $baseUrl = '@web/assets'; public $baseUrl = '@web/assets';
public $css = [ public $css = [
'css/site.css', 'css/style.css'
]; ];
public $js = [ public $js = [
['common/common.js', 'position' => View::POS_BEGIN] ['common/common.js', 'position' => View::POS_HEAD]
]; ];
public $depends = [ public $depends = [
// 'yii\web\YiiAsset', //'yii\web\YiiAsset',
// 'yii\bootstrap\BootstrapAsset', 'yii\bootstrap\BootstrapAsset'
]; ];
//定义按需加载JS方法,注意加载顺序在最后 //定义按需加载JS方法,注意加载顺序在最后
......
<?php <?php
namespace frontend\controllers; namespace frontend\controllers;
use frontend\models\CoursePublishForm;
class MyCourseController extends \yii\web\Controller class MyCourseController extends \yii\web\Controller
{ {
public $layout = 'user-center';
public function actionIndex() public function actionIndex()
{ {
return $this->render('index'); return $this->render('index');
} }
public function actionPublish()
{
$model = new CoursePublishForm();
return $this->render('publish', compact('model'));
}
} }
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 16/9/28
* Time: 17:43
*/
namespace frontend\models;
class CoursePublishForm extends \yii\base\Model
{
public $name;
public $teacher;
public $video;
public $price;
public $free_time;
public $intro;
public $preview;
public $recommend;
public function rules()
{
return [
];
}
}
\ No newline at end of file
...@@ -12,7 +12,7 @@ use common\models\User; ...@@ -12,7 +12,7 @@ use common\models\User;
class LoginForm extends Model class LoginForm extends Model
{ {
const MAX_LOGIN_NUM = 5; const MAX_LOGIN_NUM = 5;
const LOGIN_CYCLE = 15 * 60;//second const LOGIN_CYCLE = 900; //second
const REDIS_KEY_PREFIX = 'login_ip'; const REDIS_KEY_PREFIX = 'login_ip';
public $telephone; public $telephone;
public $password; public $password;
......
...@@ -11,6 +11,7 @@ use frontend\assets\AppAsset; ...@@ -11,6 +11,7 @@ use frontend\assets\AppAsset;
use common\widgets\Alert; use common\widgets\Alert;
AppAsset::register($this); AppAsset::register($this);
AppAsset::addCss($this, '@web/assets/css/site.css');
?> ?>
<?php $this->beginPage() ?> <?php $this->beginPage() ?>
<!DOCTYPE html> <!DOCTYPE html>
......
<?php
use yii\helpers\Html;
use frontend\assets\AppAsset;
/* @var $this \yii\web\View */
/* @var $content string */
AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?=Yii::$app->language?>">
<head>
<meta charset="<?=Yii::$app->charset?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><?=$this->title ? Html::encode($this->title).'-' : ''?>最课堂</title>
<?=Html::csrfMetaTags()?>
<?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<div class="tp-sidebar">
<div class="logo"><a href="/"><img src="<?=Yii::$app->assetManager->baseUrl?>/img/logo.png"></a></div>
<div class="side-menu">
<!-- Contenedor -->
<ul id="accordion" class="accordion">
<li>
<div class="link"><i class="icon-palette"></i>我的课堂<i class="icon-navigate_next"></i></div>
<ul class="submenu">
<li class="active"><a href="#">课堂概况</a></li>
<li><a href="#">讲师管理</a></li>
</ul>
</li>
<li>
<div class="link"><i class="icon-ondemand_video"></i>我的课程<i class="icon-navigate_next"></i></div>
<ul class="submenu">
<li><a href="#">发布课程</a></li>
<li><a href="#">课程列表</a></li>
</ul>
</li>
<li>
<div class="link"><i class="icon-fingerprint"></i>我的会员<i class="icon-navigate_next"></i></div>
<ul class="submenu">
<li><a href="#">会员列表</a></li>
</ul>
</li>
<li><div class="link"><i class="icon-bell"></i>知识有价<i class="icon-navigate_next"></i></div>
<ul class="submenu">
<li><a href="#">购买记录</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="auto-main">
<div class="tp-head navbar-fixed-top clearfix">
<div class="menu-btn fl"><a href="#"><i class="icon-menu"></i></a></div>
<div class="avatar fr"><a href="#"><img src="<?=Yii::$app->assetManager->baseUrl?>/img/avatar.jpg"></a></div>
</div>
<div class="tp-main">
<div class="container">
<?=$content?>
</div>
</div>
</div>
<div class="foot navbar-fixed-bottom">
<p><a href="#">隐私权政策</a> - <a href="#">服务条款</a> - <a href="#">地图条款</a></p>
<p>©2016 Zuiketang.com</p>
</div>
<script>
$(function() {
var Accordion = function(el, multiple) {
this.el = el || {};
this.multiple = multiple || false;
// Variables privadas
var links = this.el.find('.link');
// Evento
links.on('click', {el: this.el, multiple: this.multiple}, this.dropdown)
}
Accordion.prototype.dropdown = function(e) {
var $el = e.data.el;
$this = $(this),
$next = $this.next();
$next.slideToggle();
$this.parent().toggleClass('open');
if (!e.data.multiple) {
$el.find('.submenu').not($next).slideUp().parent().removeClass('open');
};
}
var accordion = new Accordion($('#accordion'), false);
});
</script>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>
<?php
use frontend\assets\AppAsset;
/*
* @var $this yii\web\View
* @var $form yii\widgets\ActiveForm
* @var $model frontend\models\CoursePublishForm
*/
$this->title = '发布课程';
AppAsset::addScript($this, '@web/assets/course_publish.js');
?>
<div class="send-class">
<div class="tit">发布课程</div>
<form method="post" name="coursePublish">
<div class="cls-part">
<div class="tit">标题</div>
<input type="text" class="input-r-control" placeholder="请输入课程标题,20 个汉字以内...">
</div>
<div class="cls-part teacher-list">
<div class="tit">讲师</div>
<div class="checkbox">
<label>
<input type="checkbox">杨佩佩
</label>
<label class="m-l-10">
<input type="checkbox">马骏
</label>
<label class="m-l-10">
<input type="checkbox">花木兰
</label>
<label class="m-l-10">
<input type="checkbox">张海
</label>
<span class="m-l-10"><a href="#">+ 添加讲师</a></span>
</div>
</div>
<div class="cls-part">
<div class="tit">上传视频</div>
<div class="upload-video-btn hide">
<input type="file">
<i class="icon-play"></i>
<b>上传视频</b>
</div>
<div class="upload-ready">
<h3>IMG_0760</h3>
<div class="video-detail">视频大小:300M 时常:45分钟</div>
<div class="video-loading-text clearfix">
<div class="upload pull-left">已上传 20.8%</div>
<div class="time pull-right">大约还剩 39 秒</div>
</div>
<i></i>
</div>
</div>
<div class="cls-part">
<div class="tit">规则设定</div>
<div class="clearfix">
<div class="checkbox rules-set fl">
<label class="clearfix">
<input type="checkbox" class="fl"><span>会员价</span> <input type="text" class="input-r-control"> <span>元</span>
</label>
</div>
<div class="checkbox rules-set m-l-20 fl">
<label class="clearfix">
<input type="checkbox" class="fl"><span>免费试看</span> <input type="text" class="input-r-control"> <span>分钟</span>
</label>
</div>
</div>
</div>
<div class="cls-part">
<div class="tit">课程介绍</div>
<div class="cls-intro-textarea">
<textarea name="" id="" class="input-r-control" placeholder="请输入课程介绍..."></textarea>
</div>
</div>
<div class="cls-part">
<div class="tit">缩略图 <small>建议尺寸:900像素 * 500像素</small></div>
<div class="upload-video-screen">
<input type="file">
<i class="icon-image"></i>上传缩略图
</div>
</div>
<div class="cls-part p-b-20">
<div class="tit">课程属性</div>
<div class="checkbox">
<label>
<input type="checkbox">推荐课程
</label>
</div>
</div>
<div class="btn-box text-center" style="border-top: 1px solid #e7e7e7; margin-top: 10px; ">
<button class="btn btn-nobg">取消</button>
<button class="btn btn-save m-l-10">保存</button>
</div>
</form>
</div>
\ No newline at end of file
This diff is collapsed.
@charset "utf-8";
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */
/* Html5 */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
nav,
section,
summary {
display: block;
}
audio,
canvas,
video {
display: inline-block;
}
audio:not([controls]) {
display: none;
height: 0;
}
/* Base */
html, body {
font: 12px/22px "微软雅黑", "\5b8b\4f53", Arial, sans-serif;
background-color: #e3e4e7;
}
html, body {
width: 100%;
}
html {
color: #666;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
* {
margin: 0;
padding: 0;
}
a {
text-decoration: none;
background: transparent;
outline: none;
blr: expression(this.onFocus=this.blur());
}
a:focus {
outline: 0;
}
a:active,
a:hover {
outline: 0;
text-decoration: none;
}
img {
border: 0;
vertical-align: middle;
-ms-interpolation-mode: bicubic;
transition: transform 1s;
}
img.hover {
transform: scale(1.15);
}
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/*margin padding*/
.m-l-10 {
margin-left: 10px;
}
.m-l-20 {
margin-left: 20px;
}
.p-b-20 {
padding-bottom: 20px;
}
/* legend */
button,
input,
select,
textarea {
font-family: inherit;
font-size: 100%;
margin: 0;
outline: none;
}
button,
input {
line-height: normal;
}
button,
select {
text-transform: none;
}
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button;
cursor: pointer;
}
button[disabled],
html input[disabled] {
cursor: default;
}
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box;
padding: 0;
}
input[type="search"] {
-webkit-appearance: textfield;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
input.submit {
cursor: pointer;
}
input.radio {
width: 13px;
height: 13px;
}
input[type="text"],
input[type="number"] {
-webkit-appearance: none;
}
textarea {
overflow: auto;
vertical-align: top;
resize: none;
-webkit-appearance: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
ul,
ol,
li {
list-style: none;
float: left;
}
i, em {
font-style: normal;
}
/* clear */
.fl {
float: left;
}
.fr {
float: right;
}
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden
}
/*icomoon*/
@font-face {
font-family: 'icomoon';
src: url('fonts/icomoon.eot?lylu0j');
src: url('fonts/icomoon.eot?lylu0j#iefix') format('embedded-opentype'),
url('fonts/icomoon.ttf?lylu0j') format('truetype'),
url('fonts/icomoon.woff?lylu0j') format('woff'),
url('fonts/icomoon.svg?lylu0j#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
[class^="icon-"], [class*=" icon-"] {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: 'icomoon' !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-add:before {
content: "\e145";
}
.icon-arrow_drop_down:before {
content: "\e5c5";
}
.icon-arrow_drop_up:before {
content: "\e5c7";
}
.icon-chat:before {
content: "\e0b7";
}
.icon-chat_bubble:before {
content: "\e0ca";
}
.icon-chat_bubble_outline:before {
content: "\e0cb";
}
.icon-navigate_before:before {
content: "\e408";
}
.icon-navigate_next:before {
content: "\e409";
}
.icon-cloud_done:before {
content: "\e2bf";
}
.icon-cloud_download:before {
content: "\e2c0";
}
.icon-palette:before {
content: "\e40a";
}
.icon-mode_edit:before {
content: "\e254";
}
.icon-create_new_folder:before {
content: "\e2cc";
}
.icon-crop_original:before {
content: "\e3c4";
}
.icon-fingerprint:before {
content: "\e90d";
}
.icon-ondemand_video:before {
content: "\e63a";
}
.icon-slideshow:before {
content: "\e41b";
}
.icon-verified_user:before {
content: "\e8e8";
}
.icon-eye:before {
content: "\e000";
}
.icon-paper-clip:before {
content: "\e001";
}
.icon-mail:before {
content: "\e002";
}
.icon-link:before {
content: "\e005";
}
.icon-bell:before {
content: "\e006";
}
.icon-lock:before {
content: "\e007";
}
.icon-unlock:before {
content: "\e008";
}
.icon-ribbon:before {
content: "\e009";
}
.icon-image:before {
content: "\e010";
}
.icon-signal:before {
content: "\e011";
}
.icon-clipboard:before {
content: "\e013";
}
.icon-clock:before {
content: "\e014";
}
.icon-camera:before {
content: "\e017";
}
.icon-video:before {
content: "\e018";
}
.icon-cog:before {
content: "\e023";
}
.icon-heart:before {
content: "\e024";
}
.icon-layers:before {
content: "\e031";
}
.icon-stack-2:before {
content: "\e033";
}
.icon-paper:before {
content: "\e034";
}
.icon-microphone:before {
content: "\e048";
}
.icon-play:before {
content: "\e052";
}
.icon-folder:before {
content: "\e059";
}
.icon-cloud-upload:before {
content: "\e066";
}
.icon-cloud-download:before {
content: "\e067";
}
.icon-upload:before {
content: "\e068";
}
.icon-location:before {
content: "\e070";
}
.icon-speech-bubble:before {
content: "\e076";
}
.icon-arrow-left:before {
content: "\e094";
}
.icon-arrow-right:before {
content: "\e095";
}
.icon-arrow-up:before {
content: "\e096";
}
.icon-arrow-down:before {
content: "\e097";
}
.icon-trash:before {
content: "\e109";
}
.icon-check:before {
content: "\e116";
}
.icon-cross:before {
content: "\e117";
}
.icon-menu:before {
content: "\e120";
}
This diff is collapsed.
/**
* Created by pader on 16/9/28.
*/
var validation = require('jquery-validation');
var form = document.forms["coursePublish"];
$(form).validate();
\ No newline at end of file
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
}, },
"dependencies": { "dependencies": {
"jquery": "~2.2.2", "jquery": "~2.2.2",
"jquery-validation": "^1.15.1",
"moment": "^2.13.0", "moment": "^2.13.0",
"vue": "^1.0.8" "vue": "^1.0.8"
} }
......
...@@ -11,12 +11,13 @@ var ExtractTextPlugin = require("extract-text-webpack-plugin"); ...@@ -11,12 +11,13 @@ var ExtractTextPlugin = require("extract-text-webpack-plugin");
var entry = { var entry = {
vendor: ["jquery", "vue", js_dir + "/utils/layer"], vendor: ["jquery", "vue", js_dir + "/utils/layer"],
site: [css_dir + '/site.css'], site: [css_dir + '/site.css'],
style: [css_dir + '/reset.css', css_dir + '/style.css'],
signup: [js_dir + '/site/signup.js'], signup: [js_dir + '/site/signup.js'],
login: [js_dir + '/site/login.js'], login: [js_dir + '/site/login.js'],
request_password_reset: [js_dir + '/site/request_password_reset'] request_password_reset: [js_dir + '/site/request_password_reset'],
course_publish: [js_dir + '/my-course/publish.js']
}; };
var config = { var config = {
entry: entry, entry: entry,
output: { output: {
...@@ -62,7 +63,7 @@ var config = { ...@@ -62,7 +63,7 @@ var config = {
new CopyWebpackPlugin([ new CopyWebpackPlugin([
// {from: __dirname + '/resource', to: 'resource'}, // {from: __dirname + '/resource', to: 'resource'},
{from: lib_dir + '/layer', to: 'layer'}, {from: lib_dir + '/layer', to: 'layer'},
// {from: img_dir, to: 'img'}, {from: img_dir, to: 'img'},
// {from: manage_dir + '/dist', to: 'manage/dist'}, // {from: manage_dir + '/dist', to: 'manage/dist'},
// {from: manage_dir + '/plugins', to: 'manage/plugins'}, // {from: manage_dir + '/plugins', to: 'manage/plugins'},
// {from: manage_dir + '/bootstrap', to: 'manage/bootstrap'} // {from: manage_dir + '/bootstrap', to: 'manage/bootstrap'}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment