consumerm模块完成度90%,完善消费者和商家端数据库表,商品、聊天、订单数据对接好了supabase,和商家端对接了聊天功能,安卓端编译通过了css样式,剩余几个页面在处理函数规范问题
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import supa, { supaReady } from '@/components/supadb/aksupainstance.uts'
|
||||
import type { UserProfile, UserStats } from '@/pages/user/types.uts'
|
||||
import type { UserProfile, UserStats } from '@/types/mall-types.uts'
|
||||
import type { DeviceInfo } from '@/pages/sense/types.uts'
|
||||
import { SenseDataService, type DeviceParams } from '@/pages/sense/senseDataService.uts'
|
||||
import { reactive } from 'vue'
|
||||
@@ -55,13 +55,13 @@ export async function getCurrentUser() : Promise<UserProfile | null> {
|
||||
|
||||
const sessionInfo = supa.getSession()
|
||||
if (sessionInfo.user == null) {
|
||||
state.userProfile = { username: '', email: '' }
|
||||
state.userProfile = { username: '', email: '' } as UserProfile
|
||||
state.isLoggedIn = false // 未登录
|
||||
return null
|
||||
}
|
||||
const userId = sessionInfo.user?.getString("id")
|
||||
if (userId == null) {
|
||||
state.userProfile = { username: '', email: '' }
|
||||
state.userProfile = { username: '', email: '' } as UserProfile
|
||||
state.isLoggedIn = false // 未登录
|
||||
return null
|
||||
} // 查询 ak_users 表补全 profile
|
||||
@@ -88,13 +88,13 @@ export async function getCurrentUser() : Promise<UserProfile | null> {
|
||||
return createdProfile
|
||||
} else {
|
||||
console.error('创建用户资料失败')
|
||||
state.userProfile = { username: '', email: '' }
|
||||
state.userProfile = { username: '', email: '' } as UserProfile
|
||||
state.isLoggedIn = false
|
||||
return null
|
||||
}
|
||||
} else {
|
||||
console.error('会话用户信息为空')
|
||||
state.userProfile = { username: '', email: '' }
|
||||
state.userProfile = { username: '', email: '' } as UserProfile
|
||||
state.isLoggedIn = false
|
||||
return null
|
||||
}
|
||||
@@ -121,7 +121,7 @@ export async function getCurrentUser() : Promise<UserProfile | null> {
|
||||
state.isLoggedIn = true // 登录成功
|
||||
return profile
|
||||
} else {
|
||||
state.userProfile = { username: '', email: '' }
|
||||
state.userProfile = { username: '', email: '' } as UserProfile
|
||||
state.isLoggedIn = false // 未登录
|
||||
return null
|
||||
}
|
||||
@@ -130,7 +130,7 @@ export async function getCurrentUser() : Promise<UserProfile | null> {
|
||||
// 登出并清空用户信息
|
||||
export function logout() {
|
||||
supa.signOut()
|
||||
state.userProfile = { username: '', email: '' }
|
||||
state.userProfile = { username: '', email: '' } as UserProfile
|
||||
state.isLoggedIn = false // 登出
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user