From a6a42525f73eaeb77e532f5f24c4e9ae20067a44 Mon Sep 17 00:00:00 2001 From: km2025 Date: Tue, 20 Jan 2026 17:54:41 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7=E5=B9=B6=E8=B0=83=E6=95=B4=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E9=85=8D=E7=BD=AE=E4=BB=A5=E6=94=AF=E6=8C=81=E7=83=AD?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.config.js | 7 ++-- app/(tabs)/_layout.tsx | 2 +- app/(tabs)/index.tsx | 83 ++++++++++++++++++++++-------------------- 3 files changed, 48 insertions(+), 44 deletions(-) diff --git a/app.config.js b/app.config.js index ee9c324..73ba3d4 100644 --- a/app.config.js +++ b/app.config.js @@ -10,7 +10,7 @@ export const IOS_UNIVERSAL_LINK = 'duooomi.bowong.cn' // 原生版本,原生代码变更时需要更新此版本号 export const VERSION = '1.1.0' // JavaScript版本,JS代码变更时需要更新此版本号 -export const APP_VERSION = 'dev202601191538' +export const APP_VERSION = 'dev202601201650' const ALIPAY_SCHEMA = 'alipay2021006119657394' const ALIPAY_SCHEMA_SANDBOX = 'alipay9021000158673972' @@ -118,8 +118,9 @@ export default ({ config }) => { }, android: { // 解决构建打包时webp导致内存占用过高,临时禁用 - enableProguardInReleaseBuilds: false, - enableShrinkResourcesInReleaseBuilds: false, + // 测试环境不压缩,会导致 developmentClient 构建失败 + enableProguardInReleaseBuilds: true, + enableShrinkResourcesInReleaseBuilds: true, // 增加 Java 堆内存 packagingOptions: { diff --git a/app/(tabs)/_layout.tsx b/app/(tabs)/_layout.tsx index 6d40fe1..983a03c 100644 --- a/app/(tabs)/_layout.tsx +++ b/app/(tabs)/_layout.tsx @@ -18,7 +18,7 @@ const navItems = [ { id: 'index', label: '探索', iconName: 'compass-outline' }, { id: 'generate', label: '生成', iconName: 'image-outline' }, { id: 'sync', label: '同步', iconName: 'refresh' }, - { id: 'explore', label: '蓝牙调试', iconName: 'person-outline' }, + // { id: 'explore', label: '蓝牙调试', iconName: 'person-outline' }, ] function renderNavItem(item: (typeof navItems)[0], isActive: boolean, onRouteChange: (route: string) => void) { diff --git a/app/(tabs)/index.tsx b/app/(tabs)/index.tsx index 31abf0a..b3b71c4 100644 --- a/app/(tabs)/index.tsx +++ b/app/(tabs)/index.tsx @@ -63,6 +63,10 @@ const Index = observer(function Index() { const [loadingMore, setLoadingMore] = useState(false) const [hasMore, setHasMore] = useState(true) + useEffect(() => { + console.log('expo env------------', process.env.EXPO_PUBLIC_ENV) + }, []) + /** ================= refs(核心) ================= */ const queryRef = useRef({ @@ -283,57 +287,56 @@ const Index = observer(function Index() { Toast.showLoading() try { - await userBalanceStore.load(true) + // await userBalanceStore.load(true) const currentBalance = userBalanceStore.balance if (currentBalance < selectedItem.price) { Toast.show({ title: '余额不足,请充值' }) return } + Toast.showModal( + + 生成将消耗 + {selectedItem.price} + + } + onCancel={Toast.hideModal} + onConfirm={async () => { + Toast.hideModal() + Toast.showLoading() + + try { + userBalanceStore.deductBalance(selectedItem.price) + + const { generationId, error } = await runTemplate({ + templateId: selectedItem.id, + data: {}, + }) + await userBalanceStore.load(true) + + if (generationId && user?.id) { + Toast.show({ title: '生成任务开启,请在我的生成中查看' }) + } else { + userBalanceStore.setBalance(userBalanceStore.balance + selectedItem.price) + Toast.show({ title: error?.message || '生成失败' }) + } + } catch (error) { + userBalanceStore.setBalance(userBalanceStore.balance + selectedItem.price) + Toast.show({ title: '网络异常,请重试' }) + } finally { + Toast.hideLoading() + } + }} + />, + ) } catch (error) { Toast.show({ title: '余额加载失败,请重试' }) return } finally { Toast.hideLoading() } - - Toast.showModal( - - 生成将消耗 - {selectedItem.price} - - } - onCancel={Toast.hideModal} - onConfirm={async () => { - Toast.hideModal() - Toast.showLoading() - - try { - userBalanceStore.deductBalance(selectedItem.price) - - const { generationId, error } = await runTemplate({ - templateId: selectedItem.id, - data: {}, - }) - - if (generationId && user?.id) { - await userBalanceStore.load(true) - Toast.show({ title: '生成任务开启,请在我的生成中查看' }) - } else { - userBalanceStore.setBalance(userBalanceStore.balance + selectedItem.price) - Toast.show({ title: error?.message || '生成失败' }) - } - } catch (error) { - userBalanceStore.setBalance(userBalanceStore.balance + selectedItem.price) - Toast.show({ title: '网络异常,请重试' }) - } finally { - Toast.hideLoading() - } - }} - />, - ) } const renderListEmpty = () => { @@ -388,7 +391,7 @@ const Index = observer(function Index() { for (let i = Math.max(0, first - 6); i < first; i++) { if (allItems[i]) currentVisible.add(allItems[i].id) } - for (let i = last + 1; i < Math.min(allItems.length, last - 6); i++) { + for (let i = last + 1; i < Math.min(allItems.length, last - 9); i++) { currentVisible.add(allItems[i].id) } }