home.ts
1.3 KB
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
// index.ts// app.ts
import { HTTPService as HTTP } from "../../services/HTTPService";
// 获取应用实例
import minaEnv from "../../utils/minaEnv";
import { API_CONST } from "./../../api/smartElectric";
// @ts-ignore
const app = getApp<IAppOption>();
Page({
data: {
url: "",
userInfoObj: {}
},
onLoad() {
this.__getUserInfoDetail()
},
handleGetMessage(e: any) {
console.log(e, 'handleGetMessagehandleGetMessage')
},
loadSuccess() {
console.log('网页加载成功!!!')
},
onShow() {
// let pages = getCurrentPages();
// console.log(pages)
},
gotoAcount() {
const userInfoStr = JSON.stringify(this.data.userInfoObj)
wx.navigateTo({ url: `/pages/acount/acount?userInfoStr=${userInfoStr}` })
},
onReady() { },
__getUserInfoDetail() {
HTTP.GET({
...API_CONST.home.userInfoDetail,
payload: {
corpCode: "hczd",
cookieFlag: true
}
}).then((res: any) => {
console.log(res, 'rrreeesss')
const arr = res.data.dataTitle.split("")
const lastName = arr[arr.length-1]
console.log(arr,'pppppparrr')
if (res.success) {
this.setData({
userInfoObj: {...res.data,lastName}
})
}else {
this.setData({
userInfoObj: {}
})
}
})
},
});