App.vue 3.3 KB

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