launchScreen.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view class="container launch-container">
  3. <view class="lauch-min">
  4. <image src="@/static/logo2.png" class="logo"></image>
  5. <!-- <view class="logo-tit"><text class="logo-tit-first">Horizon</text><text>Insights</text></view> -->
  6. </view>
  7. <template v-if="!isLogin">
  8. <button class="goLogin" @click="Login">去登录</button>
  9. <view class="warn_txt">
  10. ●请登录后查看,仅限内部员工使用
  11. </view>
  12. </template>
  13. </view>
  14. </template>
  15. <script>
  16. import {User} from '@/config/api.js';
  17. export default {
  18. data() {
  19. return {
  20. isLogin:false,
  21. };
  22. },
  23. methods:{
  24. Login() {
  25. setTimeout(function () {
  26. uni.redirectTo({
  27. url:'/pages/login/login'
  28. })
  29. }, 500);
  30. }
  31. },
  32. onLoad() {
  33. // 判断是否有token缓存
  34. let token = this.$db.get('token');
  35. if(!token) {
  36. // setTimeout(function () {
  37. // uni.redirectTo({
  38. // url:'/pages/login/login'
  39. // })
  40. // }, 2000);
  41. this.isLogin = false
  42. }else {
  43. // 校验token
  44. User.checkToken().then(res => {
  45. if(res.Ret === 200) {
  46. this.isLogin = true;
  47. setTimeout(function () {
  48. uni.redirectTo({
  49. url:'/pages/index/index'
  50. })
  51. }, 2000);
  52. }else {
  53. this.isLogin = false;
  54. this.$util.toast(res.Msg);
  55. this.$db.del('token');
  56. this.$db.del('account');
  57. }
  58. }).catch(err => {
  59. this.$toast(err)
  60. })
  61. }
  62. }
  63. }
  64. </script>
  65. <style lang="scss">
  66. .launch-container {
  67. background-color: #3385FF;
  68. .lauch-min {
  69. width: 100%;
  70. position: absolute;
  71. top: 40%;
  72. left: 0;
  73. transform: translateY(-50%);
  74. .logo {
  75. display: block;
  76. width: 582rpx;
  77. height: 404rpx;
  78. margin: 0 auto 50rpx;
  79. }
  80. .logo-tit {
  81. text-align: center;
  82. font-size: 78rpx;
  83. color: #fff;
  84. text {
  85. display: inline-block;
  86. }
  87. .logo-tit-first {
  88. margin-right: 50rpx;
  89. }
  90. }
  91. }
  92. .goLogin {
  93. width: 400rpx;
  94. height: 90rpx;
  95. line-height: 90rpx;
  96. position: absolute;
  97. left: 50%;
  98. bottom: 15%;
  99. transform: translateX(-50%);
  100. color: #fff;
  101. font-size: 38rpx;
  102. background-color: #3385FF;
  103. border:1rpx solid #fff;
  104. border-radius: 90rpx;
  105. }
  106. .warn_txt {
  107. width: 100%;
  108. font-size: 26rpx;
  109. color: #fff;
  110. position: absolute;
  111. left: 0;
  112. bottom: 8%;
  113. text-align: center;
  114. }
  115. }
  116. </style>