index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <view class="wrap">
  3. <view class="header-wrap">
  4. <view class="header f-padding">
  5. <view class="header-item header-title">
  6. 欢迎登录
  7. <view class="message" @click="openPage('pages/center/news/news')">
  8. <u-icon name="bell"></u-icon>
  9. <u-badge type="error" class="badge" :count="newsTotal" :offset='[-10,-10]'></u-badge>
  10. </view>
  11. </view>
  12. <view class="header-item header-con">{{vuex_user.officerName}}</view>
  13. </view>
  14. </view>
  15. <view class="statistics">
  16. <!-- 设备状态 1-已离线 2-运行中 4-保养中 -->
  17. <u-row justify="center">
  18. <u-col span="4" text-align="center" @click="openPage('pages/equipmentList/equipmentList','')">
  19. <view class="count" style="color: #0074DD;">{{deviceStatisData.totalNum||'0'}}</view>
  20. <view class="name">总设备数</view>
  21. </u-col>
  22. <u-col span="4" text-align="center" @click="openPage('pages/equipmentList/equipmentList','0')">
  23. <view class="count" style="color: #f00;">{{deviceStatisData.onlineNum||'0'}}</view>
  24. <view class="name">设备离线</view>
  25. </u-col>
  26. <u-col span="4" text-align="center" @click="openPage('pages/equipmentList/equipmentList','2')">
  27. <view class="count" style="color: #07A68D;">{{deviceStatisData.exceptionNum||'0'}}</view>
  28. <view class="name">未检测</view>
  29. </u-col>
  30. </u-row>
  31. </view>
  32. <view class="list-block equipment">
  33. <view class="list-block-til u-font-18">设备信息</view>
  34. <view class="list-block-con u-flex u-flex-wrap u-row-left" v-if="deviceTypeListData.length>0">
  35. <view class="list-block-item"
  36. @click="openPage('pages/deviceList/deviceList',item.id)"
  37. v-for="item in deviceTypeListData" :key="item.id">
  38. <image class="img" :src="item.deviceTypeImgUrl||''" mode="widthFix"></image>
  39. <view class="txt">{{item.deviceTypeName}}</view>
  40. </view>
  41. </view>
  42. <u-empty text="暂无内容" mode="list" v-else></u-empty>
  43. </view>
  44. <view class="list-block">
  45. <view class="list-block-til u-font-18">考勤管理</view>
  46. <view class="list-block-con u-flex u-flex-wrap u-row-left">
  47. <view class="list-block-item"
  48. @click="openPage('pages/clockIn/clockIn')">
  49. <image class="img" src="../../static/img/daka.png" mode="widthFix"></image>
  50. <view class="txt">打卡</view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="list-block">
  55. <view class="list-block-til u-font-18">问题上报</view>
  56. <view class="list-block-con u-flex u-flex-wrap u-row-left">
  57. <view class="list-block-item"
  58. @click="openPage('pages/report/report')">
  59. <image class="img" src="../../static/img/report.png" mode="widthFix"></image>
  60. <view class="txt">问题上报</view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. export default {
  68. data() {
  69. return {
  70. newsTotal:'',
  71. noticeList:[],
  72. devicemsg:[],
  73. deviceStatisData:[],
  74. deviceTypeListData:[],
  75. }
  76. },
  77. onLoad() {
  78. },
  79. onShow() {
  80. // this.deviceTypeList();
  81. this.deviceStatis();
  82. // this.getUnreadTotal();
  83. },
  84. methods: {
  85. openPage(path,param) {
  86. this.$u.route({
  87. url: path,
  88. params:{
  89. param:param
  90. }
  91. })
  92. },
  93. deviceStatis(){
  94. this.$u.api.getDeviceStatis().then(res=>{
  95. if(res.code==200){
  96. this.deviceStatisData = res.data;
  97. // console.log('getDeviceStatis',res);
  98. }else{
  99. uni.showToast({
  100. icon:'none',
  101. title:res.msg
  102. })
  103. }
  104. console.log('res',res);
  105. }).catch(err=>{
  106. console.log('err',err);
  107. })
  108. },
  109. deviceTypeList(){
  110. this.$u.api.getDeviceTypeList().then(res=>{
  111. if(res.code==200){
  112. this.deviceTypeListData = res.data;
  113. // console.log('getDeviceStatis',res);
  114. }else{
  115. uni.showToast({
  116. icon:'none',
  117. title:res.msg
  118. })
  119. }
  120. console.log('res',res);
  121. }).catch(err=>{
  122. console.log('err',err);
  123. })
  124. },
  125. getUnreadTotal(){
  126. let that = this;
  127. this.$u.api.unreadTotal().then(res=>{
  128. if(res.code==200){
  129. this.newsTotal = res.data.noReadCount;
  130. }else{
  131. uni.showToast({
  132. icon:'none',
  133. title:res.msg
  134. })
  135. }
  136. console.log('res',res);
  137. }).catch(err=>{
  138. console.log('err',err);
  139. })
  140. },
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. page{background-color: #F6F6F6;}
  146. .header-wrap{
  147. overflow: hidden;
  148. .header{
  149. position: relative;
  150. box-sizing: border-box;
  151. height: 260rpx;
  152. padding: 48rpx 24rpx 98rpx;
  153. color: #fff;
  154. border-radius: 0 0 50% 50%;
  155. &::before{
  156. width: 140%; height: 100%; position: absolute; left: -20%; top: 0; content: ''; border-radius: 0 0 50% 50%;
  157. background: linear-gradient(180deg, #4466D8 0%, #8274F8 100%);
  158. background: url(../../static/img/index-header-bg.png) no-repeat;
  159. }
  160. .header-title{
  161. font-size: 50rpx;
  162. font-weight: 400;
  163. color: #FFFFFF;
  164. line-height: 70rpx;
  165. letter-spacing: 2rpx;
  166. margin-bottom: 3rpx;
  167. .message{
  168. position: relative;
  169. float: right;
  170. cursor: pointer;
  171. .badge{
  172. }
  173. }
  174. }
  175. .header-con{
  176. font-size: 28rpx;
  177. font-weight: 400;
  178. color: #FFFFFF;
  179. line-height: 40rpx;
  180. letter-spacing: 1rpx;
  181. }
  182. .header-item{
  183. position: relative;
  184. }
  185. }
  186. }
  187. .statistics{
  188. position: relative;
  189. margin: -80rpx 24rpx 24rpx;
  190. padding: 43rpx 30rpx 43rpx;
  191. border-radius: 10rpx;
  192. background-color: #fff;
  193. .count{
  194. font-size: 86rpx;
  195. font-weight: 400;
  196. color: #3171CF;
  197. line-height: 100rpx;
  198. letter-spacing: 3rpx;
  199. }
  200. .name{
  201. font-size: 26rpx;
  202. font-weight: 400;
  203. color: #7D7D7D;
  204. line-height: 37rpx;
  205. letter-spacing: 1px;
  206. }
  207. }
  208. .notice{
  209. margin: 20rpx 0;
  210. padding: 0 30rpx;
  211. background-color: #fff;
  212. }
  213. </style>