xyvcard-wechat-auth 0.0.16 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,11 @@
1
1
  import { config } from "../../../utils/config.js";
2
+ import { authApi } from "../../../api/auth/index.js";
2
3
  Component({
3
4
  /**
4
5
  * 组件的属性列表
5
6
  */
6
7
  properties: {
7
- userInfo: {
8
+ form: {
8
9
  type: Object,
9
10
  value: {}
10
11
  },
@@ -20,10 +21,31 @@ Component({
20
21
  BASE_URL: config.baseUrl + "/v1/file/image/clip/200/200/",
21
22
  resourceUrl: config.resourceUrl + "/images/mall"
22
23
  },
24
+ lifetimes: {
25
+ ready() {
26
+ if (Object.keys(this.data.form).length > 0) {
27
+ this.setData({
28
+ userInfo: {
29
+ ...this.properties.form
30
+ }
31
+ });
32
+ } else {
33
+ this.getUserInfo();
34
+ }
35
+ }
36
+ },
23
37
  /**
24
38
  * 组件的方法列表
25
39
  */
26
40
  methods: {
41
+ // 获取用户信息
42
+ getUserInfo() {
43
+ authApi.userInfo().then((resp) => {
44
+ this.setData({
45
+ userInfo: resp.data
46
+ });
47
+ });
48
+ },
27
49
  handleLogin() {
28
50
  this.triggerEvent("login");
29
51
  },
@@ -85,13 +85,13 @@ Component({
85
85
  });
86
86
  return;
87
87
  }
88
- if (this.data.tabbar) {
88
+ if (this.properties.tabbar) {
89
89
  wx.switchTab({
90
- url: this.data.backurl
90
+ url: this.properties.backurl
91
91
  });
92
92
  } else {
93
93
  wx.navigateTo({
94
- url: this.data.backurl
94
+ url: this.properties.backurl
95
95
  });
96
96
  }
97
97
  });
@@ -107,15 +107,7 @@ Component({
107
107
  goInfo(e) {
108
108
  var _a;
109
109
  const id = (_a = e.currentTarget) == null ? void 0 : _a.id;
110
- if (id == "0") {
111
- wx.navigateTo({
112
- url: "/pages/cms/agreement/index"
113
- });
114
- } else if (id == "1") {
115
- wx.navigateTo({
116
- url: "/pages/cms/policy/index"
117
- });
118
- }
110
+ this.triggerEvent("policy", id);
119
111
  }
120
112
  }
121
113
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xyvcard-wechat-auth",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",