startup.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <view>
  3. <image src="../../static/startupImg.png" style="width: 100vw;height: 100vh;"></image>
  4. <view :class="hasNotchInScreen?'skip hasNotch':'skip'" @click="skip()">跳过 {{clock}}</view>
  5. </view>
  6. </template>
  7. <script>
  8. export default {
  9. data() {
  10. return {
  11. clock: 3,
  12. inter: undefined,
  13. hasNotchInScreen: false
  14. }
  15. },
  16. onLoad() {},
  17. mounted() {
  18. var _this = this
  19. _this.hasNotchInScreen = plus.navigator.hasNotchInScreen()
  20. _this.inter = setInterval(function() {
  21. _this.clock = _this.clock - 1
  22. if (_this.clock <= 0) {
  23. _this.skip()
  24. clearInterval(_this.inter)
  25. }
  26. }, 1000);
  27. },
  28. methods: {
  29. skip() {
  30. clearInterval(this.inter)
  31. //let token = uni.getStorageSync('uni_id_token')
  32. var token = this.$preToken + ' ' + this.$store.state.accessToken;
  33. console.log("111")
  34. console.log(token)
  35. console.log(token!=""&&token!=undefined)
  36. if (token!=""&&token!=undefined) {
  37. uni.switchTab({
  38. url: '/pages/index/index'
  39. })
  40. } else {
  41. uni.reLaunch({
  42. url: '/pages/public/login'
  43. })
  44. /* uni.redirectTo({
  45. url: '/pages/public/login'
  46. }); */
  47. }
  48. }
  49. }
  50. }
  51. </script>
  52. <style>
  53. .skip {
  54. position: absolute;
  55. background-color: #30313350;
  56. right: 20px;
  57. top: 20px;
  58. color: #dcdcdc;
  59. border-radius: 25px;
  60. border: 1px solid #dcdcdc;
  61. padding: 5rpx 12rpx 5rpx 12rpx;
  62. }
  63. .hasNotch {
  64. right: 50px;
  65. top: 50px;
  66. }
  67. </style>