feat(core): show new examination notice message at top of home

This commit is contained in:
OldHawk
2018-01-28 21:21:28 +08:00
parent 8cc5158c10
commit 20bbcd8e12
7 changed files with 144 additions and 35 deletions

View File

@@ -866,12 +866,17 @@ module.exports = {
*
* Global torrent sales settings
*
* @global: global sale settings
* @value: number value of @torrentSalesType, like 'U2/Free' etc, this value priority torrent @torrentSalesType
* @vip: vip sale settings
* @value: upload and download ratio
* @Ur: upload ratio, like 1.25 is upload scaling plus 25%
* @Dr: download ratio
* @global: global sale settings
* @value: number value of @torrentSalesType, like 'U2/Free' etc, this value priority torrent @torrentSalesType
* @startAt: sale start time
* @expires: sale expires time
* @noticeMsg: notice translate string show at top of home
* @noticeShowAt: notice begin time to show
* @timeFormats: time string format
* @vip: vip sale settings
* @value: upload and download ratio
* @Ur: upload ratio, like 1.5 is upload scaling plus 50%
* @Dr: download ratio
*/
torrentGlobalSales: {
global: {
@@ -887,6 +892,43 @@ module.exports = {
}
},
/**
* @examination
*
* examination system settings
*
* @incrementData: examination requirements data settings
* @upload: increment uploaded data size
* @download: increment downloaded data size
* @score: increment score number
* @timeSet: examination time settings
* @startAt: examination start time
* @endAt: examination end time
* @noticeMsg: notice translate string show at top of home
* @noticeShowAt: notice begin time to show
* @timeFormats: time string format
*
* ------------------------------------------------------------------------------
* !IMPORTANT NOTE:
* IF YOU START A NEW EXAMINATION, PLEASE SETTING THESE CONFIGURE ITEMS,
* AND INIT ALL USER ACCOUNT`S EXAMINATION INFO BEFORE THE EXAMINATION STARTING
* ------------------------------------------------------------------------------
*/
examination: {
incrementData: {
upload: 1024 * 1024 * 1024 * 500, //500G
download: 1024 * 1024 * 1024 * 300, //300G
score: 20000
},
timeSet: {
startAt: '2018-02-01 00:00:00',
endAt: '2018-03-01 00:00:00',
noticeMsg: 'SITE_NOTICE.EXAMINATION_NOTICE',
noticeShowAt: '2018-01-28 00:00:00',
timeFormats: 'YYYY-MM-DD HH:mm:ss'
}
},
/**
* @chat
*

View File

@@ -1563,7 +1563,8 @@
},
SITE_NOTICE: {
GLOBAL_SALES_NOTICE: '### IMPORTANT NOTICE: \n :radio: **Happy new year 2018**, **{{site_name}}** global sale is coming, sales value is <span class="sale_key">**{{sale_value}}**</span>, sales start at **{{sale_start_at | date: "yyyy-MM-dd HH:mm"}}** and continued <span class="sale_key">**{{sale_days}}**</span> days and end at **{{sale_end_at | date: "yyyy-MM-dd HH:mm"}}**, Thank you for all the help and support you have been giving us all the time!'
GLOBAL_SALES_NOTICE: '### IMPORTANT NOTICE: \n :radio: **Happy new year 2018**, **{{site_name}}** global sale is coming, sales value is <span class="sale_key">**{{sale_value}}**</span>, sales start at **{{sale_start_at | date: "yyyy-MM-dd HH:mm"}}** and continued <span class="sale_key">**{{sale_days}}**</span> days and end at **{{sale_end_at | date: "yyyy-MM-dd HH:mm"}}**, Thank you for all the help and support you have been giving us all the time!',
EXAMINATION_NOTICE: '### IMPORTANT NOTICE: \n :radio: **{{site_name}}** will take a new incremental examination from **{{examination_start_at | date: "yyyy-MM-dd HH:mm"}}** to **{{examination_end_at | date: "yyyy-MM-dd HH:mm"}}**, Incremental data requirements: upload **{{data_upload | bytes:2}}**, download **{{data_download | bytes:2}}**, score **{{data_score}}**, Please arrange your own time and hope to pass the exam smoothly. All VIP users are exempt from this examination, The unfinished user account will be banned.'
}
};

View File

@@ -1563,7 +1563,8 @@
},
SITE_NOTICE: {
GLOBAL_SALES_NOTICE: '### 重要通知! \n :radio: **新年快乐 2018**, **{{site_name}}** 新年促销活动已准备就绪, 促销活动类型为 <span class="sale_key">**{{sale_value}}**</span> , 活动将开始于 **{{sale_start_at | date: "yyyy-MM-dd HH:mm"}}** 并持续 <span class="sale_key">**{{sale_days}}**</span> 天, 结束于 **{{sale_end_at | date: "yyyy-MM-dd HH:mm"}}**, 并感谢所有会员用户一直以来给予我们的帮助与支持!'
GLOBAL_SALES_NOTICE: '### 重要通知! \n :radio: **新年快乐 2018**, **{{site_name}}** 新年促销活动已准备就绪, 促销活动类型为 <span class="sale_key">**{{sale_value}}**</span> , 活动将开始于 **{{sale_start_at | date: "yyyy-MM-dd HH:mm"}}** 并持续 <span class="sale_key">**{{sale_days}}**</span> 天, 结束于 **{{sale_end_at | date: "yyyy-MM-dd HH:mm"}}**, 并感谢所有会员用户一直以来给予我们的帮助与支持!',
EXAMINATION_NOTICE: '### 重要通知!: \n :radio: **{{site_name}}** 将从 **{{examination_start_at | date: "yyyy-MM-dd HH:mm"}}** 到 **{{examination_end_at | date: "yyyy-MM-dd HH:mm"}}** 进行一次新的增量考试, 增量数据要求: 上传 **{{data_upload | bytes:2}}**, 下载 **{{data_download | bytes:2}}**, 积分 **{{data_score}}**, 请各位会员安排好自已的时间,并祝您顺利通过这次考试. 所有vip用户可免于此次考试, 考试未达标的用户帐号将会被禁止.'
}
};

View File

@@ -16,6 +16,7 @@
vm.appConfig = MeanTorrentConfig.meanTorrentConfig.app;
vm.TGI = TorrentGetInfoServices;
vm.globalSalesConfig = MeanTorrentConfig.meanTorrentConfig.torrentGlobalSales;
vm.examinationConfig = MeanTorrentConfig.meanTorrentConfig.examination;
vm.forumsConfig = MeanTorrentConfig.meanTorrentConfig.forumsConfig;
vm.itemsPerPageConfig = MeanTorrentConfig.meanTorrentConfig.itemsPerPage;
@@ -107,6 +108,53 @@
}, 1000);
};
/**
* getExaminationNoticeMessage
* @returns {*}
*/
vm.getExaminationNoticeMessage = function () {
var start = moment(vm.examinationConfig.timeSet.startAt, vm.examinationConfig.timeSet.timeFormats).valueOf();
var end = moment(vm.examinationConfig.timeSet.endAt, vm.examinationConfig.timeSet.timeFormats).valueOf();
var ts = $translate.instant('SITE_NOTICE.EXAMINATION_NOTICE', {
site_name: vm.appConfig.name,
examination_start_at: start,
examination_end_at: end,
data_upload: vm.examinationConfig.incrementData.upload,
data_download: vm.examinationConfig.incrementData.download,
data_score: vm.examinationConfig.incrementData.score
});
return marked(ts, {sanitize: false});
};
/**
* showExaminationNotice
* @returns {boolean}
*/
vm.showExaminationNotice = function () {
var showat = moment(vm.examinationConfig.timeSet.noticeShowAt, vm.examinationConfig.timeSet.timeFormats).valueOf();
var start = moment(vm.examinationConfig.timeSet.startAt, vm.examinationConfig.timeSet.timeFormats).valueOf();
var now = Date.now();
if (now > showat && now < start) {
return true;
} else {
return false;
}
};
/**
* openExaminationNotice
*/
vm.openExaminationNotice = function () {
var e = $('.examination_notice');
$timeout(function () {
e.slideDown(800);
e.removeClass('panel-collapsed');
}, 1000);
};
/**
* onCloseNoticeClicked
* @param cls

View File

@@ -1,5 +1,38 @@
@import (reference) "../../../core/client/less/mt-var.less";
.home_notice {
padding-top: 20px;
.alert {
position: relative;
}
h3, .h3 {
margin-top: 10px;
}
p {
font-size: 16px;
}
.sale_key {
color: @brand-danger;
}
.fa-close {
position: absolute;
top: 20px;
right: 20px;
cursor: pointer;
color: #888;
&:hover {
color: @brand-danger;
}
}
}
.sales_notice {
background-color: @brand-success;
}
.examination_notice {
background-color: @brand-danger;
}
.home-help, .home-notice, .home-new-topic, .home-new-torrents {
margin: 20px 0;
color: #4d4e53;

View File

@@ -1834,32 +1834,6 @@ body {
word-break: break-all;
}
.sales_notice {
background-color: @brand-success;
padding-top: 20px;
.alert {
position: relative;
}
h3, .h3 {
margin-top: 10px;
}
p {
font-size: 16px;
}
.sale_key {
color: @brand-danger;
}
.fa-close {
position: absolute;
top: 20px;
right: 20px;
cursor: pointer;
&:hover {
color: @brand-danger;
}
}
}
//popup overlay----------------------------------------------
/* csslint ignore:start */
.warning_popup {

View File

@@ -1,5 +1,5 @@
<section ng-controller="HomeController as vm">
<div class="sales_notice panel-collapsed" ng-if="vm.showSaleNotice()" ng-init="vm.openSalesNotice()" style="display: none;">
<div class="home_notice sales_notice panel-collapsed" ng-if="vm.showSaleNotice()" ng-init="vm.openSalesNotice()" style="display: none;">
<div class="container">
<div class="alert alert-success" role="alert" style="padding: 20px 50px;">
<span ng-bind-html="vm.getSaleNoticeMessage();"></span>
@@ -9,6 +9,16 @@
</div>
</div>
<div class="home_notice examination_notice panel-collapsed" ng-if="vm.showExaminationNotice()" ng-init="vm.openExaminationNotice()" style="display: none;">
<div class="container">
<div class="alert alert-danger" role="alert" style="padding: 20px 50px;">
<span ng-bind-html="vm.getExaminationNoticeMessage();"></span>
<i class="fa fa-close" aria-hidden="true" ng-click="vm.onCloseNoticeClicked('examination_notice');">
</i>
</div>
</div>
</div>
<div class="home_global_search" ng-init="vm.getForumList()">
<div class="search-panel pagetop">
<div class="container">