App.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. console.log(res)
  22. this.globalData.barHeight = res.statusBarHeight;
  23. this.globalData.screenWidth = res.screenWidth;
  24. this.globalData.screenHeight = res.screenHeight;
  25. this.globalData.viewHeight = res.windowHeight
  26. }
  27. });
  28. /**
  29. * 校验session_key是否失效
  30. * 如果失效,则清空登录态,当需要登录的时候,从login.wxml重新登录
  31. */
  32. uni.checkSession({
  33. success() {
  34. // sessionKey有效没有过期
  35. console.log("checkSession success");
  36. },
  37. fail() {
  38. // sessionKey已经失效,过期
  39. console.log("checkSession fail");
  40. // 清空登录所有相关信息
  41. // clearLoginStatus();
  42. }
  43. });
  44. },
  45. onShow: function() {
  46. console.log('App Show')
  47. },
  48. onHide: function() {
  49. console.log('App Hide')
  50. },
  51. globalData: {
  52. test: ''
  53. }
  54. }
  55. </script>
  56. <style lang="scss">
  57. /* #ifndef APP-PLUS-NVUE */
  58. /* uni.css - 通用组件、模板样式库,可以当作一套ui库应用 */
  59. @import './common/style/uni.css';
  60. /* #endif*/
  61. uni-radio .uni-radio-input .uni-radio-input-checked {
  62. background: #FF0000 !important;
  63. }
  64. </style>