Jacob
2026-10-12 aba815cd18b9719d119c65b949d4fa0ed63a09e8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<template>
   <view>
 
   </view>
</template>
 
<script>
   const app = getApp();
   import {
       mapGetters
   } from "vuex";
   import {
       LOGO_URL,
       EXPIRES_TIME,
       USER_INFO,
       STATE_R_KEY,
       BACK_URL
   } from '@/config/cache';
   import Routine from '@/libs/routine';
   import wechat from "@/libs/wechat";
   export default {
       data() {
           return {
               myOptions:{}
           }
       },
       onLaunch(option) {},
       onLoad() {},
       onShow() {
           let that = this;
           let pages = getCurrentPages(),
               currPage = pages[pages.length - 1];
           let option = currPage.options;
           console.log('wechat_login options', option);
 
           this.myOptions = option;
           that.thirdGo()
       },
       methods: {
           back() {
               uni.navigateBack();
           },
           home() {
               uni.switchTab({
                   url: '/pages/index/index'
               })
           },
           thirdGo() {
               let that = this;
               if (this.$store.getters.isLogin) {
                   Routine.getLastUserInfo();
               }
               let backUrl = this.$Cache.get(BACK_URL) || "/pages/index/index";
               if (backUrl.indexOf('pages/users/login/index') >= 0) {
                   backUrl = '/pages/index/index';
               }
               if (that.myOptions.back_url) {
                   backUrl = decodeURIComponent(that.myOptions.back_url);
               }
               if (!this.$store.getters.isLogin) {
                   if (backUrl.indexOf('pages/users/order_list') >= 0) {
                       backUrl = '/pages/user/index';
                   }
               }
               if (backUrl.indexOf('/') > 0) {
                   backUrl = '/' + backUrl;
               }
               console.log('login backUrl:' + backUrl);
               if (backUrl) {
                   if (backUrl.indexOf('pages/index/index') >= 0 ||
                       backUrl.indexOf('pages/goods_cate/goods_cate') >= 0 ||
                       backUrl.indexOf('pages/user/index') >= 0
                   ) {
                       if (backUrl.indexOf('pages/user/index') >= 0) {
                           this.$Cache.set('skipAuthLogin', '1');
                       }
                       uni.switchTab({
                           url: backUrl,
                           success: function(e) {
 
                           }
                       });
                   } else {
                       uni.redirectTo({
                           url: backUrl,
                           success: function(e) {
 
                           }
                       });
                   }
               }
           }
       }
   }
</script>
 
<style lang="scss" scoped>
   page {
       background: #fff;
       height: 100%;
   }
</style>