Add check-in feature and update travel planner UI

This commit is contained in:
周瑞哲
2026-07-31 12:50:14 +08:00
parent ac4179086c
commit 3ef7266591
44 changed files with 2919 additions and 144 deletions
+29
View File
@@ -11,6 +11,8 @@ const expectedPages = [
'pages/itinerary/index',
'pages/planner/index',
'pages/poi/detail',
'pages/check-in/index',
'pages/check-in/records',
]
const expectedTabPages = [
'pages/map/index',
@@ -42,6 +44,29 @@ if (missingFiles.length > 0) {
}
const appConfig = JSON.parse(readFileSync(resolve(outputRoot, 'app.json'), 'utf8'))
if (appConfig.lazyCodeLoading !== 'requiredComponents') {
console.error(`组件按需注入配置错误:期望 requiredComponents,实际为 ${appConfig.lazyCodeLoading ?? '未配置'}`)
process.exit(1)
}
const checkInPageScript = readFileSync(resolve(outputRoot, 'pages/check-in/index.js'), 'utf8')
const checkInPageMarkup = readFileSync(resolve(outputRoot, 'pages/check-in/index.wxml'), 'utf8')
if (!checkInPageScript.includes('requirePrivacyAuthorize')
|| !checkInPageMarkup.includes('open-type="agreePrivacyAuthorization"')) {
console.error('打卡页缺少微信位置隐私授权兼容链。')
process.exit(1)
}
const poiDetailMarkup = readFileSync(resolve(outputRoot, 'pages/poi/detail.wxml'), 'utf8')
const checkInEntryIndex = poiDetailMarkup.indexOf('check-in-entry')
const checkInEntryStart = poiDetailMarkup.lastIndexOf('<view', checkInEntryIndex)
const checkInEntryEnd = poiDetailMarkup.indexOf('>', checkInEntryIndex)
const checkInEntryTag = checkInEntryIndex >= 0 && checkInEntryStart >= 0 && checkInEntryEnd >= 0
? poiDetailMarkup.slice(checkInEntryStart, checkInEntryEnd + 1)
: ''
const visibilityAttributes = ['wx:if=', 'wx:elif=', 'wx:else', 'hidden=']
if (!checkInEntryTag || visibilityAttributes.some(attribute => checkInEntryTag.includes(attribute))) {
console.error('景点详情页必须无条件渲染打卡入口。')
process.exit(1)
}
const expectedPrivateInfos = ['getLocation', 'startLocationUpdate', 'onLocationChange']
const configuredPrivateInfos = appConfig.requiredPrivateInfos ?? []
if (JSON.stringify(configuredPrivateInfos) !== JSON.stringify(expectedPrivateInfos)) {
@@ -55,6 +80,10 @@ if (locationPermissionDescriptionLength < 1 || locationPermissionDescriptionLeng
console.error('app.json 缺少 scope.userLocation 用途说明。')
process.exit(1)
}
if (!locationPermissionDescription.includes('打卡')) {
console.error('scope.userLocation 用途说明未覆盖到点打卡。')
process.exit(1)
}
const missingPages = expectedPages.filter(page => !appConfig.pages?.includes(page))
if (missingPages.length > 0) {