ecshop后台新订单提示音播放的代码在哪

2016-07-07 15:00 来源:www.chinab4c.com 作者:ecshop专家

我也在寻找找到告诉你共享下

回答:
我也想知道,还有留言的声音是在哪里控制播放的呢?

我也找,找到了说下哦。



在admin/templates/大部分htm主页的底部

  1. onload = function()
  2. {
  3. // 开始检查订单
  4. startCheckOrder();
  5. }
复制代码


同时在pagefooter.htm中有

  1. {if $enable_order_check eq '0'}
  2. startCheckOrder = function(){}
  3. {/if}
复制代码

保证了
当关闭订单提醒时不弹出相应的提示

startCheckOrder 的定义在admin/common.js中
  1. /* *
  2. * 开始检查新订单;
  3. */
  4. function startCheckOrder()
  5. {
  6. checkOrder()
  7. window.setInterval("checkOrder()", NEW_ORDER_INTERVAL);
  8. }

  9. /*
  10. * 检查订单
  11. */
  12. function checkOrder()
  13. {
  14. var lastCheckOrder = new Date(document.getCookie('ECS_LastCheckOrder'));
  15. var today = new Date();

  16. if (lastCheckOrder == null || today-lastCheckOrder >= NEW_ORDER_INTERVAL)
  17. {
  18. document.setCookie('ECS_LastCheckOrder', today.toGMTString());

  19. try
  20. {
  21. Ajax.call('index.php?is_ajax=1&act=check_order','', checkOrderResp**e, 'GET', 'JSON');
  22. }
  23. catch (e) { }
  24. }
  25. }

  26. /* *
  27. * 处理检查订单的反馈信息
  28. */
  29. function checkOrderResp**e(result)
  30. {
  31. //出错屏蔽
  32. if (result.error != 0 || (result.new_orders == 0 && result.new_paid == 0))
  33. {
  34. return;
  35. }
  36. try
  37. {
  38. document.getElementById('spanNewOrder').innerHTML = result.new_orders;
  39. document.getElementById('spanNewPaid').innerHTML = result.new_paid;
  40. Message.show();
  41. }
  42. catch (e) { }
  43. }
复制代码


如上代码如果有订单就调用了

Message.show();

而Message:
  1. /*
  2. * 气泡式提示信息
  3. */
  4. var Message = Object();

  5. Message.bottom = 0;
  6. Message.count = 0;
  7. Message.elem = "popMsg";
  8. Message.mvTimer = null;

  9. Message.show = function()
  10. {
  11. try
  12. {
  13. Message.controlSound('msgBeep');
  14. document.getElementById(Message.elem).style.visibility = "visible"
  15. document.getElementById(Message.elem).style.display = "block"

  16. Message.bottom = 0 - parseInt(document.getElementById(Message.elem).offsetHeight);
  17. Message.mvTimer = window.setInterval("Message.move()", 10);

  18. document.getElementById(Message.elem).style.bottom = Message.bottom + "px";
  19. }
  20. catch (e)
  21. {
  22. alert(e);
  23. }
  24. }

  25. Message.move = function()
  26. {
  27. try
  28. {
  29. if (Message.bottom == 0)
  30. {
  31. window.clearInterval(Message.mvTimer)
  32. Message.mvTimer = window.setInterval("Message.close()", 10000)
  33. }

  34. Message.bottom ++ ;
  35. document.getElementById(Message.elem).style.bottom = Message.bottom + "px";
  36. }
  37. catch (e)
  38. {
  39. alert(e);
  40. }
  41. }

  42. Message.close = function()
  43. {
  44. document.getElementById(Message.elem).style.visibility = 'hidden';
  45. document.getElementById(Message.elem).style.display = 'none';
  46. if (Message.mvTimer) window.clearInterval(Message.mvTimer)
  47. }

  48. Message.controlSound = function(_sndObj)
  49. {
  50. sndObj = document.getElementById(_sndObj);

  51. try
  52. {
  53. sndObj.Play();
  54. }
  55. catch (e) { }
  56. }
复制代码

够清楚了吧

谢谢楼上的共享 !!