@@ -9,30 +9,244 @@ body {
font-family: 'Century Gothic';
}

.wrap1366 {
width: 1366px;
margin: auto;
}

.wrap1190 {
width: 1190px;
margin: auto;
}

.wrap970 {
width: 970px;
}

.wrap740 {
width: 740px;
}

.bg-light {
background-color: #f5f5f5;
}

.bg-default {
background-color: #022e77;
}

.container {
padding: 15px 15px;
}


/* header */
header.login {
height: 50px;
background-color: #022e77;
z-index: 100;
}

header.login div.logo img {
height: 50px;
}

/* my info */
header.mine {
/* index */
div.category ul.nav li a {
color: #333;
font-size: 1em;
padding: 15px 10px;
}

#index-slide {
width: 876px;
margin: auto;
}

div.board {
margin: 50px 0;
}

/* board hot-shop */
div.shop, div.brand {
border: 1px solid #eee;
margin: 20px 20px;
height: 300px;
}

#brand-slide {
height: 290px;
}

#brand-slide div.item img {
max-height: 298px;
display: inline-block;
}

#brand-slide div.item img:first-child {
width: 658px;
}

#brand-slide div.item img:last-child {
width: 400px;
margin-left: 30px;
border-left: 1px solid #eee;
}

#brand-slide a.carousel-control.left, #brand-slide a.carousel-control.right {
background: none;
}

div.shop div.image img {
width: 400px;
height: 300px;
}

div.shop div.items {
width: 600px;
heigth: 300px;
}

div.shop div.item {
width: 50%;
height: 50%;
padding: 10px 10px;
float: left;
}

div.shop div.item div.image {
border-right: 1px solid #eee;
float: left;
}

div.shop div.item div.image img {
width: 130px;
height: 130px;
}

div.shop div.item div.text {
width: 130px;
height: 130px;
padding: 50px 10px;
float: left;
}

div.text a {
color: #333;
text-decoration: none;
}

div.text a:hover {
color: #888;
}

div.products {
height: 850px;
margin: 20px 100px;
}

div.product {
width: 400px;
height: 400px;
}

/* left */
div.product:nth-child(2n+1) {
float: left;
}

/* right */
div.product:nth-child(2n) {
float: right;
}

/* bigger than 3, row2 - col1 */
div.product:nth-child(n+3) {
margin-top: 50px;
}

div.image-lg, div.image-sm {
width: auto;
}

div.image-lg img {
width: 300px;
height: 300px;
}

div.image-sm img {
width: 100px;
height: 100px;
display: block;
border: 1px solid #eee;
}

div.product div.image-sm img {
border-bottom: 1px solid #bbb;
}

div.product div.text {
width: 300px;
height: 100px;
padding: 15px 10px;
font-size: 1.2em;
}

div.product div.list {
width: 100px;
height: 100px;
}

div.product div.list ul.nav li a {
padding: 6px 10px;
text-align: center;
}

/* footer */
footer {
clear: both;
position: absolute;
left: 0;
right: 0;
height: 100px;
border-top: 5px solid #022e77;
margin-top: 100px;
font-size: 1.1em;
}

footer ul.nav {
width: 670px;
margin: auto;
}

footer ul.nav li {
float: left;
}

footer ul.nav li a {
color: #333;
}

footer ul.nav li a:hover, footer ul.nav li a:focus {
background-color: #fff;
color: #999;
}

footer div.copyright {
margin-top: 20px;
}

/* header nav */
header.nav {
padding: 12px 0;
top: 35px;
background-color: #022e77;
line-height: 35px;
}

header.mine div.logo img {
height: 35px;
header.nav div.nav {
min-width: 400px;
max-width: 700px;
}

header.mine > div {
div.logo img {
height: 35px;
}

@@ -41,7 +255,6 @@ div.search form {
}

div.nav {
line-height: 35px;
font-size: 1.5em;
}

@@ -55,11 +268,6 @@ div.nav ul li {
padding: 0 15px;
}

div.nav ul li ul.dropdown-menu {
width: 100%;
min-width: auto;
}

div.nav ul li ul.dropdown-menu li a {
color: #333;
}
@@ -80,14 +288,8 @@ div.nav ul li a:hover {
color: #eee;
}

div.fixed {
position: fixed;
}

div.top {
height: 35px;
background-color: #f5f5f5;
z-index: 1000;
border-bottom: 1px solid #eee;
}

@@ -118,11 +320,6 @@ a.btn-top:hover {
}

/* user manage page */
div.container {
top: 35px;
padding: 15px 15px;
}

div.sidebar ul.nav li {
border-top: 1px solid #eee;
}
@@ -260,3 +457,65 @@ section#login div.ellipse img, section#register div.ellipse img {
width: 30px;
height: 30px;
}

/* data-loading overlay */
.box .overlay {
background: rgba(255, 255, 255, 0.7) none repeat scroll 0 0;
border-radius: 3px;
z-index: 1010;
}
.box > .overlay, .box > .loading-img {
height: 50%;
left: 0;
position: absolute;
top: 50%;
width: 100%;
}
.box .overlay > .fa {
color: #000;
font-size: 30px;
left: 50%;
margin-left: -15px;
margin-top: -15px;
position: absolute;
top: 50%;
}

/* wysiwyg */
/* CSS for the font-name + font-size plugin */
.wysiwyg-plugin-list {
max-height: 16em;
overflow: auto;
overflow-x: hidden;
overflow-y: scroll;
}
.wysiwyg-plugin-list a,
.wysiwyg-plugin-list a:link,
.wysiwyg-plugin-list a:visited {
display: block;
color: black;
padding: 5px 10px;
text-decoration: none;
cursor: pointer;
}
.wysiwyg-plugin-list a:hover {
color: HighlightText;
background-color: Highlight;
}
/* CSS for the smiley plugin */
.wysiwyg-plugin-smilies {
padding: 10px;
text-align: center;
white-space: normal;
}
.wysiwyg-plugin-smilies img {
display: -moz-inline-stack; /* inline-block: http://blog.mozilla.org/webdev/2009/02/20/cross-browser-inline-block/ */
display: inline-block;
*display: inline;
}
.wysiwyg-input, .wysiwyg-browse {
height: auto;
}
.wysiwyg-editor {
height: 200px;
}
@@ -19,6 +19,8 @@
<link href="/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
<!-- Data Table -->
<link href="/plugins/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
<!-- wysiwyg 1.0.0 -->
<link href="/plugins/wysiwyg/css/wysiwyg-editor.min.css" rel="stylesheet" type="text/css" />
<!-- 前台默认样式 -->
<link href="/stylesheets/front/css/default.css" rel="stylesheet">

@@ -53,6 +55,10 @@
<script src="/plugins/jasny-bootstrap/js/jasny-bootstrap.min.js" type="text/javascript"></script>
<!-- Bootstrap-datepicker 1.5.0 JS -->
<script src="/plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js" type="text/javascript"></script>
<!-- wysiwyg 1.0.0 -->
<script src="/plugins/wysiwyg/js/wysiwyg.min.js" type="text/javascript"></script>
<!-- wysiwyg 1.0.0 -->
<script src="/plugins/wysiwyg/js/wysiwyg-editor.min.js" type="text/javascript"></script>
<!-- d3 -->
<script src="/plugins/d3/d3.v3.min.js"></script>
<!--ParknShop-->
@@ -1,8 +1,12 @@
<div class="container">
<div class="container" ng-controller="shopProduct">
<div class="col-xs-2">
<% include sidebar.ejs %>
</div>
<div class="col-xs-10" ng-controller="shopProduct">
<div class="col-xs-10">
<legend><%=title%>
<small class="pull-right text-danger hide"><i class="fa fa-info"></i> <span id="errorInfo"></span></small>
<small class="pull-right text-success hide"><i class="fa fa-info"></i> <span id="successInfo"></span></small>
</legend>
<div class="panel panel-info">
<div class="panel-body">
<form class="form-inline" name="filterForm">
@@ -30,7 +34,7 @@
<input type="text" class="form-control" name="endDate" ng-model="filterData.endDate" style="width:100px;"/>
</div>
</div>
<button type="submit" class="btn btn-default btn-sm" ng-click="load()">Go!</button>
<a class="btn btn-default btn-sm" ng-click="load()">Go!</a>
</form>
</div>
</div><!-- End panel -->
@@ -49,16 +53,24 @@
<th>Name</th>
<th>State</th>
<th>Shop Owner</th>
<th>Contact</th>
<th>Visits</th>
<th>Sale Data</th>
<th>Date</th>
<th>Operation</th>
</tr>
<tr class="datalist" ng-repeat="item in data">
<td><input type="checkbox" name="listItem" class="mini" value="" ng-click=""/></td>

<td><input type="checkbox" name="listItem" class="mini" value="{{item._id}}"/></td>
<td><a>{{item.name}}</a></td>
<td>{{item.state}}</td>
<td>{{item.shop.username}}</td>
<td>{{item.visits}}</td>
<td>{{item.name}}</td>
<td>{{item.date}}</td>
<td>
<button>Edit</button>
</td>
</tr>
<tr class="datalist" ng-show="!data.length"><td colspan="8" class="text-center"><h4>Nothing here.Add product first.</h4></td></tr>
</table>
</div><!-- /.box-body -->
<div class="box-footer">
@@ -70,23 +82,23 @@
</div>
</div><!-- /.box -->
</div>
<!--添加新用户模态窗口-->
<!--模态窗口-->
<div class="modal fade" id="productModal">
<div class="modal-dialog" style="width:1100px;">
<div class="modal-dialog" style="width:1000px;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">New Administrator</h4>
<h4 class="modal-title">New Product</h4>
</div>
<div class="modal-body">
<form role="form" class="form-horizontal" name="productForm" ng-submit="processForm(productForm.$valid)" novalidate>
<div class="alert alert-danger alert-dismissible hide" role="alert">
<div class="alert alert-danger alert-dismissible text-center hide" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<strong>Error!</strong> <span class="errorInfo">Some fields are invalid.</span>
<strong>Error!</strong> <span class="text">Some fields are invalid.</span>
</div>
<div class="form-group">
<label class="control-label col-sm-4">Name</label>
<div class="col-sm-6">
<div class="col-sm-4">
<input type="text" class="form-control" name="name" ng-model="formData.name" ng-minlength="2" ng-maxlength="30" required/>
<label for="inputError" class="control-label text-danger" ng-show="productForm.name.$invalid && !productForm.name.$pristine"><i class="fa fa-times-circle-o"></i> 2-30 letters</label>
</div>
@@ -95,59 +107,56 @@
<label class="control-label col-sm-4">Description</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="description" ng-minlength="4" ng-maxlength="100" ng-model="formData.description" required/>
<label for="inputError" class="control-label text-danger" ng-show="productForm.password.$invalid && !productForm.password.$pristine"><i class="fa fa-times-circle-o"></i>4-100 letters</label>
<label for="inputError" class="control-label text-danger" ng-show="productForm.description.$invalid && !productForm.description.$pristine"><i class="fa fa-times-circle-o"></i>4-100 letters</label>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4">Classify</label>
<div class="col-sm-6">
<select class="form-control input-sm">
<option value="" ng-show="cate_options">Choose a class</option>
<option value="" ng-show="!cate_options">There's no Classification.</option>
<option value="opt._id" ng-repeat="opt in cate_options">{{opt.name}}</option>
</select>
<div class="col-sm-4">
<select class="form-control input-sm" name="category_id" ng-model="formData.category_id" ng-options="x.me.name for x in cateOptions"></select>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4">Category</label>
<div class="col-sm-6">
<select class="form-control input-sm">
<option value="">Choose a category</option>
<option value="opt._id" ng-repeat="opt in shop_cate_options">{{opt.name}}</option>
</select>
<div class="col-sm-4">
<select class="form-control input-sm" name="shop_category_id" ng-model="formData.shop_category_id" ng-options="x.me.name for x in shopCateOptions"></select>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4">Storage</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="storage" ng-model="formData.storage" ng-pattern="/^[0-9][1-9]{1,11}$/" required/>
<div class="col-sm-3">
<input type="text" class="form-control" name="storage" ng-model="formData.storage" ng-pattern="/^[1-9][0-9]{0,11}$/" required/>
<label for="inputError" class="control-label text-danger" ng-show="productForm.storage.$invalid && !productForm.storage.$pristine"><i class="fa fa-times-circle-o"></i> 1-12 numbers</label>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4">Price</label>
<div class="col-sm-6">
<div class="col-sm-3">
<div class="input-group">
<div class="input-group-addon">$</div>
<input type="text" class="form-control input" name="startPrice" ng-model="formData.price"/>
<input type="text" class="form-control input" name="price" ng-model="formData.price" ng-minlength="1" ng-maxlength="12" ng-pattern="/^[1-9]+[\.]?[0-9]*$/" required/>
</div>
<label for="inputError" class="control-label text-danger" ng-show="productForm.price.$invalid && !productForm.price.$pristine"><i class="fa fa-times-circle-o"></i> 1-12 numbers, point allowed.</label>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4">Content</label>
<div class="col-sm-6">

<div class="col-sm-7">
<textarea id="editor" name="editor" placeholder="product content..."></textarea>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary" ng-disabled="productForm.$invalid">Submit</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div>
</form>
</div><!-- /.modal-body -->
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
</div><!-- End container -->

<script src="/plugins/wysiwyg/js/editor.js" type="text/javascript"></script>

<script>
$(function () {
@@ -160,23 +169,90 @@
});
App.controller('shopProduct', function ($scope, $http) {
'use strict';
$scope.filterData = {};
$scope.sortData = {};
url = '/api/v1/product';
$scope.shopInfo = {};
$scope.targetId = '';
var url = '/api/v1/product',
cateUrl = '/api/v1/category';
// shop info
$http.get('/api/v1/shop/mine').success(function (data) {
if (typeof data === 'object') {
$scope.shopInfo = data;
} else {
showErrorInfo('Get shop info failed.');
}
});
initPage($scope, $http, url, true);
$scope.load = function () {
// product data
loadData($scope, $http, url);
}
$scope.loadCate = function () {
// category
$http.get(cateUrl).success(function (data) {
if (data !== 'error') {
$scope.cateOptions = data;
$scope.cateOptions.unshift( { me: { name: 'Other', _id: '' } } );
} else {
showFormErrorInfo('Get system category failed.');
}
});
$http.get(cateUrl + '?shop_id=' + $scope.shopInfo._id).success(function (data) {
if (data !== 'error') {
$scope.shopCateOptions = data;
// for (var i = 0; i < data.length; i++) {
// $scope.shopCateOptions.push({ name: data[i].me.name, value: data[i].me._id });
// }
} else {
showFormErrorInfo('Get shop category failed.');
}
});
};
// $scope.load();
$scope.processForm = function (isValid) {
if (isValid) {
$scope.formData.content = $.trim($('.wysiwyg-editor').html());
var cid = $scope.formData.category_id;
//$scope.formData.category_id = cid ? cid.value
console.log($scope.formData);return;
var method = 'PUT';
if ($scope.targetId) {
method = 'POST';
}
augularHttp($http, method, url, $scope.formData, function (data) {
if (data === 'success') {
$scope.load();
}
});
} else {
$("form[name='productForm'] div.alert").removeClass('hide');
showFormErrorInfo('Some fields are invalid.');
return false;
}
};
$("#productModal").on('show.bs.modal', function (event) {
$scope.loadCate();
if ($scope.targetId) {
} else {
}
}).on('hidden.bs.modal', function (event) {
$scope.formData = {};
$scope.targetId = '';
});
function showFormErrorInfo(info) {
$("form[name='productForm'] div.alert").removeClass('hide').find('span.text').text(info);
}
});
</script>