mirror of
https://gitee.com/doramart/DoraCMS.git
synced 2024-12-01 19:57:39 +08:00
DoraCMS v2.1.7 版本更新 😇😇😇
This commit is contained in:
parent
b0769d8c27
commit
b10c00ef49
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,7 @@ npm-debug.log
|
||||
node_modules/
|
||||
coverage/
|
||||
.idea/
|
||||
.github/
|
||||
run/
|
||||
.DS_Store
|
||||
*.swp
|
||||
|
@ -1,4 +1,4 @@
|
||||
sudo: false
|
||||
|
||||
language: node_js
|
||||
node_js:
|
||||
- '8'
|
||||
|
@ -7,8 +7,8 @@ ENV PORT=8080
|
||||
WORKDIR /app
|
||||
COPY . /app
|
||||
|
||||
RUN npm install
|
||||
RUN npm install mammoth node-schedule
|
||||
RUN npm install --registry=https://registry.npm.taobao.org
|
||||
RUN npm install mammoth node-schedule --registry=https://registry.npm.taobao.org
|
||||
|
||||
EXPOSE ${PORT}
|
||||
|
||||
|
33
app.js
33
app.js
@ -16,7 +16,19 @@ class AppBootHook {
|
||||
this.app.loader.loadFile(path.join(this.app.config.baseDir, 'app/bootstrap/index.js'));
|
||||
const ctx = this.app.createAnonymousContext();
|
||||
this.app.nunjucks.addExtension('remote', new remote(ctx));
|
||||
|
||||
this.app.nunjucks.addExtension('HeaderExtension', new HeaderExtension(ctx));
|
||||
this.app.nunjucks.addExtension('AssetsExtension', new AssetsExtension(ctx));
|
||||
this.app.nunjucks.addExtension('PluginsExtension', new PluginsExtension(ctx));
|
||||
this.app.nunjucks.addExtension('recommend', new recommend(ctx));
|
||||
this.app.nunjucks.addExtension('hot', new hot(ctx));
|
||||
this.app.nunjucks.addExtension('news', new news(ctx));
|
||||
this.app.nunjucks.addExtension('random', new random(ctx));
|
||||
this.app.nunjucks.addExtension('near_post', new near_post(ctx));
|
||||
this.app.nunjucks.addExtension('tags', new tags(ctx));
|
||||
this.app.nunjucks.addExtension('hottags', new hottags(ctx));
|
||||
this.app.nunjucks.addExtension('ads', new ads(ctx));
|
||||
this.app.nunjucks.addExtension('navtree', new navtree(ctx));
|
||||
this.app.nunjucks.addExtension('childnav', new childnav(ctx));
|
||||
}
|
||||
|
||||
async didLoad() {
|
||||
@ -29,7 +41,24 @@ class AppBootHook {
|
||||
}
|
||||
|
||||
async didReady() {
|
||||
this.app.cache = new Cache();
|
||||
let _theApp = this.app;
|
||||
_theApp.cache = new Cache();
|
||||
|
||||
_theApp.messenger.on('refreshCache', by => {
|
||||
_theApp.logger.info('start update by %s', by);
|
||||
const ctx = _theApp.createAnonymousContext();
|
||||
ctx.runInBackground(async () => {
|
||||
let {
|
||||
key,
|
||||
value,
|
||||
time
|
||||
} = by;
|
||||
_theApp.cache.set(key, value, time);
|
||||
});
|
||||
});
|
||||
// 应用初始化
|
||||
let thisCtx = this.app.createAnonymousContext();
|
||||
this.app.init(thisCtx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,19 +10,18 @@ const es2015Preset = require("babel-preset-es2015");
|
||||
const autoprefixer = require('gulp-autoprefixer');
|
||||
|
||||
// 设置项目根目录
|
||||
const projectPath = '..';
|
||||
|
||||
const projectPath = '../..';
|
||||
var tempforder = "dorawhite";
|
||||
var doraWhiteSassPath = './themes/' + tempforder + '/css/white.scss';
|
||||
var doraWhiteSassPath = './css/white.scss';
|
||||
var doraWhiteCssPath = projectPath + '/public/themes/' + tempforder + '/css';
|
||||
|
||||
// layer 皮肤
|
||||
var doraLayerSassPath = './themes/' + tempforder + '/css/layer.scss';
|
||||
var doraLayerSassPath = './css/layer.scss';
|
||||
var doraLayerCssPath = projectPath + '/public/plugins/layer/theme/blue';
|
||||
|
||||
var doraWhiteNormalJs = './themes/' + tempforder + '/js/dora.front.js';
|
||||
var doraWhitePagerJs = './themes/' + tempforder + '/js/avalon-ms-pager.js';
|
||||
var doraWhiteEditor = './themes/' + tempforder + '/js/ueditor.all.js';
|
||||
var doraWhiteNormalJs = './js/dora.front.js';
|
||||
var doraWhitePagerJs = './js/avalon-ms-pager.js';
|
||||
var doraWhiteEditor = './js/ueditor.all.js';
|
||||
|
||||
var doraWhiteMinJs = projectPath + '/public/themes/' + tempforder + '/js/';
|
||||
var editorMinPath = projectPath + '/public/plugins/ueditor/';
|
395
app/assets/dorawhite/js/dora.front.js
Normal file
395
app/assets/dorawhite/js/dora.front.js
Normal file
@ -0,0 +1,395 @@
|
||||
function watchCreator(id, targetId) {
|
||||
getAjaxData('/api/user/followCreator?creatorId=' + id, (data) => {
|
||||
if (data.status == 200) {
|
||||
$('#' + targetId).find('i').remove();
|
||||
$('#' + targetId).text('已关注');
|
||||
$('#' + targetId).attr('href', 'javascript:void(0)')
|
||||
}
|
||||
})
|
||||
}
|
||||
// 举报
|
||||
function reportDocument(contentId, type = '0') {
|
||||
getAjaxData('/api/user/report', (data) => {
|
||||
if (data.status == 200) {
|
||||
layer.msg(data.message, {
|
||||
icon: 1,
|
||||
time: msgTime,
|
||||
anim: 1
|
||||
});
|
||||
}
|
||||
}, 'post', {
|
||||
contentId,
|
||||
type
|
||||
})
|
||||
}
|
||||
|
||||
//兼容方式获取scrolltop以及设置scrolltop
|
||||
function getScrollTop() {
|
||||
var scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
|
||||
return scrollTop;
|
||||
}
|
||||
|
||||
// 弹窗初始化
|
||||
function initCheckModal(vm, msg, callBack) {
|
||||
$('#checkIfDo').on('show.bs.modal', function (event) {
|
||||
$(this).find('.modal-msg').text(msg);
|
||||
}).on('hide.bs.modal', function (event) {
|
||||
|
||||
});
|
||||
$('#checkIfDo').modal('show');
|
||||
//确认执行删除
|
||||
vm.confirmDo = function () {
|
||||
$('#checkIfDo').modal('hide');
|
||||
callBack();
|
||||
};
|
||||
}
|
||||
|
||||
function renderParams(paramObj) {
|
||||
let paramStr = '';
|
||||
for (let key in paramObj) {
|
||||
paramStr += ('&' + key + '=' + paramObj[key])
|
||||
}
|
||||
return paramStr.substring(1, paramStr.length);
|
||||
}
|
||||
|
||||
// 获取url参数
|
||||
function getQueryString(name) {
|
||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
||||
var r = window.location.search.substr(1).match(reg); //search,查询?后面的参数,并匹配正则
|
||||
if (r != null) return unescape(r[2]);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* header avalon controller
|
||||
*
|
||||
*/
|
||||
|
||||
avalon.filters.cutwords = function (str, length) {
|
||||
var newStr = "";
|
||||
if (!str) return '';
|
||||
if (str.replace(/[\u0391-\uFFE5]/g, "aa").length > length) {
|
||||
newStr = str.substring(0, length) + '...'
|
||||
} else {
|
||||
newStr = str;
|
||||
}
|
||||
return newStr;
|
||||
}
|
||||
|
||||
avalon.filters.formatDateByType = function (date, type) {
|
||||
var newStr = "";
|
||||
if (type == 'mini') {
|
||||
newStr = date.substring(date.length - 8, date.length - 3);
|
||||
} else if (type = 'date') {
|
||||
newStr = date.substring(0, 9);
|
||||
}
|
||||
return newStr;
|
||||
}
|
||||
|
||||
avalon.filters.renderJob = function (data, type) {
|
||||
var newStr = "",
|
||||
askArr = [];
|
||||
if (!data) return '';
|
||||
|
||||
if (type == 'industry') {
|
||||
askArr = personInfoVm.industryArr;
|
||||
} else if (type == 'profession') {
|
||||
askArr = personInfoVm.professionArr;
|
||||
} else if (type == 'experience') {
|
||||
askArr = personInfoVm.experienceArr;
|
||||
}
|
||||
for (const askItem of askArr) {
|
||||
if (askItem.value == data) {
|
||||
newStr = askItem.text;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return newStr;
|
||||
}
|
||||
|
||||
|
||||
var searchVm = avalon.define({
|
||||
$id: 'headerCtr',
|
||||
lsk: [],
|
||||
searchkey: '',
|
||||
message: '',
|
||||
activeSearch: false,
|
||||
showErr: false,
|
||||
postArticel: function () {
|
||||
if ($('#logined').val() == "true") {
|
||||
window.location.href = "/users/userAddContent"
|
||||
} else {
|
||||
window.location.href = "/users/login"
|
||||
}
|
||||
},
|
||||
searchMe: function () {
|
||||
searchVm.activeSearch = !searchVm.activeSearch;
|
||||
},
|
||||
searchOpt: function (e) {
|
||||
if (searchVm.searchkey) {
|
||||
window.location.href = '/search/' + searchVm.searchkey;
|
||||
} else {
|
||||
layer.msg(getSysValueByKey('sys_layer_validate_keyword'), {
|
||||
icon: 0,
|
||||
time: msgTime
|
||||
});
|
||||
}
|
||||
},
|
||||
onKeyUp: function (e) {
|
||||
if (e && e.keyCode === 13) {
|
||||
searchVm.searchOpt()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
*
|
||||
* detail avalon controller
|
||||
*
|
||||
*/
|
||||
|
||||
var postArticelVm = avalon.define({
|
||||
$id: 'documentInfo',
|
||||
message: '',
|
||||
showErr: false
|
||||
})
|
||||
|
||||
|
||||
function askContentThu(askContentThumbsUp) {
|
||||
getAjaxData('/api/user/askContentThumbsUp', (data) => {
|
||||
|
||||
})
|
||||
}
|
||||
// 推荐帖子静态部分
|
||||
var rcStaticlVm = avalon.define({
|
||||
$id: 'rcStatic',
|
||||
askLike: (e, type, targetId) => {
|
||||
let oldLinkNum = $('#thumbs_' + targetId).text();
|
||||
let oldRewordNum = $('#reword_' + targetId).text();
|
||||
let oldDespisesNum = $('#despises_' + targetId).text();
|
||||
let oldFavoriteCommunityNum = $('#favoriteCommunity_' + targetId).text();
|
||||
|
||||
if (type == '1') {
|
||||
getAjaxData('/api/user/askContentThumbsUp?contentId=' + targetId, (data) => {
|
||||
if (data.status == 200) {
|
||||
// layer.msg(data.message, { icon: 1, anim: 1 });
|
||||
$('#thumbs_' + targetId).text(Number(oldLinkNum) + 1);
|
||||
}
|
||||
})
|
||||
} else if (type == '2') { // 踩
|
||||
getAjaxData("/api/user/despiseContent?contentId=" + targetId, (data) => {
|
||||
if (data.status == 200) {
|
||||
// layer.msg(data.message, { icon: 1, anim: 1 });
|
||||
$('#despises_' + targetId).text(Number(oldDespisesNum) + 1);
|
||||
}
|
||||
});
|
||||
} else if (type == '3') { // 评论
|
||||
window.location.href = '/details/' + targetId + '.html?id=comments'
|
||||
} else if (type == '4') { //收藏
|
||||
getAjaxData("/api/user/favoriteContent?contentId=" + targetId, (data) => {
|
||||
if (data.status == 200) {
|
||||
// layer.msg(data.message, { icon: 1, anim: 1 });
|
||||
$('#favoriteCommunity_' + targetId).text(Number(oldFavoriteCommunityNum) + 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
function getAppendList(type = '1') { // 1增加,2原地刷新
|
||||
|
||||
if (type == '1') {
|
||||
appendNewsVm.loadingState = true;
|
||||
appendNewsVm.current++;
|
||||
} else if (type == '2') {
|
||||
appendNewsVm.current = 2;
|
||||
appendNewsVm.pageSize = appendNewsVm.current * appendNewsVm.pageSize;
|
||||
}
|
||||
let appendType = $('#appendType').val();
|
||||
let paramsStr = '';
|
||||
if (appendType == 'reCommend') {
|
||||
paramsStr = '/api/content/getList?type=1¤t=' + appendNewsVm.current + '&pageSize=' + appendNewsVm.pageSize + '&isTop=1'
|
||||
} else if (appendType == 'hot') {
|
||||
paramsStr = '/api/content/getList?type=1¤t=' + appendNewsVm.current + '&pageSize=' + appendNewsVm.pageSize + '&sortby=clickNum'
|
||||
} else if (appendType == 'community') {
|
||||
paramsStr = '/api/community/getCommunityContents?current=' + appendNewsVm.current + '&pageSize=' + appendNewsVm.pageSize + appendNewsVm.current
|
||||
} else if (appendType == 'special') {
|
||||
paramsStr = '/api/special/getList?current=' + appendNewsVm.current + '&pageSize=' + appendNewsVm.pageSize
|
||||
} else if (appendType == 'search') {
|
||||
paramsStr = '/api/content/getList?current=' + appendNewsVm.current + '&pageSize=' + appendNewsVm.pageSize + '&searchkey=' + $('#searchkey').val()
|
||||
} else if (appendType == 'tag') {
|
||||
paramsStr = '/api/content/getList?current=' + appendNewsVm.current + '&pageSize=' + appendNewsVm.pageSize + '&tagName=' + $('#tagName').val()
|
||||
} else if (appendType == 'creatorContents') {
|
||||
paramsStr = '/api/content/getList?type=1¤t=' + appendNewsVm.current + '&pageSize=' + appendNewsVm.pageSize
|
||||
}
|
||||
getAjaxData(paramsStr, (data) => {
|
||||
if (type == '1') {
|
||||
appendNewsVm.loadingState = false;
|
||||
}
|
||||
if (data.data.docs.length > 0) {
|
||||
if (type == '1') {
|
||||
appendNewsVm.appendDocumentList = (appendNewsVm.appendDocumentList).concat(data.data.docs);
|
||||
} else if (type == '2') {
|
||||
appendNewsVm.appendDocumentList = data.data.docs;
|
||||
}
|
||||
} else {
|
||||
appendNewsVm.current--
|
||||
}
|
||||
})
|
||||
}
|
||||
// 下拉加载
|
||||
var appendNewsVm = avalon.define({
|
||||
$id: 'appendItems',
|
||||
current: 1,
|
||||
pageSize: '',
|
||||
appendDocumentList: [],
|
||||
loadingState: false,
|
||||
showAuthor: function (item, author, userName) {
|
||||
var obj = item[author]
|
||||
if (obj) {
|
||||
return obj[userName]
|
||||
}
|
||||
return ''
|
||||
},
|
||||
getMoreNews: function () {
|
||||
getAppendList();
|
||||
},
|
||||
appLike: (type, targetId) => {
|
||||
if (type == '1') {
|
||||
getAjaxData('/api/user/askContentThumbsUp?contentId=' + targetId, (data) => {
|
||||
if (data.status == 200) {
|
||||
getAppendList('2');
|
||||
}
|
||||
})
|
||||
} else if (type == '0') {
|
||||
getAjaxData("/api/user/rewordContent", (data) => {
|
||||
if (data.status == 200) {
|
||||
getAppendList('2');
|
||||
}
|
||||
}, 'post', {
|
||||
coins: 10,
|
||||
unit: 'MEC',
|
||||
contentId: targetId
|
||||
});
|
||||
} else if (type == '2') { // 踩
|
||||
getAjaxData("/api/user/despiseContent?contentId=" + targetId, (data) => {
|
||||
if (data.status == 200) {
|
||||
getAppendList('2');
|
||||
}
|
||||
});
|
||||
} else if (type == '3') { // 评论
|
||||
window.location.href = '/details/' + targetId + '.html?id=comments'
|
||||
} else if (type == '4') { //收藏 /api/user/favoriteContent
|
||||
getAjaxData("/api/user/favoriteContent?contentId=" + targetId, (data) => {
|
||||
if (data.status == 200) {
|
||||
getAppendList('2');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* msgBoard avalon controller
|
||||
*
|
||||
*/
|
||||
|
||||
function getPostMessages() {
|
||||
getAjaxData('/api/contentMessage/getMessages?pageSize=100&contentId=' + $('#contentId').val(), (data) => {
|
||||
if (data.status == 200) {
|
||||
postMsgVm.messageList = data.data.docs;
|
||||
}
|
||||
})
|
||||
}
|
||||
var postMsgVm = avalon.define({
|
||||
$id: 'postMessage',
|
||||
content: '',
|
||||
logined: false,
|
||||
message: '',
|
||||
showErr: false,
|
||||
messageList: [],
|
||||
replyState: false,
|
||||
relationMsgId: "",
|
||||
replyAuthor: "",
|
||||
adminReplyAuthor: "",
|
||||
praise_num: 0,
|
||||
despises_num: 0,
|
||||
getAuthor: function (item, adminAuthor, author) {
|
||||
if (item) {
|
||||
var obj = item[adminAuthor]
|
||||
if (obj) {
|
||||
return obj
|
||||
}
|
||||
return item[author] ? item[author] : '';
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
reSetData: function () {
|
||||
postMsgVm.content = "";
|
||||
postMsgVm.relationMsgId = "";
|
||||
postMsgVm.replyAuthor = "";
|
||||
postMsgVm.adminReplyAuthor = "";
|
||||
postMsgVm.showErr = false;
|
||||
postMsgVm.message = "";
|
||||
},
|
||||
reply: function (id, user, utype) {
|
||||
if (id && user) {
|
||||
postMsgVm.reSetData();
|
||||
postMsgVm.replyState = true;
|
||||
postMsgVm.relationMsgId = id;
|
||||
if (utype == '0') {
|
||||
postMsgVm.replyAuthor = user._id;
|
||||
} else {
|
||||
postMsgVm.adminReplyAuthor = user._id;
|
||||
}
|
||||
$("#msgSendBox").appendTo($("#msglist_" + id))
|
||||
}
|
||||
},
|
||||
cancelReply: function () {
|
||||
postMsgVm.reSetData();
|
||||
postMsgVm.replyState = false;
|
||||
$("#postMessage").prepend($('#msgSendBox'));
|
||||
},
|
||||
validate: {
|
||||
onError: function (reasons) {
|
||||
reasons.forEach(function (reason) {
|
||||
console.log(reason.getMessage())
|
||||
})
|
||||
},
|
||||
onValidateAll: function (reasons) {
|
||||
if (reasons.length) {
|
||||
postMsgVm.showErr = true;
|
||||
postMsgVm.message = reasons[0].message;
|
||||
} else {
|
||||
console.log('全部通过');
|
||||
if ($('#logined').val() == 'true') {
|
||||
var params = {
|
||||
contentId: $('#contentId').val(),
|
||||
replyAuthor: postMsgVm.replyAuthor,
|
||||
adminReplyAuthor: postMsgVm.adminReplyAuthor,
|
||||
relationMsgId: postMsgVm.relationMsgId,
|
||||
content: postMsgVm.content,
|
||||
}
|
||||
getAjaxData('/api/contentMessage/postMessages', (data) => {
|
||||
if (data.status == 200) {
|
||||
$("#postMessage").prepend($('#msgSendBox'));
|
||||
postMsgVm.reSetData();
|
||||
getPostMessages();
|
||||
}
|
||||
}, 'post', params);
|
||||
} else {
|
||||
window.location.href = "/users/login";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
51
app/assets/users/.babelrc
Normal file
51
app/assets/users/.babelrc
Normal file
@ -0,0 +1,51 @@
|
||||
{
|
||||
"env": {
|
||||
"production": {
|
||||
"presets": [
|
||||
[
|
||||
"env",
|
||||
{
|
||||
"targets": {
|
||||
"browsers": [
|
||||
"last 2 version",
|
||||
"ie 10"
|
||||
]
|
||||
},
|
||||
"modules": false,
|
||||
"debug": true
|
||||
}
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
"lodash",
|
||||
"transform-runtime",
|
||||
"transform-object-rest-spread",
|
||||
"transform-vue-jsx",
|
||||
"transform-remove-strict-mode",
|
||||
"syntax-dynamic-import",
|
||||
"transform-es2015-modules-commonjs"
|
||||
]
|
||||
},
|
||||
"development": {
|
||||
"presets": [
|
||||
[
|
||||
"env",
|
||||
{
|
||||
"targets": {
|
||||
"chrome": 52
|
||||
},
|
||||
"modules": false,
|
||||
"debug": true
|
||||
}
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
"lodash",
|
||||
"transform-object-rest-spread",
|
||||
"transform-vue-jsx",
|
||||
"transform-remove-strict-mode",
|
||||
"syntax-dynamic-import"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
1
app/assets/users/.gitignore
vendored
Normal file
1
app/assets/users/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
node_modules
|
145
app/assets/users/css/layer.scss
Normal file
145
app/assets/users/css/layer.scss
Normal file
@ -0,0 +1,145 @@
|
||||
@font-face {
|
||||
font-family: "iconfont";
|
||||
src: url('iconfont.eot?t=1531899636563');
|
||||
/* IE9*/
|
||||
src: url('iconfont.eot?t=1531899636563#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
||||
url('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAAmUAAsAAAAADuQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAARAAAAFZW7kkPY21hcAAAAYAAAACeAAACIDYdn/5nbHlmAAACIAAABSsAAAfI8SNSMGhlYWQAAAdMAAAALwAAADYSF2PlaGhlYQAAB3wAAAAeAAAAJAftA35obXR4AAAHnAAAABcAAAAoJ+oAAGxvY2EAAAe0AAAAFgAAABYJ4AewbWF4cAAAB8wAAAAdAAAAIAEZAHRuYW1lAAAH7AAAAUUAAAJtPlT+fXBvc3QAAAk0AAAAXQAAAHaBcGHweJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2Bk/sc4gYGVgYOpk+kMAwNDP4RmfM1gxMjBwMDEwMrMgBUEpLmmMDgwVDyXZ27438AQw9zA0AAUZgTJAQAnrwySeJzFkrENgzAURM/BGIhSRCg9os8AjMEsaaDIBAyRKrMdY5D7fJog6uSsZ+mf5bP1bQA5gEzcRQTCGwGml9yw+hnOqx/xUH3DVU7EyMSaLTv2HDjNzbJo9djdKyhlP8w9ISm7QKX8HKWsdLD7Rwr/O/pbl3V+blUlxg1dkclR78DagXmtY2/LzlFnwd6xHA6OvTsnx/7D3DgoP0cKLswAAHicjVVdaBxVFL7nzs69szs/u5nZnc1Osr+zmUljd9tkd2e2P9loEtvGjUZbqMSHQulDQVEoCBXaQh4qiEawiC9FfLBSfaiKChakUfIQSHy0BJsgpME8+OCLD8UW6tQzm1ZWpbRzZ+495+69537nO+fcJSIh9zaFa0IvMcggGSaT5HlCgD0BJY1moejWq/QJSBXFVDqpCa7tFrldqgqjkC6xpDni1Z004ywOGuSgVhzx3Cp1oVFv0X0wYmYBMn3WEX2gXxfeg1ivm3szeIZ+DKm83R9vVYKpnWPJkYIhnVZ0PaPr8xITRYnSSFyDV9NmVIzGWPCJGLdS1/I7aB6UjGtNz6qFPv34W/XXsgPpKMDcHBh9Be3TsR6rB9+zlmnoGZ5QpV5LtctJOL0l9xpK1vmV4ANhJ0zRH0iekAHHBa/h1h3XLvEoOOhGEi0y049C6JgwfugGFBjEODAW3Aw2WUJgDPLBpmopkMefFOU4LslzDlwCFmxCnoHIVJSCm0pGgUJwkynx8EjkeC5ChDkikzSph/wSbpK0R3yHCA5xUUCVoVyKg+sgtXngIb9jkA6x7ALfq1OyFmwgguLaGhQR0sbaSnBLFEFeWQFZFINbMZZgly6xhBL2SpcszIWru3bfrXRtW0Ez9H323033ZfI//O7D8RsIXgMzD6bng1eFR0IeDH66yhIx4EsszmAf5+ZjYL0cXLkggpoQPxKBwQnJjCDGyL8wljGTH85yiaV6cjDi+T11BxWe6iiNx8C7IikgJ2RQJEmGjgTyoxELcUUKZiRZluArSfnrd1kaDBXsCAnr713hT+EMkUgPoh4lU4i8BfUwC0zxgQAdiNiqgInaaSXHDVsVay9tGt3+dfkNT1vlcsO24UKfbTfK5eCb4tGXjxZdWeS6IQJXemovVQ5YusyoqCeZKF9fDbbQ4/7VVehH/Furi/cI6mRxEXC8R2AZbLTXsOH+GPxhZbNWKRM1YjwqROPaToSjxVHkMT2WCb7uNobGhatoZbHLanfsiqRC9pBxZECDVHi/NBzPHzHTScbRywcTLcBYCQ+JrqvB9sVEo+0jsq7SylTFg4xZ2w2oQXk4W6AzB9aDDTy/uL4ORQS2sb4c3EZdWl4GCfXbP0sqLlbpHMy+IKlKdMdRoTZo7eoZmpkI1frYDvPJ8t4pgHBvl627u7uMLKPRO+GhclLuxPntiCacJUkyRDwyQU52vOQskc6FVY5e+R7FcHJUc5DUaKlK615nekTQwmnfC8MtIjVsW+EhLeHL0vfzo4XXbtpEreb59XA1vnDjjR+farftY3tPBaf2HrNPtD6Y/laamd8zPjl5/vJ3l89PTo4333nOaP2SSAEcLJmxbCwHB4wUlCtGyarK7AvdSQwc0mVZEOWoVPXNoZ1Dpl+VoqIBslo47MZ3C6/Hzpw8G/x2zp8tjI4WZv3P4JVz+/fUpMnm+PYZ4VHjzYkoDT5nOb2Sz6ZHEyIIvJCySoKWfzYCsEUlpgwlNTUiRCRH5/joDhchydSYNcCp0J0rLmmRg+RFZLFTAjlkhfDtRAg5aEHovv1PltSdASQqFX7bf1VhwbuNbb5TdqOFvQZ2EcsKZVxgCh8yI07FSkUM7iwtBXcwyHypPb+fGzLlExcPd98VtaDWbNN+B8DJQyQfjv203SwPwxUY/h4UObgrK4AjRGSFfsmpbPD98+0HVpeAh+fQuMGGa93XyeGLJkz7TRjMLuRcN7eQHYSmP12B4XITjV9fiKlqbEFWlL8BRECdcAB4nGNgZGBgAOJnfQWz4vltvjJwszCAwPVS/i8I+n8DCx9zA5DLwcAEEgUAQlwK6wB4nGNgZGBgbvjfwBDDAmT9/8TCxwCkUQAXAHH3BHMAAHicY2FgYGB+ycDAwoAHMzIwAAAjUgESAAAAAAAAdgCyARIBZAHAAkICtANYA+QAAHicY2BkYGDgYshgYGUAASYwjwtI/gfzGQAT8wGOAAAAeJxlj01OwzAQhV/6B6QSqqhgh+QFYgEo/RGrblhUavdddN+mTpsqiSPHrdQDcB6OwAk4AtyAO/BIJ5s2lsffvHljTwDc4Acejt8t95E9XDI7cg0XuBeuU38QbpBfhJto41W4Rf1N2MczpsJtdGF5g9e4YvaEd2EPHXwI13CNT+E69S/hBvlbuIk7/Aq30PHqwj7mXle4jUcv9sdWL5xeqeVBxaHJIpM5v4KZXu+Sha3S6pxrW8QmU4OgX0lTnWlb3VPs10PnIhVZk6oJqzpJjMqt2erQBRvn8lGvF4kehCblWGP+tsYCjnEFhSUOjDFCGGSIyujoO1Vm9K+xQ8Jee1Y9zed0WxTU/3OFAQL0z1xTurLSeTpPgT1fG1J1dCtuy56UNJFezUkSskJe1rZUQuoBNmVXjhF6XNGJPyhnSP8ACVpuyAAAAHicbcpRCoAgEEXReZVZtpZW0wrEhhJMYYawdl/Qb+f3Xmro4+ifQ4MWHQx6WAwY4TARrin5m2UOqSgbFili9QyBVW31kmPezHLExH3lvPvSql/foaxvIHoA4pIWNAAAAA==') format('woff'), url('iconfont.ttf?t=1531899636563') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
|
||||
url('iconfont.svg?t=1531899636563#iconfont') format('svg');
|
||||
/* iOS 4.1- */
|
||||
}
|
||||
|
||||
body .layui-layer-blue .layui-layer-ico {
|
||||
font-family: "iconfont" !important;
|
||||
font-size: 16px;
|
||||
font-style: normal;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.icon-layer-close:before {
|
||||
content: "\e606";
|
||||
}
|
||||
|
||||
.icon-error:before {
|
||||
content: "\e621";
|
||||
}
|
||||
|
||||
.icon-success:before {
|
||||
content: "\e677";
|
||||
}
|
||||
|
||||
.icon-warning:before {
|
||||
content: "\e68a";
|
||||
}
|
||||
|
||||
.icon-Smile:before {
|
||||
content: "\e612";
|
||||
}
|
||||
|
||||
.icon-wenhao:before {
|
||||
content: "\e638";
|
||||
}
|
||||
|
||||
.icon-sad:before {
|
||||
content: "\e71f";
|
||||
}
|
||||
|
||||
.icon-suoding:before {
|
||||
content: "\e650";
|
||||
}
|
||||
|
||||
body {
|
||||
.layui-layer-blue {
|
||||
border-radius: 3px;
|
||||
.layui-layer-title {
|
||||
background-color: #fff;
|
||||
border-bottom: none;
|
||||
font-size: 16px;
|
||||
}
|
||||
.layui-layer-setwin {
|
||||
top: 10px;
|
||||
.layui-layer-close1 {
|
||||
background: none;
|
||||
color: #9aa0ac;
|
||||
font-size: 18px;
|
||||
}
|
||||
.layui-layer-close1::before {
|
||||
content: "\e606";
|
||||
}
|
||||
}
|
||||
.layui-layer-btn {
|
||||
.layui-layer-btn0 {
|
||||
font-size: 0.8125rem;
|
||||
color: #fff;
|
||||
background-color: #467fcf;
|
||||
border-color: #467fcf;
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.layui-layer-blue-msg {
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #ebeef5;
|
||||
position: fixed;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
|
||||
overflow: hidden;
|
||||
.layui-layer-content {
|
||||
.layui-layer-ico1,
|
||||
.layui-layer-ico2,
|
||||
.layui-layer-ico3,
|
||||
.layui-layer-ico4,
|
||||
.layui-layer-ico4,
|
||||
.layui-layer-ico6,
|
||||
.layui-layer-ico7 {
|
||||
background: none;
|
||||
font-size: 30px;
|
||||
top: 20px;
|
||||
font-weight: 700;
|
||||
}
|
||||
.layui-layer-ico1 {
|
||||
color: #67C23A;
|
||||
}
|
||||
.layui-layer-ico1::before {
|
||||
content: "\e677";
|
||||
}
|
||||
.layui-layer-ico2 {
|
||||
color: #F56C6C;
|
||||
}
|
||||
.layui-layer-ico2::before {
|
||||
content: "\e621";
|
||||
}
|
||||
.layui-layer-ico3 {
|
||||
color: #E6A23C;
|
||||
}
|
||||
.layui-layer-ico3::before {
|
||||
content: "\e638";
|
||||
}
|
||||
.layui-layer-ico4 {
|
||||
color: #909399;
|
||||
}
|
||||
.layui-layer-ico4::before {
|
||||
content: "\e650";
|
||||
}
|
||||
.layui-layer-ico5 {
|
||||
color: #F56C6C;
|
||||
}
|
||||
.layui-layer-ico5::before {
|
||||
content: "\e71f";
|
||||
}
|
||||
.layui-layer-ico6 {
|
||||
color: #67C23A;
|
||||
}
|
||||
.layui-layer-ico6::before {
|
||||
content: "\e612";
|
||||
}
|
||||
.layui-layer-ico7 {
|
||||
color: #E6A23C;
|
||||
}
|
||||
.layui-layer-ico7::before {
|
||||
content: "\e68a";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
460
app/assets/users/css/white.scss
Normal file
460
app/assets/users/css/white.scss
Normal file
@ -0,0 +1,460 @@
|
||||
.page {
|
||||
overflow: hidden;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.whitebg {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
width: 230px;
|
||||
float: left
|
||||
}
|
||||
|
||||
.page-title li {
|
||||
margin-bottom: 10px
|
||||
}
|
||||
|
||||
.page-title li a {
|
||||
display: block;
|
||||
text-align: center;
|
||||
padding: 8px 0;
|
||||
border: #f1f1f1 1px solid;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
#pagecurrent,
|
||||
.page-title li a:hover {
|
||||
background: #1487f4;
|
||||
color: #fff;
|
||||
border: #1487f4 1px solid;
|
||||
}
|
||||
|
||||
.page-box {
|
||||
width: 830px;
|
||||
float: left;
|
||||
margin-left: 30px;
|
||||
padding-left: 30px;
|
||||
border-left: #eee 1px solid;
|
||||
min-height: 500px;
|
||||
}
|
||||
|
||||
.page-box-title {
|
||||
font-size: 16px;
|
||||
border-bottom: 1px solid #eee;
|
||||
position: relative;
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.page-box-title:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 64px;
|
||||
height: 2px;
|
||||
content: "";
|
||||
background: #000;
|
||||
left: 0;
|
||||
bottom: -1px;
|
||||
-moz-transition: all .5s ease;
|
||||
-webkit-transition: all .5s ease;
|
||||
transition: all .5s ease;
|
||||
}
|
||||
|
||||
.page-box-title:hover:after {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.page-box-content {
|
||||
line-height: 26px;
|
||||
}
|
||||
|
||||
.page-box-content p {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.page-box-content img {
|
||||
max-width: 100%;
|
||||
margin: 10px auto
|
||||
}
|
||||
|
||||
.page-box-content h2,
|
||||
.page-box-content h3,
|
||||
.page-box-content h4,
|
||||
.page-box-content h5,
|
||||
.page-box-content h6 {
|
||||
font-size: 16px;
|
||||
margin: 20px 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.page-box-content h2:before,
|
||||
.page-box-content h3:before,
|
||||
.page-box-content h4:before,
|
||||
.page-box-content h5:before,
|
||||
.page-box-content h6:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
background: #1487f4;
|
||||
width: 3px;
|
||||
height: 100%;
|
||||
left: -32px;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.page-box-content a {
|
||||
color: #39F
|
||||
}
|
||||
|
||||
/* 用户中心下拉菜单 */
|
||||
.menu_head {
|
||||
width: 185px;
|
||||
height: 47px;
|
||||
line-height: 47px;
|
||||
padding-left: 38px;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
margin: 0px;
|
||||
|
||||
background: url(../images/pro_left.png) center right no-repeat;
|
||||
|
||||
.fa {
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.menu_list .current {
|
||||
background: url(../images/pro_down.png) center right no-repeat;
|
||||
color: #1487f4;
|
||||
}
|
||||
|
||||
.menu_body {
|
||||
width: 223px;
|
||||
height: auto;
|
||||
overflow: hidden;
|
||||
line-height: 38px;
|
||||
|
||||
.fa {
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
a {
|
||||
display: block;
|
||||
width: 223px;
|
||||
height: 38px;
|
||||
line-height: 38px;
|
||||
padding-left: 48px;
|
||||
color: #333;
|
||||
background: #fff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
color: #1487f4;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 个人中心,暂无数据 */
|
||||
.no-contents {
|
||||
padding-bottom: 50px;
|
||||
|
||||
.um-profile-note {
|
||||
color: #666;
|
||||
text-align: center;
|
||||
padding-top: 60px;
|
||||
|
||||
i {
|
||||
display: block;
|
||||
font-size: 70px;
|
||||
height: 70px;
|
||||
line-height: 70px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// pannelbox
|
||||
.pannel-box {
|
||||
padding: 15px 0;
|
||||
margin-bottom: 20px;
|
||||
|
||||
.pannel-title {
|
||||
margin: 0 0 10px;
|
||||
padding: 1px 0 1px 7px;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 我的文档列表 */
|
||||
.myContentList .discription {
|
||||
border-bottom: 1px solid #efefef;
|
||||
padding-top: 20px;
|
||||
|
||||
.post-title {
|
||||
position: relative;
|
||||
margin: 0 0 15px;
|
||||
|
||||
.contentState {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
|
||||
.post-content {
|
||||
color: #666;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.post-meta li {
|
||||
display: inline-block;
|
||||
border: none;
|
||||
color: #999;
|
||||
font-size: 13px;
|
||||
margin-right: 20px;
|
||||
padding-bottom: 0;
|
||||
padding: 20px 0;
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
i {
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 我参与的
|
||||
.myJoinTopicsList {
|
||||
.replyList {
|
||||
background-color: #ffffff;
|
||||
|
||||
li {
|
||||
font-size: 14px;
|
||||
position: relative;
|
||||
|
||||
border-bottom: 1px dashed #ededed;
|
||||
|
||||
h4 {
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
time {
|
||||
float: right;
|
||||
color: #8492a6;
|
||||
font-size: 12px;
|
||||
margin-right: 30px;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
color: #475669;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 我的系统消息
|
||||
.myMessageList {
|
||||
padding: 15px;
|
||||
|
||||
ul {
|
||||
li {
|
||||
position: relative;
|
||||
padding: 15px 0;
|
||||
border-bottom: 1px dashed #ededed;
|
||||
|
||||
.notify-title {
|
||||
color: #1487f4;
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
i {
|
||||
width: 15px;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
font-size: 20px;
|
||||
margin-right: 10px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
display: inline-block;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.notify-title.noRead {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.notify-title.isRead {
|
||||
font-weight: normal;
|
||||
color: #909090;
|
||||
}
|
||||
|
||||
.notify-content {
|
||||
display: none;
|
||||
|
||||
p {
|
||||
margin: 10px 10px 10px 30px;
|
||||
font-size: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
.opt {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
right: 0px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 用户中心分页
|
||||
.pagination {
|
||||
text-align: center;
|
||||
margin: 20px 0;
|
||||
|
||||
li {
|
||||
display: inline-block;
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
border-bottom: none;
|
||||
|
||||
a:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
i {
|
||||
width: auto;
|
||||
height: auto;
|
||||
color: #aaa;
|
||||
}
|
||||
}
|
||||
|
||||
li.active {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
// 用户投稿
|
||||
.user-contents-post {
|
||||
background-color: #ffffff;
|
||||
margin: 0;
|
||||
|
||||
.main-form {
|
||||
padding: 15px;
|
||||
|
||||
.select-group {
|
||||
select {
|
||||
display: inline-block;
|
||||
width: 30%;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.right-form {
|
||||
padding: 15px;
|
||||
|
||||
.sub-content {
|
||||
width: 100%;
|
||||
padding: 10px 0;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.webuploader-pick {
|
||||
padding: 6px 15px;
|
||||
background-color: #1487f4;
|
||||
}
|
||||
|
||||
.thumbImg {
|
||||
.uploader-demo {
|
||||
position: relative;
|
||||
|
||||
.uploader-list {
|
||||
.thumbnail {
|
||||
height: 15rem;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.trashIco {
|
||||
display: none;
|
||||
position: absolute;
|
||||
z-index: 99;
|
||||
right: 0;
|
||||
top: 0;
|
||||
padding: 8px;
|
||||
font-size: 22px;
|
||||
color: #fff;
|
||||
background: rgba(0, 0, 0, .55);
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 用户注册
|
||||
.login-main {
|
||||
background-color: #fff;
|
||||
|
||||
.login-box {
|
||||
width: 65%;
|
||||
margin: 0 auto;
|
||||
margin-top: 20px;
|
||||
padding: 20px 0px 100px;
|
||||
|
||||
.title {
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.forget-psd {
|
||||
margin-top: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.form-group {
|
||||
label {
|
||||
line-height: 22px;
|
||||
padding-bottom: 8px !important;
|
||||
font-weight: 600;
|
||||
font-size: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
.sub-btns {
|
||||
button {
|
||||
width: 100%;
|
||||
padding: 12px 20px;
|
||||
}
|
||||
}
|
||||
}
|
107
app/assets/users/gulpfile.js
Normal file
107
app/assets/users/gulpfile.js
Normal file
@ -0,0 +1,107 @@
|
||||
// 皮肤开发sass监听
|
||||
'use strict';
|
||||
var gulp = require('gulp');
|
||||
var sass = require('gulp-sass');
|
||||
var jsmin = require("gulp-uglify");
|
||||
var cssmin = require("gulp-minify-css");
|
||||
var del = require("del");
|
||||
const babel = require("gulp-babel");
|
||||
const es2015Preset = require("babel-preset-es2015");
|
||||
const autoprefixer = require('gulp-autoprefixer');
|
||||
|
||||
// 设置项目根目录
|
||||
const projectPath = '../..';
|
||||
var tempforder = "users";
|
||||
var doraWhiteSassPath = './css/white.scss';
|
||||
var doraWhiteCssPath = projectPath + '/public/themes/' + tempforder + '/css';
|
||||
|
||||
// layer 皮肤
|
||||
var doraLayerSassPath = './css/layer.scss';
|
||||
var doraLayerCssPath = projectPath + '/public/plugins/layer/theme/blue';
|
||||
|
||||
var doraWhiteNormalJs = './js/dora.front.js';
|
||||
var doraWhitePagerJs = './js/avalon-ms-pager.js';
|
||||
var doraWhiteEditor = './js/ueditor.all.js';
|
||||
|
||||
var doraWhiteMinJs = projectPath + '/public/themes/' + tempforder + '/js/';
|
||||
var editorMinPath = projectPath + '/public/plugins/ueditor/';
|
||||
|
||||
|
||||
gulp.task('sass', function () {
|
||||
return gulp.src(doraWhiteSassPath)
|
||||
.pipe(sass().on('error', sass.logError))
|
||||
.pipe(autoprefixer({
|
||||
overrideBrowserslist: ['> 1%', 'iOS >= 7', 'Android >= 4.0', 'ie >= 10'],
|
||||
cascade: false
|
||||
}))
|
||||
.pipe(cssmin())
|
||||
.pipe(gulp.dest(doraWhiteCssPath));
|
||||
});
|
||||
|
||||
gulp.task("cleanjs", function () {
|
||||
return del(doraWhiteMinJs + 'dora.front.js', {
|
||||
force: true
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('layerSass', function () {
|
||||
return gulp.src(doraLayerSassPath)
|
||||
.pipe(sass().on('error', sass.logError))
|
||||
.pipe(autoprefixer({
|
||||
overrideBrowserslist: ['> 1%', 'iOS >= 7', 'Android >= 4.0', 'ie >= 10'],
|
||||
cascade: false
|
||||
}))
|
||||
.pipe(cssmin())
|
||||
.pipe(gulp.dest(doraLayerCssPath));
|
||||
});
|
||||
|
||||
|
||||
gulp.task("askjsmin", gulp.series("cleanjs", function () {
|
||||
return gulp.src(doraWhiteNormalJs)
|
||||
.pipe(babel({
|
||||
presets: [es2015Preset]
|
||||
}))
|
||||
.pipe(jsmin())
|
||||
.pipe(gulp.dest(doraWhiteMinJs));
|
||||
}));
|
||||
|
||||
gulp.task("cleanpagerjs", function () {
|
||||
return del(doraWhiteMinJs + 'avalon-ms-pager.js', {
|
||||
force: true
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task("pagerjsmin", gulp.series("cleanpagerjs", function () {
|
||||
return gulp.src(doraWhitePagerJs)
|
||||
.pipe(babel({
|
||||
presets: [es2015Preset]
|
||||
}))
|
||||
.pipe(jsmin())
|
||||
.pipe(gulp.dest(doraWhiteMinJs));
|
||||
}));
|
||||
|
||||
gulp.task("editorjsmin", function () {
|
||||
return gulp.src(doraWhiteEditor)
|
||||
.pipe(jsmin())
|
||||
.pipe(gulp.dest(editorMinPath));
|
||||
});
|
||||
|
||||
gulp.task('uglifyEditorJs', function () {
|
||||
gulp.watch(doraWhiteEditor, gulp.parallel('editorjsmin'));
|
||||
});
|
||||
|
||||
gulp.task('uglifyPagerJs', function () {
|
||||
gulp.watch(doraWhitePagerJs, gulp.parallel('pagerjsmin'));
|
||||
});
|
||||
|
||||
gulp.task('uglifyWhiteJs', function () {
|
||||
gulp.watch(doraWhiteNormalJs, gulp.parallel('askjsmin'));
|
||||
});
|
||||
|
||||
gulp.task('uglifyLayerJs', function () {
|
||||
gulp.watch(doraLayerSassPath, gulp.parallel('layerSass'));
|
||||
});
|
||||
|
||||
gulp.task('default', gulp.parallel('uglifyWhiteJs', 'uglifyEditorJs', 'uglifyPagerJs', 'uglifyLayerJs', function () {
|
||||
gulp.watch(doraWhiteSassPath, gulp.parallel('sass'));
|
||||
}))
|
228
app/assets/users/js/avalon-ms-pager.js
Normal file
228
app/assets/users/js/avalon-ms-pager.js
Normal file
@ -0,0 +1,228 @@
|
||||
; (function () {
|
||||
//*********************************************
|
||||
if (!avalon) {
|
||||
console.log("请先在当前页面引用avalon.js!另外请保证您引用了与该组件配套的css样式!");
|
||||
return;
|
||||
}
|
||||
function getHashStr(name) {
|
||||
var url = location.hash; //获取url中"?"符后的字串
|
||||
var theRequest = new Object();
|
||||
if (url.indexOf("?")) {
|
||||
var str = url.substr(url.indexOf("?") + 1);
|
||||
var strs = str.split("&");
|
||||
for (var i = 0; i < strs.length; i++) {
|
||||
theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
|
||||
}
|
||||
}
|
||||
return theRequest[name];
|
||||
}
|
||||
function getPages(currentPage) {
|
||||
var pages = []
|
||||
var s = this.showPages
|
||||
var total = this.totalPages
|
||||
var half = Math.floor(s / 2)
|
||||
var start = currentPage - half + 1 - s % 2
|
||||
var end = currentPage + half
|
||||
// handle boundary case
|
||||
if (start <= 0) {
|
||||
start = 1;
|
||||
//end = s > total ? total : s;
|
||||
}
|
||||
if (end > total) {
|
||||
//start = total - s + 1
|
||||
end = total
|
||||
}
|
||||
|
||||
var itPage = start;
|
||||
while (itPage <= end) {
|
||||
pages.push(itPage)
|
||||
itPage++
|
||||
}
|
||||
|
||||
return { currentPage: currentPage, pages: pages };
|
||||
}
|
||||
avalon.component('ms-pager', {
|
||||
template: "" +
|
||||
" <ul class='pagination' ms-visible='@totalPages>1'>" +
|
||||
" <li class='first' ms-class='{disabled: @isDisabled(\"first\", 1)}'>" +
|
||||
" <a ms-attr='{title:@getTitle(\"first\")}'" +
|
||||
" ms-click='@cbProxy($event,\"first\")'" +
|
||||
" >" +
|
||||
" <i class='fa fa-angle-double-left'></i>" +
|
||||
" </a>" +
|
||||
" </li>" +
|
||||
" <li class='prev'" +
|
||||
" ms-class='{disabled: @isDisabled(\"prev\",1)}'>" +
|
||||
" <a ms-attr='{title:@getTitle(\"prev\")}'" +
|
||||
" ms-click='@cbProxy($event,\"prev\")'" +
|
||||
" >" +
|
||||
" <i class='fa fa-angle-left'></i>" +
|
||||
" </a>" +
|
||||
" </li>" +
|
||||
" <li ms-for='page in @pages'" +
|
||||
" ms-class='{active: page === @currentPage}' >" +
|
||||
" <a ms-attr='{title:@getTitle(page)}'" +
|
||||
" ms-click='@cbProxy($event,page)'" +
|
||||
" >" +
|
||||
" {{page}}" +
|
||||
" </a>" +
|
||||
" </li>" +
|
||||
" <li class='next'" +
|
||||
" ms-class='{disabled: @isDisabled(\"next\",@totalPages)}'>" +
|
||||
" <a ms-attr='{title: @getTitle(\"next\")}'" +
|
||||
" ms-click='@cbProxy($event,\"next\")'" +
|
||||
" >" +
|
||||
" <i class='fa fa-angle-right'></i>" +
|
||||
" </a>" +
|
||||
" </li>" +
|
||||
" <li class='last'" +
|
||||
" ms-class='{disabled: @isDisabled(\"last\",@totalPages)}'>" +
|
||||
" <a ms-attr='{title: @getTitle(\"last\")}'" +
|
||||
" ms-click='@cbProxy($event,\"last\")'" +
|
||||
" >" +
|
||||
" <i class='fa fa-angle-double-right'></i>" +
|
||||
" </a>" +
|
||||
" </li>" +
|
||||
" </ul>",
|
||||
defaults: {
|
||||
$id: 'ms-pager',
|
||||
/**
|
||||
* 是否开启低版本兼容模式
|
||||
* 开启,将无法开启浏览器回退功能
|
||||
* */
|
||||
is_ie: false,
|
||||
/**
|
||||
* 配置复杂型单页
|
||||
* 默认为false
|
||||
* 如#/page=2
|
||||
* hash配置子页,后面还需配置分页信息时启用
|
||||
* 如#/game?page=2
|
||||
* 表示单页应用进入子页面game页,当前页为2
|
||||
* */
|
||||
is_more: true,
|
||||
hash: '',
|
||||
getHref: function (a) {
|
||||
if (this.is_more) {
|
||||
if (location.hash) {
|
||||
var search = location.hash,
|
||||
page = getHashStr('page');
|
||||
if (page) { // 存在就替换
|
||||
search = search.replace('page=' + page, 'page=' + this.toPage(a));
|
||||
return search;
|
||||
}
|
||||
else { // 不存在就叠加
|
||||
return location.hash + '?page=' + this.toPage(a)
|
||||
}
|
||||
}
|
||||
else {
|
||||
return '#?page=' + this.toPage(a)
|
||||
}
|
||||
}
|
||||
else {
|
||||
return '#page-' + this.toPage(a)
|
||||
}
|
||||
},
|
||||
getTitle: function (title) {
|
||||
return title
|
||||
},
|
||||
isDisabled: function (name, page) {
|
||||
return this.$buttons[name] = (this.currentPage === page)
|
||||
},
|
||||
$buttons: {},
|
||||
showPages: 5,
|
||||
pages: [],
|
||||
totalPages: avalon.noop,
|
||||
currentPage: 1,
|
||||
firstText: '《',
|
||||
prevText: '上一页',
|
||||
nextText: '下一页',
|
||||
lastText: '》',
|
||||
onPageClick: avalon.noop,
|
||||
toPage: function (p) {
|
||||
var cur = this.currentPage
|
||||
var max = this.totalPages
|
||||
switch (p) {
|
||||
case 'first':
|
||||
return 1
|
||||
case 'prev':
|
||||
return Math.max(cur - 1, 1)/*从第一页开始*/
|
||||
case 'next':
|
||||
return Math.min(cur + 1, max)
|
||||
case 'last':
|
||||
return max
|
||||
default:
|
||||
return p
|
||||
}
|
||||
},
|
||||
cbProxy: function (e, p) {
|
||||
var cur = this.toPage(p);
|
||||
if (this.$buttons[p] || p === this.currentPage) {
|
||||
if (cur === 1) {
|
||||
return this.onPageClick(e, cur);
|
||||
}
|
||||
e.preventDefault()
|
||||
return //disabled, active不会触发
|
||||
}
|
||||
/*替换链接改变hash的形式*/
|
||||
// window.location.hash = this.getHref(p);
|
||||
this.render(cur);
|
||||
return this.onPageClick(e, cur);
|
||||
},
|
||||
render: function (cur) {/*更新页码*/
|
||||
var obj = getPages.call(this, cur);
|
||||
this.currentPage = obj.currentPage;
|
||||
this.pages = obj.pages;
|
||||
},
|
||||
/*此处供正常单页应用*/
|
||||
rpage: function () {
|
||||
return this.is_more ? /(?:#|\?)page\=(\d+)/ : /(?:#|\?)page\-(\d+)/;
|
||||
},
|
||||
cur: function () { /*正确获取匹配页码*/
|
||||
var cur = this.currentPage;
|
||||
var match = this.rpage && location.href.match(this.rpage());
|
||||
if (match && match[1]) {
|
||||
var cur = ~~match[1]
|
||||
if (cur < 0 || cur > this.totalPages) {
|
||||
cur = 1
|
||||
}
|
||||
}
|
||||
return cur;
|
||||
},
|
||||
onInit: function () {
|
||||
var that = this;
|
||||
/**复杂单页应用,切换选项卡,重置页码
|
||||
* 但切换选项卡或者数据页数变化时,重置页码
|
||||
* */
|
||||
this.$watch('totalPages', function () {
|
||||
that.render(that.cur())
|
||||
});
|
||||
this.$watch('currentPage', function () {
|
||||
that.render(that.cur());
|
||||
});
|
||||
if (!that.is_ie && !that.is_more) {
|
||||
/**
|
||||
* 完美支持单页一分页组件(仅支持现代浏览器)
|
||||
* 浏览器回退键功能启动
|
||||
* */
|
||||
window.addEventListener("hashchange", function () {
|
||||
that.cbProxy(window.event, that.cur());
|
||||
}, false);
|
||||
}
|
||||
else if (!that.is_ie && that.is_more) {
|
||||
/**
|
||||
* 支持单页多分页组件(仅支持现代浏览器)
|
||||
* 此功能适用于单页多分页情景,开启此功能,可配合路由。
|
||||
* 监听location.hash触发特定的onPageClick
|
||||
* */
|
||||
window.addEventListener("hashchange", function () {
|
||||
that.render(that.cur());
|
||||
}, false);
|
||||
}
|
||||
/*进入页面预载入页码*/
|
||||
that.render(that.cur());
|
||||
}
|
||||
}
|
||||
});
|
||||
console.log("成功加载ms-pager组件!");
|
||||
//*********************************************
|
||||
})();
|
@ -1,7 +1,6 @@
|
||||
/*
|
||||
前后台公用js*/
|
||||
$(function () {
|
||||
|
||||
// 国际化信息存储
|
||||
window.__lk = '';
|
||||
let currentKeys = $('#sysKeys').val();
|
||||
@ -22,6 +21,11 @@ $(function () {
|
||||
return false;
|
||||
});
|
||||
|
||||
function getScrollTop() {
|
||||
var scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
|
||||
return scrollTop;
|
||||
}
|
||||
|
||||
// 监听滚动条位置
|
||||
$(window).scroll(function (event) {
|
||||
if (getScrollTop() > 200) {
|
||||
@ -113,6 +117,7 @@ function getSysValueByKey(key) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function loginOut() {
|
||||
layer.confirm(getSysValueByKey('sys_layer_confirm_logOut'), {
|
||||
title: getSysValueByKey('sys_layer_confirm_title'),
|
||||
@ -133,51 +138,6 @@ function loginOut() {
|
||||
})
|
||||
}
|
||||
|
||||
function watchCreator(id, targetId) {
|
||||
getAjaxData('/api/user/followCreator?creatorId=' + id, (data) => {
|
||||
if (data.status == 200) {
|
||||
$('#' + targetId).find('i').remove();
|
||||
$('#' + targetId).text('已关注');
|
||||
$('#' + targetId).attr('href', 'javascript:void(0)')
|
||||
}
|
||||
})
|
||||
}
|
||||
// 举报
|
||||
function reportDocument(contentId, type = '0') {
|
||||
getAjaxData('/api/user/report', (data) => {
|
||||
if (data.status == 200) {
|
||||
layer.msg(data.message, {
|
||||
icon: 1,
|
||||
time: msgTime,
|
||||
anim: 1
|
||||
});
|
||||
}
|
||||
}, 'post', {
|
||||
contentId,
|
||||
type
|
||||
})
|
||||
}
|
||||
|
||||
//兼容方式获取scrolltop以及设置scrolltop
|
||||
function getScrollTop() {
|
||||
var scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
|
||||
return scrollTop;
|
||||
}
|
||||
|
||||
// 弹窗初始化
|
||||
function initCheckModal(vm, msg, callBack) {
|
||||
$('#checkIfDo').on('show.bs.modal', function (event) {
|
||||
$(this).find('.modal-msg').text(msg);
|
||||
}).on('hide.bs.modal', function (event) {
|
||||
|
||||
});
|
||||
$('#checkIfDo').modal('show');
|
||||
//确认执行删除
|
||||
vm.confirmDo = function () {
|
||||
$('#checkIfDo').modal('hide');
|
||||
callBack();
|
||||
};
|
||||
}
|
||||
|
||||
function renderParams(paramObj) {
|
||||
let paramStr = '';
|
||||
@ -195,103 +155,6 @@ function getQueryString(name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* header avalon controller
|
||||
*
|
||||
*/
|
||||
|
||||
avalon.filters.cutwords = function (str, length) {
|
||||
var newStr = "";
|
||||
if (!str) return '';
|
||||
if (str.replace(/[\u0391-\uFFE5]/g, "aa").length > length) {
|
||||
newStr = str.substring(0, length) + '...'
|
||||
} else {
|
||||
newStr = str;
|
||||
}
|
||||
return newStr;
|
||||
}
|
||||
|
||||
avalon.filters.formatDateByType = function (date, type) {
|
||||
var newStr = "";
|
||||
if (type == 'mini') {
|
||||
newStr = date.substring(date.length - 8, date.length - 3);
|
||||
} else if (type = 'date') {
|
||||
newStr = date.substring(0, 9);
|
||||
}
|
||||
return newStr;
|
||||
}
|
||||
|
||||
avalon.filters.renderJob = function (data, type) {
|
||||
var newStr = "",
|
||||
askArr = [];
|
||||
if (!data) return '';
|
||||
|
||||
if (type == 'industry') {
|
||||
askArr = personInfoVm.industryArr;
|
||||
} else if (type == 'profession') {
|
||||
askArr = personInfoVm.professionArr;
|
||||
} else if (type == 'experience') {
|
||||
askArr = personInfoVm.experienceArr;
|
||||
}
|
||||
for (const askItem of askArr) {
|
||||
if (askItem.value == data) {
|
||||
newStr = askItem.text;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return newStr;
|
||||
}
|
||||
|
||||
|
||||
var searchVm = avalon.define({
|
||||
$id: 'headerCtr',
|
||||
lsk: [],
|
||||
searchkey: '',
|
||||
message: '',
|
||||
activeSearch: false,
|
||||
showErr: false,
|
||||
postArticel: function () {
|
||||
if ($('#logined').val() == "true") {
|
||||
window.location.href = "/users/userAddContent"
|
||||
} else {
|
||||
window.location.href = "/users/login"
|
||||
}
|
||||
},
|
||||
searchMe: function () {
|
||||
searchVm.activeSearch = !searchVm.activeSearch;
|
||||
},
|
||||
searchOpt: function (e) {
|
||||
if (searchVm.searchkey) {
|
||||
window.location.href = '/search/' + searchVm.searchkey;
|
||||
} else {
|
||||
layer.msg(getSysValueByKey('sys_layer_validate_keyword'), {
|
||||
icon: 0,
|
||||
time: msgTime
|
||||
});
|
||||
}
|
||||
},
|
||||
onKeyUp: function (e) {
|
||||
if (e && e.keyCode === 13) {
|
||||
searchVm.searchOpt()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
*
|
||||
* detail avalon controller
|
||||
*
|
||||
*/
|
||||
|
||||
var postArticelVm = avalon.define({
|
||||
$id: 'documentInfo',
|
||||
message: '',
|
||||
showErr: false
|
||||
})
|
||||
|
||||
var _oldValuesOfPersonInfoVM = {} // 用于保存旧的数据,取消时还原
|
||||
var personInfoVm = avalon.define({
|
||||
$id: 'personInfo',
|
||||
@ -409,140 +272,6 @@ var personInfoVm = avalon.define({
|
||||
},
|
||||
})
|
||||
|
||||
function askContentThu(askContentThumbsUp) {
|
||||
getAjaxData('/api/user/askContentThumbsUp', (data) => {
|
||||
|
||||
})
|
||||
}
|
||||
// 推荐帖子静态部分
|
||||
var rcStaticlVm = avalon.define({
|
||||
$id: 'rcStatic',
|
||||
askLike: (e, type, targetId) => {
|
||||
let oldLinkNum = $('#thumbs_' + targetId).text();
|
||||
let oldRewordNum = $('#reword_' + targetId).text();
|
||||
let oldDespisesNum = $('#despises_' + targetId).text();
|
||||
let oldFavoriteCommunityNum = $('#favoriteCommunity_' + targetId).text();
|
||||
|
||||
if (type == '1') {
|
||||
getAjaxData('/api/user/askContentThumbsUp?contentId=' + targetId, (data) => {
|
||||
if (data.status == 200) {
|
||||
// layer.msg(data.message, { icon: 1, anim: 1 });
|
||||
$('#thumbs_' + targetId).text(Number(oldLinkNum) + 1);
|
||||
}
|
||||
})
|
||||
} else if (type == '2') { // 踩
|
||||
getAjaxData("/api/user/despiseContent?contentId=" + targetId, (data) => {
|
||||
if (data.status == 200) {
|
||||
// layer.msg(data.message, { icon: 1, anim: 1 });
|
||||
$('#despises_' + targetId).text(Number(oldDespisesNum) + 1);
|
||||
}
|
||||
});
|
||||
} else if (type == '3') { // 评论
|
||||
window.location.href = '/details/' + targetId + '.html?id=comments'
|
||||
} else if (type == '4') { //收藏
|
||||
getAjaxData("/api/user/favoriteContent?contentId=" + targetId, (data) => {
|
||||
if (data.status == 200) {
|
||||
// layer.msg(data.message, { icon: 1, anim: 1 });
|
||||
$('#favoriteCommunity_' + targetId).text(Number(oldFavoriteCommunityNum) + 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
function getAppendList(type = '1') { // 1增加,2原地刷新
|
||||
|
||||
if (type == '1') {
|
||||
appendNewsVm.loadingState = true;
|
||||
appendNewsVm.current++;
|
||||
} else if (type == '2') {
|
||||
appendNewsVm.current = 2;
|
||||
appendNewsVm.pageSize = appendNewsVm.current * appendNewsVm.pageSize;
|
||||
}
|
||||
let appendType = $('#appendType').val();
|
||||
let paramsStr = '';
|
||||
if (appendType == 'reCommend') {
|
||||
paramsStr = '/api/content/getList?type=1¤t=' + appendNewsVm.current + '&pageSize=' + appendNewsVm.pageSize + '&isTop=1'
|
||||
} else if (appendType == 'hot') {
|
||||
paramsStr = '/api/content/getList?type=1¤t=' + appendNewsVm.current + '&pageSize=' + appendNewsVm.pageSize + '&sortby=clickNum'
|
||||
} else if (appendType == 'community') {
|
||||
paramsStr = '/api/community/getCommunityContents?current=' + appendNewsVm.current + '&pageSize=' + appendNewsVm.pageSize + appendNewsVm.current
|
||||
} else if (appendType == 'special') {
|
||||
paramsStr = '/api/special/getList?current=' + appendNewsVm.current + '&pageSize=' + appendNewsVm.pageSize
|
||||
} else if (appendType == 'search') {
|
||||
paramsStr = '/api/content/getList?current=' + appendNewsVm.current + '&pageSize=' + appendNewsVm.pageSize + '&searchkey=' + $('#searchkey').val()
|
||||
} else if (appendType == 'tag') {
|
||||
paramsStr = '/api/content/getList?current=' + appendNewsVm.current + '&pageSize=' + appendNewsVm.pageSize + '&tagName=' + $('#tagName').val()
|
||||
} else if (appendType == 'creatorContents') {
|
||||
paramsStr = '/api/content/getList?type=1¤t=' + appendNewsVm.current + '&pageSize=' + appendNewsVm.pageSize
|
||||
}
|
||||
getAjaxData(paramsStr, (data) => {
|
||||
if (type == '1') {
|
||||
appendNewsVm.loadingState = false;
|
||||
}
|
||||
if (data.data.docs.length > 0) {
|
||||
if (type == '1') {
|
||||
appendNewsVm.appendDocumentList = (appendNewsVm.appendDocumentList).concat(data.data.docs);
|
||||
} else if (type == '2') {
|
||||
appendNewsVm.appendDocumentList = data.data.docs;
|
||||
}
|
||||
} else {
|
||||
appendNewsVm.current--
|
||||
}
|
||||
})
|
||||
}
|
||||
// 下拉加载
|
||||
var appendNewsVm = avalon.define({
|
||||
$id: 'appendItems',
|
||||
current: 1,
|
||||
pageSize: '',
|
||||
appendDocumentList: [],
|
||||
loadingState: false,
|
||||
showAuthor: function (item, author, userName) {
|
||||
var obj = item[author]
|
||||
if (obj) {
|
||||
return obj[userName]
|
||||
}
|
||||
return ''
|
||||
},
|
||||
getMoreNews: function () {
|
||||
getAppendList();
|
||||
},
|
||||
appLike: (type, targetId) => {
|
||||
if (type == '1') {
|
||||
getAjaxData('/api/user/askContentThumbsUp?contentId=' + targetId, (data) => {
|
||||
if (data.status == 200) {
|
||||
getAppendList('2');
|
||||
}
|
||||
})
|
||||
} else if (type == '0') {
|
||||
getAjaxData("/api/user/rewordContent", (data) => {
|
||||
if (data.status == 200) {
|
||||
getAppendList('2');
|
||||
}
|
||||
}, 'post', {
|
||||
coins: 10,
|
||||
unit: 'MEC',
|
||||
contentId: targetId
|
||||
});
|
||||
} else if (type == '2') { // 踩
|
||||
getAjaxData("/api/user/despiseContent?contentId=" + targetId, (data) => {
|
||||
if (data.status == 200) {
|
||||
getAppendList('2');
|
||||
}
|
||||
});
|
||||
} else if (type == '3') { // 评论
|
||||
window.location.href = '/details/' + targetId + '.html?id=comments'
|
||||
} else if (type == '4') { //收藏 /api/user/favoriteContent
|
||||
getAjaxData("/api/user/favoriteContent?contentId=" + targetId, (data) => {
|
||||
if (data.status == 200) {
|
||||
getAppendList('2');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
*
|
||||
@ -783,106 +512,6 @@ var userEmailLoginVm = avalon.define({
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
*
|
||||
* msgBoard avalon controller
|
||||
*
|
||||
*/
|
||||
|
||||
function getPostMessages() {
|
||||
getAjaxData('/api/contentMessage/getMessages?pageSize=100&contentId=' + $('#contentId').val(), (data) => {
|
||||
if (data.status == 200) {
|
||||
postMsgVm.messageList = data.data.docs;
|
||||
}
|
||||
})
|
||||
}
|
||||
var postMsgVm = avalon.define({
|
||||
$id: 'postMessage',
|
||||
content: '',
|
||||
logined: false,
|
||||
message: '',
|
||||
showErr: false,
|
||||
messageList: [],
|
||||
replyState: false,
|
||||
relationMsgId: "",
|
||||
replyAuthor: "",
|
||||
adminReplyAuthor: "",
|
||||
praise_num: 0,
|
||||
despises_num: 0,
|
||||
getAuthor: function (item, adminAuthor, author) {
|
||||
if (item) {
|
||||
var obj = item[adminAuthor]
|
||||
if (obj) {
|
||||
return obj
|
||||
}
|
||||
return item[author] ? item[author] : '';
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
reSetData: function () {
|
||||
postMsgVm.content = "";
|
||||
postMsgVm.relationMsgId = "";
|
||||
postMsgVm.replyAuthor = "";
|
||||
postMsgVm.adminReplyAuthor = "";
|
||||
postMsgVm.showErr = false;
|
||||
postMsgVm.message = "";
|
||||
},
|
||||
reply: function (id, user, utype) {
|
||||
if (id && user) {
|
||||
postMsgVm.reSetData();
|
||||
postMsgVm.replyState = true;
|
||||
postMsgVm.relationMsgId = id;
|
||||
if (utype == '0') {
|
||||
postMsgVm.replyAuthor = user._id;
|
||||
} else {
|
||||
postMsgVm.adminReplyAuthor = user._id;
|
||||
}
|
||||
$("#msgSendBox").appendTo($("#msglist_" + id))
|
||||
}
|
||||
},
|
||||
cancelReply: function () {
|
||||
postMsgVm.reSetData();
|
||||
postMsgVm.replyState = false;
|
||||
$("#postMessage").prepend($('#msgSendBox'));
|
||||
},
|
||||
validate: {
|
||||
onError: function (reasons) {
|
||||
reasons.forEach(function (reason) {
|
||||
console.log(reason.getMessage())
|
||||
})
|
||||
},
|
||||
onValidateAll: function (reasons) {
|
||||
if (reasons.length) {
|
||||
postMsgVm.showErr = true;
|
||||
postMsgVm.message = reasons[0].message;
|
||||
} else {
|
||||
console.log('全部通过');
|
||||
if ($('#logined').val() == 'true') {
|
||||
var params = {
|
||||
contentId: $('#contentId').val(),
|
||||
replyAuthor: postMsgVm.replyAuthor,
|
||||
adminReplyAuthor: postMsgVm.adminReplyAuthor,
|
||||
relationMsgId: postMsgVm.relationMsgId,
|
||||
content: postMsgVm.content,
|
||||
}
|
||||
getAjaxData('/api/contentMessage/postMessages', (data) => {
|
||||
if (data.status == 200) {
|
||||
$("#postMessage").prepend($('#msgSendBox'));
|
||||
postMsgVm.reSetData();
|
||||
getPostMessages();
|
||||
}
|
||||
}, 'post', params);
|
||||
} else {
|
||||
window.location.href = "/users/login";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
*
|
||||
* myContents avalon controller
|
||||
@ -1430,12 +1059,15 @@ var userInfoVm = avalon.define({
|
||||
*/
|
||||
var userNavVm = avalon.define({
|
||||
$id: 'user-nav',
|
||||
currentPath: window.location.pathname
|
||||
})
|
||||
|
||||
/**
|
||||
*
|
||||
* userAddContent avalon controller
|
||||
*
|
||||
*/
|
||||
// });
|
||||
currentPath: window.location.pathname,
|
||||
menu_body_2_show: () => {
|
||||
return userNavVm.currentPath.indexOf('personInfo') > 0 ||
|
||||
userNavVm.currentPath.indexOf('setUserPsd') > 0
|
||||
},
|
||||
menu_body_1_show: () => {
|
||||
return userNavVm.currentPath.indexOf('userContents') > 0 ||
|
||||
userNavVm.currentPath.indexOf('joinComments') > 0 ||
|
||||
userNavVm.currentPath.indexOf('notify') > 0 ||
|
||||
userNavVm.currentPath.indexOf('userAddContent') > 0
|
||||
}
|
||||
})
|
29568
app/assets/users/js/ueditor.all.js
Normal file
29568
app/assets/users/js/ueditor.all.js
Normal file
File diff suppressed because it is too large
Load Diff
41
app/assets/users/package.json
Normal file
41
app/assets/users/package.json
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "doracms_theme_static",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "gulpfile.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://e.coding.net/doracms/doracms_theme_static.git"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"autoprefixer": "^7.1.0",
|
||||
"babel-core": "^6.24.1",
|
||||
"babel-helper-vue-jsx-merge-props": "^2.0.2",
|
||||
"babel-loader": "^7.0.0",
|
||||
"babel-plugin-lodash": "^3.3.2",
|
||||
"babel-plugin-syntax-jsx": "^6.18.0",
|
||||
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
|
||||
"babel-plugin-transform-object-rest-spread": "^6.23.0",
|
||||
"babel-plugin-transform-remove-strict-mode": "0.0.2",
|
||||
"babel-plugin-transform-runtime": "^6.23.0",
|
||||
"babel-plugin-transform-vue-jsx": "^3.4.3",
|
||||
"babel-preset-env": "^1.4.0",
|
||||
"babel-preset-es2015": "^6.13.2",
|
||||
"babel-preset-stage-2": "^6.24.1",
|
||||
"babel-runtime": "^6.20.0",
|
||||
"browserslist": "^2.1.2",
|
||||
"del": "^3.0.0",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-autoprefixer": "^6.0.0",
|
||||
"gulp-babel": "^7.0.1",
|
||||
"gulp-minify-css": "^1.2.4",
|
||||
"gulp-sass": "^4.0.2",
|
||||
"gulp-sequence": "^1.0.0",
|
||||
"gulp-uglify": "^3.0.0"
|
||||
}
|
||||
}
|
6
app/assets/users/postcss.config.js
Normal file
6
app/assets/users/postcss.config.js
Normal file
@ -0,0 +1,6 @@
|
||||
var autoprefixer = require('autoprefixer')
|
||||
var browserslist = require('browserslist')
|
||||
|
||||
module.exports = {
|
||||
plugins: [autoprefixer({browsers: browserslist('last 3 version, iOS > 8')})]
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
* @Author: doramart
|
||||
* @Date: 2019-06-18 17:04:40
|
||||
* @Last Modified by: doramart
|
||||
* @Last Modified time: 2020-03-10 17:18:10
|
||||
* @Last Modified time: 2020-04-28 00:04:55
|
||||
*/
|
||||
|
||||
const _ = require('lodash');
|
||||
@ -83,13 +83,13 @@ global.getContentListFields = (type = '') => {
|
||||
|
||||
let files = null;
|
||||
if (type == 'normal') {
|
||||
files = '_id title stitle sImg uAuthor date updateDate discription clickNum roofPlacement type videoImg state dismissReason categories isTop'
|
||||
files = '_id url title stitle sImg uAuthor date updateDate discription clickNum roofPlacement type videoImg state dismissReason categories isTop'
|
||||
} else if (type == 'simple') {
|
||||
files = '_id title stitle sImg stitle date updateDate clickNum roofPlacement type videoImg state dismissReason';
|
||||
files = '_id url title stitle sImg stitle date updateDate clickNum roofPlacement type videoImg state dismissReason';
|
||||
} else if (type == 'stage1') {
|
||||
files = '_id title stitle sImg uAuthor date updateDate discription comments clickNum roofPlacement type videoImg state dismissReason categories isTop'
|
||||
files = '_id url title stitle sImg uAuthor date updateDate discription comments clickNum roofPlacement type videoImg state dismissReason categories isTop'
|
||||
} else {
|
||||
files = '_id title stitle sImg uAuthor date discription clickNum roofPlacement type appShowType imageArr videoArr duration simpleComments comments videoImg state dismissReason categories isTop'
|
||||
files = '_id url title stitle sImg uAuthor date discription clickNum roofPlacement type appShowType imageArr videoArr duration simpleComments comments videoImg state dismissReason categories isTop'
|
||||
}
|
||||
// console.log('--files----', files)
|
||||
return files;
|
||||
|
21
app/bootstrap/plugin.js
Normal file
21
app/bootstrap/plugin.js
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* @Author: doramart
|
||||
* @description: js 插件资源
|
||||
* @Date: 2020-04-29 09:40:34
|
||||
* @Last Modified by: doramart
|
||||
* @Last Modified time: 2020-08-04 18:46:01
|
||||
*/
|
||||
module.exports = {
|
||||
|
||||
webuploader: ['webuploader.css', 'webuploader.min.js'],
|
||||
html5shiv: ['1.10.2/jquery.min.js'],
|
||||
jquery: ['3.7.2/html5shiv.min.js'],
|
||||
['respond.js']: ['1.4.2/respond.min.js'],
|
||||
json3: ['3.3.2/json3.min.js'],
|
||||
promise: ['promise.js'],
|
||||
ueditor: ['ueditor.config.js', 'ueditor.all.js'],
|
||||
['twitter-bootstrap']: ['3.3.5/css/bootstrap.min.css', '3.3.5/js/bootstrap.min.js'],
|
||||
['avalon.js']: ['2.2.7/avalon.min.js'],
|
||||
layer: ['layer.js', 'theme/default/layer.css'],
|
||||
['font-awesome']: ['4.7.0/css/font-awesome.min.css']
|
||||
}
|
@ -2,13 +2,104 @@
|
||||
* @Author: doramart
|
||||
* @Date: 2019-06-18 17:27:24
|
||||
* @Last Modified by: doramart
|
||||
* @Last Modified time: 2019-10-02 21:50:23
|
||||
* @Last Modified time: 2020-05-14 12:27:28
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
const _ = require('lodash');
|
||||
const nunjucks = require('nunjucks');
|
||||
const jsPlugins = require('./plugin');
|
||||
|
||||
const _renderContentCtx = async (appCtx, context, args, actionType) => {
|
||||
let _ctx = context.ctx;
|
||||
let key = _.isEmpty(args.key) ? actionType : args.key;
|
||||
|
||||
let api = 'content/getList';
|
||||
|
||||
let queryObj = {};
|
||||
if (actionType == 'recommend') {
|
||||
queryObj = {
|
||||
"model": "1",
|
||||
"isPaging": "0"
|
||||
}
|
||||
} else if (actionType == 'hot') {
|
||||
queryObj = {
|
||||
"sortby": "1",
|
||||
"isPaging": "0"
|
||||
}
|
||||
} else if (actionType == 'news') {
|
||||
queryObj = {
|
||||
"isPaging": "0"
|
||||
}
|
||||
} else if (actionType == 'random') {
|
||||
api = 'content/getRadomContents';
|
||||
queryObj = {
|
||||
"isPaging": "0"
|
||||
}
|
||||
} else if (actionType == 'near_post') {
|
||||
api = "content/getNearbyContent";
|
||||
queryObj = {
|
||||
"id": args.id || _ctx.post._id
|
||||
}
|
||||
} else if (actionType == 'tags') {
|
||||
api = "contentTag/getList";
|
||||
queryObj = {
|
||||
"isPaging": "0"
|
||||
}
|
||||
} else if (actionType == 'hottags') {
|
||||
api = "contentTag/getHotList"
|
||||
} else if (actionType == 'ads') {
|
||||
api = "ads/getOne";
|
||||
if (args.name) {
|
||||
key = args.name;
|
||||
queryObj = {
|
||||
"name": args.name || ''
|
||||
}
|
||||
}
|
||||
} else if (actionType == 'navtree') {
|
||||
api = "contentCategory/getTreelist";
|
||||
} else if (actionType == 'childnav') {
|
||||
api = "contentCategory/getCurrentCategoriesById";
|
||||
}
|
||||
|
||||
|
||||
const typeId = args.typeId ? args.typeId : false;
|
||||
const pageSize = args.pageSize ? args.pageSize : 10;
|
||||
const isPaging = args.isPaging ? args.isPaging : "1";
|
||||
|
||||
let apiData = [];
|
||||
|
||||
if (!key || !api) {
|
||||
throw new Error(context.ctx.__('validate_error_params'));
|
||||
}
|
||||
|
||||
let payload = {};
|
||||
|
||||
if (typeId) {
|
||||
payload.typeId = typeId;
|
||||
}
|
||||
|
||||
if (pageSize) {
|
||||
payload.pageSize = pageSize;
|
||||
}
|
||||
|
||||
if (isPaging) {
|
||||
payload.isPaging = isPaging;
|
||||
}
|
||||
|
||||
if (queryObj) {
|
||||
_.assign(payload, queryObj);
|
||||
}
|
||||
|
||||
// console.log(actionType, '--payload--', payload)
|
||||
apiData = await appCtx.helper.reqJsonData(api, payload);
|
||||
|
||||
context.ctx[key] = apiData;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// api调用
|
||||
global.remote = function (appCtx) {
|
||||
|
||||
this.tags = ['remote'];
|
||||
@ -59,4 +150,442 @@ global.remote = function (appCtx) {
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
// 最新文档
|
||||
global.news = function (appCtx) {
|
||||
|
||||
this.tags = ['news'];
|
||||
|
||||
this.parse = function (parser, nodes, lexer) {
|
||||
var tok = parser.nextToken();
|
||||
var args = parser.parseSignature(null, true);
|
||||
parser.advanceAfterBlockEnd(tok.value);
|
||||
return new nodes.CallExtensionAsync(this, 'run', args);
|
||||
};
|
||||
|
||||
this.run = async (context, args, callback) => {
|
||||
|
||||
try {
|
||||
await _renderContentCtx(appCtx, context, args, 'news')
|
||||
return callback(null, '');
|
||||
} catch (error) {
|
||||
context.ctx[key] = [];
|
||||
return callback(null, '');
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
// 推荐文档
|
||||
global.recommend = function (appCtx) {
|
||||
|
||||
this.tags = ['recommend'];
|
||||
|
||||
this.parse = function (parser, nodes, lexer) {
|
||||
var tok = parser.nextToken();
|
||||
var args = parser.parseSignature(null, true);
|
||||
parser.advanceAfterBlockEnd(tok.value);
|
||||
return new nodes.CallExtensionAsync(this, 'run', args);
|
||||
};
|
||||
|
||||
this.run = async (context, args, callback) => {
|
||||
|
||||
try {
|
||||
await _renderContentCtx(appCtx, context, args, 'recommend')
|
||||
return callback(null, '');
|
||||
} catch (error) {
|
||||
return callback(null, '');
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
// 热门文档
|
||||
global.hot = function (appCtx) {
|
||||
|
||||
this.tags = ['hot'];
|
||||
|
||||
this.parse = function (parser, nodes, lexer) {
|
||||
var tok = parser.nextToken();
|
||||
var args = parser.parseSignature(null, true);
|
||||
parser.advanceAfterBlockEnd(tok.value);
|
||||
return new nodes.CallExtensionAsync(this, 'run', args);
|
||||
};
|
||||
|
||||
this.run = async (context, args, callback) => {
|
||||
|
||||
try {
|
||||
await _renderContentCtx(appCtx, context, args, 'hot')
|
||||
return callback(null, '');
|
||||
} catch (error) {
|
||||
context.ctx[key] = [];
|
||||
return callback(null, '');
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
// 随机文档
|
||||
global.random = function (appCtx) {
|
||||
|
||||
this.tags = ['random'];
|
||||
|
||||
this.parse = function (parser, nodes, lexer) {
|
||||
var tok = parser.nextToken();
|
||||
var args = parser.parseSignature(null, true);
|
||||
parser.advanceAfterBlockEnd(tok.value);
|
||||
return new nodes.CallExtensionAsync(this, 'run', args);
|
||||
};
|
||||
|
||||
this.run = async (context, args, callback) => {
|
||||
try {
|
||||
await _renderContentCtx(appCtx, context, args, 'random')
|
||||
return callback(null, '');
|
||||
} catch (error) {
|
||||
return callback(null, '');
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
// 标签
|
||||
global.tags = function (appCtx) {
|
||||
|
||||
this.tags = ['tags'];
|
||||
|
||||
this.parse = function (parser, nodes, lexer) {
|
||||
var tok = parser.nextToken();
|
||||
var args = parser.parseSignature(null, true);
|
||||
parser.advanceAfterBlockEnd(tok.value);
|
||||
return new nodes.CallExtensionAsync(this, 'run', args);
|
||||
};
|
||||
|
||||
this.run = async (context, args, callback) => {
|
||||
try {
|
||||
await _renderContentCtx(appCtx, context, args, 'tags')
|
||||
return callback(null, '');
|
||||
} catch (error) {
|
||||
return callback(null, '');
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
// 热门标签
|
||||
global.hottags = function (appCtx) {
|
||||
|
||||
this.tags = ['hottags'];
|
||||
|
||||
this.parse = function (parser, nodes, lexer) {
|
||||
var tok = parser.nextToken();
|
||||
var args = parser.parseSignature(null, true);
|
||||
parser.advanceAfterBlockEnd(tok.value);
|
||||
return new nodes.CallExtensionAsync(this, 'run', args);
|
||||
};
|
||||
|
||||
this.run = async (context, args, callback) => {
|
||||
try {
|
||||
await _renderContentCtx(appCtx, context, args, 'hottags')
|
||||
return callback(null, '');
|
||||
} catch (error) {
|
||||
return callback(null, '');
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
// 广告
|
||||
global.ads = function (appCtx) {
|
||||
|
||||
this.tags = ['ads'];
|
||||
|
||||
this.parse = function (parser, nodes, lexer) {
|
||||
var tok = parser.nextToken();
|
||||
var args = parser.parseSignature(null, true);
|
||||
parser.advanceAfterBlockEnd(tok.value);
|
||||
return new nodes.CallExtensionAsync(this, 'run', args);
|
||||
};
|
||||
|
||||
this.run = async (context, args, callback) => {
|
||||
try {
|
||||
await _renderContentCtx(appCtx, context, args, 'ads')
|
||||
return callback(null, '');
|
||||
} catch (error) {
|
||||
return callback(null, '');
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
// 具有父子关系的分类列表
|
||||
global.navtree = function (appCtx) {
|
||||
|
||||
this.tags = ['navtree'];
|
||||
|
||||
this.parse = function (parser, nodes, lexer) {
|
||||
var tok = parser.nextToken();
|
||||
var args = parser.parseSignature(null, true);
|
||||
parser.advanceAfterBlockEnd(tok.value);
|
||||
return new nodes.CallExtensionAsync(this, 'run', args);
|
||||
};
|
||||
|
||||
this.run = async (context, args, callback) => {
|
||||
try {
|
||||
await _renderContentCtx(appCtx, context, args, 'navtree')
|
||||
return callback(null, '');
|
||||
} catch (error) {
|
||||
return callback(null, '');
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
// 指定类别下的子类
|
||||
global.childnav = function (appCtx) {
|
||||
|
||||
this.tags = ['childnav'];
|
||||
|
||||
this.parse = function (parser, nodes, lexer) {
|
||||
var tok = parser.nextToken();
|
||||
var args = parser.parseSignature(null, true);
|
||||
parser.advanceAfterBlockEnd(tok.value);
|
||||
return new nodes.CallExtensionAsync(this, 'run', args);
|
||||
};
|
||||
|
||||
this.run = async (context, args, callback) => {
|
||||
try {
|
||||
await _renderContentCtx(appCtx, context, args, 'childnav')
|
||||
return callback(null, '');
|
||||
} catch (error) {
|
||||
return callback(null, '');
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
// 上下篇文档
|
||||
global.near_post = function (appCtx) {
|
||||
|
||||
this.tags = ['near_post'];
|
||||
|
||||
this.parse = function (parser, nodes, lexer) {
|
||||
var tok = parser.nextToken();
|
||||
var args = parser.parseSignature(null, true);
|
||||
parser.advanceAfterBlockEnd(tok.value);
|
||||
return new nodes.CallExtensionAsync(this, 'run', args);
|
||||
};
|
||||
|
||||
this.run = async (context, args, callback) => {
|
||||
try {
|
||||
await _renderContentCtx(appCtx, context, args, 'near_post')
|
||||
return callback(null, '');
|
||||
} catch (error) {
|
||||
return callback(null, '');
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
// 头部
|
||||
global.HeaderExtension = function () {
|
||||
this.tags = ['header'];
|
||||
|
||||
this.parse = function (parser, nodes) {
|
||||
const tok = parser.nextToken(); // Get the tag token
|
||||
|
||||
// Parse the args and move after the block end.
|
||||
const args = parser.parseSignature(null, true);
|
||||
parser.advanceAfterBlockEnd(tok.value);
|
||||
|
||||
// Parse the body
|
||||
const body = parser.parseUntilBlocks('header', 'endheader');
|
||||
parser.advanceAfterBlockEnd();
|
||||
|
||||
// Actually do work on block body and arguments
|
||||
return new nodes.CallExtension(this, 'run', args, [body]);
|
||||
};
|
||||
|
||||
this.run = function (context, args, bodyCallback) {
|
||||
const params = !_.isEmpty(args) ? args : {};
|
||||
let _ctx = context.ctx;
|
||||
const rawCode = bodyCallback ? bodyCallback() : '';
|
||||
let metaArr = [];
|
||||
|
||||
metaArr.push(`<meta charset="utf-8">`);
|
||||
metaArr.push(`<title>${_ctx.site.title}</title>`);
|
||||
metaArr.push(`<meta name="viewport" content="width=device-width, initial-scale=1">`);
|
||||
metaArr.push(`<meta name="description" content="${_ctx.site.discription}">`);
|
||||
metaArr.push(`<meta content="${_ctx.site.key}" name="keywords" />`);
|
||||
metaArr.push(`<meta property="og:type" content="website" />`);
|
||||
metaArr.push(`<meta property="og:title" content="${_ctx.site.title}" />`);
|
||||
metaArr.push(`<meta property="og:description" content="${_ctx.site.discription}" />`);
|
||||
metaArr.push(`<meta property="og:image" content="${_ctx.ogData.img}">`);
|
||||
metaArr.push(`<meta property="og:url" content="${_ctx.ogData.url}">`);
|
||||
metaArr.push(`<meta name="author" content="DoraCMS">`);
|
||||
|
||||
// 默认插件支持
|
||||
metaArr.push(`<script src="${_ctx.staticRootPath}/plugins/avalon.js/2.2.7/avalon.min.js?version=${_ctx.site.version}"></script>`);
|
||||
metaArr.push(`<script src="${_ctx.staticRootPath}/plugins/jquery/1.10.2/jquery.min.js?version=${_ctx.site.version}"></script>`);
|
||||
metaArr.push(`<script src="${_ctx.staticRootPath}/plugins/layer/layer.js?version=${_ctx.site.version}"></script>`);
|
||||
metaArr.push(`<script src="${_ctx.staticRootPath}/themes/users/js/dora.front.js?version=${_ctx.site.version}"></script>\n`)
|
||||
metaArr.push(`<link rel="stylesheet" href="${_ctx.staticRootPath}/plugins/layer/theme/default/layer.css">`);
|
||||
|
||||
if (params.adaptor == 'ie') {
|
||||
metaArr.push(`<!--[if lt IE 9]>`);
|
||||
metaArr.push(`<script src="${_ctx.staticRootPath}/plugins/html5shiv/3.7.2/html5shiv.min.js"></script>`);
|
||||
metaArr.push(`<script src="${_ctx.staticRootPath}/plugins/respond.js/1.4.2/respond.min.js"></script>`);
|
||||
metaArr.push(`<script src="${_ctx.staticRootPath}/plugins/json3/3.3.2/json3.min.js"></script>`);
|
||||
metaArr.push(`<script src="${_ctx.staticRootPath}/plugins/promise/promise.js"></script>`);
|
||||
metaArr.push(`<![endif]-->`);
|
||||
} else if (params.adaptor == 'modernizr') {
|
||||
metaArr.push(`<script src="${_ctx.staticRootPath}/plugins/modernizr/modernizr.js"></script>`);
|
||||
}
|
||||
|
||||
if (_ctx.site.router == 'users') {
|
||||
metaArr.push(`<link rel="stylesheet" href="${_ctx.staticRootPath}/plugins/font-awesome/4.7.0/css/font-awesome.min.css">`);
|
||||
metaArr.push(`<link rel="stylesheet" href="${_ctx.staticRootPath}/plugins/twitter-bootstrap/3.3.5/css/bootstrap.min.css?version=${_ctx.site.version}">\n`);
|
||||
metaArr.push(`<link rel="stylesheet" href="${_ctx.staticRootPath}/themes/users/css/white.css?version=${_ctx.site.version}">\n`);
|
||||
metaArr.push(`<script src="${_ctx.staticRootPath}/themes/users/js/avalon-ms-pager.js?version=${_ctx.site.version}"></script>\n`)
|
||||
}
|
||||
|
||||
metaArr.push(rawCode);
|
||||
let metaStr = metaArr.join('\n');
|
||||
|
||||
if (_ctx.site.configs.statisticalCode) {
|
||||
metaStr += `\n`;
|
||||
metaStr += `
|
||||
<script>
|
||||
var _hmt = _hmt || [];
|
||||
(function () {
|
||||
var hm = document.createElement("script");
|
||||
hm.src = "${_ctx.site.configs.statisticalCode}";
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
</script>
|
||||
`;
|
||||
}
|
||||
return new nunjucks.runtime.SafeString(metaStr);
|
||||
};
|
||||
}
|
||||
|
||||
// 静态资源
|
||||
global.AssetsExtension = function () {
|
||||
|
||||
this.tags = ['assets'];
|
||||
|
||||
this.parse = function (parser, nodes) {
|
||||
const tok = parser.nextToken(); // Get the tag token
|
||||
|
||||
// Parse the args and move after the block end.
|
||||
const args = parser.parseSignature(null, true);
|
||||
parser.advanceAfterBlockEnd(tok.value);
|
||||
|
||||
// Parse the body
|
||||
const body = parser.parseUntilBlocks('assets', 'endassets');
|
||||
parser.advanceAfterBlockEnd();
|
||||
|
||||
// Actually do work on block body and arguments
|
||||
return new nodes.CallExtension(this, 'run', args, [body]);
|
||||
};
|
||||
|
||||
this.run = function (context, args, bodyCallback) {
|
||||
let _ctx = context.ctx;
|
||||
const assetsSource = args ? args : '';
|
||||
// const assetsType = args.type;
|
||||
const assetsKeyArr = assetsSource.split(' ');
|
||||
// console.log('--_ctx--', _ctx)
|
||||
const rawCode = bodyCallback();
|
||||
let assetsStr = ``;
|
||||
let assetsPath = `${_ctx.staticThemePath}`;
|
||||
|
||||
for (const item of assetsKeyArr) {
|
||||
let fileExtension = item.split('.').pop();
|
||||
if (fileExtension != 'js' && fileExtension != 'css') {
|
||||
continue;
|
||||
}
|
||||
let targetPath = '';
|
||||
if (item.indexOf('/') >= 1) {
|
||||
targetPath = `${_ctx.staticRootPath}/${item}`;
|
||||
} else {
|
||||
targetPath = `${assetsPath}/${fileExtension}/${item}`;
|
||||
}
|
||||
if (fileExtension == 'js') {
|
||||
assetsStr += `<script src="${targetPath}?version=${_ctx.site.version}"></script>\n`
|
||||
} else if (fileExtension == 'css') {
|
||||
assetsStr += `<link href="${targetPath}?version=${_ctx.site.version}" rel="stylesheet">\n`
|
||||
}
|
||||
}
|
||||
|
||||
if (rawCode) {
|
||||
assetsStr += `\n
|
||||
${rawCode}
|
||||
`
|
||||
}
|
||||
|
||||
return new nunjucks.runtime.SafeString(assetsStr);
|
||||
};
|
||||
}
|
||||
|
||||
// js 插件
|
||||
global.PluginsExtension = function () {
|
||||
|
||||
this.tags = ['plugin'];
|
||||
|
||||
this.parse = function (parser, nodes) {
|
||||
const tok = parser.nextToken(); // Get the tag token
|
||||
|
||||
// Parse the args and move after the block end.
|
||||
const args = parser.parseSignature(null, true);
|
||||
parser.advanceAfterBlockEnd(tok.value);
|
||||
|
||||
// Parse the body
|
||||
const body = parser.parseUntilBlocks('plugin', 'endplugin');
|
||||
parser.advanceAfterBlockEnd();
|
||||
|
||||
// Actually do work on block body and arguments
|
||||
return new nodes.CallExtension(this, 'run', args, [body]);
|
||||
};
|
||||
|
||||
this.run = function (context, args, bodyCallback) {
|
||||
|
||||
let _ctx = context.ctx;
|
||||
const rawCode = bodyCallback();
|
||||
let assetsStr = ``;
|
||||
let pluginName = args.name ? args.name : '';
|
||||
|
||||
if (!pluginName) {
|
||||
return '';
|
||||
} else {
|
||||
pluginName = pluginName.split(' ');
|
||||
}
|
||||
|
||||
for (const pluginItem of pluginName) {
|
||||
|
||||
const assetsKeyArr = jsPlugins[pluginItem];
|
||||
|
||||
for (const item of assetsKeyArr) {
|
||||
let fileExtension = item.split('.').pop();
|
||||
if (fileExtension != 'js' && fileExtension != 'css') {
|
||||
continue;
|
||||
}
|
||||
let targetPath = `${_ctx.staticRootPath}/plugins/${pluginItem}/${item}`;
|
||||
|
||||
if (fileExtension == 'js') {
|
||||
assetsStr += `<script src="${targetPath}?version=${_ctx.site.version}"></script>\n`
|
||||
} else if (fileExtension == 'css') {
|
||||
assetsStr += `<link href="${targetPath}?version=${_ctx.site.version}" rel="stylesheet">\n`
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (rawCode) {
|
||||
assetsStr += `\n
|
||||
${rawCode}
|
||||
`
|
||||
}
|
||||
|
||||
return new nunjucks.runtime.SafeString(assetsStr);
|
||||
};
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
* @Author: doramart
|
||||
* @Date: 2019-06-27 17:16:32
|
||||
* @Last Modified by: doramart
|
||||
* @Last Modified time: 2020-03-20 08:53:05
|
||||
* @Last Modified time: 2020-07-27 17:03:50
|
||||
*/
|
||||
const Controller = require('egg').Controller;
|
||||
const jwt = require('jsonwebtoken')
|
||||
@ -93,7 +93,7 @@ class AdminController extends Controller {
|
||||
// 兼容老的加密方式
|
||||
if (userPsd !== CryptoJS.MD5(this.app.config.salt_md5_key + fields.password).toString() &&
|
||||
fields.password != ctx.helper.decrypt(userPsd, this.app.config.encrypt_key)) {
|
||||
throw new Error(ctx.__("validate_user_forbiden"));
|
||||
throw new Error(ctx.__("validate_login_notSuccess"));
|
||||
}
|
||||
|
||||
if (!user.enable) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: doramart
|
||||
* @Date: 2019-06-20 18:55:40
|
||||
* @Last Modified by: doramart
|
||||
* @Last Modified time: 2020-02-17 17:19:22
|
||||
* @Last Modified time: 2020-08-02 00:15:44
|
||||
*/
|
||||
const Controller = require('egg').Controller;
|
||||
const {
|
||||
@ -178,12 +178,21 @@ class AdminResourceController extends Controller {
|
||||
ctx.validate(adminResourceRule.form(ctx), formObj);
|
||||
|
||||
|
||||
|
||||
let oldResource = await ctx.service.adminResource.item(ctx, {
|
||||
query: {
|
||||
label: fields.label
|
||||
}
|
||||
})
|
||||
let oldResource;
|
||||
if (fields.type == '0') {
|
||||
oldResource = await ctx.service.adminResource.item(ctx, {
|
||||
query: {
|
||||
label: fields.label
|
||||
}
|
||||
})
|
||||
} else {
|
||||
oldResource = await ctx.service.adminResource.item(ctx, {
|
||||
query: {
|
||||
parentId: fields.parentId,
|
||||
comments: fields.comments
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (!_.isEmpty(oldResource) && oldResource._id != fields._id) {
|
||||
throw new Error(ctx.__("user_action_tips_repeat", [ctx.__('label_resourceName')]));
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: doramart
|
||||
* @Date: 2019-06-20 18:55:40
|
||||
* @Last Modified by: doramart
|
||||
* @Last Modified time: 2020-02-17 17:20:26
|
||||
* @Last Modified time: 2020-07-27 16:58:55
|
||||
*/
|
||||
const Controller = require('egg').Controller;
|
||||
const {
|
||||
@ -517,7 +517,6 @@ class AdminUserController extends Controller {
|
||||
}
|
||||
|
||||
renderMap = _.uniqWith(renderMap, _.isEqual);
|
||||
|
||||
await ctx.render('manage/index.html', {
|
||||
renderMap: renderMap,
|
||||
renderMapJson: JSON.stringify(renderMap),
|
||||
|
178
app/controller/manage/hook.js
Executable file
178
app/controller/manage/hook.js
Executable file
@ -0,0 +1,178 @@
|
||||
/*
|
||||
* @Author: doramart
|
||||
* @Date: 2019-06-20 18:55:40
|
||||
* @Last Modified by: doramart
|
||||
* @Last Modified time: 2020-07-05 18:06:07
|
||||
*/
|
||||
const Controller = require('egg').Controller;
|
||||
const xss = require("xss");
|
||||
const _ = require('lodash');
|
||||
|
||||
class HookController extends Controller {
|
||||
|
||||
async list(ctx) {
|
||||
|
||||
try {
|
||||
|
||||
let payload = ctx.query;
|
||||
let queryObj = {};
|
||||
|
||||
let hooksList = await ctx.service.hook.find(payload, {
|
||||
query: queryObj,
|
||||
});
|
||||
|
||||
ctx.helper.renderSuccess(ctx, {
|
||||
data: hooksList
|
||||
});
|
||||
|
||||
} catch (err) {
|
||||
|
||||
ctx.helper.renderFail(ctx, {
|
||||
message: err
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
async create(ctx) {
|
||||
|
||||
|
||||
try {
|
||||
|
||||
let fields = ctx.request.body || {};
|
||||
const formObj = {
|
||||
|
||||
|
||||
name: fields.name,
|
||||
|
||||
|
||||
|
||||
|
||||
description: fields.description,
|
||||
|
||||
|
||||
|
||||
|
||||
type: fields.type,
|
||||
|
||||
|
||||
|
||||
|
||||
ext: fields.ext,
|
||||
|
||||
|
||||
|
||||
|
||||
status: fields.status,
|
||||
|
||||
|
||||
|
||||
createTime: new Date()
|
||||
}
|
||||
|
||||
|
||||
await ctx.service.hook.create(formObj);
|
||||
|
||||
ctx.helper.renderSuccess(ctx);
|
||||
|
||||
} catch (err) {
|
||||
ctx.helper.renderFail(ctx, {
|
||||
message: err
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async getOne(ctx) {
|
||||
|
||||
try {
|
||||
let _id = ctx.query.id;
|
||||
|
||||
let targetItem = await ctx.service.hook.item(ctx, {
|
||||
query: {
|
||||
_id: _id
|
||||
}
|
||||
});
|
||||
|
||||
ctx.helper.renderSuccess(ctx, {
|
||||
data: targetItem
|
||||
});
|
||||
|
||||
} catch (err) {
|
||||
ctx.helper.renderFail(ctx, {
|
||||
message: err
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
async update(ctx) {
|
||||
|
||||
|
||||
try {
|
||||
|
||||
let fields = ctx.request.body || {};
|
||||
const formObj = {
|
||||
|
||||
|
||||
name: fields.name,
|
||||
|
||||
|
||||
|
||||
|
||||
description: fields.description,
|
||||
|
||||
|
||||
|
||||
|
||||
type: fields.type,
|
||||
|
||||
|
||||
|
||||
|
||||
ext: fields.ext,
|
||||
|
||||
|
||||
|
||||
|
||||
status: fields.status,
|
||||
|
||||
|
||||
|
||||
updateTime: new Date()
|
||||
}
|
||||
|
||||
|
||||
await ctx.service.hook.update(ctx, fields._id, formObj);
|
||||
|
||||
ctx.helper.renderSuccess(ctx);
|
||||
|
||||
} catch (err) {
|
||||
|
||||
ctx.helper.renderFail(ctx, {
|
||||
message: err
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
async removes(ctx) {
|
||||
|
||||
try {
|
||||
let targetIds = ctx.query.ids;
|
||||
await ctx.service.hook.removes(ctx, targetIds);
|
||||
ctx.helper.renderSuccess(ctx);
|
||||
|
||||
} catch (err) {
|
||||
|
||||
ctx.helper.renderFail(ctx, {
|
||||
message: err
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = HookController;
|
@ -2,7 +2,7 @@
|
||||
* @Author: doramart
|
||||
* @Date: 2019-06-20 18:55:40
|
||||
* @Last Modified by: doramart
|
||||
* @Last Modified time: 2020-03-31 11:38:15
|
||||
* @Last Modified time: 2020-04-11 22:28:08
|
||||
*/
|
||||
const Controller = require('egg').Controller;
|
||||
const shell = require('shelljs');
|
||||
@ -127,6 +127,7 @@ class PluginController extends Controller {
|
||||
// 5、保存插件基本信息到本地
|
||||
let currentPluginInfo = _.assign({}, pluginInfos, {
|
||||
pluginId: pluginInfos._id,
|
||||
installor: ctx.session.adminUserInfo._id,
|
||||
createTime: new Date()
|
||||
})
|
||||
delete currentPluginInfo._id;
|
||||
@ -251,6 +252,41 @@ class PluginController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
async enablePlugin() {
|
||||
|
||||
const {
|
||||
ctx,
|
||||
service
|
||||
} = this;
|
||||
try {
|
||||
|
||||
let fields = ctx.request.body;
|
||||
let targetId = fields.id;
|
||||
let state = fields.state;
|
||||
|
||||
let pluginInfos = await ctx.service.plugin.item(ctx, {
|
||||
query: {
|
||||
_id: targetId
|
||||
}
|
||||
})
|
||||
|
||||
if (_.isEmpty(pluginInfos)) {
|
||||
throw new Error(ctx.__('validate_error_params'));
|
||||
}
|
||||
|
||||
await ctx.service.plugin.update(ctx, targetId, {
|
||||
state
|
||||
})
|
||||
|
||||
ctx.helper.renderSuccess(ctx);
|
||||
|
||||
} catch (err) {
|
||||
ctx.helper.renderFail(ctx, {
|
||||
message: err
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async getOne() {
|
||||
const {
|
||||
ctx,
|
||||
|
@ -78,23 +78,7 @@ class HomeController extends Controller {
|
||||
ctx.body = stream;
|
||||
}
|
||||
|
||||
// 获取类别或文档详情模板文件
|
||||
getCateOrDetailTemp(defaultTempItems, contentTemp = '', type) {
|
||||
let fileName = "contentList.html",
|
||||
currentPath = "";
|
||||
if (type == 'detail') {
|
||||
fileName = "detail.html";
|
||||
}
|
||||
if (!_.isEmpty(contentTemp)) {
|
||||
currentPath = contentTemp.forder + "/" + fileName;
|
||||
} else {
|
||||
let defaultItem = _.filter(defaultTempItems, (temp) => {
|
||||
return temp.isDefault;
|
||||
})
|
||||
currentPath = defaultItem[0].forder + "/" + fileName;
|
||||
}
|
||||
return currentPath;
|
||||
}
|
||||
|
||||
|
||||
async getSiteMapPage() {
|
||||
// 获取站点配置
|
||||
@ -117,13 +101,7 @@ class HomeController extends Controller {
|
||||
allCategories.forEach(function (cate) {
|
||||
xml += "<url>";
|
||||
xml +=
|
||||
"<loc>" +
|
||||
root_path +
|
||||
"/" +
|
||||
cate.defaultUrl +
|
||||
"___" +
|
||||
cate._id +
|
||||
"</loc>";
|
||||
"<loc>" + root_path + cate.url + "</loc>";
|
||||
xml += "<changefreq>weekly</changefreq>";
|
||||
xml += "<lastmod>" + lastMod + "</lastmod>";
|
||||
xml += "<priority>0.8</priority>";
|
||||
@ -136,7 +114,7 @@ class HomeController extends Controller {
|
||||
});
|
||||
allContents.forEach(function (post) {
|
||||
xml += "<url>";
|
||||
xml += "<loc>" + root_path + "/details/" + post._id + ".html</loc>";
|
||||
xml += "<loc>" + root_path + post.url + "</loc>";
|
||||
xml += "<changefreq>weekly</changefreq>";
|
||||
xml += "<lastmod>" + lastMod + "</lastmod>";
|
||||
xml += "<priority>0.5</priority>";
|
||||
@ -151,8 +129,9 @@ class HomeController extends Controller {
|
||||
const ctx = this.ctx;
|
||||
ctx.query.current = ctx.params.current;
|
||||
ctx.tempPage = 'index.html';
|
||||
ctx.pageType = "index"
|
||||
await this.getPageData(this);
|
||||
ctx.pageType = "index";
|
||||
// console.log('-ctx.getSiteInfo();--', await ctx.getSiteInfo())
|
||||
await ctx.getPageData();
|
||||
}
|
||||
|
||||
async getDataForCatePage() {
|
||||
@ -166,12 +145,12 @@ class HomeController extends Controller {
|
||||
} else {
|
||||
if (current) {
|
||||
if (validator.isNumeric(current)) {
|
||||
await this.getPageData(this);
|
||||
await ctx.getPageData();
|
||||
} else {
|
||||
ctx.redirect("/");
|
||||
}
|
||||
} else {
|
||||
await this.getPageData(this);
|
||||
await ctx.getPageData();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -187,12 +166,12 @@ class HomeController extends Controller {
|
||||
if (searchkey) {
|
||||
if (current) {
|
||||
if (validator.isNumeric(current)) {
|
||||
await this.getPageData(this);
|
||||
await ctx.getPageData();
|
||||
} else {
|
||||
ctx.redirect("/");
|
||||
}
|
||||
} else {
|
||||
await this.getPageData(this);
|
||||
await ctx.getPageData();
|
||||
}
|
||||
} else {
|
||||
ctx.redirect("/");
|
||||
@ -207,12 +186,37 @@ class HomeController extends Controller {
|
||||
if (tagName) {
|
||||
if (current) {
|
||||
if (validator.isNumeric(current)) {
|
||||
await this.getPageData(this);
|
||||
await ctx.getPageData();
|
||||
} else {
|
||||
ctx.redirect("/");
|
||||
}
|
||||
} else {
|
||||
await this.getPageData(this);
|
||||
await ctx.getPageData();
|
||||
}
|
||||
} else {
|
||||
ctx.redirect("/");
|
||||
}
|
||||
}
|
||||
|
||||
async getDataForAuthorPage() {
|
||||
const ctx = this.ctx;
|
||||
ctx.pageType = "author";
|
||||
ctx.tempPage = 'author.html';
|
||||
let userId = ctx.params.userId;
|
||||
let current = ctx.params.current;
|
||||
if (userId) {
|
||||
if (!shortid.isValid(userId)) {
|
||||
ctx.redirect("/");
|
||||
} else {
|
||||
if (current) {
|
||||
if (validator.isNumeric(current)) {
|
||||
await ctx.getPageData();
|
||||
} else {
|
||||
ctx.redirect("/");
|
||||
}
|
||||
} else {
|
||||
await ctx.getPageData();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ctx.redirect("/");
|
||||
@ -226,8 +230,12 @@ class HomeController extends Controller {
|
||||
if (!shortid.isValid(contentId)) {
|
||||
ctx.redirect("/");
|
||||
} else {
|
||||
// 挂载钩子
|
||||
await this.app.hooks(ctx, 'messageBoard', {
|
||||
contentId
|
||||
});
|
||||
ctx.pageType = "detail"
|
||||
await this.getPageData(this);
|
||||
await ctx.getPageData();
|
||||
}
|
||||
} else {
|
||||
ctx.redirect("/");
|
||||
@ -238,7 +246,7 @@ class HomeController extends Controller {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'sitemap.html';
|
||||
ctx.pageType = "sitemap"
|
||||
await this.getPageData(this);
|
||||
await ctx.getPageData();
|
||||
}
|
||||
|
||||
async getDataForErr() {
|
||||
@ -247,261 +255,31 @@ class HomeController extends Controller {
|
||||
ctx.modules = [{
|
||||
action: 'get_error_info_' + ctx.errNo
|
||||
}];
|
||||
await this.getPageData(this);
|
||||
await ctx.getPageData();
|
||||
}
|
||||
|
||||
async getDataForUserLogin() {
|
||||
const ctx = this.ctx;
|
||||
if (ctx.session.user) {
|
||||
ctx.redirect("/");
|
||||
} else {
|
||||
ctx.title = '用户登录';
|
||||
ctx.tempPage = 'users/userLogin.html';
|
||||
await this.getPageData(this);
|
||||
}
|
||||
}
|
||||
|
||||
async getDataForUserReg() {
|
||||
const ctx = this.ctx;
|
||||
if (ctx.session.user) {
|
||||
ctx.redirect("/");
|
||||
} else {
|
||||
ctx.title = '用户注册';
|
||||
ctx.tempPage = 'users/userReg.html';
|
||||
await this.getPageData(this);
|
||||
}
|
||||
}
|
||||
|
||||
async getDataForResetPsdPage() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/userConfirmEmail.html';
|
||||
await this.getPageData(this);
|
||||
}
|
||||
|
||||
async getDataForUserIndex() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/userCenter.html';
|
||||
await this.getPageData(this);
|
||||
}
|
||||
|
||||
async getDataForUserCenter() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/userContents.html';
|
||||
await this.getPageData(this);
|
||||
}
|
||||
|
||||
async getDataForJoinComments() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/joinComments.html';
|
||||
await this.getPageData(this);
|
||||
}
|
||||
|
||||
async getDataForUserNotify() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/notify.html';
|
||||
await this.getPageData(this);
|
||||
}
|
||||
|
||||
async getDataForUserAddContent() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/userAddContent.html';
|
||||
await this.getPageData(this);
|
||||
}
|
||||
|
||||
async getDataForUserInfo() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/personInfo.html';
|
||||
await this.getPageData(this);
|
||||
}
|
||||
|
||||
async getDataForSetUserPwd() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/userSetPsd.html';
|
||||
await this.getPageData(this);
|
||||
}
|
||||
|
||||
async getDataForEditContent() {
|
||||
const ctx = this.ctx;
|
||||
let contentId = ctx.params.id;
|
||||
if (!shortid.isValid(contentId)) {
|
||||
ctx.redirect("/users/userCenter");
|
||||
} else {
|
||||
let contentInfo = await ctx.helper.reqJsonData('content/getContent', {
|
||||
id: contentId,
|
||||
userId: ctx.session.user._id,
|
||||
token: ctx.session.user.token
|
||||
});
|
||||
if (!_.isEmpty(contentInfo)) {
|
||||
ctx.tempPage = 'users/userAddContent.html';
|
||||
ctx.pageType = 'editContent';
|
||||
ctx.title = "编辑创作";
|
||||
ctx.contentId = contentId;
|
||||
await this.getPageData(this);
|
||||
} else {
|
||||
ctx.redirect("/users/userCenter");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async getDataForUserReply() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/userReplies.html';
|
||||
ctx.pageType = 'replies'
|
||||
await this.getPageData(this);
|
||||
}
|
||||
|
||||
async getDataForUserNotice() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/userNotice.html';
|
||||
ctx.pageType = 'notifies'
|
||||
await this.getPageData(this);
|
||||
}
|
||||
|
||||
async getDataForPhoneCategory() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'mb/phone-fenlei.html';
|
||||
ctx.pageType = 'phone_fenlei'
|
||||
await this.getPageData(this);
|
||||
await ctx.getPageData();
|
||||
}
|
||||
|
||||
async getDataForPhoneList() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'mb/phone-list.html';
|
||||
ctx.pageType = 'phone_list'
|
||||
await this.getPageData(this);
|
||||
await ctx.getPageData();
|
||||
}
|
||||
|
||||
async getDataForPhoneUser() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'mb/phone-user.html';
|
||||
ctx.pageType = 'phone_list'
|
||||
await this.getPageData(this);
|
||||
await ctx.getPageData();
|
||||
}
|
||||
|
||||
async getPageData(that) {
|
||||
let {
|
||||
ctx
|
||||
} = that;
|
||||
let payload = ctx.params;
|
||||
let pageData = {
|
||||
pageType: ctx.pageType
|
||||
};
|
||||
|
||||
let targetTempPage = ctx.tempPage;
|
||||
// 获取当前模板信息
|
||||
let defaultTemp = await ctx.helper.reqJsonData('contentTemplate/getDefaultTempInfo');
|
||||
|
||||
// 获取用户信息
|
||||
if (ctx.session.logined) {
|
||||
pageData.userInfo = ctx.session.user;
|
||||
pageData.logined = ctx.session.logined;
|
||||
}
|
||||
// 静态目录
|
||||
if (!_.isEmpty(defaultTemp)) {
|
||||
pageData.staticforder = defaultTemp.alias;
|
||||
} else {
|
||||
throw new Error(ctx.__('validate_error_params'));
|
||||
}
|
||||
|
||||
// 所有页面都需要的基础数据
|
||||
pageData.cateTypes = await ctx.helper.reqJsonData('contentCategory/getList', payload);
|
||||
pageData.siteInfo = await this.getSiteInfo(ctx);
|
||||
pageData.staticRootPath = that.app.config.static.prefix
|
||||
|
||||
// 针对分类页和内容详情页动态添加meta
|
||||
let defaultTempItems = defaultTemp.items;
|
||||
if (!_.isEmpty(pageData.siteInfo)) {
|
||||
let siteDomain = pageData.siteInfo.configs.siteDomain;
|
||||
let ogUrl = siteDomain;
|
||||
let ogImg = siteDomain + "/public/themes/" + defaultTemp.alias + "/images/mobile_logo2.jpeg"
|
||||
|
||||
if (ctx.pageType == 'index') { // 首页
|
||||
pageData.documentList = await ctx.helper.reqJsonData('content/getList', payload);
|
||||
} else if (ctx.pageType == 'cate') { // 分类列表
|
||||
|
||||
if (payload.typeId) {
|
||||
// 获取指定类别下的子类列表
|
||||
pageData.currentCateList = await ctx.helper.reqJsonData('contentCategory/getCurrentCategoriesById', {
|
||||
typeId: payload.typeId
|
||||
});
|
||||
// 获取当前分类的基本信息
|
||||
pageData.cateInfo = await ctx.helper.reqJsonData('contentCategory/getOne', {
|
||||
id: payload.typeId
|
||||
});
|
||||
}
|
||||
|
||||
if (!_.isEmpty(pageData.cateInfo)) {
|
||||
let {
|
||||
defaultUrl,
|
||||
_id,
|
||||
contentTemp
|
||||
} = pageData.cateInfo;
|
||||
ogUrl = siteDomain + '/' + defaultUrl + '___' + _id;
|
||||
targetTempPage = this.getCateOrDetailTemp(defaultTempItems, contentTemp, 'cate');
|
||||
}
|
||||
let cateName = _.isEmpty(pageData.cateInfo) ? '' : (' | ' + pageData.cateInfo.name);
|
||||
pageData.siteInfo.title = pageData.siteInfo.title + cateName;
|
||||
// 获取分类文档列表
|
||||
pageData.documentList = await ctx.helper.reqJsonData('content/getList', payload);
|
||||
|
||||
} else if (ctx.pageType == 'detail') { // 文档详情
|
||||
pageData.documentInfo = await ctx.helper.reqJsonData('content/getContent', {
|
||||
id: payload.id
|
||||
})
|
||||
if (!_.isEmpty(pageData.documentInfo)) {
|
||||
// 更改文档meta
|
||||
pageData.siteInfo.title = pageData.documentInfo.title + ' | ' + pageData.siteInfo.title;
|
||||
pageData.siteInfo.discription = pageData.documentInfo.discription;
|
||||
// 获取文档所属类别下的分类列表
|
||||
pageData.currentCateList = await ctx.helper.reqJsonData('contentCategory/getCurrentCategoriesById', {
|
||||
contentId: pageData.documentInfo._id
|
||||
});
|
||||
ogUrl = siteDomain + '/details/' + pageData.documentInfo._id + '.html';
|
||||
if (pageData.documentInfo.sImg && (pageData.documentInfo.sImg).indexOf('defaultImg.jpg') < 0) {
|
||||
ogImg = siteDomain + pageData.documentInfo.sImg;
|
||||
}
|
||||
let parentCateTemp = pageData.documentInfo.categories[0].contentTemp;
|
||||
targetTempPage = this.getCateOrDetailTemp(defaultTempItems, parentCateTemp, 'detail');
|
||||
} else {
|
||||
throw new Error(ctx.__('label_page_no_power_content'));
|
||||
}
|
||||
} else if (ctx.pageType == 'sitemap') { // 站点地图
|
||||
let siteMapParams = _.assign({}, payload, {
|
||||
isPaging: '0'
|
||||
});
|
||||
pageData.siteMapList = await ctx.helper.reqJsonData('content/getList', siteMapParams);
|
||||
} else if (ctx.pageType == 'editContent') { // 文档编辑
|
||||
if (ctx.contentId) {
|
||||
pageData.contentId = ctx.contentId;
|
||||
}
|
||||
} else if (ctx.pageType == 'search') { // 关键词搜索
|
||||
targetTempPage = this.getCateOrDetailTemp(defaultTempItems, '', 'cate');
|
||||
payload.searchkey && (pageData.targetSearchKey = payload.searchkey);
|
||||
pageData.documentList = await ctx.helper.reqJsonData('content/getList', payload);
|
||||
} else if (ctx.pageType == 'tag') { // 标签所属
|
||||
targetTempPage = this.getCateOrDetailTemp(defaultTempItems, '', 'cate');
|
||||
payload.tagName && (pageData.targetTagName = payload.tagName);
|
||||
pageData.documentList = await ctx.helper.reqJsonData('content/getList', payload);
|
||||
}
|
||||
pageData.ogData = {
|
||||
url: ogUrl,
|
||||
img: ogImg
|
||||
};
|
||||
}
|
||||
|
||||
let targetLocalJson = require('@root/config/locale/zh-CN.json')
|
||||
// 记录针对组件的国际化信息
|
||||
let sysKeys = {};
|
||||
for (let lockey in targetLocalJson) {
|
||||
if (lockey.indexOf('_layer_') > 0 || lockey.indexOf('label_system_') >= 0 || lockey.indexOf('label_uploader_') >= 0) {
|
||||
sysKeys[lockey] = ctx.__(lockey);
|
||||
}
|
||||
}
|
||||
|
||||
// console.log('----pageData.siteInfo---', pageData.siteInfo);
|
||||
pageData.lsk = JSON.stringify(sysKeys);
|
||||
await ctx.render(defaultTemp.alias + '/' + targetTempPage, pageData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
119
app/controller/page/user.js
Executable file
119
app/controller/page/user.js
Executable file
@ -0,0 +1,119 @@
|
||||
const Controller = require('egg').Controller;
|
||||
const _ = require('lodash');
|
||||
const shortid = require('shortid');
|
||||
|
||||
|
||||
class UserController extends Controller {
|
||||
|
||||
|
||||
async getDataForUserLogin() {
|
||||
const ctx = this.ctx;
|
||||
if (ctx.session.user) {
|
||||
ctx.redirect("/");
|
||||
} else {
|
||||
ctx.title = '用户登录';
|
||||
ctx.tempPage = 'users/userLogin.html';
|
||||
await ctx.getPageData();
|
||||
}
|
||||
}
|
||||
|
||||
async getDataForUserReg() {
|
||||
const ctx = this.ctx;
|
||||
if (ctx.session.user) {
|
||||
ctx.redirect("/");
|
||||
} else {
|
||||
ctx.title = '用户注册';
|
||||
ctx.tempPage = 'users/userReg.html';
|
||||
await ctx.getPageData();
|
||||
}
|
||||
}
|
||||
|
||||
async getDataForResetPsdPage() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/userConfirmEmail.html';
|
||||
await ctx.getPageData();
|
||||
}
|
||||
|
||||
async getDataForUserIndex() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/userCenter.html';
|
||||
await ctx.getPageData();
|
||||
}
|
||||
|
||||
async getDataForUserCenter() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/userContents.html';
|
||||
await ctx.getPageData();
|
||||
}
|
||||
|
||||
async getDataForJoinComments() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/joinComments.html';
|
||||
await ctx.getPageData();
|
||||
}
|
||||
|
||||
async getDataForUserNotify() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/notify.html';
|
||||
await ctx.getPageData();
|
||||
}
|
||||
|
||||
async getDataForUserAddContent() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/userAddContent.html';
|
||||
await ctx.getPageData();
|
||||
}
|
||||
|
||||
async getDataForUserInfo() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/personInfo.html';
|
||||
await ctx.getPageData();
|
||||
}
|
||||
|
||||
async getDataForSetUserPwd() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/userSetPsd.html';
|
||||
await ctx.getPageData();
|
||||
}
|
||||
|
||||
async getDataForEditContent() {
|
||||
const ctx = this.ctx;
|
||||
let contentId = ctx.params.id;
|
||||
if (!shortid.isValid(contentId)) {
|
||||
ctx.redirect("/users/userCenter");
|
||||
} else {
|
||||
let contentInfo = await ctx.helper.reqJsonData('content/getContent', {
|
||||
id: contentId,
|
||||
userId: ctx.session.user._id,
|
||||
token: ctx.session.user.token
|
||||
});
|
||||
if (!_.isEmpty(contentInfo)) {
|
||||
ctx.tempPage = 'users/userAddContent.html';
|
||||
ctx.pageType = 'editContent';
|
||||
ctx.title = "编辑创作";
|
||||
ctx.contentId = contentId;
|
||||
await ctx.getPageData();
|
||||
} else {
|
||||
ctx.redirect("/users/userCenter");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async getDataForUserReply() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/userReplies.html';
|
||||
ctx.pageType = 'replies'
|
||||
await ctx.getPageData();
|
||||
}
|
||||
|
||||
async getDataForUserNotice() {
|
||||
const ctx = this.ctx;
|
||||
ctx.tempPage = 'users/userNotice.html';
|
||||
ctx.pageType = 'notifies'
|
||||
await ctx.getPageData();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
module.exports = UserController;
|
@ -2,7 +2,7 @@
|
||||
* @Author: doramart
|
||||
* @Date: 2019-09-23 09:25:24
|
||||
* @Last Modified by: doramart
|
||||
* @Last Modified time: 2020-04-02 18:21:16
|
||||
* @Last Modified time: 2020-08-03 00:09:00
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
@ -10,7 +10,7 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
const _ = require('lodash');
|
||||
const muri = require('muri');
|
||||
const isDev = process.env.NODE_ENV == 'development' ? true : false;
|
||||
const restore = require('@cdxoo/mongodb-restore')
|
||||
const child = require('child_process');
|
||||
|
||||
require('module-alias/register')
|
||||
@ -19,7 +19,29 @@ const {
|
||||
} = require('@utils');
|
||||
|
||||
module.exports = {
|
||||
|
||||
// 应用初始化
|
||||
async init(ctx) {
|
||||
let app = this;
|
||||
console.log('app init');
|
||||
try {
|
||||
let checkSystemInfo = await ctx.service.systemConfig.count();
|
||||
if (checkSystemInfo == 0) {
|
||||
const uri = app.config.mongoose.client.url;
|
||||
let datafile = path.join(__dirname, '../../databak/doracms2')
|
||||
await restore.database({
|
||||
uri,
|
||||
database: 'doracms2',
|
||||
from: datafile
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
if (error && error.message == 'Invalid Operation, no operations specified') {
|
||||
console.log('init data success')
|
||||
} else {
|
||||
console.log('init data error:', error.message)
|
||||
}
|
||||
}
|
||||
},
|
||||
// 获取插件api白名单
|
||||
getExtendApiList() {
|
||||
let app = this;
|
||||
@ -174,33 +196,28 @@ module.exports = {
|
||||
async initPluginConfig(pluginInfos = {}, type = 'install') {
|
||||
if (!_.isEmpty(pluginInfos)) {
|
||||
let app = this;
|
||||
let pluginConfigPath = path.join(app.config.baseDir, `config/plugin.js`);
|
||||
let configDefaultPath = path.join(app.config.baseDir, `config/config.default.js`);
|
||||
// let packageJsonPath = path.join(app.config.baseDir, `package.json`);
|
||||
|
||||
let configPluginPath = path.join(app.config.baseDir, `config/ext/config/${pluginInfos.alias}.js`);
|
||||
let extConfigPath = path.join(app.config.baseDir, `config/ext/plugin/${pluginInfos.alias}.js`);
|
||||
if (type == 'install') {
|
||||
|
||||
if (fs.existsSync(pluginConfigPath) && pluginInfos.pluginsConfig) {
|
||||
let pluginStr = `// ${pluginInfos.enName}PluginBegin\n
|
||||
${pluginInfos.pluginsConfig}// ${pluginInfos.enName}PluginEnd\n `;
|
||||
siteFunc.appendTxtToFileByLine(pluginConfigPath, 1, pluginStr);
|
||||
if (pluginInfos.pluginsConfig) {
|
||||
siteFunc.createFileByStr(extConfigPath, pluginInfos.pluginsConfig)
|
||||
}
|
||||
|
||||
if (fs.existsSync(configDefaultPath) && pluginInfos.defaultConfig) {
|
||||
if (pluginInfos.defaultConfig) {
|
||||
|
||||
siteFunc.createFileByStr(configPluginPath, pluginInfos.defaultConfig)
|
||||
|
||||
let configStr = `// ${pluginInfos.enName}PluginBegin\n
|
||||
${pluginInfos.defaultConfig}// ${pluginInfos.enName}PluginEnd\n `;
|
||||
siteFunc.appendTxtToFileByLine(configDefaultPath, 2, configStr);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (fs.existsSync(pluginConfigPath) && pluginInfos.pluginsConfig) {
|
||||
siteFunc.modifyFileByReplace(pluginConfigPath, `// ${pluginInfos.enName}PluginBegin`, `// ${pluginInfos.enName}PluginEnd`);
|
||||
if (fs.existsSync(extConfigPath)) {
|
||||
fs.unlinkSync(extConfigPath);
|
||||
}
|
||||
|
||||
if (fs.existsSync(configDefaultPath) && pluginInfos.defaultConfig) {
|
||||
siteFunc.modifyFileByReplace(configDefaultPath, `// ${pluginInfos.enName}PluginBegin`, `// ${pluginInfos.enName}PluginEnd`);
|
||||
if (fs.existsSync(configPluginPath)) {
|
||||
fs.unlinkSync(configPluginPath);
|
||||
}
|
||||
|
||||
}
|
||||
@ -304,6 +321,79 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// 添加钩子
|
||||
async hooks(ctx, hooks, params = {}) {
|
||||
try {
|
||||
|
||||
let targetHook = await ctx.service.hook.item(ctx, {
|
||||
query: {
|
||||
name: hooks
|
||||
},
|
||||
files: '_id'
|
||||
})
|
||||
|
||||
if (!_.isEmpty(targetHook)) {
|
||||
|
||||
// 暂时遍历开发环境插件列表
|
||||
// console.log('-----', app.config)
|
||||
// 通过钩子获取是哪个插件在挂载
|
||||
let plugins = await ctx.service.plugin.find({
|
||||
isPaging: '0'
|
||||
}, {
|
||||
query: {
|
||||
state: true,
|
||||
hooks: hooks
|
||||
}
|
||||
})
|
||||
|
||||
// console.log('--plugins--', plugins)
|
||||
|
||||
if (!_.isEmpty(plugins)) {
|
||||
|
||||
// let targetPluginConfig = this.config.doraValine;
|
||||
// let targetHook = await ctx.service[targetPluginConfig.alias].item(ctx, {
|
||||
// query: {
|
||||
// name: hooks
|
||||
// },
|
||||
// files: '_id'
|
||||
// })
|
||||
let targetPluginConfig = plugins[0];
|
||||
|
||||
let targetHtml = await this.hookRender(ctx, hooks, targetPluginConfig.alias, params);
|
||||
// console.log('--targetHtml--', targetHtml)
|
||||
if (targetHtml) {
|
||||
ctx.locals['HOOK@' + hooks] = targetHtml;
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new Error(ctx.__('validate_error_params'));
|
||||
}
|
||||
|
||||
} else {
|
||||
console.log('非法钩子')
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log('暂无插件挂载');
|
||||
}
|
||||
},
|
||||
|
||||
// 插件渲染
|
||||
async hookRender(ctx, hookname, plugin, args) {
|
||||
|
||||
try {
|
||||
let html = await ctx.helper.reqJsonData(`${plugin}/hookRender`, Object.assign({
|
||||
hookname
|
||||
}, args));
|
||||
return html;
|
||||
} catch (error) {
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
@ -1,6 +1,267 @@
|
||||
'use strict';
|
||||
const _ = require('lodash');
|
||||
const fs = require('fs');
|
||||
const pkg = require('../../package.json')
|
||||
|
||||
module.exports = {
|
||||
|
||||
|
||||
async getSiteInfo() {
|
||||
let ctx = this;
|
||||
// console.log('--ctx.originalUrl--', ctx.originalUrl)
|
||||
let configs = await ctx.helper.reqJsonData('systemConfig/getConfig');
|
||||
const {
|
||||
siteName,
|
||||
siteDiscription,
|
||||
siteKeywords,
|
||||
siteAltKeywords,
|
||||
ogTitle,
|
||||
siteLogo,
|
||||
siteDomain
|
||||
} = configs || [];
|
||||
|
||||
let {
|
||||
title,
|
||||
des,
|
||||
keywords
|
||||
} = ctx.params;
|
||||
let pageTitle = title ? (title + ' | ' + siteName) : siteName;
|
||||
let discription = des ? des : siteDiscription;
|
||||
let key = keywords ? keywords : siteKeywords;
|
||||
let altkey = siteAltKeywords || '';
|
||||
return {
|
||||
title: pageTitle,
|
||||
logo: siteLogo,
|
||||
url: siteDomain,
|
||||
ogTitle,
|
||||
discription,
|
||||
key,
|
||||
altkey,
|
||||
configs: configs || [],
|
||||
version: pkg.version,
|
||||
lang: ctx.session.locale,
|
||||
router: ctx.originalUrl.split('/')[1]
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
renderCateName(pageData) {
|
||||
|
||||
let pageType = pageData.pageType;
|
||||
let title = '';
|
||||
if (pageType == 'search') {
|
||||
title = `搜索:${pageData.targetSearchKey}`
|
||||
} else if (pageType == 'tag') {
|
||||
title = `标签:${pageData.targetTagName}`
|
||||
} else {
|
||||
title = !_.isEmpty(pageData.cateInfo) ? pageData.cateInfo.name : '推荐';
|
||||
}
|
||||
|
||||
pageData['list_title'] = title;
|
||||
},
|
||||
|
||||
// 获取类别或文档详情模板文件
|
||||
getCateOrDetailTemp(defaultTemp, contentTemp = '', type) {
|
||||
let fileName = "contentList.html",
|
||||
currentPath = "";
|
||||
if (type == 'detail') {
|
||||
fileName = "detail.html";
|
||||
}
|
||||
if (!_.isEmpty(contentTemp)) {
|
||||
currentPath = contentTemp.forder + "/" + fileName;
|
||||
} else {
|
||||
let defaultItem = _.filter(defaultTemp.items, (temp) => {
|
||||
return temp.isDefault;
|
||||
})
|
||||
currentPath = defaultItem[0].forder + "/" + fileName;
|
||||
}
|
||||
// 校验模板的真实路径
|
||||
let themePath = this.app.config.temp_view_forder + defaultTemp.alias + '/';
|
||||
// console.log('--current--', current)
|
||||
if (fs.existsSync(themePath + currentPath)) {
|
||||
return currentPath;
|
||||
} else {
|
||||
// 兼容根目录下的模板方案
|
||||
if (type == 'cate' && fs.existsSync(themePath + 'page.html')) {
|
||||
return 'page.html';
|
||||
} else if (type == 'detail' && fs.existsSync(themePath + 'post.html')) {
|
||||
console.log('---get post-')
|
||||
return 'post.html';
|
||||
} else if (type == 'author' && fs.existsSync(themePath + 'author.html')) {
|
||||
return 'author.html';
|
||||
} else {
|
||||
throw new Error('please add template first!');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
async getPageData() {
|
||||
|
||||
let ctx = this;
|
||||
let payload = ctx.params;
|
||||
let pageData = {
|
||||
pageType: ctx.pageType
|
||||
};
|
||||
|
||||
// console.log('--payload--', payload)
|
||||
// console.log('--pageData--', pageData)
|
||||
|
||||
let targetTempPage = ctx.tempPage;
|
||||
// 获取当前模板信息
|
||||
let defaultTemp = await ctx.helper.reqJsonData('contentTemplate/getDefaultTempInfo');
|
||||
|
||||
// 获取用户信息
|
||||
if (ctx.session.logined) {
|
||||
pageData.userInfo = ctx.session.user;
|
||||
pageData.logined = ctx.session.logined;
|
||||
}
|
||||
// 静态目录
|
||||
if (!_.isEmpty(defaultTemp)) {
|
||||
pageData.staticforder = defaultTemp.alias;
|
||||
} else {
|
||||
throw new Error(ctx.__('validate_error_params'));
|
||||
}
|
||||
|
||||
// 所有页面都需要的基础数据
|
||||
pageData.navigation = await ctx.helper.reqJsonData('contentCategory/getList', payload);
|
||||
pageData.site = await this.getSiteInfo();
|
||||
pageData.staticRootPath = this.app.config.static.prefix;
|
||||
pageData.staticThemePath = this.app.config.static.prefix + '/themes/' + defaultTemp.alias;
|
||||
|
||||
// 针对分类页和内容详情页动态添加meta
|
||||
// let defaultTempItems = defaultTemp.items;
|
||||
if (!_.isEmpty(pageData.site)) {
|
||||
let siteDomain = pageData.site.configs.siteDomain;
|
||||
let ogUrl = siteDomain;
|
||||
let ogImg = `${siteDomain}${this.app.config.static.prefix}/themes/${defaultTemp.alias}/images/mobile_logo2.jpeg`;
|
||||
|
||||
if (ctx.pageType == 'index') { // 首页
|
||||
let {
|
||||
docs,
|
||||
pageInfo
|
||||
} = await ctx.helper.reqJsonData('content/getList', payload);
|
||||
pageData.posts = docs;
|
||||
pageData.pageInfo = pageInfo;
|
||||
} else if (ctx.pageType == 'cate') { // 分类列表
|
||||
|
||||
if (payload.typeId) {
|
||||
// 获取指定类别下的子类列表
|
||||
pageData.currentCateList = await ctx.helper.reqJsonData('contentCategory/getCurrentCategoriesById', {
|
||||
typeId: payload.typeId
|
||||
});
|
||||
// 获取当前分类的基本信息
|
||||
pageData.cateInfo = await ctx.helper.reqJsonData('contentCategory/getOne', {
|
||||
id: payload.typeId
|
||||
});
|
||||
}
|
||||
|
||||
if (!_.isEmpty(pageData.cateInfo)) {
|
||||
let {
|
||||
defaultUrl,
|
||||
_id,
|
||||
contentTemp
|
||||
} = pageData.cateInfo;
|
||||
ogUrl = siteDomain + '/' + defaultUrl + '___' + _id;
|
||||
targetTempPage = this.getCateOrDetailTemp(defaultTemp, contentTemp, 'cate');
|
||||
}
|
||||
let cateName = _.isEmpty(pageData.cateInfo) ? '' : (' | ' + pageData.cateInfo.name);
|
||||
pageData.site.title = pageData.site.title + cateName;
|
||||
// 获取分类文档列表
|
||||
let {
|
||||
docs,
|
||||
pageInfo
|
||||
} = await ctx.helper.reqJsonData('content/getList', payload);
|
||||
pageData.posts = docs;
|
||||
pageData.pageInfo = pageInfo;
|
||||
|
||||
} else if (ctx.pageType == 'detail') { // 文档详情
|
||||
pageData.post = await ctx.helper.reqJsonData('content/getContent', {
|
||||
id: payload.id
|
||||
})
|
||||
if (!_.isEmpty(pageData.post)) {
|
||||
// 更改文档meta
|
||||
pageData.site.title = pageData.post.title + ' | ' + pageData.site.title;
|
||||
pageData.site.discription = pageData.post.discription;
|
||||
// 获取文档所属类别下的分类列表
|
||||
pageData.currentCateList = await ctx.helper.reqJsonData('contentCategory/getCurrentCategoriesById', {
|
||||
contentId: pageData.post._id
|
||||
});
|
||||
ogUrl = siteDomain + pageData.post.url;
|
||||
if (pageData.post.sImg && (pageData.post.sImg).indexOf('defaultImg.jpg') < 0) {
|
||||
ogImg = siteDomain + pageData.post.sImg;
|
||||
}
|
||||
let parentCateTemp = pageData.post.categories[0].contentTemp;
|
||||
targetTempPage = this.getCateOrDetailTemp(defaultTemp, parentCateTemp, 'detail');
|
||||
} else {
|
||||
throw new Error(ctx.__('label_page_no_power_content'));
|
||||
}
|
||||
} else if (ctx.pageType == 'sitemap') { // 站点地图
|
||||
let siteMapParams = _.assign({}, payload, {
|
||||
isPaging: '0'
|
||||
});
|
||||
pageData.siteMapList = await ctx.helper.reqJsonData('content/getList', siteMapParams);
|
||||
} else if (ctx.pageType == 'editContent') { // 文档编辑
|
||||
if (ctx.contentId) {
|
||||
pageData.contentId = ctx.contentId;
|
||||
}
|
||||
} else if (ctx.pageType == 'search') { // 关键词搜索
|
||||
targetTempPage = this.getCateOrDetailTemp(defaultTemp, '', 'cate');
|
||||
payload.searchkey && (pageData.targetSearchKey = payload.searchkey);
|
||||
let {
|
||||
docs,
|
||||
pageInfo
|
||||
} = await ctx.helper.reqJsonData('content/getList', payload);
|
||||
pageData.posts = docs;
|
||||
pageData.pageInfo = pageInfo;
|
||||
} else if (ctx.pageType == 'tag') { // 标签所属
|
||||
targetTempPage = this.getCateOrDetailTemp(defaultTemp, '', 'cate');
|
||||
payload.tagName && (pageData.targetTagName = payload.tagName);
|
||||
let {
|
||||
docs,
|
||||
pageInfo
|
||||
} = await ctx.helper.reqJsonData('content/getList', payload);
|
||||
pageData.posts = docs;
|
||||
pageData.pageInfo = pageInfo;
|
||||
} else if (ctx.pageType == 'author') { // 作者主页
|
||||
targetTempPage = this.getCateOrDetailTemp(defaultTemp, '', 'author');
|
||||
let {
|
||||
docs,
|
||||
pageInfo,
|
||||
author
|
||||
} = await ctx.helper.reqJsonData('content/getList', payload);
|
||||
pageData.posts = docs;
|
||||
pageData.pageInfo = pageInfo;
|
||||
pageData.author = author;
|
||||
}
|
||||
pageData.ogData = {
|
||||
url: ogUrl,
|
||||
img: ogImg
|
||||
};
|
||||
}
|
||||
|
||||
let targetLocalJson = require('@root/config/locale/zh-CN.json')
|
||||
// 记录针对组件的国际化信息
|
||||
let sysKeys = {};
|
||||
for (let lockey in targetLocalJson) {
|
||||
if (lockey.indexOf('_layer_') > 0 || lockey.indexOf('label_system_') >= 0 || lockey.indexOf('label_uploader_') >= 0) {
|
||||
sysKeys[lockey] = ctx.__(lockey);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取分类标题
|
||||
this.renderCateName(pageData);
|
||||
|
||||
// console.log('----ctx.hooks.---', ctx.locals['HOOK@documentDetailAfter']);
|
||||
pageData.lsk = JSON.stringify(sysKeys);
|
||||
if (targetTempPage.indexOf('users/') == '0') {
|
||||
pageData.themePublicPath = `../${defaultTemp.alias}/default.html`;
|
||||
console.log('--pageData.themePublicPath--', pageData.themePublicPath)
|
||||
await ctx.render(targetTempPage, pageData);
|
||||
} else {
|
||||
await ctx.render(defaultTemp.alias + '/' + targetTempPage, pageData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
@ -2,13 +2,14 @@
|
||||
* @Author: doramart
|
||||
* @Date: 2019-08-15 14:23:19
|
||||
* @Last Modified by: doramart
|
||||
* @Last Modified time: 2020-04-02 17:04:44
|
||||
* @Last Modified time: 2020-05-02 17:06:17
|
||||
*/
|
||||
|
||||
require('module-alias/register')
|
||||
|
||||
//文件操作对象
|
||||
let fs = require('fs');
|
||||
let path = require('path');
|
||||
let stat = fs.stat;
|
||||
//TODO 老版本暂时保留,下个版本移除
|
||||
var CryptoJS = require("crypto-js");
|
||||
@ -178,6 +179,7 @@ module.exports = {
|
||||
|
||||
return folderList;
|
||||
},
|
||||
|
||||
deleteFolder(path) {
|
||||
// console.log("---del path--" + path);
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -402,13 +404,12 @@ module.exports = {
|
||||
var DOWNLOAD_DIR = system_template_forder + targetForder + '/tempconfig.json';
|
||||
var DIST_DIR = system_template_forder + targetForder + '/dist';
|
||||
var PUBLIC_DIR = system_template_forder + targetForder + '/public';
|
||||
var USERS_DIR = system_template_forder + targetForder + '/users';
|
||||
var TWOSTAGEDEFAULT_DIR = system_template_forder + targetForder + '/2-stage-default';
|
||||
var DEFAULT_DIR = system_template_forder + targetForder + '/index.html';
|
||||
|
||||
let checkTempCount = 0;
|
||||
var tempTask = setInterval(async () => {
|
||||
if (fs.existsSync(DOWNLOAD_DIR) && fs.existsSync(DIST_DIR) && fs.existsSync(PUBLIC_DIR) &&
|
||||
fs.existsSync(USERS_DIR) && fs.existsSync(TWOSTAGEDEFAULT_DIR)) {
|
||||
fs.existsSync(DEFAULT_DIR)) {
|
||||
clearInterval(tempTask);
|
||||
resolve('1');
|
||||
} else {
|
||||
@ -430,7 +431,6 @@ module.exports = {
|
||||
var name = tempInfoData.name;
|
||||
var alias = tempInfoData.alias;
|
||||
var version = tempInfoData.version;
|
||||
var sImg = tempInfoData.sImg;
|
||||
var author = tempInfoData.author;
|
||||
var comment = tempInfoData.comment;
|
||||
var errors;
|
||||
@ -506,7 +506,15 @@ module.exports = {
|
||||
},
|
||||
|
||||
setMemoryCache(key, value, time) {
|
||||
this.app.cache.set(key, value, time);
|
||||
this.app.messenger.sendToApp('refreshCache', {
|
||||
key,
|
||||
value,
|
||||
time
|
||||
});
|
||||
},
|
||||
|
||||
assignLocals(ctx, key, value) {
|
||||
ctx.locals[key] = value;
|
||||
}
|
||||
|
||||
};
|
@ -2,13 +2,12 @@
|
||||
* @Author: doramart
|
||||
* @Date: 2019-08-16 14:51:46
|
||||
* @Last Modified by: doramart
|
||||
* @Last Modified time: 2019-10-22 17:35:32
|
||||
* @Last Modified time: 2020-04-29 08:39:57
|
||||
*/
|
||||
|
||||
const _ = require('lodash')
|
||||
module.exports = options => {
|
||||
return async function crossHeader(ctx, next) {
|
||||
|
||||
ctx.set('Access-Control-Allow-Origin', '*');
|
||||
ctx.set('Access-Control-Allow-Headers', 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild');
|
||||
ctx.set('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS');
|
||||
|
@ -3,8 +3,9 @@
|
||||
* @Date: 2019-11-02 18:38:55
|
||||
* @Discription 404 filter
|
||||
* @Last Modified by: doramart
|
||||
* @Last Modified time: 2019-11-02 18:43:56
|
||||
* @Last Modified time: 2020-07-28 20:34:10
|
||||
*/
|
||||
const _ = require('lodash')
|
||||
module.exports = () => {
|
||||
return async function notFoundHandler(ctx, next) {
|
||||
await next();
|
||||
@ -15,9 +16,22 @@ module.exports = () => {
|
||||
};
|
||||
} else {
|
||||
if (ctx.originalUrl.indexOf('/admin/') == 0) {
|
||||
ctx.redirect('/admin/login');
|
||||
ctx.redirect('/dr-admin');
|
||||
} else {
|
||||
ctx.body = '<h1>Page Not Found</h1>';
|
||||
try {
|
||||
let defaultTemp = await ctx.helper.reqJsonData('contentTemplate/getDefaultTempInfo');
|
||||
let configs = await ctx.helper.reqJsonData('systemConfig/getConfig');
|
||||
if (!_.isEmpty(defaultTemp) && !_.isEmpty(configs)) {
|
||||
await ctx.render(`${defaultTemp.alias}/404`, {
|
||||
domain: configs.siteDomain,
|
||||
siteName: configs.siteName
|
||||
});
|
||||
} else {
|
||||
ctx.body = '<h1>Page Not Found</h1>';
|
||||
}
|
||||
} catch (error) {
|
||||
ctx.body = '<h1>Page Not Found</h1>';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
48
app/model/hook.js
Executable file
48
app/model/hook.js
Executable file
@ -0,0 +1,48 @@
|
||||
module.exports = app => {
|
||||
const mongoose = app.mongoose
|
||||
var shortid = require('shortid');
|
||||
var path = require('path');
|
||||
var Schema = mongoose.Schema;
|
||||
var moment = require('moment')
|
||||
|
||||
var HookSchema = new Schema({
|
||||
_id: {
|
||||
type: String,
|
||||
'default': shortid.generate
|
||||
},
|
||||
createTime: {
|
||||
type: Date,
|
||||
},
|
||||
updateTime: {
|
||||
type: Date,
|
||||
},
|
||||
name: String, // 名称
|
||||
description: String, // 描述
|
||||
type: {
|
||||
type: String,
|
||||
default: '1'
|
||||
}, // 类型
|
||||
ext: String, // 钩子挂载的插件
|
||||
status: String, // 状态
|
||||
|
||||
});
|
||||
|
||||
HookSchema.set('toJSON', {
|
||||
getters: true,
|
||||
virtuals: true
|
||||
});
|
||||
HookSchema.set('toObject', {
|
||||
getters: true,
|
||||
virtuals: true
|
||||
});
|
||||
|
||||
HookSchema.path('createTime').get(function (v) {
|
||||
return moment(v).format("YYYY-MM-DD HH:mm:ss");
|
||||
});
|
||||
HookSchema.path('updateTime').get(function (v) {
|
||||
return moment(v).format("YYYY-MM-DD HH:mm:ss");
|
||||
});
|
||||
|
||||
return mongoose.model("Hook", HookSchema, 'hooks');
|
||||
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
* @Author: doramart
|
||||
* @Date: 2019-09-23 13:28:28
|
||||
* @Last Modified by: doramart
|
||||
* @Last Modified time: 2020-03-24 14:26:56
|
||||
* @Last Modified time: 2020-04-11 21:58:09
|
||||
*/
|
||||
|
||||
module.exports = app => {
|
||||
@ -23,6 +23,10 @@ module.exports = app => {
|
||||
name: String, // 插件名称
|
||||
enName: String, // 插件英文名
|
||||
description: String, // 插件描述
|
||||
state: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}, // 是否启用
|
||||
amount: {
|
||||
type: Number,
|
||||
default: 0
|
||||
@ -53,6 +57,9 @@ module.exports = app => {
|
||||
default: false
|
||||
},
|
||||
initDataPath: String, //初始化表路径
|
||||
hooks: [{
|
||||
type: String,
|
||||
}], //钩子
|
||||
defaultConfig: String, //插入到 config.default.js 中的配置
|
||||
pluginsConfig: String, //插入到 plugins.js 中的配置
|
||||
type: {
|
||||
|
@ -1302,12 +1302,43 @@
|
||||
"application/json"
|
||||
],
|
||||
"parameters": [{
|
||||
"name": "_id",
|
||||
"in": "query",
|
||||
"description": "Status values that need to be considered for filter",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}],
|
||||
"name": "phoneNum",
|
||||
"in": "query",
|
||||
"description": "手机号(eq:15220064294)",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "countryCode",
|
||||
"in": "query",
|
||||
"description": "国家代码(eq: 86)",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "email",
|
||||
"in": "query",
|
||||
"description": "用户邮箱",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "messageType",
|
||||
"in": "query",
|
||||
"description": "发送验证码类别(0、注册 1、登录,2、忘记密码找回, 3、忘记密码,4、身份验证, 5、管理员登录,6、游客绑定邮箱或手机号)",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"default": "0"
|
||||
},
|
||||
{
|
||||
"name": "sendType",
|
||||
"in": "query",
|
||||
"description": "发送验证码形式(1: 短信验证码 2:邮箱验证码)",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"default": "2"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "successful operation",
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 4.2 KiB |
1
app/public/plugins/highlight.js/9.18.1/default.min.css
vendored
Normal file
1
app/public/plugins/highlight.js/9.18.1/default.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.hljs{display:block;overflow-x:auto;padding:.5em;background:#F0F0F0}.hljs,.hljs-subst{color:#444}.hljs-comment{color:#888888}.hljs-keyword,.hljs-attribute,.hljs-selector-tag,.hljs-meta-keyword,.hljs-doctag,.hljs-name{font-weight:bold}.hljs-type,.hljs-string,.hljs-number,.hljs-selector-id,.hljs-selector-class,.hljs-quote,.hljs-template-tag,.hljs-deletion{color:#880000}.hljs-title,.hljs-section{color:#880000;font-weight:bold}.hljs-regexp,.hljs-symbol,.hljs-variable,.hljs-template-variable,.hljs-link,.hljs-selector-attr,.hljs-selector-pseudo{color:#BC6060}.hljs-literal{color:#78A960}.hljs-built_in,.hljs-bullet,.hljs-code,.hljs-addition{color:#397300}.hljs-meta{color:#1f7199}.hljs-meta-string{color:#4d99bf}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:bold}
|
2
app/public/plugins/highlight.js/9.18.1/highlight.min.js
vendored
Normal file
2
app/public/plugins/highlight.js/9.18.1/highlight.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
app/public/plugins/modernizr/modernizr.js
Normal file
1
app/public/plugins/modernizr/modernizr.js
Normal file
File diff suppressed because one or more lines are too long
5460
app/public/plugins/showdown/showdown.js
Normal file
5460
app/public/plugins/showdown/showdown.js
Normal file
File diff suppressed because it is too large
Load Diff
1
app/public/plugins/showdown/showdown.js.map
Normal file
1
app/public/plugins/showdown/showdown.js.map
Normal file
File diff suppressed because one or more lines are too long
3
app/public/plugins/showdown/showdown.min.js
vendored
Normal file
3
app/public/plugins/showdown/showdown.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
app/public/plugins/showdown/showdown.min.js.map
Normal file
1
app/public/plugins/showdown/showdown.min.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
app/public/themes/users/css/white.css
Normal file
1
app/public/themes/users/css/white.css
Normal file
File diff suppressed because one or more lines are too long
1
app/public/themes/users/js/avalon-ms-pager.js
Normal file
1
app/public/themes/users/js/avalon-ms-pager.js
Normal file
@ -0,0 +1 @@
|
||||
avalon?(avalon.component("ms-pager",{template:" <ul class='pagination' ms-visible='@totalPages>1'> <li class='first' ms-class='{disabled: @isDisabled(\"first\", 1)}'> <a ms-attr='{title:@getTitle(\"first\")}' ms-click='@cbProxy($event,\"first\")' > <i class='fa fa-angle-double-left'></i> </a> </li> <li class='prev' ms-class='{disabled: @isDisabled(\"prev\",1)}'> <a ms-attr='{title:@getTitle(\"prev\")}' ms-click='@cbProxy($event,\"prev\")' > <i class='fa fa-angle-left'></i> </a> </li> <li ms-for='page in @pages' ms-class='{active: page === @currentPage}' > <a ms-attr='{title:@getTitle(page)}' ms-click='@cbProxy($event,page)' > {{page}} </a> </li> <li class='next' ms-class='{disabled: @isDisabled(\"next\",@totalPages)}'> <a ms-attr='{title: @getTitle(\"next\")}' ms-click='@cbProxy($event,\"next\")' > <i class='fa fa-angle-right'></i> </a> </li> <li class='last' ms-class='{disabled: @isDisabled(\"last\",@totalPages)}'> <a ms-attr='{title: @getTitle(\"last\")}' ms-click='@cbProxy($event,\"last\")' > <i class='fa fa-angle-double-right'></i> </a> </li> </ul>",defaults:{$id:"ms-pager",is_ie:!1,is_more:!0,hash:"",getHref:function(e){if(this.is_more){if(location.hash){var t=location.hash,a=function(e){var t=location.hash,a=new Object;if(t.indexOf("?"))for(var s=t.substr(t.indexOf("?")+1).split("&"),i=0;i<s.length;i++)a[s[i].split("=")[0]]=decodeURI(s[i].split("=")[1]);return a[e]}("page");return a?t=t.replace("page="+a,"page="+this.toPage(e)):location.hash+"?page="+this.toPage(e)}return"#?page="+this.toPage(e)}return"#page-"+this.toPage(e)},getTitle:function(e){return e},isDisabled:function(e,t){return this.$buttons[e]=this.currentPage===t},$buttons:{},showPages:5,pages:[],totalPages:avalon.noop,currentPage:1,firstText:"《",prevText:"上一页",nextText:"下一页",lastText:"》",onPageClick:avalon.noop,toPage:function(e){var t=this.currentPage,a=this.totalPages;switch(e){case"first":return 1;case"prev":return Math.max(t-1,1);case"next":return Math.min(t+1,a);case"last":return a;default:return e}},cbProxy:function(e,t){var a=this.toPage(t);return this.$buttons[t]||t===this.currentPage?1===a?this.onPageClick(e,a):void e.preventDefault():(this.render(a),this.onPageClick(e,a))},render:function(e){var t=function(e){var t=[],a=this.showPages,s=this.totalPages,i=Math.floor(a/2),r=e-i+1-a%2,n=e+i;r<=0&&(r=1),s<n&&(n=s);for(var l=r;l<=n;)t.push(l),l++;return{currentPage:e,pages:t}}.call(this,e);this.currentPage=t.currentPage,this.pages=t.pages},rpage:function(){return this.is_more?/(?:#|\?)page\=(\d+)/:/(?:#|\?)page\-(\d+)/},cur:function(){var e=this.currentPage,t=this.rpage&&location.href.match(this.rpage());return t&&t[1]&&((e=~~t[1])<0||e>this.totalPages)&&(e=1),e},onInit:function(){var e=this;this.$watch("totalPages",function(){e.render(e.cur())}),this.$watch("currentPage",function(){e.render(e.cur())}),e.is_ie||e.is_more?!e.is_ie&&e.is_more&&window.addEventListener("hashchange",function(){e.render(e.cur())},!1):window.addEventListener("hashchange",function(){e.cbProxy(window.event,e.cur())},!1),e.render(e.cur())}}}),console.log("成功加载ms-pager组件!")):console.log("请先在当前页面引用avalon.js!另外请保证您引用了与该组件配套的css样式!");
|
1
app/public/themes/users/js/dora.front.js
Normal file
1
app/public/themes/users/js/dora.front.js
Normal file
File diff suppressed because one or more lines are too long
@ -4,6 +4,8 @@ module.exports = app => {
|
||||
controller
|
||||
} = app;
|
||||
|
||||
const authPage = app.middleware.authPage({});
|
||||
|
||||
//配置站点地图和robots抓取
|
||||
router.get("/sitemap.xml", controller.page.home.getSiteMapPage);
|
||||
|
||||
@ -30,9 +32,12 @@ module.exports = app => {
|
||||
router.get(["/search/:searchkey", "/search/:searchkey/:current.html"], controller.page.home.getDataForSearchPage);
|
||||
// 标签
|
||||
router.get(["/tag/:tagName", "/tag/:tagName/:current.html"], controller.page.home.getDataForTagPage);
|
||||
// 作者
|
||||
router.get(["/author/:userId", "/author/:userId/:current.html"], controller.page.home.getDataForAuthorPage);
|
||||
|
||||
// 移动端
|
||||
router.get("/phone-fenlei.html", controller.page.home.getDataForPhoneCategory);
|
||||
router.get("/phone-list.html", controller.page.home.getDataForPhoneList);
|
||||
router.get("/phone-user.html", authPage, controller.page.home.getDataForPhoneUser);
|
||||
|
||||
}
|
@ -91,6 +91,9 @@ module.exports = app => {
|
||||
// 升级
|
||||
router.get('/manage/plugin/updatePlugin', controller.manage.plugin.updatePlugin);
|
||||
|
||||
// 启用插件
|
||||
router.post('/manage/plugin/enablePlugin', controller.manage.plugin.enablePlugin);
|
||||
|
||||
// 心跳
|
||||
router.get('/manage/plugin/pluginHeartBeat', controller.manage.plugin.pluginHeartBeat);
|
||||
|
||||
@ -106,6 +109,20 @@ module.exports = app => {
|
||||
// 订单校验
|
||||
router.post('/manage/plugin/checkInvoice', controller.manage.plugin.checkInvoice);
|
||||
|
||||
/**
|
||||
* 钩子管理
|
||||
*/
|
||||
router.get('/manage/hook/getList', controller.manage.hook.list)
|
||||
|
||||
router.get('/manage/hook/getOne', controller.manage.hook.getOne)
|
||||
|
||||
router.post('/manage/hook/addOne', controller.manage.hook.create)
|
||||
|
||||
router.post('/manage/hook/updateOne', controller.manage.hook.update)
|
||||
|
||||
router.get('/manage/hook/deleteUser', controller.manage.hook.removes)
|
||||
|
||||
|
||||
|
||||
//ManageRouters
|
||||
|
||||
|
@ -7,38 +7,37 @@ module.exports = app => {
|
||||
const authPage = app.middleware.authPage({});
|
||||
|
||||
//用户登录
|
||||
router.get('/users/login', controller.page.home.getDataForUserLogin);
|
||||
router.get('/users/login', controller.page.user.getDataForUserLogin);
|
||||
|
||||
//用户注册
|
||||
router.get('/users/reg', controller.page.home.getDataForUserReg);
|
||||
router.get('/users/reg', controller.page.user.getDataForUserReg);
|
||||
|
||||
//用户中心
|
||||
router.get('/users/userCenter', authPage, controller.page.home.getDataForUserIndex);
|
||||
router.get('/users/userCenter', authPage, controller.page.user.getDataForUserIndex);
|
||||
|
||||
// 修改用户密码页面
|
||||
router.get('/users/setUserPsd', authPage, controller.page.home.getDataForSetUserPwd);
|
||||
router.get('/users/setUserPsd', authPage, controller.page.user.getDataForSetUserPwd);
|
||||
|
||||
router.get('/users/personInfo', authPage, controller.page.home.getDataForUserInfo);
|
||||
router.get('/users/personInfo', authPage, controller.page.user.getDataForUserInfo);
|
||||
|
||||
// 用户相关主界面
|
||||
router.get('/users/userContents', authPage, controller.page.home.getDataForUserCenter);
|
||||
router.get('/users/userContents', authPage, controller.page.user.getDataForUserCenter);
|
||||
|
||||
// 参与评论
|
||||
router.get('/users/joinComments', authPage, controller.page.home.getDataForJoinComments);
|
||||
router.get('/users/joinComments', authPage, controller.page.user.getDataForJoinComments);
|
||||
|
||||
// 系统消息
|
||||
router.get('/users/notify', authPage, controller.page.home.getDataForUserNotify);
|
||||
router.get('/users/notify', authPage, controller.page.user.getDataForUserNotify);
|
||||
|
||||
|
||||
// 用户投稿主界面
|
||||
router.get('/users/userAddContent', authPage, controller.page.home.getDataForUserAddContent);
|
||||
router.get('/users/userAddContent', authPage, controller.page.user.getDataForUserAddContent);
|
||||
|
||||
router.get('/users/editContent/:id', authPage, controller.page.home.getDataForEditContent);
|
||||
router.get('/users/editContent/:id', authPage, controller.page.user.getDataForEditContent);
|
||||
|
||||
// 找回密码
|
||||
router.get('/users/confirmEmail', controller.page.home.getDataForResetPsdPage)
|
||||
router.get('/users/confirmEmail', controller.page.user.getDataForResetPsdPage)
|
||||
|
||||
router.get("/phone-user.html", authPage, controller.page.home.getDataForPhoneUser);
|
||||
|
||||
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
* @Author: doramart
|
||||
* @Date: 2019-06-21 11:14:02
|
||||
* @Last Modified by: doramart
|
||||
* @Last Modified time: 2020-03-14 12:01:05
|
||||
* @Last Modified time: 2020-05-05 22:16:02
|
||||
*/
|
||||
|
||||
|
||||
@ -52,7 +52,8 @@ exports._list = async (Model, payload, {
|
||||
pageSize,
|
||||
searchkey,
|
||||
isPaging,
|
||||
skip
|
||||
skip,
|
||||
lean
|
||||
} = payload;
|
||||
|
||||
let docs = [];
|
||||
@ -60,6 +61,7 @@ exports._list = async (Model, payload, {
|
||||
query = query || {};
|
||||
current = current || 1, pageSize = Number(pageSize) || 10;
|
||||
isPaging = isPaging == '0' ? false : true;
|
||||
lean = lean == '1' ? true : false;
|
||||
let skipNum = skip ? skip : ((Number(current)) - 1) * Number(pageSize);
|
||||
sort = !_.isEmpty(sort) ? sort : {
|
||||
date: -1
|
||||
@ -87,12 +89,12 @@ exports._list = async (Model, payload, {
|
||||
}
|
||||
// console.log('--query--', query);
|
||||
if (isPaging) {
|
||||
docs = await Model.find(query, files).skip(skipNum).limit(Number(pageSize)).sort(sort).populate(populate).exec();
|
||||
docs = !lean ? await Model.find(query, files).skip(skipNum).limit(Number(pageSize)).sort(sort).populate(populate).exec() : await Model.find(query, files).skip(skipNum).limit(Number(pageSize)).sort(sort).populate(populate).lean().exec();
|
||||
} else {
|
||||
if (payload.pageSize > 0) {
|
||||
docs = await Model.find(query, files).skip(skipNum).limit(pageSize).sort(sort).populate(populate).exec();
|
||||
docs = !lean ? await Model.find(query, files).skip(skipNum).limit(pageSize).sort(sort).populate(populate).exec() : await Model.find(query, files).skip(skipNum).limit(pageSize).sort(sort).populate(populate).lean().exec();
|
||||
} else {
|
||||
docs = await Model.find(query, files).skip(skipNum).sort(sort).populate(populate).exec();
|
||||
docs = !lean ? await Model.find(query, files).skip(skipNum).sort(sort).populate(populate).exec() : await Model.find(query, files).skip(skipNum).sort(sort).populate(populate).lean().exec();
|
||||
}
|
||||
}
|
||||
count = await Model.countDocuments(query).exec();
|
||||
@ -370,7 +372,9 @@ exports._inc = async (ctx, Model, id, data, {
|
||||
}
|
||||
|
||||
if (!_.isEmpty(id)) {
|
||||
query = _.assign({}, query);
|
||||
query = _.assign({}, {
|
||||
_id: id
|
||||
}, query);
|
||||
}
|
||||
|
||||
return await Model.updateMany(query, {
|
||||
|
71
app/service/hook.js
Executable file
71
app/service/hook.js
Executable file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* @Author: doramart
|
||||
* @Date: 2019-06-24 13:20:49
|
||||
* @Last Modified by: doramart
|
||||
* @Last Modified time: 2020-04-10 09:13:42
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
const Service = require('egg').Service;
|
||||
const path = require('path')
|
||||
|
||||
// general是一个公共库,可用可不用
|
||||
const {
|
||||
_list,
|
||||
_item,
|
||||
_count,
|
||||
_create,
|
||||
_update,
|
||||
_removes,
|
||||
_removeAll
|
||||
} = require('./general');
|
||||
|
||||
|
||||
class HookService extends Service {
|
||||
|
||||
async find(payload, {
|
||||
query = {},
|
||||
searchKeys = [],
|
||||
populate = [],
|
||||
files = null
|
||||
} = {}) {
|
||||
|
||||
let listdata = _list(this.ctx.model.Hook, payload, {
|
||||
query: query,
|
||||
searchKeys: searchKeys,
|
||||
populate: populate,
|
||||
files
|
||||
});
|
||||
return listdata;
|
||||
|
||||
}
|
||||
|
||||
|
||||
async count(params = {}) {
|
||||
return _count(this.ctx.model.Hook, params);
|
||||
}
|
||||
|
||||
async create(payload) {
|
||||
return _create(this.ctx.model.Hook, payload);
|
||||
}
|
||||
|
||||
async removes(res, values, key = '_id') {
|
||||
return _removes(res, this.ctx.model.Hook, values, key);
|
||||
}
|
||||
|
||||
async removeAll() {
|
||||
return _removeAll(this.ctx.model.Hook);
|
||||
}
|
||||
|
||||
async update(res, _id, payload) {
|
||||
return _update(res, this.ctx.model.Hook, _id, payload);
|
||||
}
|
||||
|
||||
async item(res, params = {}) {
|
||||
return _item(res, this.ctx.model.Hook, params)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
module.exports = HookService;
|
@ -435,6 +435,16 @@ var siteFunc = {
|
||||
fs.writeFileSync(targetPath, fileData.join('\n'), 'utf8');
|
||||
},
|
||||
|
||||
// 创建文件并写入
|
||||
createFileByStr(path, str) {
|
||||
if (fs.existsSync(path)) {
|
||||
fs.unlinkSync(path);
|
||||
}
|
||||
if (path && str) {
|
||||
fs.writeFileSync(path, str, 'utf8')
|
||||
}
|
||||
}
|
||||
|
||||
// OPTION_DATABASE_END
|
||||
};
|
||||
module.exports = siteFunc;
|
@ -1,9 +1,9 @@
|
||||
{% extends "../public/defaultTemp.html" %} {% block content %}
|
||||
{% extends "../default.html" %} {% block content %}
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12 main-container">
|
||||
|
||||
{% set firstDocuments = documentList.docs[0] %}
|
||||
{% set firstDocuments = posts[0] %}
|
||||
|
||||
{% if firstDocuments %}
|
||||
<input type="hidden" value="{{firstDocuments._id}}" id="contentId">
|
||||
@ -14,7 +14,7 @@
|
||||
<article class="post">
|
||||
<div class="col-md-2"> </div>
|
||||
<div class="col-md-8">
|
||||
<h2 alt="{{siteInfo.altkey}}{{firstDocuments.title}}" class="post-title">
|
||||
<h2 alt="{{site.altkey}}{{firstDocuments.title}}" class="post-title">
|
||||
{{firstDocuments.title}} {% if firstDocuments.from == '2' %}
|
||||
<span class="badge">{{__('lc_document_share')}}</span>
|
||||
{% endif %}
|
||||
|
@ -1,9 +1,9 @@
|
||||
{% extends "../public/defaultTemp.html" %} {% block content %}
|
||||
{% extends "../default.html" %} {% block content %}
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12 main-container">
|
||||
|
||||
{% set firstDocuments = documentList.docs[0] %}
|
||||
{% set firstDocuments = posts[0] %}
|
||||
|
||||
{% if firstDocuments %}
|
||||
<input type="hidden" value="{{firstDocuments._id}}" id="contentId">
|
||||
@ -14,7 +14,7 @@
|
||||
<article class="post">
|
||||
<div class="col-md-2"> </div>
|
||||
<div class="col-md-8">
|
||||
<h2 alt="{{siteInfo.altkey}}{{firstDocuments.title}}" class="post-title">
|
||||
<h2 alt="{{site.altkey}}{{firstDocuments.title}}" class="post-title">
|
||||
{{firstDocuments.title}} {% if firstDocuments.from == '2' %}
|
||||
<span class="badge">{{__('lc_document_share')}}</span>
|
||||
{% endif %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "../public/defaultTemp.html" %} {% block content %} {% import "../public/adsPannel.html" as adsPannel %}
|
||||
{% extends "../default.html" %} {% block content %} {% import "../public/adsPannel.html" as adsPannel %}
|
||||
<script async defer id="github-bjs" src="https://buttons.github.io/buttons.js"></script>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
<div class="col-md-1"></div>
|
||||
<div class="col-md-10">
|
||||
{% remote key="anli",api="ads/getOne",query='{"name":"anli"}' %}
|
||||
{% ads name="anli" %}
|
||||
{{adsPannel.slider(anli)}}
|
||||
</div>
|
||||
<div class="col-md-1"></div>
|
||||
|
@ -1,11 +1,11 @@
|
||||
{% extends "../public/defaultTemp.html" %} {% block content %}
|
||||
{% extends "../default.html" %} {% block content %}
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12 main-container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 left-frame">
|
||||
<div class="column-wrap">
|
||||
<h1 alt="{{siteInfo.altkey}}{{cateInfo.name}}">{{cateInfo.name}}</h1>
|
||||
<h1 alt="{{site.altkey}}{{cateInfo.name}}">{{cateInfo.name}}</h1>
|
||||
</div>
|
||||
{% include "../public/sysItemListTemp.html" %} {% include "../public/pagination.html" %}
|
||||
</div>
|
||||
|
@ -1,48 +1,48 @@
|
||||
{% extends "../public/defaultTemp.html" %} {% block content %}
|
||||
{% extends "../default.html" %} {% block content %}
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12 main-container" ms-controller="documentInfo">
|
||||
<input type="hidden" value="{{documentInfo._id}}" id="contentId">
|
||||
<input type="hidden" value="{{post._id}}" id="contentId">
|
||||
<div class="row articel-details">
|
||||
{% if (documentInfo.categories[0]).enable %}
|
||||
{% if (post.categories[0]).enable %}
|
||||
<div class="col-md-8 left-frame">
|
||||
<div class="articel-main ">
|
||||
<article class="">fsdfsdf
|
||||
<h2 alt="{{siteInfo.altkey}}{{documentInfo.title}}" class="post-title">
|
||||
{{documentInfo.title}} {% if documentInfo.from == '2' %}
|
||||
<h2 alt="{{site.altkey}}{{post.title}}" class="post-title">
|
||||
{{post.title}} {% if post.from == '2' %}
|
||||
<span class="badge">{{__('lc_document_share')}}</span>
|
||||
{% endif %}
|
||||
</h2>
|
||||
<ul class="post-meta content-author">
|
||||
<li class="author-name">
|
||||
{% if documentInfo.author %} {{documentInfo.author.userName}} {% else %}
|
||||
{{documentInfo.uAuthor.userName}} {% endif %}
|
||||
{% if post.author %} {{post.author.userName}} {% else %}
|
||||
{{post.uAuthor.userName}} {% endif %}
|
||||
</li>
|
||||
<li>
|
||||
{% set cateInfo = (documentInfo.categories[0]) %}
|
||||
{% set cateInfo = (post.categories[0]) %}
|
||||
<span class="dot"> • </span>
|
||||
<a href="/{{cateInfo.defaultUrl}}___{{cateInfo._id}}"
|
||||
target="_blank">{{(documentInfo.categories[documentInfo.categories.length-1]).name}}</a>
|
||||
<a href="{{cateInfo.url}}"
|
||||
target="_blank">{{(post.categories[post.categories.length-1]).name}}</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="dot"> • </span> {{documentInfo.date}}
|
||||
<span class="dot"> • </span> {{post.date}}
|
||||
</li>
|
||||
<li>
|
||||
<span
|
||||
class="dot"> • </span>{{__('lc_document_readNum}} {{documentInfo.clickNum')}}
|
||||
class="dot"> • </span>{{__('lc_document_readNum}} {{post.clickNum')}}
|
||||
</li>
|
||||
</ul>
|
||||
<div class="post-content">
|
||||
{{documentInfo.comments | safe}}
|
||||
{{post.comments | safe}}
|
||||
</div>
|
||||
</article>
|
||||
{% if documentInfo.tags.length>0%}
|
||||
{% if post.tags.length>0%}
|
||||
<div class="tag-list">
|
||||
<ul>
|
||||
{% for tag in documentInfo.tags %}
|
||||
{% for tag in post.tags %}
|
||||
<li>
|
||||
<span class="label label-info">
|
||||
<a href="/tag/{{tag.name}}">{{tag.name}}</a>
|
||||
<a href="{{tag.url}}">{{tag.name}}</a>
|
||||
</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
@ -58,30 +58,30 @@
|
||||
<div class="col-md-12 left-frame">
|
||||
<div class="articel-main">
|
||||
<article class="post">
|
||||
<h2 alt="{{siteInfo.altkey}}{{documentInfo.title}}" class="post-title">
|
||||
{{documentInfo.discription}} {% if documentInfo.from == '2' %}
|
||||
<h2 alt="{{site.altkey}}{{post.title}}" class="post-title">
|
||||
{{post.discription}} {% if post.from == '2' %}
|
||||
<span class="badge">{{__('lc_document_share')}}</span>
|
||||
{% endif %}
|
||||
</h2>
|
||||
<ul class="post-meta content-author">
|
||||
<li class="author-name">
|
||||
{% if documentInfo.author %} {{documentInfo.author.userName}} {% else %}
|
||||
{{documentInfo.uAuthor.userName}} {% endif %}
|
||||
{% if post.author %} {{post.author.userName}} {% else %}
|
||||
{{post.uAuthor.userName}} {% endif %}
|
||||
</li>
|
||||
<li>
|
||||
<span class="dot"> • </span>
|
||||
{{(documentInfo.categories[documentInfo.categories.length-1]).name}}
|
||||
{{(post.categories[post.categories.length-1]).name}}
|
||||
</li>
|
||||
<li>
|
||||
<span class="dot"> • </span> {{documentInfo.date}}
|
||||
<span class="dot"> • </span> {{post.date}}
|
||||
</li>
|
||||
<li>
|
||||
<span
|
||||
class="dot"> • </span>{{__('lc_document_readNum}} {{documentInfo.clickNum')}}
|
||||
class="dot"> • </span>{{__('lc_document_readNum}} {{post.clickNum')}}
|
||||
</li>
|
||||
</ul>
|
||||
<div class="post-content">
|
||||
{{documentInfo.comments | safe}}
|
||||
{{post.comments | safe}}
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
|
@ -1,17 +1,11 @@
|
||||
{% extends "../public/defaultTemp.html" %} {% block content %}
|
||||
{% extends "../default.html" %} {% block content %}
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12 main-container">
|
||||
<div class="row">
|
||||
<div class="col-md-8 left-frame">
|
||||
<div class="column-wrap">
|
||||
{% if pageType == 'search' %}
|
||||
<h1 alt="{{siteInfo.altkey}}{{targetSearchKey}}">搜索:{{targetSearchKey}}</h1>
|
||||
{% elif pageType == 'tag' %}
|
||||
<h1 alt="{{siteInfo.altkey}}{{targetTagName}}">标签:{{targetTagName}}</h1>
|
||||
{% else %}
|
||||
<h1 alt="{{siteInfo.altkey}}{{cateInfo.name}}">{{cateInfo.name}}</h1>
|
||||
{% endif %}
|
||||
<h1 alt="{{site.altkey}}{{targetSearchKey}}">{{list_title}}</h1>
|
||||
</div>
|
||||
{% include "../public/itemListTemp.html" %}
|
||||
</div>
|
||||
|
@ -1,72 +1,75 @@
|
||||
{% extends "../public/defaultTemp.html" %} {% block content %}
|
||||
{% extends "../default.html" %} {% block content %}
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12 main-container" ms-controller="documentInfo">
|
||||
<input type="hidden" value="{{documentInfo._id}}" id="contentId">
|
||||
<input type="hidden" value="{{post._id}}" id="contentId">
|
||||
<div class="row articel-details">
|
||||
<div class="col-md-8 left-frame">
|
||||
<div class="articel-main ">
|
||||
<article class="post">
|
||||
<h2 alt="{{siteInfo.altkey}}{{documentInfo.title}}" class="post-title">
|
||||
{{documentInfo.title}} {% if documentInfo.from == '2' %}
|
||||
<h2 alt="{{site.altkey}}{{post.title}}" class="post-title">
|
||||
{{post.title}} {% if post.from == '2' %}
|
||||
<span class="badge">{{__('lc_document_share')}}</span>
|
||||
{% endif %}
|
||||
</h2>
|
||||
<ul class="post-meta content-author">
|
||||
<li class="author-name">
|
||||
{% if documentInfo.uAuthor %} {{documentInfo.uAuthor.userName}} {% else %}
|
||||
{{documentInfo.author.userName}} {% endif %}
|
||||
{% if post.uAuthor %} {{post.uAuthor.userName}} {% else %}
|
||||
{{post.author.userName}} {% endif %}
|
||||
</li>
|
||||
<li>
|
||||
{% set cateInfo = (documentInfo.categories[0]) %}
|
||||
{% set cateInfo = (post.categories[0]) %}
|
||||
<span class="dot"> • </span>
|
||||
<a href="/{{cateInfo.defaultUrl}}___{{cateInfo._id}}"
|
||||
target="_blank">{{(documentInfo.categories[documentInfo.categories.length-1]).name}}</a>
|
||||
<a href="{{cateInfo.url}}"
|
||||
target="_blank">{{(post.categories[post.categories.length-1]).name}}</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="dot"> • </span> {{documentInfo.date}}
|
||||
<span class="dot"> • </span> {{post.date}}
|
||||
</li>
|
||||
<li>
|
||||
<span
|
||||
class="dot"> • </span>{{__('lc_document_readNum')}} {{documentInfo.clickNum}}
|
||||
class="dot"> • </span>{{__('lc_document_readNum')}} {{post.clickNum}}
|
||||
</li>
|
||||
</ul>
|
||||
<div class="post-content">
|
||||
{{documentInfo.comments | safe}}
|
||||
{{post.comments | safe}}
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<div class="tag-list">
|
||||
<ul>
|
||||
{% for tag in documentInfo.tags %}
|
||||
{% for tag in post.tags %}
|
||||
<li>
|
||||
<span class="label label-info">
|
||||
<a href="/tag/{{tag.name}}">{{tag.name}}</a>
|
||||
<a href="{{tag.url}}">{{tag.name}}</a>
|
||||
</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% remote key="nearArticle",api="content/getNearbyContent",query='{"id":"' + documentInfo._id +'"}' %}
|
||||
{% if nearArticle %}
|
||||
{% near_post "id"=post._id %}
|
||||
{% if near_post %}
|
||||
<div class="near-article">
|
||||
<ul>
|
||||
{% if nearArticle.preContent.title %}
|
||||
<li class="left">{{__('lc_pre_document')}}: <a
|
||||
href="/details/{{nearArticle.preContent._id}}.html "
|
||||
target="_self">{{nearArticle.preContent.title}}</a>
|
||||
{% if near_post.preContent.title %}
|
||||
<li class="left">{{__('lc_pre_document')}}: <a href="{{near_post.preContent.url}}"
|
||||
target="_self">{{near_post.preContent.title}}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if nearArticle.nextContent.title %}
|
||||
<li class="right">{{__('lc_next_document')}}: <a
|
||||
href="/details/{{nearArticle.nextContent._id}}.html "
|
||||
target="_self">{{nearArticle.nextContent.title}}</a>
|
||||
{% if near_post.nextContent.title %}
|
||||
<li class="right">{{__('lc_next_document')}}: <a href="{{near_post.nextContent.url}}"
|
||||
target="_self">{{near_post.nextContent.title}}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% include "../public/randomList.html" %} {% include "../public/msgBoard.html" %}
|
||||
{% include "../public/randomList.html" %}
|
||||
{% if HOOK@messageBoard %}
|
||||
{{HOOK@messageBoard | safe}}
|
||||
{% else %}
|
||||
{% include "../public/msgBoard.html" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 right-frame">
|
||||
|
@ -2,8 +2,8 @@
|
||||
<div class="container min-hight margin-bottom-20 margin-top-20" style="background: #FFFFFF">
|
||||
<div class="row">
|
||||
<div class="col-md-12 page-404">
|
||||
<script type="text/javascript" src="http://www.qq.com/404/search_children.js" charset="utf-8" homePageUrl="http://<%=siteInfo.docs[0].siteDomain%>"
|
||||
homePageName="回到前端开发俱乐部"></script>
|
||||
<script type="text/javascript" src="http://www.qq.com/404/search_children.js" charset="utf-8"
|
||||
homePageUrl="{{domain}}" homePageName="{{siteName}}"></script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
29
app/view/dorawhite/default.html
Executable file
29
app/view/dorawhite/default.html
Executable file
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="{{pageType}}">
|
||||
|
||||
<head>
|
||||
{% header adaptor="ie" %}
|
||||
|
||||
<!-- 引入组件库 -->
|
||||
{% plugin name="twitter-bootstrap font-awesome" %}
|
||||
{% endplugin %}
|
||||
|
||||
<!-- 二次开发静态资源 -->
|
||||
{% assets 'dora.front.js white.css' %}
|
||||
{% endassets %}
|
||||
|
||||
{% endheader %}
|
||||
|
||||
<input type="hidden" value="{{lsk}}" id="sysKeys">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{% include "./public/header.html" %}
|
||||
<div class="mainbody" id="{{pageType}}">
|
||||
<input type="hidden" value="{{site.lang}}" id="siteLang">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
{% include "./public/footer.html" %}
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,4 +1,4 @@
|
||||
{% extends "./public/defaultTemp.html" %} {% block content %} {% import "./public/adsPannel.html" as adsPannel %}
|
||||
{% extends "./default.html" %} {% block content %} {% import "./public/adsPannel.html" as adsPannel %}
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12 main-container">
|
||||
@ -6,30 +6,29 @@
|
||||
<div class="col-md-8 left-frame">
|
||||
<div class="row slider-box">
|
||||
<div class="col-md-10">
|
||||
{% remote key="recommend",api="ads/getOne",query='{"name":"recommend"}' %}
|
||||
{% ads name="recommend" %}
|
||||
{{adsPannel.slider(recommend)}}
|
||||
</div>
|
||||
<div class="col-md-2 top-rec-contents">
|
||||
{% remote key="reCommendListTop",api="content/getList",query='{"model":"1","pageSize":3,"isPaging":"0"}' %}
|
||||
{% if reCommendListTop.length > 0 %}
|
||||
{% for item in reCommendListTop%}
|
||||
{% recommend pageSize=3 %}
|
||||
{% for item in recommend%}
|
||||
<div class="rec-li">
|
||||
<div class="contentImg">
|
||||
<a href="/details/{{item._id}}.html">
|
||||
<a href="{{item.url}}">
|
||||
<img src="{{item.sImg}}" alt="{{item.title}}" />
|
||||
</a>
|
||||
</div>
|
||||
<a class="title" href="/details/{{item._id}}.html">{{item.title | cutwords(15)}}</a>
|
||||
<a class="title" href="{{item.url}}">{{item.title | cutwords(15)}}</a>
|
||||
</div>
|
||||
{% endfor %} {% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% include "./public/itemListTemp.html" %}
|
||||
</div>
|
||||
<div class="col-md-4 right-frame">
|
||||
{% remote key="publishCms",api="ads/getOne",query='{"name":"publishCms"}' %}
|
||||
{% ads name="publishCms" %}
|
||||
{{adsPannel.slider(publishCms)}}
|
||||
{% remote key="qrCode",api="ads/getOne",query='{"name":"qrCode"}' %}
|
||||
{% ads name="qrCode" %}
|
||||
{{adsPannel.slider(qrCode)}} {% include "./public/hotNewsList.html" %} {% include "./public/reCommendList.html"
|
||||
%} {% include "./public/newMessageBoard.html" %}
|
||||
</div>
|
||||
|
@ -7,17 +7,18 @@ item为子元素集合
|
||||
<article class="post" ms-for="(index,item) in @appendDocumentList">
|
||||
<div class="row">
|
||||
<div class="col-xs-5 col-sm-3 col-md-4">
|
||||
<a ms-if="@item.categories.length > 1" target="_blank" class="item-category" ms-attr="{href:'/'+(@item.categories)[@item.categories.length-1].defaultUrl+ '___'+(@item.categories)[@item.categories.length-1]._id}"
|
||||
ms-text="(@item.categories)[@item.categories.length-1].name"></a>
|
||||
<a ms-if="@item.categories.length == 1" target="_blank" class="item-category" ms-attr="{href:'/'+(@item.categories)[0].defaultUrl+ '___'+(@item.categories)[0]._id}"
|
||||
ms-text="(@item.categories)[0].name"></a>
|
||||
<a ms-attr="{href:'/details/'+ @item._id + '.html'}" target="_blank " class="contentImg ">
|
||||
<a ms-if="@item.categories.length > 1" target="_blank" class="item-category"
|
||||
ms-attr="{href:(@item.categories)[@item.categories.length-1].url}"
|
||||
ms-text="(@item.categories)[@item.categories.length-1].name"></a>
|
||||
<a ms-if="@item.categories.length == 1" target="_blank" class="item-category"
|
||||
ms-attr="{href:(@item.categories)[0].url}" ms-text="(@item.categories)[0].name"></a>
|
||||
<a ms-attr="{href:'@item.url'}" target="_blank " class="contentImg ">
|
||||
<img ms-attr="{src: @item.sImg,alt:@item.title }" class="img-responsive " />
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-xs-7 col-sm-9 col-md-8 discription ">
|
||||
<h2 class="post-title" ms-attr="{alt:@item.title}">
|
||||
<a ms-attr="{href:'/details/'+ @item._id + '.html'}" target="_blank" ms-text="@item.title">
|
||||
<a ms-attr="{href:'@item.url'}" target="_blank" ms-text="@item.title">
|
||||
</a>
|
||||
</h2>
|
||||
<div class="post-content " ms-text="@item.discription | cutwords(60)">
|
||||
@ -48,7 +49,7 @@ item为子元素集合
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
{% if documentList.docs.length > 0 %}
|
||||
{% if posts.length > 0 %}
|
||||
<div class="loading-more" ms-on-click="@getMoreNews">
|
||||
<i :visible="!@loadingState" class="fa fa-sort-down" aria-hidden="true"></i>
|
||||
<i :visible="@loadingState" class="fa fa-spin fa-spinner"></i>
|
||||
@ -86,9 +87,10 @@ item为子元素集合
|
||||
appendNewsVm.loadingState = false;
|
||||
if (data.status == 200) {
|
||||
if (data.data.docs.length > 0) {
|
||||
appendNewsVm.appendDocumentList = (appendNewsVm.appendDocumentList).concat(data.data.docs);
|
||||
appendNewsVm.appendDocumentList = (appendNewsVm.appendDocumentList).concat(data.data
|
||||
.docs);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (d) {
|
||||
console.log('error:', d)
|
||||
|
@ -9,7 +9,7 @@
|
||||
{% for sonNav in currentCateList.cates %} {% if sonNav.parentId === parentNav._id %} {% if cateInfo._id == sonNav._id %}
|
||||
{% set navClass = 'active'%} {% else %} {% set navClass = ''%} {% endif %}
|
||||
<li class="{{navClass}}">
|
||||
<a href="{{'/'+sonNav.defaultUrl+ '___'+sonNav._id}}">{{sonNav.name}}</a>
|
||||
<a href="{{sonNav.url}}">{{sonNav.name}}</a>
|
||||
</li>
|
||||
{% endif %} {% endfor %}
|
||||
</ul>
|
||||
|
@ -1,69 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="{{pageType}}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport"
|
||||
content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no" />
|
||||
<meta name="description" content="{{siteInfo.discription}}">
|
||||
<meta content="{{siteInfo.key}}" name="keywords" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="{{siteInfo.title}}" />
|
||||
<meta property="og:description" content="{{siteInfo.discription}}" />
|
||||
<meta property="og:image" content="{{ogData.img}}">
|
||||
<meta property="og:url" content="{{ogData.url}}">
|
||||
<meta name="author" content="DoraCMS">
|
||||
<title>
|
||||
{{siteInfo.title}}
|
||||
</title>
|
||||
<!-- 引入组件库 -->
|
||||
<script src="{{staticRootPath}}/plugins/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
|
||||
<link href="{{staticRootPath}}/plugins/twitter-bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
|
||||
<script src="{{staticRootPath}}/plugins/twitter-bootstrap/3.3.5/js/bootstrap.min.js" type="text/javascript">
|
||||
</script>
|
||||
<link href="{{staticRootPath}}/plugins/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
|
||||
<script src="{{staticRootPath}}/plugins/avalon.js/2.2.7/avalon.min.js"></script>
|
||||
<script src="{{staticRootPath}}/plugins/layer/layer.js"></script>
|
||||
<link rel="stylesheet" href="{{staticRootPath}}/plugins/layer/theme/default/layer.css">
|
||||
|
||||
<!--default theme-->
|
||||
<script src="{{staticRootPath}}/themes/{{staticforder}}/js/dora.front.js?version={{siteInfo.version}}"
|
||||
type="text/javascript">
|
||||
</script>
|
||||
<link href="{{staticRootPath}}/themes/{{staticforder}}/css/white.css?version={{siteInfo.version}}" rel="stylesheet">
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="{{staticRootPath}}/plugins/html5shiv/3.7.2/html5shiv.min.js"></script>
|
||||
<script src="{{staticRootPath}}/plugins/respond.js/1.4.2/respond.min.js"></script>
|
||||
<script src="{{staticRootPath}}/plugins/json3/3.3.2/json3.min.js"></script>
|
||||
<script src="{{staticRootPath}}/themes/{{staticforder}}/js/promise/promise.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
{% if siteInfo.configs and siteInfo.configs.statisticalCode %}
|
||||
<!-- 百度统计 -->
|
||||
<script>
|
||||
var _hmt = _hmt || [];
|
||||
(function () {
|
||||
var hm = document.createElement("script");
|
||||
hm.src = "{{siteInfo.configs.statisticalCode}}";
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
<input type="hidden" value="{{lsk}}" id="sysKeys">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{% include "./header.html" %}
|
||||
<div class="mainbody" id="{{pageType}}">
|
||||
<input type="hidden" value="{{siteInfo.lang}}" id="siteLang">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
{% include "./footer.html" %}
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,19 +0,0 @@
|
||||
<!-- BEGIN CONTAINER -->
|
||||
<div class="container min-hight" style="margin-top: 50px;margin-bottom: 20px;">
|
||||
|
||||
<div class="col-md-9 col-md-offset-2 page-500">
|
||||
<div class="number">
|
||||
500
|
||||
</div>
|
||||
<div class="details">
|
||||
<h3>程序出错了.</h3>
|
||||
<p>
|
||||
{{errInfo}}
|
||||
<br> 我们正在加紧处理,请稍后访问...
|
||||
<br>
|
||||
<br>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END CONTAINER -->
|
@ -6,10 +6,10 @@
|
||||
<div class="container">
|
||||
<ul>
|
||||
<li>自豪的采用
|
||||
<a href="https://github.com/doramart/DoraCMS" rel="nofollow" target="_blank" title="代码在这里">DoraCMS {{siteInfo.version}}
|
||||
<a href="https://github.com/doramart/DoraCMS" rel="nofollow" target="_blank" title="代码在这里">DoraCMS {{site.version}}
|
||||
</a> Copyright (c) 2020
|
||||
<a href="http://www.beian.miit.gov.cn/" rel="nofollow" target="_blank">
|
||||
{{siteInfo.configs.registrationNo}}
|
||||
{{site.configs.registrationNo}}
|
||||
</a> All Rights Reserved
|
||||
<a href="/sitemap.html" target="_blank">{{__('lc_sitemap')}}</a>
|
||||
</li>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!--头部模板-->
|
||||
<script>
|
||||
if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
|
||||
document.write("<script src='{{staticRootPath}}/themes/{{staticforder}}/js/iscroll/iscroll.js'><" + '/' +
|
||||
document.write("<script src='{{staticThemePath}}/js/iscroll/iscroll.js'><" + '/' +
|
||||
"script>");
|
||||
$(function () {
|
||||
new IScroll('#navWrapper', {
|
||||
@ -17,7 +17,7 @@
|
||||
<input type="hidden" value="{{logined}}" id="logined">
|
||||
<input type="hidden" value="{{tokenId}}" id="tokenId">
|
||||
<header class="clearfix" id="header" ms-controller="headerCtr">
|
||||
{% if siteInfo.lang == 'zh-TW' %}
|
||||
{% if site.lang == 'zh-TW' %}
|
||||
{% set homelink = '/zh-TW' %}
|
||||
{% set endStr = '_zh-TW' %}
|
||||
{% else %}
|
||||
@ -31,7 +31,7 @@
|
||||
<div class="col-sm-2 col-md-2">
|
||||
<div class="site-name ">
|
||||
<a href="{{homelink}}" id="logo">
|
||||
<img src="{{siteInfo.siteLogo}}" alt="{{siteInfo.title}}" />
|
||||
<img src="{{site.logo}}" alt="{{site.title}}" />
|
||||
</a>
|
||||
</a>
|
||||
</div>
|
||||
@ -39,10 +39,10 @@
|
||||
<div class="col-sm-9 col-md-6" id="navWrapper">
|
||||
<div id="navScroller">
|
||||
<ul>
|
||||
{% for cate in cateTypes %} {% if cate.parentId == '0' %}
|
||||
{% for cate in navigation %} {% if cate.parentId == '0' %}
|
||||
<li role="presentation">
|
||||
<a role="menuitem" tabindex="-1" alt="{{siteInfo.altkey}}{{cate.name}}"
|
||||
href="/{{cate.defaultUrl}}___{{cate._id}}">{{cate.name}}</a>
|
||||
<a role="menuitem" tabindex="-1" alt="{{site.altkey}}{{cate.name}}"
|
||||
href="{{cate.url}}">{{cate.name}}</a>
|
||||
</li>
|
||||
{% endif %} {% endfor %}
|
||||
</ul>
|
||||
|
@ -1,5 +1,4 @@
|
||||
{% remote key="hotItemListData",api="content/getList",query='{"sortby":"1","pageSize":10,"isPaging":"0"}' %}
|
||||
|
||||
{% hot key="hotItemListData","pageSize"=10 %}
|
||||
{% if hotItemListData.length > 0 %}
|
||||
<div class="pannel-box hot-content-list">
|
||||
<h2 class="pannel-title">{{__('lc_hotDocuments')}}</h2>
|
||||
@ -9,7 +8,7 @@
|
||||
<li>
|
||||
<span class="triangle"></span>
|
||||
<div class="con">
|
||||
<a href="/details/{{item._id}}.html" target="_blank">
|
||||
<a href="{{item.url}}" target="_blank">
|
||||
{{item.title}}
|
||||
</a>
|
||||
</div>
|
||||
|
@ -3,29 +3,31 @@
|
||||
item为子元素集合
|
||||
-->
|
||||
<div class="post-list">
|
||||
|
||||
{% if pageType == 'index' %}
|
||||
<h2 class="top-news">
|
||||
<span>{{__('lc_new_document')}}
|
||||
<span>
|
||||
</h2>
|
||||
{% endif %} {% for item in documentList.docs %}
|
||||
{% endif %}
|
||||
{% for item in posts %}
|
||||
<article class="post">
|
||||
<div class="row">
|
||||
<div class="col-xs-5 col-sm-3 col-md-4">
|
||||
{% if item.categories %} {% if item.categories.length > 1 %}
|
||||
<a target="_blank" class="item-category"
|
||||
href="{{'/'+(item.categories)[item.categories.length-1].defaultUrl+ '___'+(item.categories)[item.categories.length-1]._id}}">{{(item.categories)[item.categories.length-1].name}}</a>
|
||||
href="{{(item.categories)[item.categories.length-1].url}}">{{(item.categories)[item.categories.length-1].name}}</a>
|
||||
{% elif item.categories == 1 %}
|
||||
<a target="_blank" class="item-category"
|
||||
href="{{'/'+(item.categories)[0].defaultUrl+ '___'+(item.categories)[0]._id}}">{{(item.categories)[0].name}}</a>
|
||||
href="{{(item.categories)[0].url}}">{{(item.categories)[0].name}}</a>
|
||||
{% endif%} {% endif%}
|
||||
<a href="/details/{{item._id}}.html " target="_blank " class="contentImg ">
|
||||
<a href="{{item.url}} " target="_blank " class="contentImg ">
|
||||
<img src="{{item.sImg}} " class="img-responsive " alt="{{item.title}} " />
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-xs-7 col-sm-9 col-md-8 discription ">
|
||||
<h2 class="post-title" alt="{{siteInfo.altkey}}{{item.title}}">
|
||||
<a href="/details/{{item._id}}.html " target="_blank ">
|
||||
<h2 class="post-title" alt="{{site.altkey}}{{item.title}}">
|
||||
<a href="{{item.url}} " target="_blank ">
|
||||
{% if item.roofPlacement == 1 %}
|
||||
<span class="sticky-post">置顶</span>
|
||||
{% endif %}
|
||||
|
@ -8,7 +8,7 @@
|
||||
</h2>
|
||||
<div class="give-message">
|
||||
<form name="postMsgForm" ms-validate="@validate">
|
||||
<input id="contentId" type="hidden" value="{{documentInfo._id}}" />
|
||||
<input id="contentId" type="hidden" value="{{post._id}}" />
|
||||
<textarea class="form-control" rows="3" name="email" ms-duplex="@content"
|
||||
placeholder="{{__('lc_please_write_message')}}"
|
||||
ms-rules="{required:true,minlength:5,maxlength:200 }"
|
||||
|
@ -1,162 +0,0 @@
|
||||
<script src="{{staticRootPath}}/themes/{{staticforder}}/js/avalon-ms-pager.js?version={{siteInfo.version}}" type="text/javascript">
|
||||
</script>
|
||||
<div class="my-contents" ms-controller="my-contents">
|
||||
{% include "./modal.html" %}
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" class="active">
|
||||
<a href="#home" aria-controls="home" role="tab" data-toggle="tab">
|
||||
<i aria-hidden="true" class="fa fa-pencil"></i> {{__('lc_myDocument')}}</a>
|
||||
</li>
|
||||
<li role="presentation">
|
||||
<a href="#myMessages" aria-controls="myMessages" role="tab" data-toggle="tab">
|
||||
<i aria-hidden="true" class="fa fa-comment"></i> {{__('lc_myMessage')}}</a>
|
||||
</li>
|
||||
<li role="presentation">
|
||||
<a href="#myJoinTopics" aria-controls="myJoinTopics" role="tab" data-toggle="tab">
|
||||
<i aria-hidden="true" class="fa fa-file-text"></i> {{__('lc_myJoinComment')}}</a>
|
||||
</li>
|
||||
<li role="presentation">
|
||||
<a href="/users/userAddContent" aria-controls="settings">
|
||||
<i aria-hidden="true" class="fa fa-edit"></i> {{__('lc_myPostArticels')}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane active" id="home">
|
||||
<div :if="@myContentList.length == 0">
|
||||
<div class="no-contents">
|
||||
<div class="um-profile-note">
|
||||
<i class="fa fa-frown-o"></i>
|
||||
<span>{{__('lc_no_myDocument')}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="myContentList" :if="@myContentList.length > 0">
|
||||
<div ms-for="(index,el) in @myContentList">
|
||||
<div class="discription ">
|
||||
<h2 class="post-title ">
|
||||
<a ms-visible="@el.state=='2'" ms-attr="{href:'/details/'+el._id+'.html'}" target="_blank "
|
||||
ms-text="@el.title"></a>
|
||||
<a ms-visible="@el.state != '2'" ms-text="@el.title"></a>
|
||||
<div class="contentState">
|
||||
<span ms-visible="@el.state == '0'" style="font-weight:normal;"><a target="_blank"
|
||||
ms-attr="{href:'/users/editContent/'+ @el._id}">{{__('lc_content_state_draft')}}</a></span>
|
||||
<span style="color:orange;"
|
||||
ms-visible="@el.state == '1'">{{__('lc_content_state_wait')}}</span>
|
||||
<span style="color:green;"
|
||||
ms-visible="@el.state == '2'">{{__('lc_content_state_publish')}}</span>
|
||||
<span style="color:red;"
|
||||
ms-visible="@el.state == '3'">{{__('lc_content_state_failed')}}</span>
|
||||
</div>
|
||||
</h2>
|
||||
<div class="post-content" ms-html="@el.discription"></div>
|
||||
<ul class="post-meta ">
|
||||
<li>
|
||||
<i class="fa fa-clock-o " aria-hidden="true "></i>
|
||||
<span ms-text="@el.date"></span>
|
||||
</li>
|
||||
<li>
|
||||
<i class="fa fa-eye " aria-hidden="true "></i>
|
||||
<span ms-text="@el.clickNum"></span>
|
||||
</li>
|
||||
<li>
|
||||
<i class="fa fa-comment " aria-hidden="true "></i>
|
||||
<span ms-text="@el.commentNum"></span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<wbr ms-widget="{is:'ms-pager', onPageClick: @contentPageClick, totalPages:@contentTotalPage}" /></div>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="myMessages">
|
||||
<div :if="@myMessageList.length == 0">
|
||||
<div class="no-contents">
|
||||
<div class="um-profile-note">
|
||||
<i class="fa fa-frown-o"></i>
|
||||
<span>{{__('lc_no_myMessage')}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="myMessageList" :if="@myMessageList.length > 0">
|
||||
<div ms-for="(index,el) in @myMessageList">
|
||||
<ul>
|
||||
<li>
|
||||
<div :class="['notify-title',(@el.isRead?'isRead':'noRead')]"><i
|
||||
class="fa fa-angle-right" ms-on-click="showMessageDetails($event,el)"></i><span
|
||||
ms-html="@el.notify.title"></span></div>
|
||||
<span class="notify-content" ms-html="@el.notify.content"></span>
|
||||
<div class="opt pull-right">
|
||||
<button ms-on-click="@deleteNotify(el._id)" type="button"
|
||||
class="btn btn-danger btn-xs">删除</button>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<wbr ms-widget="{is:'ms-pager', onPageClick: @messagePageClick, totalPages:@messageTotalPage}" /></div>
|
||||
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="myJoinTopics">
|
||||
<div :if="@myJoinTopicsList.length == 0">
|
||||
<div class="no-contents">
|
||||
<div class="um-profile-note">
|
||||
<i class="fa fa-frown-o"></i>
|
||||
<span>{{__('lc_no_myJoinComment')}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="myJoinTopicsList" :if="@myJoinTopicsList.length > 0">
|
||||
<div>
|
||||
<ul class="replyList">
|
||||
<li ms-for="(index,el) in @myJoinTopicsList">
|
||||
<time ms-text="@el.date"></time>
|
||||
<h4>
|
||||
<a href="#">{{userInfo.userName}}</a> 发表在
|
||||
<a ms-attr="{href:'/details/'+el.contentId._id+'.html'}" class=""
|
||||
ms-text="@el.contentId.title"></a>
|
||||
</h4>
|
||||
<blockquote ms-text="@el.content"></blockquote>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<wbr ms-widget="{is:'ms-pager', onPageClick: @joinTopicPageClick, totalPages:@joinTopicsTotalPage}" /></div>
|
||||
</div>
|
||||
<!-- <div role="tabpanel" class="tab-pane" id="settings">...</div> -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||
var targetId = e.target.hash;
|
||||
if (targetId.indexOf('myMessages') >= 0) {
|
||||
// 获取用户消息列表
|
||||
getUserRelevantList('/systemNotify/getUserNotifys', 'myMessages', 1, {
|
||||
ids: $('#userId').val()
|
||||
})
|
||||
} else if (targetId.indexOf('home') >= 0) {
|
||||
getUserRelevantList('/content/getUserContents', 'myContents', 1, {
|
||||
userId: $('#userId').val(),
|
||||
listState: 'all'
|
||||
})
|
||||
} else if (targetId.indexOf('myJoinTopics') >= 0) {
|
||||
getUserRelevantList('/contentMessage/getMessages', 'myJoinTopics', 1, {
|
||||
userId: $('#userId').val()
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
// 获取用户投稿列表
|
||||
getUserRelevantList('/content/getUserContents', 'myContents', 1, {
|
||||
userId: $('#userId').val(),
|
||||
listState: 'all'
|
||||
});
|
||||
</script>
|
@ -3,17 +3,17 @@
|
||||
<h2 class="pannel-title">{{__('lc_new_document')}}</h2>
|
||||
<div class="content-list">
|
||||
<ul class="row">
|
||||
{% remote key="newItemList",api="content/getList",query='{"model":"1","pageSize":10,"isPaging":"0"}' %}
|
||||
{% news key="newItemList","pageSize"=10 %}
|
||||
{% if newItemList.length > 0 %} {% for item in newItemList %}
|
||||
<li class="list-img">
|
||||
<div class="row">
|
||||
<div class="col-md-5 ">
|
||||
<a href="/details/{{item._id}}.html" class="contentImg">
|
||||
<a href="{{item.url}}" class="contentImg">
|
||||
<img src="{{item.sImg}}" alt="{{item.title}}">
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<a href="/details/{{item._id}}.html" target="_blank" class="title">
|
||||
<a href="{{item.url}}" target="_blank" class="title">
|
||||
{{item.stitle | cutwords(80)}}
|
||||
</a>
|
||||
<span class="date">{{item.date | formatDateForMini('date')}}</span>
|
||||
|
@ -20,7 +20,7 @@
|
||||
<p>{{item.content | cutwords(100,false)}}</p>
|
||||
</div>
|
||||
<p class="comment-post">
|
||||
<a href="/details/{{item.contentId._id}}.html"
|
||||
<a href="{{item.contentId.url}}"
|
||||
class="title">{{item.contentId.title | cutwords(50,false)}}</a>
|
||||
</p>
|
||||
</li>
|
||||
|
@ -1,15 +1,15 @@
|
||||
<!--分页模块-->
|
||||
<div class="pagenation text-center">
|
||||
<ul>
|
||||
{% if documentList.pageInfo.totalItems > 0 %}
|
||||
{% if pageInfo.totalItems > 0 %}
|
||||
{% set localUrl = "" %}
|
||||
{% set param = "" %}
|
||||
{% set pageInfo = documentList.pageInfo %}
|
||||
{% set pageInfo = pageInfo %}
|
||||
|
||||
{% if pageType == 'index' %}
|
||||
{% set localUrl = "/page" %}
|
||||
{% elif pageType == 'cate' %}
|
||||
{% set localUrl = '/'+ cateInfo.defaultUrl + '___' + cateInfo._id %}
|
||||
{% set localUrl = cateInfo.url %}
|
||||
{% elif pageType == 'search' %}
|
||||
{% set param = '?searchKey=' + pageInfo.searchkey %}
|
||||
{% set localUrl = '/search/' + pageInfo.searchkey %}
|
||||
|
@ -1,18 +1,18 @@
|
||||
<!--文章推荐模块-->
|
||||
{% remote key="randomList",api="content/getRadomContents",query='{"pageSize":6,"isPaging":"0"}' %}
|
||||
{% random "pageSize"=6 %}
|
||||
<div class="pannel-box random-content-list">
|
||||
<h2 class="pannel-title">{{__('lc_random_document')}}</h2>
|
||||
<div class="content-list">
|
||||
<div class="row random-articls">
|
||||
{% if randomList.length > 0 %} {% for item in randomList %}
|
||||
{% if random.length > 0 %} {% for item in random %}
|
||||
<div class="col-xs-6 col-md-4">
|
||||
<div class="contentImg">
|
||||
<a href="/details/{{item._id}}.html">
|
||||
<a href="{{item.url}}">
|
||||
<img src="{{item.sImg}}" alt="{{item.title}}" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="title">
|
||||
<a href="/details/{{item._id}}.html" target="_blank">
|
||||
<a href="{{item.url}}" target="_blank">
|
||||
{{item.stitle | cutwords(50)}}
|
||||
</a>
|
||||
</div>
|
||||
|
@ -1,17 +1,17 @@
|
||||
<!--文章推荐模块-->
|
||||
{% remote key="reCommendList",api="content/getList",query='{"model":"1","pageSize":10,"isPaging":"0"}' %}
|
||||
{% if reCommendList.length > 0 %}
|
||||
{% recommend pageSize=10 %}
|
||||
{% if recommend.length > 0 %}
|
||||
<div class="pannel-box rec-content-list">
|
||||
<h2 class="pannel-title">{{__('lc_rec_document')}}</h2>
|
||||
<div class="content-list">
|
||||
<div class="row">
|
||||
{% for item in reCommendList %}
|
||||
{% for item in recommend %}
|
||||
|
||||
<div class="col-md-6 list-img">
|
||||
<a href="/details/{{item._id}}.html" class="continue-reading">
|
||||
<a href="{{item.url}}" class="continue-reading">
|
||||
<img src="{{item.sImg}}" alt="{{item.title}}">
|
||||
</a>
|
||||
<a href="/details/{{item._id}}.html" target="_blank" class="title">
|
||||
<a href="{{item.url}}" target="_blank" class="title">
|
||||
{{item.stitle | cutwords(40)}}
|
||||
</a>
|
||||
</div>
|
||||
|
@ -8,22 +8,24 @@ item为子元素集合
|
||||
<span>{{__('lc_new_document')}}
|
||||
<span>
|
||||
</h3>
|
||||
{% endif %} {% for item in documentList.docs %}
|
||||
{% endif %} {% for item in posts %}
|
||||
<article class="post">
|
||||
<div class="row">
|
||||
<div class="col-xs-5 col-md-4">
|
||||
{% if item.categories %} {% if item.categories.length > 1 %}
|
||||
<a target="_blank" class="item-category" href="{{'/'+(item.categories)[item.categories.length-1].defaultUrl+ '___'+(item.categories)[item.categories.length-1]._id}}">{{(item.categories)[item.categories.length-1].name}}</a>
|
||||
<a target="_blank" class="item-category"
|
||||
href="{{(item.categories)[item.categories.length-1].url}}">{{(item.categories)[item.categories.length-1].name}}</a>
|
||||
{% elif item.categories == 1 %}
|
||||
<a target="_blank" class="item-category" href="{{'/'+(item.categories)[0].defaultUrl+ '___'+(item.categories)[0]._id}}">{{(item.categories)[0].name}}</a>
|
||||
<a target="_blank" class="item-category"
|
||||
href="{{(item.categories)[0].url}}">{{(item.categories)[0].name}}</a>
|
||||
{% endif%} {% endif%}
|
||||
<a href="/details/{{item._id}}.html " target="_blank " class="contentImg ">
|
||||
<a href="{{item.url}} " target="_blank " class="contentImg ">
|
||||
<img src="{{item.sImg}} " class="img-responsive " alt="{{item.title}} " />
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-xs-7 col-md-8 discription ">
|
||||
<h2 class="post-title" alt="{{siteInfo.altkey}}{{item.title}}">
|
||||
<a href="/details/{{item._id}}.html " target="_blank ">
|
||||
<h2 class="post-title" alt="{{site.altkey}}{{item.title}}">
|
||||
<a href="{{item.url}} " target="_blank ">
|
||||
{{item.title}}
|
||||
</a>
|
||||
</h2>
|
||||
@ -31,7 +33,8 @@ item为子元素集合
|
||||
{{item.discription | cutwords(100)}}
|
||||
</div>
|
||||
<ul class="post-meta ">
|
||||
{% if item.author %} {% set renderAuthor = item.author %} {% else %} {% set renderAuthor = item.uAuthor %} {% endif %}
|
||||
{% if item.author %} {% set renderAuthor = item.author %} {% else %}
|
||||
{% set renderAuthor = item.uAuthor %} {% endif %}
|
||||
<li class="author">
|
||||
<a class="logo">
|
||||
<img src="{{ renderAuthor.logo}}" alt="{{renderAuthor.userName}}">
|
||||
|
@ -1,28 +0,0 @@
|
||||
<!--用户中心右侧菜单-->
|
||||
<div class="user-left-menu" ms-controller="user-nav">
|
||||
<div class="user-logo">
|
||||
<div class="logo">
|
||||
<img src="{{ userInfo.logo}}" alt="">
|
||||
</div>
|
||||
<span>{{userInfo.userName}}</span>
|
||||
</div>
|
||||
<ul class="user-menu-options">
|
||||
<li :class="[@currentPath.indexOf('userCenter')>0 && 'active']">
|
||||
<a href="/users/userCenter">
|
||||
<span class="fa fa-user"></span>
|
||||
<span class="label">{{__('lc_basic_userInfo')}}</span>
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li :class="[@currentPath.indexOf('setUserPsd')>0 && 'active']">
|
||||
<a href="/users/setUserPsd">
|
||||
<span class="fa fa-asterisk"></span>
|
||||
<span class="label">{{__('lc_basic_set_password')}}</span>
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
</script>
|
@ -1,5 +1,5 @@
|
||||
<!-- BEGIN SITEMAP -->
|
||||
{% extends "./public/defaultTemp.html" %} {% block content %}
|
||||
{% extends "./default.html" %} {% block content %}
|
||||
<style>
|
||||
.siteMap {
|
||||
padding: 15px;
|
||||
@ -16,7 +16,7 @@
|
||||
<ol>
|
||||
{% for item in siteMapList %}
|
||||
<li>
|
||||
<a href="/details/{{item._id}}.html">{{item.title}}</a>
|
||||
<a href="{{item.url}}">{{item.title}}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
|
@ -1,21 +0,0 @@
|
||||
<!--用户中心-->
|
||||
{% extends "../public/defaultTemp.html" %} {% block content %}
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12 main-container ">
|
||||
<div class="row user-pannel">
|
||||
<div class="pannel-container clearfix">
|
||||
<div class="col-md-4 right-frame">
|
||||
{% include "../public/userNav.html" %}
|
||||
</div>
|
||||
<div class="col-md-8 left-frame">
|
||||
{% include "../public/uInfo.html" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
@ -1,11 +0,0 @@
|
||||
<!--确认邮箱-->
|
||||
{% extends "../public/defaultTemp.html" %} {% block content %}
|
||||
<div class="container">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-6 col-md-offset-3 alert alert-info" style="margin-top: 30px;">{{__('label_findPwd_top_notice')}}</div>
|
||||
<div class="col-md-4 col-md-offset-4 min-hight" style="margin-top: 50px;">
|
||||
{% include "../public/confirmEmail.html" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
@ -1,21 +0,0 @@
|
||||
<!--我的投稿-->
|
||||
{% extends "../public/defaultTemp.html" %} {% block content %}
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12 main-container ">
|
||||
<div class="row user-contents">
|
||||
<div class="pannel-container clearfix">
|
||||
<div class="col-md-8 left-frame">
|
||||
{% include "../public/myContents.html" %}
|
||||
</div>
|
||||
<div class="col-md-4 right-frame">
|
||||
{% include "../public/newItemList.html" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
@ -1,9 +0,0 @@
|
||||
{% extends "../public/defaultTemp.html" %} {% block content %}
|
||||
<div class="container-fluid user-container">
|
||||
<div class="col-md-12 main-container login-main">
|
||||
<div class="" style="margin-top: 50px;">
|
||||
{% include "../public/login.html" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
@ -1,10 +0,0 @@
|
||||
<!--用户注册-->
|
||||
{% extends "../public/defaultTemp.html" %} {% block content %}
|
||||
<div class="container-fluid user-container">
|
||||
<div class="col-md-12 login-main">
|
||||
<div class="" style="margin-top: 50px;">
|
||||
{% include "../public/reg.html" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
@ -1,22 +0,0 @@
|
||||
<!--用户中心-->
|
||||
{% extends "../public/defaultTemp.html" %} {% block content %}
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12 main-container ">
|
||||
<div class="row user-pannel">
|
||||
<div class="pannel-container clearfix">
|
||||
<div class="col-md-4 right-frame">
|
||||
{% include "../public/userNav.html" %}
|
||||
</div>
|
||||
<div class="col-md-8 left-frame">
|
||||
{% include "../public/setPsd.html" %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user