camera.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template name="camera">
  2. <view>
  3. <scroll-view>
  4. <!-- 综合报表 -->
  5. <view class="cu-bar bg-white solid-bottom" :style="[{animation: 'show 0.6s 1'}]">
  6. <view class="action">
  7. <text class='cuIcon-title text-yellow'></text>综合报表
  8. </view>
  9. </view>
  10. <!-- 通风设备 -->
  11. <view class="cu-bar bg-white solid-bottom margin-top" :style="[{animation: 'show 0.5s 1'}]">
  12. <view class="action">
  13. <text class='cuIcon-title text-blue'></text>通风设备
  14. </view>
  15. </view>
  16. <!-- 防灭火设备 -->
  17. <view class="cu-bar bg-white solid-bottom margin-top" :style="[{animation: 'show 0.6s 1'}]">
  18. <view class="action">
  19. <text class='cuIcon-title text-yellow'></text>防灭火设备
  20. </view>
  21. </view>
  22. <!-- 防尘设备 -->
  23. <view class="cu-bar bg-white solid-bottom margin-top" :style="[{animation: 'show 0.6s 1'}]">
  24. <view class="action">
  25. <text class='cuIcon-title text-yellow'></text>防尘设备
  26. </view>
  27. </view>
  28. </scroll-view>
  29. <view class="cu-tabbar-height margin-top"></view>
  30. </view>
  31. </template>
  32. <script>
  33. import { us,os } from '@/common/util/work.js'
  34. import socket from '@/common/js-sdk/socket/socket.js'
  35. export default {
  36. name: 'camera',
  37. props:{
  38. cur:String,
  39. },
  40. watch: {
  41. cur: {
  42. immediate: true,
  43. handler:function(val,oldVal){
  44. console.log('cur',val,oldVal)
  45. this.initMenu()
  46. },
  47. },
  48. },
  49. data() {
  50. return {
  51. }
  52. },
  53. methods: {
  54. initMenu(){
  55. console.log("-----------home------------")
  56. this.onSocketOpen()
  57. this.onSocketReceive()
  58. this.loadCount(0);
  59. },
  60. goPage(page){
  61. if(!page){
  62. return false;
  63. }
  64. if(page==='annotationList'){
  65. this.msgCount = 0
  66. }
  67. this.dot[page]=false
  68. this.$Router.push({name: page})
  69. },
  70. // 启动webSocket
  71. onSocketOpen() {
  72. socket.init('websocket');
  73. },
  74. onSocketReceive() {
  75. var _this=this
  76. socket.acceptMessage = function(res){
  77. // console.log("页面收到的消息", res);
  78. if(res.cmd == "topic"){
  79. //系统通知
  80. _this.loadCount('1')
  81. }else if(res.cmd == "user"){
  82. //用户消息
  83. _this.loadCount('2')
  84. } else if(res.cmd == 'email'){
  85. //邮件消息
  86. _this.loadEmailCount()
  87. }
  88. }
  89. },
  90. loadCount(flag){
  91. console.log("loadCount::flag",flag)
  92. let url = '/sys/annountCement/listByUser';
  93. this.$http.get(url).then(res=>{
  94. console.log("res::",res)
  95. if(res.data.success){
  96. let msg1Count = res.data.result.anntMsgTotal;
  97. let msg2Count = res.data.result.sysMsgTotal;
  98. this.msgCount = msg1Count + msg2Count
  99. console.log("this.msgCount",this.msgCount)
  100. }
  101. })
  102. },
  103. loadEmailCount(){
  104. this.dot.mailHome = true
  105. },
  106. getTtemDotInfo(item){
  107. if(item.page==='annotationList' && this.msgCount>0){
  108. return this.msgCount
  109. }
  110. return '';
  111. }
  112. }
  113. }
  114. </script>
  115. <style scoped>
  116. .cu-list.grid>.cu-item {
  117. padding: 0px 0px;
  118. }
  119. .line2-icon {
  120. width: 60px;
  121. height: 60px;
  122. }
  123. </style>