diff --git a/App.uvue b/App.uvue index d2dd69f3..b753fb7e 100644 --- a/App.uvue +++ b/App.uvue @@ -2,16 +2,12 @@ import { setIsLoggedIn, setUserProfile, getCurrentUser } from '@/utils/store.uts' import supa from '@/components/supadb/aksupainstance.uts' - // 自动登录凭据(开发测试用) - const AUTO_LOGIN_EMAIL = 'test@mall.com' - const AUTO_LOGIN_PASSWORD = 'Hf2152111' - export default { onLaunch: function () { console.log('App Launch') - // 尝试自动登录并跳转(使用 Promise 链) - this.tryAutoLogin() + // 检查是否已有有效会话,有则恢复登录状态 + this.checkExistingSession() }, onShow: function () { console.log('App Show') @@ -20,11 +16,11 @@ console.log('App Hide') }, methods: { - tryAutoLogin: function(): void { + checkExistingSession: function(): void { // 检查是否已有有效会话 const session = supa.getSession() if (session.user != null) { - console.log('已有有效会话,跳过自动登录') + console.log('已有有效会话,恢复登录状态') setIsLoggedIn(true) uni.reLaunch({ url: '/pages/mall/consumer/index' }) return @@ -39,49 +35,14 @@ console.log('会话恢复成功') setIsLoggedIn(true) uni.reLaunch({ url: '/pages/mall/consumer/index' }) - return } - // 恢复失败,执行自动登录 - this.doAutoLogin() }).catch(() => { - console.log('会话恢复失败,尝试自动登录') - this.doAutoLogin() + console.log('会话恢复失败,需要重新登录') }) - return } - // 执行自动登录 - this.doAutoLogin() - }, - doAutoLogin: function(): void { - console.log('开始自动登录...') - supa.signIn(AUTO_LOGIN_EMAIL, AUTO_LOGIN_PASSWORD).then((result) => { - if (result.user != null) { - console.log('自动登录成功') - setIsLoggedIn(true) - - // 保存用户ID到本地存储 - const uid = result.user.getString('id') - if (uid != null) { - uni.setStorageSync('user_id', uid) - console.log('用户ID已保存:', uid) - } - - // 获取用户资料 - getCurrentUser().then(() => { - console.log('获取用户资料成功') - }).catch((e) => { - console.log('获取用户资料失败(忽略)') - }) - - // 直接跳转到首页 - uni.reLaunch({ url: '/pages/mall/consumer/index' }) - } else { - console.log('自动登录失败,用户需要手动登录') - } - }).catch((e) => { - console.error('自动登录异常:', e) - }) + // 没有有效会话,显示登录页 + console.log('无有效会话,显示登录页') } } } diff --git a/ak/config.uts b/ak/config.uts index 87731945..b788f2e4 100644 --- a/ak/config.uts +++ b/ak/config.uts @@ -5,11 +5,11 @@ //export const SUPA_URL: string = 'http://192.168.1.61:18000' //export const SUPA_KEY: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlLTEiLCJpYXQiOjE3Njk2NzY0OTgsImV4cCI6MTkyNzM1NjQ5OH0.ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' -export const SUPA_URL: string = 'http://192.168.1.61:18000' +export const SUPA_URL: string = 'http://119.146.131.237:9126' export const SUPA_KEY: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlLTEiLCJpYXQiOjE3Njk2NzY0OTgsImV4cCI6MTkyNzM1NjQ5OH0.ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' // WebSocket 实时连接(内网使用 ws:// 而非 wss://) -export const WS_URL: string = 'ws://192.168.1.61:18000/realtime/v1/websocket' +export const WS_URL: string = 'ws://119.146.131.237:9126/realtime/v1/websocket' //export const WS_URL: string = 'ws://localhost:18000/realtime/v1/websocket' // 备用配置(已注释,如需切换可取消注释) diff --git a/check_icons.py b/check_icons.py new file mode 100644 index 00000000..64b0f0c0 --- /dev/null +++ b/check_icons.py @@ -0,0 +1,20 @@ + +import cv2 +import numpy as np +import os + +def check_icon_brightness(file_path): + if not os.path.exists(file_path): + return None + img = cv2.imread(file_path, cv2.IMREAD_GRAYSCALE) + if img is None: + return None + # 计算非透明区域的平均亮度 + return np.mean(img) + +icon_dir = r'D:\companyproject\mall\pages\mall\consumer\icons' +fav = os.path.join(icon_dir, 'favorite.png') +fav_active = os.path.join(icon_dir, 'favorite-active.png') + +print(f"favorite.png brightness: {check_icon_brightness(fav)}") +print(f"favorite-active.png brightness: {check_icon_brightness(fav_active)}") diff --git a/components/supadb/aksupa.uts b/components/supadb/aksupa.uts index 3254a1c1..c96b9faa 100644 --- a/components/supadb/aksupa.uts +++ b/components/supadb/aksupa.uts @@ -442,41 +442,24 @@ export class AkSupaQueryBuilder { if (res["data"] == null) res["data"] = {}; return res; } // 新增:支持类型转换的执行方法 - async executeAs() : Promise>> { + async executeAs() : Promise> { const result = await this.execute(); - // 如果原始 data 是 null,直接返回 null if (result.data == null) { - const aaa = { - status: result.status, - data: null, - headers: result.headers, - error: result.error, - total: result.total, - page: result.page, - limit: result.limit, - hasmore: result.hasmore, - origin: result.origin - } - return aaa; + return result as AkReqResponse; } - // 尝试类型转换 - let convertedData : T | Array | null = null; + let convertedData : any | null = null; try { if (Array.isArray(result.data)) { - // 处理数组数据 const dataArray = result.data; - const convertedArray : Array = []; - //console.log(convertedArray) + const convertedArray : Array = []; for (let i = 0; i < dataArray.length; i++) { const item = dataArray[i]; if (item instanceof UTSJSONObject) { // #ifdef APP-ANDROID - // //console.log(item) const parsed = item.parse(); - // //console.log('ak parsed') // #endif // #ifndef APP-ANDROID const parsed = item as T; @@ -485,10 +468,9 @@ export class AkSupaQueryBuilder { convertedArray.push(parsed); } else { console.warn('转换失败,使用原始对象:', item); - convertedArray.push(item as T); + convertedArray.push(item); } } else { - // 将普通对象转换为 UTSJSONObject 后再 parse const jsonObj = new UTSJSONObject(item); // #ifdef APP-ANDROID const parsed = jsonObj.parse(); @@ -501,15 +483,14 @@ export class AkSupaQueryBuilder { } else { console.warn('转换失败,使用原始对象:', item); - convertedArray.push(item as T); + convertedArray.push(item); } } } convertedData = convertedArray; } else { - // 处理单个对象 - const convertedArray : Array = []; + const convertedArray : Array = []; if (result.data instanceof UTSJSONObject) { const parsed = result.data.parse(); @@ -534,23 +515,10 @@ export class AkSupaQueryBuilder { } catch (e) { console.warn('数据类型转换失败,使用原始数据:', e); console.log(result.data) - // 转换失败时,使用原始数据 - convertedData = result.data as T | Array; + convertedData = result.data as any; } result.data = convertedData - const aaa = result as AkReqResponse - // const aaa = { - // status: result.status, - // data: convertedData, - // headers: result.headers, - // error: result.error, - // total: result.total, - // page: result.page, - // limit: result.limit, - // hasmore: result.hasmore, - // origin: result.origin - // } - return aaa; + return result as AkReqResponse; } } diff --git a/pages.json b/pages.json index fa41ce4d..49e5bf31 100644 --- a/pages.json +++ b/pages.json @@ -914,32 +914,32 @@ { "pagePath": "pages/mall/consumer/index", "text": "首页", - "iconPath": "static/tabbar/home.svg", - "selectedIconPath": "static/tabbar/home-active.svg" + "iconPath": "static/tabbar/home.png", + "selectedIconPath": "static/tabbar/home.png" }, { "pagePath": "pages/mall/consumer/category", "text": "分类", - "iconPath": "static/tabbar/category.svg", - "selectedIconPath": "static/tabbar/category-active.svg" + "iconPath": "static/tabbar/category.png", + "selectedIconPath": "static/tabbar/category.png" }, { "pagePath": "pages/mall/consumer/messages", "text": "消息", - "iconPath": "static/tabbar/messages.svg", - "selectedIconPath": "static/tabbar/messages-active.svg" + "iconPath": "static/tabbar/message.png", + "selectedIconPath": "static/tabbar/message.png" }, { "pagePath": "pages/mall/consumer/cart", "text": "购物车", - "iconPath": "static/tabbar/cart.svg", - "selectedIconPath": "static/tabbar/cart-active.svg" + "iconPath": "static/tabbar/cart.png", + "selectedIconPath": "static/tabbar/cart.png" }, { "pagePath": "pages/mall/consumer/profile", "text": "我的", - "iconPath": "static/tabbar/profile.svg", - "selectedIconPath": "static/tabbar/profile-active.svg" + "iconPath": "static/tabbar/user.png", + "selectedIconPath": "static/tabbar/user.png" } ] }, diff --git a/pages/mall/consumer/address-edit.uvue b/pages/mall/consumer/address-edit.uvue index 5ac79432..660d461d 100644 --- a/pages/mall/consumer/address-edit.uvue +++ b/pages/mall/consumer/address-edit.uvue @@ -1,52 +1,70 @@ -