welcome.vue 3.8 KB

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