App.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <script>
  2. export default {
  3. globalData: {
  4. //全局配置参数
  5. barHeight: 0,
  6. screenWidth: 0,
  7. screenHeight: 0,
  8. viewHeight: 0,
  9. },
  10. onLaunch: function(options) {
  11. console.log("APP----onLaunch", options);
  12. if (options.query.code) {
  13. uni.setStorageSync('code', options.query.code)
  14. }
  15. // #ifdef APP-PLUS
  16. // App平台检测升级,服务端代码是通过uniCloud的云函数实现的,详情可参考:https://ext.dcloud.net.cn/plugin?id=2226
  17. // #endif
  18. //获取设备顶部窗口的高度(不同设备窗口高度不一样,根据这个来设置自定义导航栏的高度)
  19. uni.getSystemInfo({
  20. success: (res) => {
  21. this.globalData.barHeight = res.statusBarHeight;
  22. this.globalData.screenWidth = res.screenWidth;
  23. this.globalData.screenHeight = res.screenHeight;
  24. this.globalData.viewHeight = res.windowHeight
  25. }
  26. });
  27. /**
  28. * 校验session_key是否失效
  29. * 如果失效,则清空登录态,当需要登录的时候,从login.wxml重新登录
  30. */
  31. uni.checkSession({
  32. success() {
  33. // sessionKey有效没有过期
  34. console.log("checkSession success");
  35. },
  36. fail() {
  37. // sessionKey已经失效,过期
  38. console.log("checkSession fail");
  39. // 清空登录所有相关信息
  40. // clearLoginStatus();
  41. }
  42. });
  43. },
  44. onShow: function() {
  45. console.log('App Show')
  46. },
  47. onHide: function() {
  48. console.log('App Hide')
  49. },
  50. globalData: {
  51. test: ''
  52. }
  53. }
  54. </script>
  55. <style lang="scss">
  56. @import "uview-ui/index.scss";
  57. /* #ifndef APP-PLUS-NVUE */
  58. /* uni.css - 通用组件、模板样式库,可以当作一套ui库应用 */
  59. @import './common/style/uni.css';
  60. /* #endif*/
  61. /*每个页面公共css */
  62. uni-radio .uni-radio-input .uni-radio-input-checked {
  63. background: #FF0000 !important;
  64. }
  65. </style>