App.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <script>
  2. // import routingIntercept from '@/common/permission.js'
  3. import {
  4. getToken
  5. } from '@/common/auth.js'
  6. export default {
  7. onLaunch(e) {
  8. // 限制必须在微信中打开H5连接,即公众号中打开
  9. // var ua = navigator.userAgent.toLowerCase();
  10. // var isWeixin = ua.indexOf('micromessenger') != -1;
  11. // if (!isWeixin) {
  12. // window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxeb15ff6b40432045"
  13. // }
  14. const { path } = e
  15. const whiteList = ['pages/entryPage/entryPage']
  16. // 开发时使用
  17. // const whiteList = ['pages/entryPage/entryPage', 'pages/createInfo/createInfo', 'pages/searchState/searchState']
  18. if (!getToken()) {
  19. // 非老人自主注册页面, 不允许直接进入
  20. if (!(whiteList.includes(path))) {
  21. uni.reLaunch({
  22. url: '/pages/login/index'
  23. })
  24. }
  25. }
  26. },
  27. onShow: function() {},
  28. onHide: function() {}
  29. }
  30. </script>
  31. <style>
  32. /*每个页面公共css */
  33. @font-face {
  34. /* font-family: 'puhui';
  35. src: url('./static/fonts/AlibabaPuHuiTi-3-65-Medium.ttf'); */
  36. }
  37. .global-font {
  38. /* font-family: 'puhui';
  39. font-size: 16px;
  40. color: #333; */
  41. }
  42. uni-page-body,
  43. html,
  44. body {
  45. height: 100%;
  46. }
  47. </style>