Blame view

src/App.vue 3 KB
55ddb3f8a   范牧   登陆逻辑修改
1
  <script>
0db291810   BigBoss   “-mcomfirmOder页面
2
      import Vue from 'vue';
55ddb3f8a   范牧   登陆逻辑修改
3
4
      import store from '@/store';
  
0db291810   BigBoss   “-mcomfirmOder页面
5
6
      export default Vue.extend({
          mpType: 'app',
55ddb3f8a   范牧   登陆逻辑修改
7
8
9
          onLaunch(options) {
              const option = options || {};
              // 获取用户来源
c300654f9   范牧   首页部分功能
10
11
              // console.log('软件启动,输出转来的参数:', option);
              // console.log('场景值------------------:', option.scene);
55ddb3f8a   范牧   登陆逻辑修改
12
13
              let loginQueryInfo = option ? option.query : {};
              loginQueryInfo = loginQueryInfo || {};
c300654f9   范牧   首页部分功能
14
              // console.log('loginQueryInfo onShow===>', loginQueryInfo);
55ddb3f8a   范牧   登陆逻辑修改
15
              const scene = decodeURIComponent(loginQueryInfo.scene);
c300654f9   范牧   首页部分功能
16
              // console.log('decodeURIComponent scense====>', scene);
55ddb3f8a   范牧   登陆逻辑修改
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
              let fromInfo = {};
  
              if(scene.length > 0 ) {
                  const getQueryString = {
                      uid: undefined,
                      sid: undefined,
                      pid: undefined
                  };
                  const strB = scene.split('&');
  
                  for(let i = 0; i < strB.length; i += 1) {
                      getQueryString[strB[i].split('=')[0]] = unescape(strB[i].split('=')[1]);
                  }
                  fromInfo = {
                      loginQueryInfo,
                      fromuid: getQueryString.uid,
                      fromsid: getQueryString.sid,
                      frompid: getQueryString.pid,
                      scene: option.scene,
                  }
                  store.dispatch('user/setFrom', fromInfo);
c300654f9   范牧   首页部分功能
38
                  // console.log('loginQueryInfo.hasOwnProperty=====111===>', getQueryString);
55ddb3f8a   范牧   登陆逻辑修改
39
              } else {
c300654f9   范牧   首页部分功能
40
                  // console.log('loginQueryInfo.hasOwnProperty====22222====>', loginQueryInfo);
55ddb3f8a   范牧   登陆逻辑修改
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
                  if (loginQueryInfo.hasOwnProperty('sid') == false) {
                      loginQueryInfo.sid = 0;
                  }
                  if (loginQueryInfo.hasOwnProperty('pid') == false) {
                      loginQueryInfo.pid = 0;
                  }
                  if (loginQueryInfo.hasOwnProperty('uid') == false) {
                      loginQueryInfo.uid = 0;
                  }
                  fromInfo = {
                      loginQueryInfo,
                      fromuid: loginQueryInfo.uid,
                      fromsid: loginQueryInfo.sid,
                      frompid: loginQueryInfo.pid,
                      scene: option.scene,
                  }
                  store.dispatch('user/setFrom', fromInfo)
              }
  
              // 登陆
              const openId = uni.getStorageSync('openid') || "";
              if(openId.length <= 10) {
                  uni.clearStorageSync()
                  store.dispatch("user/login", fromInfo);
              } else {
                  store.dispatch("user/getUserInfo", fromInfo);
              }
0db291810   BigBoss   “-mcomfirmOder页面
68
69
          },
          onShow() {
c300654f9   范牧   首页部分功能
70
              // console.log('App Show')
0db291810   BigBoss   “-mcomfirmOder页面
71
72
          },
          onHide() {
c300654f9   范牧   首页部分功能
73
              // console.log('App Hide')
55ddb3f8a   范牧   登陆逻辑修改
74
75
          },
          methods: {
0db291810   BigBoss   “-mcomfirmOder页面
76
77
78
79
80
81
          }
      });
  </script>
  
  <style>
      /*每个页面公共css */
843fce64e   wulunyi   feat(master): 加入 ...
82
  </style>