系统通知功能加入。
This commit is contained in:
parent
8ed33979e3
commit
b3a6ba373a
@ -16,6 +16,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{4C2B47
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RwTicketAssistantV2", "RwTicketAssistantV2\RwTicketAssistantV2.csproj", "{9D141603-1A9D-4EEC-82D8-C473EA436839}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mobile12306New", "Mobile12306New\Mobile12306New.csproj", "{4B41EA5E-B7CD-4FC6-B9E3-9AE5222695F6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -34,6 +36,10 @@ Global
|
||||
{9D141603-1A9D-4EEC-82D8-C473EA436839}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9D141603-1A9D-4EEC-82D8-C473EA436839}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9D141603-1A9D-4EEC-82D8-C473EA436839}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4B41EA5E-B7CD-4FC6-B9E3-9AE5222695F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4B41EA5E-B7CD-4FC6-B9E3-9AE5222695F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4B41EA5E-B7CD-4FC6-B9E3-9AE5222695F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4B41EA5E-B7CD-4FC6-B9E3-9AE5222695F6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -218,6 +218,7 @@
|
||||
<Content Include="js\ui\ui-order-submit-process.js" />
|
||||
<Content Include="js\ui\ui-passenger-selection.js" />
|
||||
<Content Include="js\ui\ui-submit-order.js" />
|
||||
<Content Include="js\ui\ui-sysnotice.js" />
|
||||
<Content Include="js\ui\ui-theme-manager.js" />
|
||||
<Content Include="js\ui\ui-train-stop.js" />
|
||||
<Content Include="js\ui\ui-trainlist.js" />
|
||||
@ -238,6 +239,7 @@
|
||||
<Content Include="Web.Release.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
</Content>
|
||||
<Content Include="systemNotice.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
|
@ -78,12 +78,21 @@
|
||||
#chat_container .chat-items .chat-item-private {
|
||||
border-width: 2px;
|
||||
}
|
||||
|
||||
|
||||
#chat_container .chat-items .chat-state-disconnect {
|
||||
background-color: #ffeeee;
|
||||
color: rgb(50, 83, 168);
|
||||
color: rgb(168, 50, 64);
|
||||
}
|
||||
|
||||
#chat_container .chat-items .chat-state-disconnect a {
|
||||
text-decoration: underline;
|
||||
color: #7A7A7A;
|
||||
}
|
||||
|
||||
#chat_container .chat-items .chat-state-disconnect a:hover {
|
||||
color: #444444;
|
||||
}
|
||||
|
||||
#chat_container .chat-item-at {
|
||||
color: inherit;
|
||||
text-decoration: underline;
|
||||
|
@ -121,6 +121,7 @@
|
||||
width: 300px;
|
||||
box-shadow: 5px 5px 10px rgba(110, 110, 110, 0.4);
|
||||
display: none;
|
||||
min-height: 50px;
|
||||
}
|
||||
|
||||
.search-box .search-tips-container:before,
|
||||
|
@ -196,3 +196,7 @@
|
||||
#index-tip-body {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#index-tip-body .order-num {
|
||||
display: none;
|
||||
}
|
@ -45,6 +45,19 @@
|
||||
</nav>
|
||||
</header>
|
||||
<article>
|
||||
<script id="search_tips_template" type="text/x-dot-template">
|
||||
{{~it:s:i}}
|
||||
<header>
|
||||
{{!s.title}}
|
||||
{{?i==0}}
|
||||
<i class="fa fa-times fr"></i>
|
||||
{{?}}
|
||||
</header>
|
||||
<div>
|
||||
{{!s.text}}
|
||||
</div>
|
||||
{{~}}
|
||||
</script>
|
||||
<!-- 搜索输入框 -->
|
||||
<div class="search-box pr">
|
||||
<div class="search-box-l"></div>
|
||||
@ -55,7 +68,7 @@
|
||||
<span class="net-tips">已分配到畅通的网络环境,为你提速80%:乌鲁木齐</span>
|
||||
<span class="reset-btn">还原到默认</span>
|
||||
<span class="order-tips"></span>
|
||||
<span class="icon order-ring fr" id="index-tip-body"><span class="order-num">1</span></span>
|
||||
<span class="icon order-ring fr" id="index-tip-body"><span class="order-num"></span></span>
|
||||
<!--提示-->
|
||||
<section class="search-tips-container">
|
||||
<header>
|
||||
@ -238,10 +251,10 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<i class="fa fa-times"></i>
|
||||
请先设置站点和日期信息,再重新查询。
|
||||
</td>
|
||||
<td colspan="6">
|
||||
<i class="fa fa-times"></i>
|
||||
请先设置站点和日期信息,再重新查询。
|
||||
</td>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<i class="fa fa-times"></i>
|
||||
@ -823,7 +836,7 @@
|
||||
{{~it.list:s:i}}
|
||||
<li data-id="{{!s.id}}" class="chat-server-status-{{!s.status}}">
|
||||
{{!s.name}}
|
||||
{{=s.status=='full'?"<em>(已满)</em>":""}}
|
||||
{{=s.status=='full'?"<em>(已满)</em>":s.status=='close'?"<em>(已关闭)</em>":""}}
|
||||
<span>({{!s.onlinecount}}人)</span>
|
||||
</li>
|
||||
{{~}}
|
||||
@ -846,14 +859,14 @@
|
||||
<script type="text/x-dot-template" id="chat_sys_alert">
|
||||
<section class="chat-item chat-item-alert">
|
||||
<i class="fa fa-exclamation-triangle"></i>
|
||||
您已经进入了 <span>{{!it.name}}</span>,当前在线 {{=it.onlinecount}} 人。请阅读我们的 <a href="">发言规范</a>,请不要出现任何非法信息和倒卖信息,否则您的账号将会被封。
|
||||
您已经进入了 <span>{{!it.name}}</span>,当前在线 <span class="chat-online-count">{{=it.onlinecount}}</span> 人。请阅读我们的 <a href="">发言规范</a>,请不要出现任何非法信息和倒卖信息,否则您的账号将会被封。
|
||||
</section>
|
||||
</script>
|
||||
<script type="text/x-dot-template" id="chat_connect_server">
|
||||
<section class="chat-item chat-state chat-state-{{!it.state}}">
|
||||
<i class="fa {{!it.stateIcon}}"></i>
|
||||
{{!it.msg}}
|
||||
{{=it.exinfo}}
|
||||
{{=it.exinfo||""}}
|
||||
</section>
|
||||
</script>
|
||||
<script type="text/x-dot-template" id="chat_msg_item">
|
||||
|
@ -2,6 +2,9 @@
|
||||
var citydata = require("./station/station_data.js");
|
||||
var utility = require("./utility.js");
|
||||
|
||||
exports.sysNoticeUrl = "/systemNotice.json";
|
||||
exports.sysNoticeLoadInterval = 30 * 60 * 1800;
|
||||
exports.sysNoticeMaxShowCount = 3;
|
||||
|
||||
exports.citydata = citydata;
|
||||
exports.cities = _(_.flatten(_.map(_.values(citydata.data), function (e) { return _.values(e); }))).mapObject(function (e) { return e.c; });;
|
||||
|
@ -36,11 +36,12 @@
|
||||
that.refreshOnlineCount();
|
||||
page.find("button.button-primary").prop("disabled", true);
|
||||
|
||||
port.postMessage("enterChatRoom", room);
|
||||
that.fireEvent("enterRoom");
|
||||
port.postMessage("enterChatRoom", room);
|
||||
};
|
||||
this.refreshOnlineCount = function () {
|
||||
page.find(">header>span:eq(1)").html("当前在线 " + room.onlinecount + " 人");
|
||||
page.find(".chat-online-count").html(room.onlinecount);
|
||||
};
|
||||
this.exitRoom = function () {
|
||||
room = null;
|
||||
@ -66,6 +67,12 @@
|
||||
}
|
||||
port.postMessage("chatRoomSendMsg", data);
|
||||
};
|
||||
this.reconnect = function () {
|
||||
if (!room)
|
||||
return;
|
||||
|
||||
port.postMessage("enterChatRoom", room);
|
||||
};
|
||||
|
||||
Object.defineProperty(this, "room", {
|
||||
get: function () {
|
||||
@ -110,6 +117,8 @@
|
||||
if (!room)
|
||||
return;
|
||||
room.onlinecount = this.detail.count;
|
||||
//更新显示
|
||||
that.refreshOnlineCount();
|
||||
});
|
||||
|
||||
return this;
|
||||
@ -189,6 +198,8 @@
|
||||
$(document).on("click", "a.chat-item-at", function () {
|
||||
var un = this.dataset.un;
|
||||
var name = this.innerHTML;
|
||||
if (!un)
|
||||
return;
|
||||
|
||||
var html = "<span class='chat-editor-at' contenteditable='false' data-un='" + un + "'>@" + name + "</span> ";
|
||||
editorArea.append(html);
|
||||
@ -201,6 +212,10 @@
|
||||
selection.addRange(range);
|
||||
editorArea[0].focus();
|
||||
});
|
||||
$(document).on("click", "a.chat-frame-reconnect", function() {
|
||||
$(".chat-item").remove();
|
||||
session.reconnect();
|
||||
});
|
||||
})();
|
||||
|
||||
return {
|
||||
|
@ -45,6 +45,9 @@
|
||||
//模式管理
|
||||
require("./ui-theme-manager.js");
|
||||
|
||||
//系统公告
|
||||
require("./ui-sysnotice.js");
|
||||
|
||||
//用户配置和选项的加载以及保存
|
||||
require("../platform/profileBinder.js");
|
||||
require("../platform/optionBinder.js");
|
||||
@ -117,12 +120,6 @@
|
||||
}
|
||||
checkbox.eq(0).change();
|
||||
});
|
||||
$("#index-tip-body").click(function () {
|
||||
$(this).next().fadeIn();
|
||||
});
|
||||
$("section.search-tips-container i.fa-times").click(function () {
|
||||
$(this).closest("section.search-tips-container").fadeOut();
|
||||
});
|
||||
//登录失效
|
||||
sessMgr.on("userForcedOut", function () {
|
||||
mp.showMessagePopup("error", "您的登录出现了问题,请重新登录");
|
||||
|
70
Web12306/js/ui/ui-sysnotice.js
Normal file
70
Web12306/js/ui/ui-sysnotice.js
Normal file
@ -0,0 +1,70 @@
|
||||
define(function (require, exports, module) {
|
||||
var data = require("../data.js");
|
||||
var utility = require("../utility.js");
|
||||
var storage = require("../platform/storage.js");
|
||||
var loadUrl = data.sysNoticeUrl;
|
||||
var savedNotice = JSON.parse(storage.get("systemNotice") || "{}");
|
||||
var unreadNotice = null;
|
||||
var noticeTemplate = $("#search_tips_template").doT();
|
||||
|
||||
var loadSystemNotice = function () {
|
||||
$.get(loadUrl).done(function (json) {
|
||||
json.lastLoad = new Date().getTime();
|
||||
if (savedNotice.lastReadId) {
|
||||
var takeCounter = 0;
|
||||
json.items = _.filter(json.items, function (i) {
|
||||
return !savedNotice.lastReadId || savedNotice.lastReadId < i.id || (takeCounter++ < data.sysNoticeMaxShowCount);
|
||||
});
|
||||
json.lastReadId = savedNotice.lastReadId;
|
||||
}
|
||||
savedNotice = json;
|
||||
unreadNotice = _.filter(savedNotice.items, function (s) {
|
||||
return !savedNotice.lastReadId || savedNotice.lastReadId < s.id;
|
||||
});
|
||||
renderUnreadNotice();
|
||||
storage.put("systemNotice", savedNotice);
|
||||
|
||||
//定时器
|
||||
setTimeout(loadSystemNotice, data.sysNoticeLoadInterval);
|
||||
});
|
||||
};
|
||||
|
||||
var renderUnreadNotice = function () {
|
||||
if (unreadNotice && unreadNotice.length) {
|
||||
$(".search-tips-container").html(noticeTemplate(unreadNotice));
|
||||
$("#index-tip-body").find(".order-num").html(unreadNotice.length).show();
|
||||
} else {
|
||||
$("#index-tip-body").find(".order-num").html(0).hide();
|
||||
//取最新的几条通知
|
||||
var shownNotice = _.first(savedNotice.items, data.sysNoticeMaxShowCount);
|
||||
$(".search-tips-container").html(noticeTemplate(shownNotice));
|
||||
}
|
||||
};
|
||||
|
||||
var resetUnreadItems = function () {
|
||||
unreadNotice = null;
|
||||
renderUnreadNotice();
|
||||
};
|
||||
|
||||
//是否需要立刻刷新通知?
|
||||
if (!savedNotice.lastLoad || (new Date().getTime() - savedNotice.lastLoad) > 1000 * 60 * 30) {
|
||||
loadSystemNotice();
|
||||
} else {
|
||||
unreadNotice = _.filter(savedNotice.items, function (s) {
|
||||
return savedNotice.lastReadId < s.id;
|
||||
});
|
||||
renderUnreadNotice();
|
||||
var nextTime = Math.min(savedNotice.lastLoad ? new Date() - savedNotice.lastLoad : data.sysNoticeLoadInterval, data.sysNoticeLoadInterval);
|
||||
setTimeout(loadSystemNotice, nextTime);
|
||||
}
|
||||
|
||||
$("#index-tip-body").click(function () {
|
||||
$(this).next().fadeIn();
|
||||
});
|
||||
$(document).on("click", "section.search-tips-container i.fa-times", function () {
|
||||
$(this).closest("section.search-tips-container").fadeOut();
|
||||
savedNotice.lastReadId = savedNotice.items[0].id;
|
||||
resetUnreadItems();
|
||||
});
|
||||
|
||||
});
|
13
Web12306/systemNotice.json
Normal file
13
Web12306/systemNotice.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"defaultText": "欢迎使用订票助手",
|
||||
"items": [
|
||||
{
|
||||
"id": 5,
|
||||
"title": "欢迎使用",
|
||||
"text": "欢迎使用订票助手。祝您旅途顺利。",
|
||||
"pubTime": "2014-08-19",
|
||||
"expiresTime": 1409048829425,
|
||||
"important": false
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user