Helius
2021-11-19 66f8eeab8b21f81e310d3f7cbc2766bb8b2ec0d5
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
// pages/welcome/welcome.js
var api = require('../../utils/service-api.js');
var util = require('../../utils/util.js')
 
 
Page({
 
  /**
   * 页面的初始数据
   */
  data: {
    artId: '',
    loadding: true,
    jumpUrl: '',
  },
 
 
  onLoad: function(option) {
    var _this = this
 
    if (option.url != undefined) {
      _this.setData({
        jumpUrl: decodeURIComponent(option.url)
      })
    }
  },
 
  /**
   * 用户授权登录
   */
  userAuthorization: function(options) {
 
    var _this = this;
    _this.setData({
      loadding: false
    })
    if (options.detail.errMsg == 'getUserInfo:fail auth deny') {
      wx.showToast({
        title: "为了您能正常使用小程序,请先同意授权",
        icon: "none"
      });
      _this.setData({
        loadding: true
      })
      return;
    }
 
    var userInfo = options.detail.userInfo
    //更新用戶信息
    util.request({
      api: "/wxapi/user/saveUserInfo",
      checkLogin: true,
      data: userInfo,
      callback: function(data) {
 
        getApp().userInfo = data.rows[0];
        //跳转页面
        _this.setData({
          loadding: true
 
        })
        if (_this.data.jumpUrl == '' || _this.data.jumpUrl == undefined) {
          wx.reLaunch({
            url: '/pages/index/index'
          })
        } else if (_this.data.jumpUrl == 'back') {
          //后退一页
          wx.navigateBack({
            delta: 1
          })
        } else {
 
          wx.reLaunch({
            url: _this.data.jumpUrl
          })
        }
 
      }
    });
 
 
 
 
  },
 
 
  agreement(e) {
    wx.navigateTo({
      url: '../shopType/shopType',
    })
  },
 
  // 进入内容页面
  intoContent() {
    wx.navigateTo({
      url: '/pages/article/article?id=12',
    })
  },
})