xyvcard-wechat-auth 0.0.17 → 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
|
-
|
|
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
|
},
|