继续完善购物逻辑闭环,consumer模块完成度75%
This commit is contained in:
@@ -85,8 +85,9 @@
|
||||
<script lang="uts">
|
||||
import {HOME_REDIRECT,TABORPAGE} from '@/ak/config.uts'
|
||||
import type { AkReqOptions, AkReqResponse, AkReqError } from '@/uni_modules/ak-req/index.uts';
|
||||
import supa from '@/components/supadb/aksupainstance.uts';
|
||||
import { getCurrentUser, logout } from '@/utils/store.uts';
|
||||
import { supabase as supa } from '@/components/supadb/aksupainstance.uts';
|
||||
import { getCurrentUser, logout, setUserProfile, setIsLoggedIn } from '@/utils/store.uts';
|
||||
import type { UserProfile } from '@/types/mall-types.uts';
|
||||
import { switchLocale, getCurrentLocale } from '@/utils/utils.uts';
|
||||
|
||||
export default {
|
||||
@@ -190,7 +191,7 @@
|
||||
} else {
|
||||
uni.removeStorageSync('rememberEmail');
|
||||
} // Call signin method from Supabase
|
||||
const result = await supa.signIn(
|
||||
/* const result = await supa.signIn(
|
||||
this.email,
|
||||
this.password);
|
||||
if (result.user !== null) {
|
||||
@@ -204,7 +205,31 @@
|
||||
return;
|
||||
} else {
|
||||
throw new Error(this.$t('user.login.login_failed'));
|
||||
}
|
||||
} */
|
||||
|
||||
// MOCK LOGIN START
|
||||
const mockProfile = {
|
||||
id: 'mock-user-id-123',
|
||||
username: 'Mock User',
|
||||
email: this.email,
|
||||
role: 'consumer',
|
||||
avatar_url: '/static/avatar/default.png',
|
||||
bio: 'This is a mock user.',
|
||||
preferred_language: 'zh-CN',
|
||||
created_at: new Date().toISOString(),
|
||||
updated_at: new Date().toISOString()
|
||||
} as UserProfile;
|
||||
|
||||
setUserProfile(mockProfile);
|
||||
setIsLoggedIn(true);
|
||||
|
||||
// 模拟延迟
|
||||
await new Promise(resolve => setTimeout(resolve, 500));
|
||||
|
||||
uni.showToast({ title: this.$t('user.login.login_success'), icon: 'success' });
|
||||
uni.switchTab({ url: '/pages/mall/consumer/index' });
|
||||
// MOCK LOGIN END
|
||||
|
||||
} catch (err) {
|
||||
console.error("Login error:", err);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user