App.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <script>
  2. // import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
  3. export default {
  4. onLaunch: function() {
  5. // wx.showShareMenu({
  6. // withShareTicket: true,
  7. // menus: ['shareAppMessage', 'shareTimeline']
  8. // })
  9. // onShareAppMessage(() => {
  10. // return {
  11. // title: '门墩儿 专注顶尖招聘',
  12. // path: '/pages/index/position',
  13. // imageUrl: '../../static/img/share-poster.jpg'
  14. // }
  15. // })
  16. // onShareTimeline(() => {
  17. // return {
  18. // title: '门墩儿 专注顶尖招聘',
  19. // path: '/pages/index/position',
  20. // imageUrl: '../../static/img/share-poster.jpg'
  21. // }
  22. // })
  23. console.log('App Launch')
  24. uni.setStorageSync('firstOpen', true)
  25. // 检查是否是个人令牌
  26. if (uni.getStorageSync('token') && uni.getStorageSync('isPersonalToken')) {
  27. try {
  28. const url = uni.getStorageSync('entRegisterData') ? '/pages/register/review?hasData=true' : '/pages/register/index'
  29. uni.redirectTo({ url }) // redirectTo: 关闭当前页面,跳转(不可返回); reLaunch: 关闭所有页面,重新打开(完全重置导航栈)
  30. } catch (e) {
  31. console.error('Navigation error:', e)
  32. }
  33. }
  34. const updateManager = uni.getUpdateManager();
  35. updateManager.onCheckForUpdate(function(res){});
  36. updateManager.onUpdateReady(function(res){
  37. uni.showModal({
  38. title: '更新提示',
  39. content:'发现新版本,是否重启应用',
  40. success(res) {
  41. if(res.confirm) {
  42. updateManager.applyUpdate();
  43. }
  44. }
  45. })
  46. });
  47. updateManager.onUpdateFailed(function(res) {
  48. //新本版下载失败
  49. uni.showModal({
  50. title:'失败提示',
  51. content:'新版本下载失败,请手动删掉小程序后重新搜索进入小程序'
  52. })
  53. })
  54. },
  55. onShow: function() {
  56. console.log('App Show')
  57. },
  58. onHide: function() {
  59. console.log('App Hide')
  60. }
  61. }
  62. </script>
  63. <style lang="scss">
  64. /*每个页面公共css */
  65. @import '@/uni_modules/uni-scss/index.scss';
  66. /* #ifndef APP-NVUE */
  67. @import '@/static/iconfont.wxss';
  68. @import '@/static/style/index.scss';
  69. // 设置整个项目的背景色
  70. page {
  71. background-color: #ffffff;
  72. }
  73. /* #endif */
  74. .example-info {
  75. font-size: 14px;
  76. color: #333;
  77. padding: 10px;
  78. }
  79. /* 隐藏scroll-view的滚动条 */
  80. ::-webkit-scrollbar {
  81. display: none;
  82. width: 0 !important;
  83. height: 0 !important;
  84. -webkit-appearance: none;
  85. background: transparent;
  86. color: transparent;
  87. }
  88. uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
  89. display: none;
  90. width: 0 !important;
  91. height: 0 !important;
  92. -webkit-appearance: none;
  93. background: transparent;
  94. color: transparent;
  95. }
  96. </style>