App.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <script>
  2. var http = require("./common/request.js");
  3. var tabberData = require ('./components/tabber/tabber.js' )
  4. import Vue from 'vue'
  5. export default {
  6. globalData: {
  7. principal: [] ,
  8. isbingCID:false,
  9. diary:{},
  10. },
  11. onLaunch: function() {
  12. uni.getSystemInfo({
  13. success: function(e) {
  14. // #ifndef MP
  15. Vue.prototype.StatusBar = e.statusBarHeight;
  16. if (e.platform == 'android') {
  17. Vue.prototype.CustomBar = e.statusBarHeight + 50;
  18. } else {
  19. Vue.prototype.CustomBar = e.statusBarHeight + 45;
  20. };
  21. // #endif
  22. // #ifdef MP-WEIXIN
  23. Vue.prototype.StatusBar = e.statusBarHeight;
  24. let custom = wx.getMenuButtonBoundingClientRect();
  25. Vue.prototype.Custom = custom;
  26. Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
  27. // #endif
  28. // #ifdef MP-ALIPAY
  29. Vue.prototype.StatusBar = e.statusBarHeight;
  30. Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
  31. // #endif
  32. }
  33. })
  34. //清除权限缓存
  35. uni.removeStorageSync('authorityList');
  36. // #ifdef APP-PLUS
  37. //消息推送
  38. getApp().globalData.isbingCID = false;
  39. // const _self = this;
  40. plus.push.addEventListener('click', function(message) {
  41. //console.log(message,'click')
  42. //console.log(message.payload)
  43. if(message.payload && message.payload.url){
  44. let userInfo = uni.getStorageSync('userInfo');
  45. //是否登录
  46. if(userInfo){
  47. //console.log(message.payload.url)
  48. uni.navigateTo({
  49. url: message.payload.url
  50. });
  51. }
  52. }
  53. });
  54. plus.push.addEventListener('receive', function(message) {
  55. console.log(message,'receive')
  56. if ( message.aps ) { // Apple APNS message
  57. //APNS下发的消息,应用在前台
  58. } else if ( 'LocalMSG' == message.payload ) { // 特殊payload标识本地创建的消息
  59. //本地创建的消息,通常不需要处理
  60. //注意:不要在这种情况下再此调用plus.push.createMessage,从而引起循环创建本地消息
  61. } else {
  62. //接收到在线透传消息
  63. plus.push.createMessage(message.content, "LocalMSG",{cover:false,title:message.title});
  64. }
  65. });
  66. // #endif
  67. },
  68. onShow: function() {
  69. http.getDomain();
  70. //半个小时为周期来生成该用户的任务预警信息
  71. setInterval(function(){
  72. console.log("-----------------开始生成任务预警信息-----------------");
  73. var userId = uni.getStorageSync("userInfo").id;
  74. var porject = uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id);
  75. if(userId!=null && porject.contractId!=null && porject.id){
  76. http.request("/app/task/taskRules",{userId:userId,contractId:porject.contractId,projectId:porject.id},null,1).then((res)=>{
  77. console.log("-----------------任务预警信息执行完成-----------------");
  78. })
  79. }
  80. },1800000);
  81. //定时监测
  82. // #ifdef APP-PLUS
  83. plus.runtime.getProperty(plus.runtime.appid,(widgetInfo)=>{
  84. //console.log(widgetInfo)
  85. this.widgetInfo = widgetInfo;
  86. //console.log(plus.os.name)
  87. http.request("/app/appversion/update",{name:widgetInfo.name,version:widgetInfo.version,platform:plus.os.name}).then((res)=>{
  88. console.log(res)
  89. if(res.update){
  90. //检查是否有新版本
  91. this.$set(this.tabberData,'newVersion',true);
  92. }
  93. })
  94. });
  95. // #endif
  96. },
  97. onHide: function() {
  98. }
  99. };
  100. </script>
  101. <style>
  102. /*每个页面公共css */
  103. @import "style/main.css";
  104. @import "style/icon.css";
  105. @import "style/ly-tree.css";
  106. @import "style/index.css";
  107. .menuImageNoTask{
  108. height: 80rpx;
  109. width: 120rpx;
  110. }
  111. .menuImageTask{
  112. height: 90rpx;
  113. width: 90rpx;
  114. }
  115. .cu-avatar {
  116. font-variant: small-caps;
  117. margin: 0;
  118. padding: 0;
  119. display: inline-flex;
  120. text-align: center;
  121. justify-content: center;
  122. align-items: center;
  123. background-color: white;
  124. color: #ffffff;
  125. white-space: nowrap;
  126. position: relative;
  127. width: 94upx;
  128. height: 64upx;
  129. background-size: cover;
  130. background-position: center;
  131. vertical-align: middle;
  132. font-size: 1.5em;
  133. }
  134. .login-img{
  135. width: 30rpx;
  136. height: 30rpx;
  137. }
  138. /* 浅黄辅色 */
  139. .bg-yellow-secondary{
  140. background-color:#FCF1E2;
  141. color: #EF9D1E;
  142. }
  143. /* 浅蓝辅色 */
  144. .bg-blue-secondary{
  145. background-color:#C6E6FF;
  146. color: #0A8CD5;
  147. }
  148. /* 背景灰色*/
  149. .bg-gray-secondary{
  150. background-color:#F7F7F7;
  151. }
  152. uni-checkbox:not([disabled]) .uni-checkbox-input:hover{
  153. border-color: #d1d1d1;
  154. }
  155. </style>