您的位置:首页 > 其它

rt_dream01

2020-02-03 01:52 218 查看

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

  • 点赞
  • 收藏
  • 分享
  • 文章举报
dichuzhi7828 发布了0 篇原创文章 · 获赞 0 · 访问量 155 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: