Merge remote-tracking branch 'origin/master' into feature/tongji-endless-game

# Conflicts:
#	TUICallKit-Vue3/tongji/endless-game/README.md
#	TUICallKit-Vue3/tongji/endless-game/index.vue
#	TUICallKit-Vue3/vite.config.ts
This commit is contained in:
大哥大哥的大哥哥
2026-07-18 11:24:59 +08:00
338 changed files with 1029 additions and 681 deletions
+48 -10
View File
@@ -13,9 +13,11 @@
:style="piece.style"
>{{ piece.emoji }}</text>
</view>
<view class="eg-nav" :style="{ paddingTop: safeTop + 'px' }">
<view class="eg-nav-btn" @tap="goBack">
<TongjiIcon name="chevron-left" size="md" color="#155e4b" />
<view class="eg-nav" :style="navStyle">
<view class="eg-nav-leading">
<view class="eg-nav-btn" @tap="goBack">
<TongjiIcon name="chevron-left" size="md" color="#155e4b" />
</view>
</view>
<view class="eg-title-wrap">
<text class="eg-title">控糖消消乐</text>
@@ -299,11 +301,12 @@
<script setup>
import { computed, getCurrentInstance, ref } from 'vue'
import { onLoad, onShareAppMessage, onShareTimeline, onShow, onUnload } from '@dcloudio/uni-app'
import TongjiIcon from './components/TongjiIcon.vue'
import TongjiIcon from '../components/TongjiIcon.vue'
import { useGameSfx } from './composables/useGameSfx.js'
import { useGamePlatform } from './composables/useGamePlatform.js'
import { useGameAuth } from './composables/useGameAuth.js'
import FOOD_IMAGES from 'virtual:tongji-endless-food-images'
const FOOD_IMAGE_BASE_URL = 'https://gz-1349751149.cos.ap-guangzhou.myqcloud.com/games/food/'
const ROWS = 5
const COLS = 4
@@ -371,7 +374,7 @@ const FOODS = {
milkTea: { name: '含糖奶茶', short: '奶茶', emoji: '🧋', color: 'orange', level: 'high', levelLabel: '高糖', high: true, replaceable: true, tip: '含糖奶茶可能同时含有较多添加糖和能量,应关注配方与饮用量。' },
camel: { name: '驼乳', short: '驼乳', emoji: '🥛', color: 'milk', level: 'prop', levelLabel: '道具', product: true }
}
Object.keys(FOODS).forEach((key) => { FOODS[key].img = FOOD_IMAGES[key] || '' })
Object.keys(FOODS).forEach((key) => { FOODS[key].img = `${FOOD_IMAGE_BASE_URL}${key}.jpg` })
const FOOD_GROUPS = [
{ title: '中式早餐', safe: ['egg', 'cucumber', 'corn', 'grainMantou'], danger: 'congee' },
{ title: '家常粥餐', safe: ['celery', 'mushroom', 'chicken', 'taro'], danger: 'centuryCongee' },
@@ -426,7 +429,7 @@ const comboDryTurns = ref(0)
const taskRewardVisible = ref(false)
const taskRewardKey = ref(0)
const statusText = ref('交换相邻食物,三个相同即可消除')
const safeTop = ref(20)
const navStyle = ref({ paddingTop: '20px' })
const touch = { x: 0, y: 0, index: -1 }
const dragIndex = ref(-1)
const dragTarget = ref(-1)
@@ -557,9 +560,36 @@ onShareTimeline(() => {
}
})
function initNavLayout() {
let paddingTop = 20
let paddingRight = uni.upx2px(28)
try {
const info = uni.getSystemInfoSync()
paddingTop = Number(info.safeAreaInsets?.top || info.statusBarHeight) || 20
// #ifdef MP-WEIXIN
const menu = typeof uni.getMenuButtonBoundingClientRect === 'function'
? uni.getMenuButtonBoundingClientRect()
: null
if (menu && menu.width > 0) {
paddingTop = Math.max(paddingTop, Number(menu.top) || 0)
paddingRight = Math.max(
paddingRight,
(Number(info.windowWidth) || 0) - Number(menu.left) + uni.upx2px(8)
)
}
// #endif
} catch (_) {}
navStyle.value = {
paddingTop: `${paddingTop}px`,
paddingRight: `${paddingRight}px`
}
}
onLoad((options = {}) => {
const info = uni.getSystemInfoSync()
safeTop.value = info.safeAreaInsets?.top || info.statusBarHeight || 20
initNavLayout()
bestScore.value = Number(uni.getStorageSync('tongji_endless_best') || 0)
incomingInviteCode = String(options.invite_code || '').trim()
startGame()
@@ -684,7 +714,15 @@ function startGame() {
}
function goBack() {
uni.navigateBack({ fail: () => uni.switchTab({ url: '/pages/index/index' }) })
const pages = getCurrentPages()
if (pages.length > 1) {
uni.navigateBack({
delta: 1,
fail: () => uni.redirectTo({ url: '/tongji/pages/weekly' })
})
return
}
uni.redirectTo({ url: '/tongji/pages/weekly' })
}
function showRules() {