feat: add account profile, search, help and security features
1. add default avatar and multiple notification icons 2. update finance archive note and add form styles 3. add new pages: edit-profile, security, password, change-phone, search, help 4. refactor navigation action layout to support multiple actions 5. add search button to home page 6. add security code component and account service APIs 7. add help and search content services 8. update message notice to use svg icons 9. update asset section in finance assessment 10. update manifest appid and pack options
This commit is contained in:
+30
-4
@@ -2,13 +2,15 @@ export type AssessmentForm = {
|
||||
name: string, idCard: string, phone: string, city: string, maritalStatus: string,
|
||||
occupation: string, company: string, monthlyIncome: string, socialSecurity: string,
|
||||
housingFund: string, house: string, car: string, savings: string, creditCard: string,
|
||||
creditLoanCount: string, totalDebtBalance: string, monthlyLoanPayment: string,
|
||||
creditCardCount: string, creditCardTotalLimit: string, creditCardUsedLimit: string,
|
||||
otherAssets: string, enterpriseName: string, businessCode: string, annualRevenue: string, operatingYears: string
|
||||
}
|
||||
export type SelectedDocument = { name: string, path: string }
|
||||
export type DataAuthorization = { key: string, name: string, selected: boolean }
|
||||
|
||||
export function emptyAssessmentForm(): AssessmentForm {
|
||||
return { name: '', idCard: '', phone: '', city: '', maritalStatus: '', occupation: '', company: '', monthlyIncome: '', socialSecurity: '', housingFund: '', house: '', car: '', savings: '', creditCard: '', otherAssets: '', enterpriseName: '', businessCode: '', annualRevenue: '', operatingYears: '' }
|
||||
return { name: '', idCard: '', phone: '', city: '', maritalStatus: '', occupation: '', company: '', monthlyIncome: '', socialSecurity: '', housingFund: '', house: '', car: '', savings: '', creditCard: '', otherAssets: '', creditLoanCount: '', totalDebtBalance: '', monthlyLoanPayment: '', creditCardCount: '', creditCardTotalLimit: '', creditCardUsedLimit: '', enterpriseName: '', businessCode: '', annualRevenue: '', operatingYears: '' }
|
||||
}
|
||||
export function draftText(saved: UTSJSONObject, key: string): string {
|
||||
const value = saved[key]
|
||||
@@ -35,10 +37,32 @@ export function formFromDraft(saved: UTSJSONObject): AssessmentForm {
|
||||
return {
|
||||
name: draftText(saved, 'name'), idCard: draftText(saved, 'idCard'), phone: draftText(saved, 'phone'), city: draftText(saved, 'city'), maritalStatus: draftText(saved, 'maritalStatus'),
|
||||
occupation: draftText(saved, 'occupation'), company: draftText(saved, 'company'), monthlyIncome: draftText(saved, 'monthlyIncome'), socialSecurity: draftText(saved, 'socialSecurity'), housingFund: draftText(saved, 'housingFund'),
|
||||
house: draftText(saved, 'house'), car: draftText(saved, 'car'), savings: draftText(saved, 'savings'), creditCard: draftText(saved, 'creditCard'), otherAssets: draftText(saved, 'otherAssets'),
|
||||
house: ownershipFromDraft(saved, 'house'), car: ownershipFromDraft(saved, 'car'), savings: draftText(saved, 'savings'), creditCard: draftText(saved, 'creditCard'), otherAssets: draftText(saved, 'otherAssets'),
|
||||
creditLoanCount: draftText(saved, 'creditLoanCount'), totalDebtBalance: draftText(saved, 'totalDebtBalance'), monthlyLoanPayment: draftText(saved, 'monthlyLoanPayment'),
|
||||
creditCardCount: draftText(saved, 'creditCardCount'), creditCardTotalLimit: draftText(saved, 'creditCardTotalLimit'), creditCardUsedLimit: draftText(saved, 'creditCardUsedLimit'),
|
||||
enterpriseName: draftText(saved, 'enterpriseName'), businessCode: draftText(saved, 'businessCode'), annualRevenue: draftText(saved, 'annualRevenue'), operatingYears: draftText(saved, 'operatingYears')
|
||||
}
|
||||
}
|
||||
export function ownershipFromDraft(saved: UTSJSONObject, key: string): string {
|
||||
const value = draftText(saved, key)
|
||||
if (value == '有' || value == '无') return value
|
||||
if (value == '无房产' || value == '无车辆') return '无'
|
||||
if (['全款房产', '按揭房产', '全款车辆', '按揭车辆'].includes(value)) return '有'
|
||||
return ''
|
||||
}
|
||||
export function assetValidationMessage(form: AssessmentForm): string {
|
||||
const counts = [form.creditLoanCount, form.creditCardCount]
|
||||
const countLabels = ['信用贷款笔数', '银行信用卡张数']
|
||||
for (let i = 0; i < counts.length; i++) {
|
||||
if (counts[i].length > 0 && !/^[0-9]{1,4}$/.test(counts[i])) return countLabels[i] + '请输入非负整数'
|
||||
}
|
||||
const amounts = [form.totalDebtBalance, form.monthlyLoanPayment, form.creditCardTotalLimit, form.creditCardUsedLimit]
|
||||
const amountLabels = ['欠款总余额', '贷款月还款金额', '总额度', '已使用总额度']
|
||||
for (let i = 0; i < amounts.length; i++) {
|
||||
if (amounts[i].length > 0 && !/^[0-9]{1,12}([.][0-9]{1,2})?$/.test(amounts[i])) return amountLabels[i] + '请输入有效金额,最多两位小数'
|
||||
}
|
||||
return ''
|
||||
}
|
||||
export function documentsFromDraft(saved: UTSJSONObject): SelectedDocument[] {
|
||||
const results: SelectedDocument[] = []
|
||||
const items = saved['documents'] as UTSJSONObject[] | null
|
||||
@@ -56,6 +80,8 @@ export function saveAssessmentDraft(type: string, step: number, form: Assessment
|
||||
type, step, name: form.name, idCard: form.idCard, phone: form.phone, city: form.city, maritalStatus: form.maritalStatus,
|
||||
occupation: form.occupation, company: form.company, monthlyIncome: form.monthlyIncome, socialSecurity: form.socialSecurity, housingFund: form.housingFund,
|
||||
house: form.house, car: form.car, savings: form.savings, creditCard: form.creditCard, otherAssets: form.otherAssets,
|
||||
creditLoanCount: form.creditLoanCount, totalDebtBalance: form.totalDebtBalance, monthlyLoanPayment: form.monthlyLoanPayment,
|
||||
creditCardCount: form.creditCardCount, creditCardTotalLimit: form.creditCardTotalLimit, creditCardUsedLimit: form.creditCardUsedLimit,
|
||||
enterpriseName: form.enterpriseName, businessCode: form.businessCode, annualRevenue: form.annualRevenue, operatingYears: form.operatingYears,
|
||||
documents: files, authorizations: grants, documentConsent, dataConsent
|
||||
}
|
||||
@@ -74,9 +100,9 @@ export function assessmentProgress(type: string): AssessmentProgress {
|
||||
if (saved == null) return { percent: 0, basicDone: false, incomeDone: false, assetsDone: false, authorizationSelected: false }
|
||||
const basic = type == 'enterprise' ? ['enterpriseName', 'businessCode', 'name', 'phone', 'city'] : ['name', 'idCard', 'phone', 'city', 'maritalStatus']
|
||||
const income = type == 'enterprise' ? ['occupation', 'operatingYears', 'annualRevenue'] : ['occupation', 'company', 'monthlyIncome', 'socialSecurity', 'housingFund']
|
||||
const assets = ['house', 'car', 'savings', 'creditCard']
|
||||
const assets = ['house', 'car', 'creditLoanCount', 'totalDebtBalance', 'monthlyLoanPayment', 'creditCardCount', 'creditCardTotalLimit', 'creditCardUsedLimit']
|
||||
const keys = basic.concat(income).concat(assets)
|
||||
const filled = keys.filter((key) => draftText(saved, key).trim().length > 0).length
|
||||
const grants = saved['authorizations'] as string[] | null
|
||||
return { percent: Math.round(filled / keys.length * 100), basicDone: basic.every((key) => draftText(saved, key).length > 0), incomeDone: income.every((key) => draftText(saved, key).length > 0), assetsDone: assets.every((key) => draftText(saved, key).length > 0), authorizationSelected: documentsFromDraft(saved).length > 0 || (grants != null && grants.length > 0) }
|
||||
return { percent: Math.round(filled / keys.length * 100), basicDone: basic.every((key) => draftText(saved, key).length > 0), incomeDone: income.every((key) => draftText(saved, key).length > 0), assetsDone: assets.every((key) => draftText(saved, key).trim().length > 0) && assetValidationMessage(formFromDraft(saved)).length == 0, authorizationSelected: documentsFromDraft(saved).length > 0 || (grants != null && grants.length > 0) }
|
||||
}
|
||||
|
||||
+5
-4
@@ -7,7 +7,7 @@ export type PageLayout = {
|
||||
statusStyle: (offset: number) => string,
|
||||
navigationStyle: () => string,
|
||||
navigationTitleStyle: () => string,
|
||||
navigationActionStyle: (headerHeight: number) => string,
|
||||
navigationActionStyle: (headerHeight: number, actionCount: number) => string,
|
||||
navigationBrandStyle: (headerHeight: number) => string,
|
||||
bottomStyle: (padding: number) => string
|
||||
}
|
||||
@@ -63,13 +63,14 @@ export function usePageLayout(): PageLayout {
|
||||
return ''
|
||||
// #endif
|
||||
}
|
||||
const navigationActionStyle = (headerHeight: number): string => {
|
||||
// 微信通知按钮与系统胶囊等高、顶部对齐;App 保持导航行内居中。
|
||||
const navigationActionStyle = (headerHeight: number, actionCount: number): string => {
|
||||
// 微信操作按钮与胶囊等高、顶部对齐,整组向左展开;App 保持导航行内居中。
|
||||
// #ifdef MP-WEIXIN
|
||||
const size = capsuleHeight.value > 0 ? capsuleHeight.value : 32
|
||||
const top = capsuleHeight.value > 0 ? Math.max(0, capsuleTop.value - status()) : Math.max(0, (rpx(headerHeight) - size) / 2)
|
||||
const right = capsuleLeft.value > 0 ? windowInfo.value.windowWidth - capsuleLeft.value + 8 : 104
|
||||
return 'position:absolute;top:' + top + 'px;right:' + right + 'px;width:' + size + 'px;height:' + size + 'px;'
|
||||
const width = size * actionCount + rpx(16) * Math.max(0, actionCount - 1)
|
||||
return 'position:absolute;top:' + top + 'px;right:' + right + 'px;width:' + width + 'px;height:' + size + 'px;'
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
return ''
|
||||
|
||||
Reference in New Issue
Block a user