history.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template name="history">
  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. <view class="cu-list grid col-4 text-sm">
  11. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.1 + 's'}]" v-for="(item,index) in osList" :key="index" @tap="goPage(item.page)">
  12. <view class="padding text-center">
  13. <image :src="item.icon" style="width:28px;height:28px;"/>
  14. <view class="margin-top-xs">{{item.title}}</view>
  15. </view>
  16. </view>
  17. </view>
  18. <!-- 通风设备 -->
  19. <view class="cu-bar bg-white solid-bottom margin-top" :style="[{animation: 'show 0.5s 1'}]">
  20. <view class="action">
  21. <text class='cuIcon-title text-blue'></text>通风设备
  22. </view>
  23. </view>
  24. <view class="cu-list grid col-4 text-sm">
  25. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.05 + 's'}]" v-for="(item,index) in usList" :key="index" @tap="goPage(item.page)">
  26. <view class="padding text-center">
  27. <image :src="item.icon" style="width:28px;height:28px;">
  28. <view class="cu-tag badge margin-top-sm" style="margin-left:1.2em" v-if="getTtemDotInfo(item)">
  29. <block v-if="getTtemDotInfo(item)">{{getTtemDotInfo(item)}}</block>
  30. </view>
  31. </image>
  32. <view class="margin-top-xs">{{item.title}}</view>
  33. </view>
  34. </view>
  35. </view>
  36. <!-- 防灭火设备 -->
  37. <view class="cu-bar bg-white solid-bottom margin-top" :style="[{animation: 'show 0.6s 1'}]">
  38. <view class="action">
  39. <text class='cuIcon-title text-yellow'></text>防灭火设备
  40. </view>
  41. </view>
  42. <view class="cu-list grid col-4 text-sm">
  43. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.1 + 's'}]" v-for="(item,index) in osList" :key="index" @tap="goPage(item.page)">
  44. <view class="padding text-center">
  45. <image :src="item.icon" style="width:28px;height:28px;"/>
  46. <view class="margin-top-xs">{{item.title}}</view>
  47. </view>
  48. </view>
  49. </view>
  50. <!-- 防尘设备 -->
  51. <view class="cu-bar bg-white solid-bottom margin-top" :style="[{animation: 'show 0.6s 1'}]">
  52. <view class="action">
  53. <text class='cuIcon-title text-yellow'></text>防尘设备
  54. </view>
  55. </view>
  56. <view class="cu-list grid col-4 text-sm">
  57. <view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.1 + 's'}]" v-for="(item,index) in osList" :key="index" @tap="goPage(item.page)">
  58. <view class="padding text-center">
  59. <image :src="item.icon" style="width:28px;height:28px;"/>
  60. <view class="margin-top-xs">{{item.title}}</view>
  61. </view>
  62. </view>
  63. </view>
  64. </scroll-view>
  65. <view class="cu-tabbar-height margin-top"></view>
  66. </view>
  67. </template>
  68. <script>
  69. import { us,os } from '@/common/util/work.js'
  70. import socket from '@/common/js-sdk/socket/socket.js'
  71. export default {
  72. name: 'home',
  73. props:{
  74. cur:String,
  75. },
  76. watch: {
  77. cur: {
  78. immediate: true,
  79. handler:function(val,oldVal){
  80. console.log('cur',val,oldVal)
  81. this.initMenu()
  82. },
  83. },
  84. },
  85. data() {
  86. return {
  87. swiperList: [
  88. {id:1,type: 'image',url: '/static/banner/banner1.png', link: ''},
  89. {id:2,type: 'image',url: '/static/banner/banner2.jpg', link: ''},
  90. {id:3,type: 'image',url: '/static/banner/banner3.jpg', link: ''},
  91. {id:4,type: 'image',url: '/static/banner/banner4.jpg', link: ''},
  92. ],
  93. middleApps: [
  94. {icon: 'line2_icon1.png', title: '审批', 'text': '个人审批'},
  95. {icon: 'line2_icon2.png', title: '审批稿', 'text': '审批草稿箱'},
  96. ],
  97. usList:us.data,
  98. osList:os.data,
  99. msgCount:0,
  100. dot:{
  101. mailHome:false
  102. }
  103. }
  104. },
  105. methods: {
  106. initMenu(){
  107. console.log("-----------home------------")
  108. this.onSocketOpen()
  109. this.onSocketReceive()
  110. this.loadCount(0);
  111. },
  112. goPage(page){
  113. if(!page){
  114. return false;
  115. }
  116. if(page==='annotationList'){
  117. this.msgCount = 0
  118. }
  119. this.dot[page]=false
  120. this.$Router.push({name: page})
  121. },
  122. // 启动webSocket
  123. onSocketOpen() {
  124. socket.init('websocket');
  125. },
  126. onSocketReceive() {
  127. var _this=this
  128. socket.acceptMessage = function(res){
  129. // console.log("页面收到的消息", res);
  130. if(res.cmd == "topic"){
  131. //系统通知
  132. _this.loadCount('1')
  133. }else if(res.cmd == "user"){
  134. //用户消息
  135. _this.loadCount('2')
  136. } else if(res.cmd == 'email'){
  137. //邮件消息
  138. _this.loadEmailCount()
  139. }
  140. }
  141. },
  142. loadCount(flag){
  143. console.log("loadCount::flag",flag)
  144. let url = '/sys/annountCement/listByUser';
  145. this.$http.get(url).then(res=>{
  146. console.log("res::",res)
  147. if(res.data.success){
  148. let msg1Count = res.data.result.anntMsgTotal;
  149. let msg2Count = res.data.result.sysMsgTotal;
  150. this.msgCount = msg1Count + msg2Count
  151. console.log("this.msgCount",this.msgCount)
  152. }
  153. })
  154. },
  155. loadEmailCount(){
  156. this.dot.mailHome = true
  157. },
  158. getTtemDotInfo(item){
  159. if(item.page==='annotationList' && this.msgCount>0){
  160. return this.msgCount
  161. }
  162. return '';
  163. }
  164. }
  165. }
  166. </script>
  167. <style scoped>
  168. .cu-list.grid>.cu-item {
  169. padding: 0px 0px;
  170. }
  171. .line2-icon {
  172. width: 60px;
  173. height: 60px;
  174. }
  175. </style>