rt_dream01
10.15
当出入金值发生变化时给全局添加声音
cs界面
//在数据库中取出最后一个出入金的值
public partial class api_info_check_new_cashrecord : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Ari.Fi.CashRecord[] rows = Ari.Fi.CashRecord.LoadAll("TOP 1", "ORDER BY ID DESC");
if (rows.Length > 0)
{
top_cashrecord_id = rows[0].ID;
}
}
}
aspx界面
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="check-new-cashrecord.aspx.cs" Inherits="api_info_check_new_cashrecord" %>
<%= top_cashrecord_id %>
//查看最后一个出入金id是否变换,如果改变了就发出声音
+ <audio src="/ui/4082.wav" preload id="new-cashrecord-alert"></audio>
<% if (Ari.Sys.StaffRole.CheckPoint(this.sessionuser, Protocol.Auth.Privilege.Enums.Fi_Cash_WithdrawApprove)) { %>
setInterval(function () {
$.get('/api/info/check-new-cashrecord', function (data) {
+ var top_cashrecord_id = data.trim();
+ var local_id = localStorage.getItem("top_cashrecord_id");
+
+ if (!local_id)//false,local_id为string,加“!”后变为false
+ localStorage.setItem("top_cashrecord_id", top_cashrecord_id);
+ else
+ if (local_id != top_cashrecord_id){
+ $('#new-cashrecord-alert')[0].play();
+ localStorage.setItem("top_cashrecord_id", top_cashrecord_id);
+ }
});
}, 5000);
<% } %>
1
localStorage.setItem("top_cashrecord_id", top_cashrecord_id)//设置top_cashrecord_id的值
localStorage.getItem("top_cashrecord_id")//获取top_cashrecord_id的值
以键值对的方式存储,存储的类型为string类型
2
localStorage - 没有时间限制的数据存储
sessionStorage - 针对一个 session 的数据存储
转载于:https://www.cnblogs.com/lv-sally/p/4894527.html
- 点赞
- 收藏
- 分享
- 文章举报
- rt_dream01
- RT-Thread Nano实战2-msh配置与运行
- RT-Thread初探
- RT-Thread_manual 学习笔记(二)--线程调度与管理
- RT-Thread 验证 线程相同优先级时间片轮转调度例程
- 【RT-Thread 笔记】——使用消息队列发送不定长数据
- RTThread中falut定位方法
- RT-thread 线程状态切换函数
- 调整rt-linux的进程调度方式为实时调度
- com.intellij.rt.debugger.agent.CaptureAgent
- 吞吐量(TPS)、QPS、并发数、响应时间(RT)
- rt.jar ,dt.jar ,tool.jar都是 做什么用的 ,分别什么时候需要设置到classpath里?
- PCI标准及其应用的现状分析 (RT)
- 玩聚RT 受到 Twitter Search 的影响无法自动更新
- RedHat AS4性能优化(RT)
- jstlCore与Core_rt的异常
- 基于RT-Linux机器人控制系统实时性的研究
- webaprt在SPD设计视图下呈现
- 基于 Eclipse + CodeSourcery 的 RT-Thread 开发环境