12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <template>
- <view>
- <u-navbar></u-navbar>
- 首页图
- <view v-if="bottonShow">
- <u-button @click="gotoMain(true)" >加入我们</u-button>
- <u-button @click="gotoMain(false)">我先逛逛</u-button>
- </view>
-
- </view>
- </template>
- <script>
- import * as loginApi from '@/apis/login.js'
-
- export default {
- data() {
- return {
- bottonShow:false
- }
- },
- methods: {
- gotoMain(k){
- if(k){
- uni.navigateTo({
- url:"pagesA/pages/login/index"
- })
- }else{
- uni.switchTab({
- url: '/pages/index/index'
- });
- }
- },
- findByOpenId(){
- var openId=this.carhelp.getOpenId()
- if(openId==""){
- console.log("------------------")
- setTimeout(()=>{
- this.findByOpenId()
- },1000)
- return
- }
- uni.request({
- method:'get',
- url: process.car.BASE_URL + "/mobile/regUser/findByOpenId",
- data: {
- openId:openId,
- },
- header: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'X-Requested-With': 'XMLHttpRequest',
- }
- }).then((response) => {
- console.log('findByOpenId')
- let [error, res] = response;
-
- if (res.data.code == 200&&res.data.result) {
- var token = res ? res.data.data.token : '';
- this.carhelp.setPersonInfo(res.data.data.memberInfo );
- this.carhelp.setToken(token);
-
- setTimeout(()=>{
- uni.switchTab({
- url: '/pages/index/index'
- });
- },1000)
-
- } else{
- this.bottonShow=true
- }
- }).catch(error => {
-
- this.bottonShow=true
- })
- }
- },
- onReady() {
-
- this.findByOpenId()
- }
- }
- </script>
- <style>
- </style>
|