mirror of
https://gitee.com/doramart/DoraCMS.git
synced 2024-12-04 21:27:52 +08:00
重新整理分页并修复angularJs产生的报错
This commit is contained in:
parent
c6ad107a5a
commit
9a5fa14fe5
@ -65,7 +65,7 @@ module.exports = {
|
||||
site_email : 'xx@163.com',
|
||||
site_email_psd : 'xxx',
|
||||
email_findPsd : 'findPsd',
|
||||
email_reg_active : 'reg_active'
|
||||
email_reg_active : 'reg_active',
|
||||
email_notice_contentMsg : 'notice_contentMsg',
|
||||
email_notice_user_contentMsg : 'notice_user_contentMsg'
|
||||
};
|
||||
|
@ -9,6 +9,8 @@ var ContentCategory = require("../ContentCategory");
|
||||
var ContentTags = require("../ContentTags");
|
||||
//广告对象
|
||||
var Ads = require("../Ads");
|
||||
//留言对象
|
||||
var Message = require("../Message");
|
||||
var settings = require("./settings");
|
||||
//数据库操作对象
|
||||
var DbOpt = require("../Dbopt");
|
||||
@ -88,6 +90,10 @@ var siteFunc = {
|
||||
return Ads.find({'category': 'friendlink'});
|
||||
},
|
||||
|
||||
getMessageList : function(contentId){
|
||||
return Message.find({'contentId' : contentId})
|
||||
},
|
||||
|
||||
setDataForIndex: function (req, res, q, title) {
|
||||
var requireField = 'title date commentNum discription sImg';
|
||||
var documentList = DbOpt.getPaginationResult(Content, req, res, q, requireField);
|
||||
@ -128,17 +134,18 @@ var siteFunc = {
|
||||
}
|
||||
},
|
||||
|
||||
setDetailInfo: function (req, res, cateQuery, docs) {
|
||||
setDetailInfo: function (req, res, cateQuery, doc) {
|
||||
var currentCateList = ContentCategory.find(cateQuery).sort({'sortId': 1});
|
||||
var tagsData = DbOpt.getDatasByParam(ContentTags, req, res, {});
|
||||
return {
|
||||
siteConfig: siteFunc.siteInfos(docs.title, docs.discription, docs.keywords),
|
||||
siteConfig: siteFunc.siteInfos(doc.title, doc.discription, doc.keywords),
|
||||
cateTypes: siteFunc.getCategoryList(),
|
||||
currentCateList: currentCateList,
|
||||
hotItemListData: siteFunc.getHotItemListData({}),
|
||||
newItemListData: siteFunc.getNewItemListData({}),
|
||||
friendLinkData: siteFunc.getFriendLink(),
|
||||
documentInfo: docs,
|
||||
documentInfo: doc,
|
||||
messageList : siteFunc.getMessageList(doc._id),
|
||||
pageType: 'detail',
|
||||
logined: isLogined(req),
|
||||
layout: 'web/public/defaultTemp'
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!--用户登录模块-->
|
||||
<!--通过邮箱找回密码模块-->
|
||||
<div class="conformBoard" ng-controller="confirmEmail">
|
||||
<form name="confirmEmailForm" ng-submit="processConfirmEmailForm(confirmEmailForm.$valid)" novalidate>
|
||||
<div class="alert alert-info">请输入您的用户名或电子邮箱地址。您会收到一封包含创建新密码链接的电子邮件。</div>
|
||||
@ -16,6 +16,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var doraApp = angular.module("webApp",[]);
|
||||
doraApp.controller("confirmEmail",function($scope,$http) {
|
||||
$scope.processConfirmEmailForm = function(isValid){
|
||||
|
||||
|
@ -14,8 +14,6 @@
|
||||
<link href="/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
||||
<script src="/javascripts/bootstrap.min.js" type="text/javascript"></script>
|
||||
|
||||
|
||||
<script src="/javascripts/angular.min.js"></script>
|
||||
<script src="/javascripts/dora.public.js" type="text/javascript"></script>
|
||||
<link href="/stylesheets/front/css/white.css" rel="stylesheet">
|
||||
|
||||
@ -31,7 +29,7 @@
|
||||
|
||||
</head>
|
||||
|
||||
<body ng-app="webApp">
|
||||
<body>
|
||||
<%- include header %>
|
||||
|
||||
|
||||
|
@ -1,7 +1,4 @@
|
||||
<!--头部模板-->
|
||||
<script>
|
||||
var doraApp = angular.module("webApp",[]);
|
||||
</script>
|
||||
<header class="clearfix" id="header">
|
||||
<div class="container">
|
||||
<div class="text-right topNav">
|
||||
|
@ -20,6 +20,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var doraApp = angular.module("webApp",[]);
|
||||
doraApp.controller("userlogin",function($scope,$http) {
|
||||
$scope.processLogForm = function(isValid){
|
||||
|
||||
|
@ -1,19 +1,23 @@
|
||||
<!--留言板模块-->
|
||||
<script src="/javascripts/angular.min.js"></script>
|
||||
<%if(logined){%>
|
||||
<input type="hidden" value="<%=userInfo._id%>" id="uid"/>
|
||||
<input type="hidden" value="<%=userInfo.userName%>" id="uName"/>
|
||||
<input type="hidden" value="<%=userInfo.logo%>" id="ulogo"/>
|
||||
<input type="hidden" value="<%=userInfo.email%>" id="uEmail"/>
|
||||
<%}%>
|
||||
<div ng-controller="msgBoard" class="msgBoard">
|
||||
<div class="msgBoard" ng-app="webApp">
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12 msgList" ng-repeat="msg in messageList">
|
||||
<%messageList.forEach(function(item){%>
|
||||
<div class="col-md-12 col-sm-12 msgList">
|
||||
|
||||
<h3 class="media-heading"><a href="###">{{msg.uName}}</a> <span><small>{{msg.date | date:"yyyy-MM-dd" }}</small> <a href="###" ng-click="replyMsg(msg.uName,msg.uid,msg.uEmail)" class="pull-right reply">回复</a></span></h3>
|
||||
<p>{{msg.content}}</p>
|
||||
<h3 class="media-heading"><a href="###"><%=item.uName%></a> <span><small><%=myDateFormat(item.date)%></small> <a href="###" class="pull-right reply">回复</a></span></h3>
|
||||
<p><%=item.content%></p>
|
||||
|
||||
</div>
|
||||
<%})%>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row" ng-controller="msgBoard">
|
||||
<div class="col-md-12 col-sm-12 giveMsg">
|
||||
<h3>添加新评论</h3>
|
||||
<div class="txt-area">
|
||||
@ -32,15 +36,13 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
var doraApp = angular.module("webApp",[]);
|
||||
doraApp.controller('msgBoard',function($scope,$http){
|
||||
|
||||
$scope.msgFormData = {};
|
||||
var detailId = '<%=documentInfo._id%>';
|
||||
var loginState = '<%=logined%>';
|
||||
$scope.msgFormData.contentId = '<%=documentInfo._id%>';
|
||||
$scope.msgFormData.contentTitle = '<%=documentInfo.title%>';
|
||||
getMsgData($scope,$http,detailId);
|
||||
|
||||
$scope.sentMsgForm = function(isValid){
|
||||
|
||||
@ -62,7 +64,7 @@
|
||||
})
|
||||
.success(function(data) {
|
||||
if(data === "success"){
|
||||
getMsgData($scope,$http,detailId);
|
||||
window.location.reload();
|
||||
}else{
|
||||
alert("未知异常,请稍后重试");
|
||||
}
|
||||
@ -88,16 +90,4 @@
|
||||
}
|
||||
});
|
||||
|
||||
function getMsgData($scope,$http,detailId){
|
||||
$scope.messageList = {};
|
||||
$('.msgList').hide();
|
||||
$http.get('/users/message/getlist?contentId='+detailId).success(function(result){
|
||||
if(result.length > 0){
|
||||
$('.msgList').show();
|
||||
$scope.messageList = result;
|
||||
// 清空留言信息
|
||||
$scope.msgFormData.content = "";
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
@ -1,36 +1,47 @@
|
||||
<!--分页模块-->
|
||||
<div class="pagenation text-center" ng-controller="pagenation">
|
||||
<div class="pagenation text-center">
|
||||
<ul>
|
||||
<li ng-class="{true:'hide'}[currentPage==1]"><a href="javascript:void(0);" ng-click="prevPage()">上一页</a></li>
|
||||
<li ng-repeat="page in pages" ng-class="{true:'active'}[currentPage==page]"><a href="javascript:void(0);" ng-click="loadPage(page)">{{ page }}</a></li>
|
||||
<li ng-class="{true:'hide'}[currentPage==totalPage]"><a href="javascript:void(0);" ng-click="nextPage()">下一页</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
doraApp.controller("pagenation",function($scope,$http) {
|
||||
|
||||
$scope.currentPage = Number('<%=pageInfo.currentPage%>');
|
||||
$scope.totalItems = Number('<%=pageInfo.totalItems%>');
|
||||
$scope.limit = Number('<%=pageInfo.limit%>');
|
||||
$scope.startNum = Number('<%=pageInfo.startNum%>');
|
||||
$scope.totalPage = Math.ceil($scope.totalItems / $scope.limit);
|
||||
$scope.pages = [];
|
||||
|
||||
var localUrl = "";
|
||||
var param = "";
|
||||
var pageType = '<%=pageType%>';
|
||||
if(pageType == 'index'){
|
||||
localUrl = "/page";
|
||||
<%var localUrl;var param ='';%>
|
||||
<%if(pageType == 'index'){
|
||||
localUrl = "/page";
|
||||
}else if(pageType == 'cate'){
|
||||
localUrl = "/<%=cateInfo.defaultUrl%>___<%=cateInfo._id%>";
|
||||
localUrl = '/'+ cateInfo.defaultUrl + '___' + cateInfo._id;
|
||||
}else if(pageType == 'search'){
|
||||
param = "?searchKey=<%=pageInfo.searchKey%>";
|
||||
localUrl = "/content/searchResult/items";
|
||||
param = '?searchKey=' + pageInfo.searchKey;
|
||||
localUrl = '/content/searchResult/items';
|
||||
}
|
||||
%>
|
||||
|
||||
<%var totalItems = pageInfo.totalItems;var limit = pageInfo.limit%>
|
||||
<%var totalPage = Math.ceil(totalItems / limit) ;%>
|
||||
|
||||
initPagination($scope,$http,localUrl,param);
|
||||
})
|
||||
</script>
|
||||
<%
|
||||
var page_start = pageInfo.currentPage - 2 > 0 ? pageInfo.currentPage - 2 : 1;
|
||||
var page_end = page_start + 4 >= totalPage ? totalPage : page_start + 4;
|
||||
%>
|
||||
|
||||
<%if(pageInfo.currentPage != 1){%>
|
||||
<li><a href="<%=localUrl%>—1.html<%=param%>">«</a></li>
|
||||
<%}%>
|
||||
|
||||
<% if (page_start > 1) { %>
|
||||
<li><a>...</a></li>
|
||||
<% } %>
|
||||
|
||||
<%for(var i=page_start;i<=page_end;i++){%>
|
||||
<%if(i == pageInfo.currentPage){%>
|
||||
<li class="active"><a><%=i%></a></li>
|
||||
<%}else{%>
|
||||
<li><a href="<%=localUrl%>—<%=i%>.html<%=param%>"><%=i%></a></li>
|
||||
<%}%>
|
||||
<%}%>
|
||||
|
||||
<% if (page_end < totalPage ) { %>
|
||||
<li><a>...</a></li>
|
||||
<% } %>
|
||||
|
||||
<%if(pageInfo.currentPage != totalPage){%>
|
||||
<li><a href="<%=localUrl%>—<%=totalPage%>.html<%=param%>">»</a></li>
|
||||
<%}%>
|
||||
</ul>
|
||||
</div>
|
@ -22,6 +22,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var doraApp = angular.module("webApp",[]);
|
||||
doraApp.controller("reSetPsd",function($scope,$http) {
|
||||
$scope.processReSetPsdForm = function(isValid){
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
<!--用户注册模块-->
|
||||
<div class="regBoard" ng-controller="userReg">
|
||||
|
||||
|
||||
<form name="regForm" ng-submit="processRegForm(regForm.$valid)" novalidate>
|
||||
<h3>用户注册 <small class="text-danger hide" id="errorInfo">邮箱格式不正确</small></h3>
|
||||
<div class="form-group">
|
||||
@ -34,6 +32,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var doraApp = angular.module("webApp",[]);
|
||||
doraApp.controller("userReg",function($scope,$http) {
|
||||
|
||||
$scope.processRegForm = function (isValid) {
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
|
||||
<script>
|
||||
var doraApp = angular.module("webApp",[]);
|
||||
doraApp.controller("setUserPsd",function($scope,$http) {
|
||||
// 重置密码
|
||||
$scope.processReSetForm = function(isValid){
|
||||
|
@ -86,6 +86,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var doraApp = angular.module("webApp",[]);
|
||||
doraApp.controller("userInfo",function($scope,$http) {
|
||||
$scope.targetId = "<%= userInfo._id%>";
|
||||
if($scope.targetId){
|
||||
|
@ -1,5 +1,6 @@
|
||||
<!--用户中心-->
|
||||
<div class="container">
|
||||
<script src="/javascripts/angular.min.js"></script>
|
||||
<div class="container" ng-app="webApp">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-9 left-frame">
|
||||
<% include ../public/uInfo %>
|
||||
|
@ -1,4 +1,6 @@
|
||||
<div class="container">
|
||||
<!--确认邮箱-->
|
||||
<script src="/javascripts/angular.min.js"></script>
|
||||
<div class="container" ng-app="webApp">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-4 col-md-offset-4 min-hight" style="margin-top: 50px;">
|
||||
<% include ../public/confirmEmail %>
|
||||
|
@ -1,8 +1,8 @@
|
||||
<div class="container">
|
||||
<script src="/javascripts/angular.min.js"></script>
|
||||
<div class="container" ng-app="webApp">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-4 col-md-offset-4 min-hight" style="margin-top: 50px;">
|
||||
<% include ../public/login %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
@ -1,8 +1,8 @@
|
||||
<div class="container">
|
||||
<!--信息提示-->
|
||||
<div class="container" ng-app="webApp">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-8 col-md-offset-2 min-hight" style="margin-top: 50px;">
|
||||
<% include ../public/notice %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
@ -1,4 +1,6 @@
|
||||
<div class="container">
|
||||
<!--用户注册-->
|
||||
<script src="/javascripts/angular.min.js"></script>
|
||||
<div class="container" ng-app="webApp">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-4 col-md-offset-4 min-hight" style="margin-top: 50px;">
|
||||
<% include ../public/reg %>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<!--密码重置-->
|
||||
<div class="container">
|
||||
<script src="/javascripts/angular.min.js"></script>
|
||||
<div class="container" ng-app="webApp">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-4 col-md-offset-4 min-hight" style="margin-top: 50px;">
|
||||
<% include ../public/reSetPsd %>
|
||||
|
@ -1,9 +1,9 @@
|
||||
<!--用户中心-->
|
||||
<div class="container">
|
||||
<script src="/javascripts/angular.min.js"></script>
|
||||
<div class="container" ng-app="webApp">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-9 left-frame">
|
||||
<% include ../public/setPsd %>
|
||||
|
||||
</div>
|
||||
<div class="col-md-3 right-frame">
|
||||
<% include ../public/userNav %>
|
||||
|
Loading…
Reference in New Issue
Block a user