注册资料
This commit is contained in:
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user