welcome.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view>
  3. <view class="welcome">
  4. <view class="welcome-state1">
  5. <view class="welcome-next" @click="gotoIndex()">{{step}}|跳过</view>
  6. <view class="welcome-foot">
  7. <u-image width="185px" height="48px" src="../../static/img/logo.png"></u-image>
  8. </view>
  9. </view>
  10. <!-- <view class="welcome-state2">
  11. <view class="welcome-logo">
  12. <u-image width="200px" height="50px" src="../../static/img/logo2.png"></u-image>
  13. </view>
  14. <view class="welcome-btn">
  15. <u-button class="welcomeBtn" shape="circle">用户登录</u-button>
  16. <p>随便逛逛</p>
  17. </view>
  18. </view> -->
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import * as loginApi from '@/apis/login.js'
  24. export default {
  25. data() {
  26. return {
  27. step:3
  28. }
  29. },
  30. methods: {
  31. findNoLTextConfigure(){
  32. loginApi.findNoLTextConfigure().then((response) => {
  33. this.carhelp.setConfig(response.data.configure)
  34. this.setBackImg()
  35. }).catch(error => {
  36. uni.showToast({
  37. title: error,
  38. icon: "none"
  39. })
  40. })
  41. },
  42. findByOpenId(){
  43. var openId=this.carhelp.getOpenId()
  44. if(openId==""){
  45. console.log("--------findByOpenId----------")
  46. setTimeout(()=>{
  47. this.findByOpenId()
  48. },1000)
  49. return
  50. }
  51. uni.request({
  52. method:'get',
  53. url: process.car.BASE_URL + "/mobile/regUser/findByOpenId",
  54. data: {
  55. openId:openId,
  56. },
  57. header: {
  58. 'Content-Type': 'application/x-www-form-urlencoded',
  59. 'X-Requested-With': 'XMLHttpRequest',
  60. }
  61. }).then((response) => {
  62. let [error, res] = response;
  63. if (res.data.code == 200&&res.data.result) {
  64. var token = res ? res.data.data.token : '';
  65. this.carhelp.setPersonInfo(res.data.data.regUser );
  66. this.carhelp.setToken(token);
  67. this.carhelp.setPersonInfoPlus(res.data.data);
  68. } else{
  69. this.carhelp.logoff()
  70. }
  71. }).catch(error => {
  72. })
  73. },
  74. setBackImg(){
  75. var img=this.carhelp.getConfig().homepageLogo
  76. // img="https://yktwechat.xiaoxinda.com/config/xxd2021.jpg"
  77. if(img){
  78. document.body.style="background:url("+img+") no-repeat;background-size: 100%;"
  79. }
  80. },
  81. gotoIndex(){
  82. uni.redirectTo({
  83. url: '/pages/index/index'
  84. });
  85. },
  86. indexstep(){
  87. setTimeout(()=>{
  88. this.step--;
  89. if(this.step<0){
  90. this.gotoIndex()
  91. }else{
  92. this.indexstep()
  93. }
  94. },1000)
  95. }
  96. },
  97. onLoad() {
  98. this.indexstep()
  99. this.setBackImg( )
  100. },
  101. onUnload(){
  102. document.body.style=""
  103. },
  104. onReady() {
  105. this.findNoLTextConfigure()
  106. this.findByOpenId()
  107. }
  108. }
  109. </script>
  110. <style>
  111. page{
  112. background:url(../../static/img/welcome_bg.png) no-repeat;
  113. background-size:100%;
  114. }
  115. </style>
  116. <style lang="scss" scoped>
  117. .welcome{
  118. position: relative;
  119. }
  120. .welcome-next{
  121. position: absolute;
  122. padding: 4px 15px;
  123. color:#fff;
  124. border-radius: 14px;
  125. background:rgba(0,0,0,0.5);
  126. right: 15px;
  127. top: 15px;
  128. }
  129. .welcome-foot{
  130. position:fixed;
  131. left: 0;
  132. right: 0;
  133. bottom: 0;
  134. background-color: #fff;
  135. height: 100px;
  136. display: flex;
  137. align-items: center;
  138. justify-content: center;
  139. }
  140. .welcome-logo{
  141. position: absolute;
  142. left: 50%;
  143. margin-left: -100px;
  144. top: 120px;
  145. }
  146. .welcome-btn{
  147. position: fixed;
  148. left: 48px;
  149. right: 48px;
  150. bottom:48px;
  151. text-align: center;
  152. .welcomeBtn{
  153. color:#009143;
  154. border-color:#fff;
  155. }
  156. p{
  157. color:#fff;
  158. margin-top: 12px;
  159. font-size: 16px;
  160. }
  161. }
  162. </style>