main.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. import App from './App'
  2. import Vue from 'vue'
  3. import getOpenId from './apis/utils/init.js'
  4. //import getALIOpenId from './apis/utils/initALI.js'
  5. //import './assets/font/font.css'
  6. // var IS_WEIXIN = /MicroMessenger/.test(window.navigator.userAgent)
  7. // var IS_ALI = /AlipayClient/.test(window.navigator.userAgent)
  8. // if (IS_ALI) {
  9. // getALIOpenId.init()
  10. // } else {
  11. // }
  12. getOpenId.init()
  13. import mixin from './apis/utils/mixin.js'
  14. Vue.prototype.carhelp = mixin
  15. //import Vconsole from 'vconsole'
  16. //import uView from "uview-ui";
  17. import uView from '@/uni_modules/uview-ui'
  18. Vue.use(uView);
  19. import {
  20. afterTimeStamp,parseUnixTime,newDate,daysDistance
  21. } from '@/apis/utils'
  22. Vue.mixin({
  23. updated: function() {
  24. },
  25. onReady() {
  26. },
  27. onLoad(option) {
  28. if (option.test == 'test') {
  29. //let vConsole = new Vconsole()
  30. }
  31. },
  32. methods: {
  33. showCode(info){
  34. return info.customCode?info.customCode:'-'
  35. },
  36. isNull(k){
  37. if(k){
  38. return k
  39. }else{
  40. return '无'
  41. }
  42. },
  43. gotoInfo(id){
  44. if(id){
  45. uni.navigateTo({
  46. url:'/pages/otherFunctions/equipmentRetrieval/equipmentInfo?id='+id
  47. })
  48. }
  49. },
  50. descriptionKey(info,bl){
  51. var key=''
  52. if(info.experimentPeriod&&info.experimentLastTime){
  53. var time=parseUnixTime(afterTimeStamp(info.experimentPeriod,newDate(info.experimentLastTime)),'{y}-{m}-{d}');
  54. var saytime=daysDistance(new Date(),time);
  55. var color="red";
  56. if(saytime>30){
  57. color="#4caf50";
  58. }else if(saytime>10){
  59. color="#ff9800";
  60. }
  61. if(!bl){
  62. key+=`<p>上次检验${info.experimentLastTime},检验周期${info.experimentPeriod?info.experimentPeriod+'天':'不定期'}</p><p>`;
  63. }
  64. key+=`下次检验${time},距离下次还剩`;
  65. if(!bl){
  66. key+=`<span style="color:${color}">`
  67. }
  68. key+=`${saytime}`
  69. if(!bl){
  70. key+=`</span>`
  71. }
  72. key+=`天`
  73. if(!bl){
  74. key+='</p>'
  75. }
  76. }else {
  77. if(!bl){
  78. if(info.experimentLastTime){
  79. key+=`<p>上次检验${info.experimentLastTime},`
  80. }else{
  81. key+=`<p>上次检验<span style='color:red'>未录入</span>,`
  82. }
  83. if(info.experimentPeriod){
  84. key+=`检验周期${info.experimentPeriod?info.experimentPeriod+'天':'不定期'}</p>`;
  85. }else{
  86. key+=`检验周期<span style='color:red'>未录入</span></p>`;
  87. }
  88. }
  89. }
  90. return key
  91. },
  92. takeCodeJp(val){
  93. if(val&&val.indexOf("jp=")==0){
  94. val=val.split("jp=")[1]
  95. return val
  96. }else if(val&&val.indexOf("?jpdeviceid=")>-1){
  97. val=val.split("?jpdeviceid=")[1]
  98. if(val.indexOf("&")>-1){
  99. val=val.split("&")[0]
  100. }
  101. return val
  102. }else{
  103. return '0'
  104. }
  105. },
  106. gotoUrl(url) {
  107. uni.navigateTo({
  108. url: "/" + url
  109. })
  110. }
  111. }
  112. })
  113. Vue.config.productionTip = false
  114. App.mpType = 'app'
  115. const app = new Vue({
  116. ...App
  117. })
  118. app.$mount()