App.vue 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <script>
  2. import { calcDate } from '@/utils/date.js'
  3. import { tokenTime } from '@/common/setting.js'
  4. export default {
  5. data() {
  6. return { refreshLock: false }
  7. },
  8. onLaunch: function(options) {
  9. //var aa = {"path":"pages/index/index","query":{},"scene":1001,"referrerInfo":{"extraData":{"internet":true,"data":{"userCredential":"用户凭证","personIdentifier":"12010119610707201X","Fields":"data","personCode":"106470","depName":"吉林省公安厅","appCredential":"应用凭证","NetworkCode":"3","personId":"410000000000","police":"101470","mobile":"13122223331","personName":"张胜男","resourceList":[{"resourceRegionalismCode":"220000000000","resourceAddress":"http://20.3.1.162:9105/drs/ppc/v1/appQuery.do","resourceId":" 120000000000-3-0100-b0e037d83ecc4d43be788a5e9ddcbbe5","resourceServiceType":"10"}],"personType":"10","depCode":"220000000000","sex":"男","dataObjId":"资源id"}}},"channel":"","launcher":"default"}
  10. //var dataOption = JSON.stringify(options)
  11. //console.log('MiniMall App Launch --- ' + options);
  12. //uni.setStorageSync('SzApp', dataOption);
  13. uni.setStorageSync('isSzApp',options.referrerInfo);
  14. },
  15. onShow: function() {
  16. console.log('App Show')
  17. },
  18. onHide: function() {
  19. console.log('App Hide')
  20. },
  21. methods: {
  22. // 定时检测token
  23. refreshToken() {
  24. this.refreshTime = setInterval(() => {
  25. const token = uni.getStorageSync('token')
  26. const date = calcDate(token.datetime, new Date().getTime())
  27. if (!date) return
  28. if (date.seconds >= tokenTime && !this.refreshLock) {
  29. this.refreshLock = true
  30. this.$u.api
  31. .refreshToken(token.content, '000000')
  32. .then(res => {
  33. this.$u.func
  34. .refreshToken(res)
  35. .then(() => {
  36. this.refreshLock = false
  37. })
  38. .catch(() => {
  39. this.refreshLock = false
  40. })
  41. })
  42. .catch(() => {
  43. this.refreshLock = false
  44. })
  45. }
  46. }, 30000)
  47. }
  48. }
  49. }
  50. </script>
  51. <style lang="scss">
  52. /*uview全局样式*/
  53. @import 'uview-ui/index.scss';
  54. /*app全局样式*/
  55. @import 'static/style/app.scss';
  56. /*每个页面公共css */
  57. @import '@/uni_modules/uni-scss/index.scss';
  58. // 修改checkbox样式
  59. checkbox.curdCheck .wx-checkbox-input,
  60. checkbox.curdCheck .uni-checkbox-input {
  61. border-radius: 50% !important;
  62. border-color: #c8c9cc !important;
  63. color: #5f88ff !important;
  64. }
  65. checkbox.curdCheck .wx-checkbox-input-checked,
  66. checkbox.curdCheck .uni-checkbox-input-checked {
  67. // background-color: #5f88ff;
  68. color: #5f88ff !important;
  69. border-color: #5f88ff !important;
  70. }
  71. .uni-picker-container,
  72. .wx-picker-container {
  73. z-index: 10074;
  74. }
  75. uni-modal {
  76. z-index: 19999 !important;
  77. }
  78. </style>