初步完成merchant和admin不同role的展示内容逻辑3
This commit is contained in:
@@ -1110,8 +1110,7 @@ async delete(table : string, filter : string | null) : Promise<AkReqResponse<any
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.removeStorageSync('user_id');
|
// completely removed global storage clearing
|
||||||
uni.removeStorageSync('token');
|
|
||||||
|
|
||||||
uni.reLaunch({ url: '/pages/user/login' });
|
uni.reLaunch({ url: '/pages/user/login' });
|
||||||
throw toUniError('登录已过期,请重新登录', '用户认证失败');
|
throw toUniError('登录已过期,请重新登录', '用户认证失败');
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="subscribe-checkout">
|
<view class="subscribe-checkout">
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<text class="title">确认订阅</text>
|
<text class="title">确认订阅</text>
|
||||||
@@ -91,7 +91,7 @@ const selPay = (v: number) => { payMethod.value = v }
|
|||||||
|
|
||||||
// 获取当前用户ID(按现有store实现替换)
|
// 获取当前用户ID(按现有store实现替换)
|
||||||
const getCurrentUserId = (): string => {
|
const getCurrentUserId = (): string => {
|
||||||
try { return (uni.getStorageSync('current_user_id') as string) || '' } catch { return '' }
|
try { return (supa.getSession().user?.id as string) || '' } catch { return '' }
|
||||||
}
|
}
|
||||||
|
|
||||||
const confirmSubscribe = async () => {
|
const confirmSubscribe = async () => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="page" :style="cssVars">
|
<view class="page" :style="cssVars">
|
||||||
<!-- Header:仅保留左侧Logo -->
|
<!-- Header:仅保留左侧Logo -->
|
||||||
<view class="header">
|
<view class="header">
|
||||||
@@ -339,7 +339,7 @@ const handleLogin = async () => {
|
|||||||
class_id: ''
|
class_id: ''
|
||||||
} as UserProfile
|
} as UserProfile
|
||||||
setUserProfile(adminProfile)
|
setUserProfile(adminProfile)
|
||||||
uni.setStorageSync('merchant_id', 'admin') // mock
|
// uni.setStorageSync('merchant_id', 'admin') // mock removed
|
||||||
|
|
||||||
uni.showToast({ title: '管理员登录成功', icon: 'success' })
|
uni.showToast({ title: '管理员登录成功', icon: 'success' })
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -422,14 +422,8 @@ const handleLogin = async () => {
|
|||||||
console.error('获取用户信息失败(忽略):', e)
|
console.error('获取用户信息失败(忽略):', e)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 显式保存用户ID到本地存储
|
// 已移除对 shared storage user_id 的依赖
|
||||||
const currentSession = supa.getSession()
|
const currentSession = supa.getSession()
|
||||||
if (currentSession.user != null) {
|
|
||||||
const uid = currentSession.user?.getString('id')
|
|
||||||
if (uid != null) {
|
|
||||||
uni.setStorageSync('user_id', uid)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uni.showToast({ title: '登录成功', icon: 'success' })
|
uni.showToast({ title: '登录成功', icon: 'success' })
|
||||||
|
|
||||||
|
|||||||
@@ -126,9 +126,8 @@ class SupabaseService {
|
|||||||
return session.user.getString('id')
|
return session.user.getString('id')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 后备:尝试从本地存储获取 (兼容旧逻辑)
|
// 移除基于 storage 的后备获取,严格只认当前 Tab 独立 session
|
||||||
const userId = uni.getStorageSync('user_id')
|
return null
|
||||||
return userId ? userId as string : null
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('获取用户ID失败:', e)
|
console.error('获取用户ID失败:', e)
|
||||||
return null
|
return null
|
||||||
|
|||||||
Reference in New Issue
Block a user