注册资料

This commit is contained in:
xiaoxiao
2025-05-20 14:23:03 +08:00
parent f821535e18
commit 09a6f13e1d
80 changed files with 1102 additions and 1038 deletions
+17
View File
@@ -2,6 +2,7 @@ import { preferences } from '@kit.ArkData'
import { router } from '@kit.ArkUI'
import { Data } from '../models/LoginInfoModel'
import { ExpertData } from '../models/RequestDefaultModel'
import { BusinessError } from '@kit.BasicServicesKit'
export interface HdUser {
id: string
@@ -38,6 +39,18 @@ class AuthStore {
await this.getStore().flush()
}
async setPerfactUser(mobile:string,user:ExpertData) {
AppStorage.setOrCreate('mobile', mobile)
await this.getStore().put(mobile, JSON.stringify(user))
await this.getStore().flush((err:BusinessError)=>{
if (err) {
console.error('保存失败',err.code,err.message)
} else {
console.info('保存成功',JSON.stringify(user))
}
})
}
async delUser() {
AppStorage.setOrCreate('user', {})
await this.getStore().put(AUTH_STORE_KEY, '{}')
@@ -53,6 +66,10 @@ class AuthStore {
return AppStorage.get<Data>('user') || {} as Data
}
getPerfactUser(phone:string) {
return AppStorage.get<ExpertData>(phone) || {} as ExpertData
}
checkAuth(options: router.RouterOptions | Function) {
// if (this.getUser().token) {
// if (typeof options === 'function') {