feat(auth): 添加统一认证工具和优化登录流程
- 新增 auth 工具模块,包含 isLoggedIn、goToRegister、ensureLoggedIn 方法 - 将硬编码的服务器URL更新为 glt-server 域名 - 重构多个页面的登录检查逻辑,使用统一的认证工具 - 在用户注册/登录流程中集成邀请关系处理 - 更新注册页面配置和实现,支持跳转参数传递 - 优化分销商二维码页面的加载状态和错误处理 - 在水票使用页面添加无票时的购买引导 - 统一文件上传和API请求的服务器地址 - 添加加密库类型定义文件
This commit is contained in:
@@ -9,6 +9,7 @@ import {getSelectedStoreFromStorage} from '@/utils/storeSelection'
|
||||
import {listShopStoreUser} from '@/api/shop/shopStoreUser'
|
||||
import {getShopStore} from '@/api/shop/shopStore'
|
||||
import type {ShopStore as ShopStoreModel} from '@/api/shop/shopStore/model'
|
||||
import { goToRegister } from '@/utils/auth'
|
||||
|
||||
const StoreIndex: React.FC = () => {
|
||||
const themeStyles = useThemeStyles()
|
||||
@@ -43,7 +44,7 @@ const StoreIndex: React.FC = () => {
|
||||
|
||||
const navigateToPage = (url: string) => {
|
||||
if (!isLoggedIn) {
|
||||
Taro.showToast({title: '请先登录', icon: 'none', duration: 1500})
|
||||
goToRegister({ redirect: '/store/index' })
|
||||
return
|
||||
}
|
||||
Taro.navigateTo({url})
|
||||
@@ -121,8 +122,8 @@ const StoreIndex: React.FC = () => {
|
||||
<View className="bg-white rounded-xl p-4">
|
||||
<Text className="text-gray-700">请先登录后再进入门店中心</Text>
|
||||
<View className="mt-3">
|
||||
<Button type="primary" onClick={() => Taro.navigateTo({url: '/passport/login'})}>
|
||||
去登录
|
||||
<Button type="primary" onClick={() => goToRegister({ redirect: '/store/index' })}>
|
||||
去注册/登录
|
||||
</Button>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user