Index.ets
4.9 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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import HomePage from '../components/HomePage'
import MainPage from '../components/MainPage'
import DialogTip from '../dialog/DialogTip'
import { personData, companyData, personCertificateTest, personCertificateRow } from '../api/userType'
import { getPersonalCertificate } from '../api/user'
import preferencesUtil from '../utils/preferences'
import { getNoticeDetail, noticeRow, noticeDetailTest } from '../api/notice'
import { AxiosResponse } from '@ohos/axios'
@Entry
@Component
struct Index {
// 通知公告
@State noticeInfo: noticeRow = {
noticeTitle: '',
noticeContent: '',
noticeType: '2'
}
// 证书信息
@State personCertificateInfo: personCertificateRow = {
certificateName: '',
certificateLevel: '',
certificateNo: '',
certificateId: 1,
certificateImg: '',
issueDate: ''
}
// 是否为编辑
@State isEdit: boolean = false
async aboutToAppear() {
const noticeRes: AxiosResponse<noticeDetailTest> = await getNoticeDetail(13)
this.noticeInfo = noticeRes.data.data
if (this.noticeInfo.noticeContent !== '') {
this.dialogController.open()
}
}
@State userInfo: personData = {
createBy: '',
createTime: '',
updateBy: '',
updateTime: '',
remark: '',
personId: 0,
personName: '',
email: '',
gender: '',
birthDate: '',
idNo: '',
phone: '',
personalImg: '',
idImgFront: '',
idImgBack: '',
address: '',
userId: 0,
username: '',
state: '',
companyId: 0,
}
@State companyInfo: companyData = {
createBy: null,
createTime: null,
updateBy: null,
updateTime: '',
remark: null,
companyId: 65,
companyName: '',
province: '',
city: '',
county: '',
address: '',
legalPerson: null,
lpTel: null,
linkMan: '',
lmTel: '',
companyTel: null,
fax: null,
postCode: null,
email: '',
website: null,
floorage: 0,
siteVoucher: '',
businessLicenseNo: '',
businessStartTime: null,
businessEndTime: null,
businessLicensePic: '',
businessScope: null,
peopleNum: 0,
companyIntroduce: null,
registeredCapital: null,
compangyPic: '',
memo: null,
state: '',
companyType: '',
isShow: null,
isValidVedio: null,
userId: 0,
username: '',
level: null,
regionCode: null,
levelModifyDate: null,
endTime: '',
}
roleName = preferencesUtil.get('XF_ROLE_NAME', '')
async onPageShow() {
let personId = preferencesUtil.get('XF_PERSON_ID', 0)
if(preferencesUtil.get('XF_PERSON_INFO', '') !== '') {
this.userInfo = JSON.parse(preferencesUtil.get('XF_PERSON_INFO', '') as string)
}
if(preferencesUtil.get('XF_COMPANY_INFO', '') !== '') {
this.companyInfo = JSON.parse(preferencesUtil.get('XF_COMPANY_INFO', '') as string)
}
if(this.roleName == 'person' || this.roleName == 'unapprovedPerson') {
// 获取个人证书信息
const result: AxiosResponse<personCertificateTest> = await getPersonalCertificate({pageNum: 1, pageSize: 10, personId: Number(personId)})
this.isEdit = result.data.rows.length > 0
if(result.data.rows.length > 0) {
this.personCertificateInfo = result.data.rows[0]
}
}
}
@State currentIndex: number = 0
@Builder tabBuilder(title: string, targetIndex: number, selectedImg: Resource, normalImg: Resource) {
Column({space: 5}) {
Image(this.currentIndex === targetIndex ? selectedImg : normalImg)
.size({ width: 25, height: 25 })
Text(title)
.fontColor(this.currentIndex === targetIndex ? '#6D9DFF' : '#999')
}
.width('100%')
.height(50)
.justifyContent(FlexAlign.Center)
}
dialogController: CustomDialogController = new CustomDialogController({
builder: DialogTip({
noticeDetail: this.noticeInfo
}),
autoCancel: false,
cornerRadius: 10
})
build() {
Tabs({barPosition: BarPosition.End}){
TabContent() {
HomePage()
}.layoutWeight(1)
.tabBar(this.tabBuilder('首页', 0, $r('app.media.home_active'), $r('app.media.home')))
TabContent() {
MainPage({
userInfo: this.userInfo,
companyInfo: this.companyInfo,
personCertificateInfo: this.personCertificateInfo,
isEdit: this.isEdit
})
}
.tabBar(this.tabBuilder('我的', 1, $r('app.media.my_active'), $r('app.media.my')))
}.width('100%').height('100%').onChange(async (index) => {
this.currentIndex = index
})
}
}