郑许地铁

myindex.js 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. layui.use(['layer', 'element'], function() {
  2. var element = layui.element,
  3. layer = layui.layer; //获得layer模块
  4. var index;
  5. //会话窗口
  6. $('#service').on('click', function() {
  7. index = layer.open({
  8. type: 1,
  9. content: $('.service'),
  10. title: '客服服务',
  11. area: ['800px', '520px'],
  12. anim: 1,
  13. resize: false,
  14. shade: 0
  15. })
  16. //移除小图标
  17. $(this).find('sup').remove();
  18. //移除动画
  19. $(this).find('i').removeClass('layui-anim layui-anim-scaleSpring layui-anim-loop');
  20. })
  21. //关闭会话窗口
  22. $('.closWin').on('click', function() {
  23. layer.close(index);
  24. })
  25. //发送消息
  26. $('.sendNews').on('click', function() {
  27. chatNews();
  28. })
  29. //回车发送
  30. $('.service').keypress(function(event) {
  31. var e = event || window.event;
  32. if(e.keyCode == 13) {
  33. chatNews()
  34. return;
  35. }
  36. })
  37. //聊天信息
  38. function chatNews() {
  39. var txt = $('.layim-chat-textarea textarea').val();
  40. if(txt == '') {
  41. layer.msg('发送内容不能为空!');
  42. } else {
  43. //发送内容
  44. alert(123);
  45. }
  46. }
  47. //通知项
  48. $('#news').on('click',function () {
  49. layer.open({
  50. type:1,
  51. title:'通知公告',
  52. content:$('.newsTips'),
  53. area:['300px', '500px'],
  54. offset :'rb',
  55. anim: 2,
  56. shade:0,
  57. resize:false
  58. })
  59. //移除小图标
  60. $(this).find('sup').remove();
  61. })
  62. //通知项点击打开新的标签页
  63. $('.newsTips .newsBox li').on('click',function () {
  64. var str = $('<a data-url="page/404.html"><cite openid="123">我是通知</cite></a>');
  65. addTab(str);
  66. })
  67. });