feat(auth): 添加统一认证工具和优化登录流程

- 新增 auth 工具模块,包含 isLoggedIn、goToRegister、ensureLoggedIn 方法
- 将硬编码的服务器URL更新为 glt-server 域名
- 重构多个页面的登录检查逻辑,使用统一的认证工具
- 在用户注册/登录流程中集成邀请关系处理
- 更新注册页面配置和实现,支持跳转参数传递
- 优化分销商二维码页面的加载状态和错误处理
- 在水票使用页面添加无票时的购买引导
- 统一文件上传和API请求的服务器地址
- 添加加密库类型定义文件
This commit is contained in:
2026-02-13 21:30:58 +08:00
parent 52ef8d4199
commit e22cfe4646
23 changed files with 712 additions and 154 deletions

View File

@@ -21,7 +21,7 @@ export async function uploadOssByPath(filePath: string) {
let stsExpired = Taro.getStorageSync('stsExpiredAt');
if (!sts || (stsExpired && dayjs().isBefore(dayjs(stsExpired)))) {
// @ts-ignore
const {data: {data: {credentials}}} = await request.get(`https://server.websoft.top/api/oss/getSTSToken`)
const {data: {data: {credentials}}} = await request.get(`https://gle-server.websoft.top/api/oss/getSTSToken`)
Taro.setStorageSync('sts', credentials)
Taro.setStorageSync('stsExpiredAt', credentials.expiration)
sts = credentials
@@ -49,7 +49,7 @@ export async function uploadOssByPath(filePath: string) {
})
}
const computeSignature = (accessKeySecret, canonicalString) => {
const computeSignature = (accessKeySecret: string, canonicalString: string): string => {
return crypto.enc.Base64.stringify(crypto.HmacSHA1(canonicalString, accessKeySecret));
}
@@ -66,7 +66,7 @@ export async function uploadFile() {
const tempFilePath = res.tempFilePaths[0];
// 上传图片到OSS
Taro.uploadFile({
url: 'https://server.websoft.top/api/oss/upload',
url: 'https://glt-server.websoft.top/api/oss/upload',
filePath: tempFilePath,
name: 'file',
header: {