App.vue 1.3 KB

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