diff --git a/JY-Salon-WeChat/pages/appointment-form/index.js b/JY-Salon-WeChat/pages/appointment-form/index.js index c1688791..348ce6c6 100644 --- a/JY-Salon-WeChat/pages/appointment-form/index.js +++ b/JY-Salon-WeChat/pages/appointment-form/index.js @@ -598,6 +598,7 @@ Page({ }, customerOptions: [], customerDropdownVisible: false, + customerNameFocused: false, customerLoading: false, customerError: '', products: [], @@ -651,6 +652,9 @@ Page({ } this.loadOptions() this.searchCustomers() + wx.nextTick(() => { + this.setData({ customerNameFocused: true }) + }) }, async loadOptions() { @@ -745,7 +749,10 @@ Page({ onCustomerFocus(event) { const field = event.currentTarget.dataset.field - this.setData({ customerDropdownVisible: true }) + this.setData({ + customerDropdownVisible: true, + customerNameFocused: field === 'customerName' + }) this.searchCustomers(field) }, @@ -794,7 +801,10 @@ Page({ hideCustomerDropdown() { setTimeout(() => { - this.setData({ customerDropdownVisible: false }) + this.setData({ + customerDropdownVisible: false, + customerNameFocused: false + }) }, 180) }, diff --git a/JY-Salon-WeChat/pages/appointment-form/index.wxml b/JY-Salon-WeChat/pages/appointment-form/index.wxml index 6f32b1c3..7b59d21d 100644 --- a/JY-Salon-WeChat/pages/appointment-form/index.wxml +++ b/JY-Salon-WeChat/pages/appointment-form/index.wxml @@ -1,9 +1,9 @@ - + 客户姓名 - + 手机号 diff --git a/JY-Salon-WeChat/pages/appointment-form/index.wxss b/JY-Salon-WeChat/pages/appointment-form/index.wxss index 7e09bcc8..be33519c 100644 --- a/JY-Salon-WeChat/pages/appointment-form/index.wxss +++ b/JY-Salon-WeChat/pages/appointment-form/index.wxss @@ -1,3 +1,35 @@ +.form-card { + padding: 8rpx 0; + overflow: visible; +} + +.form-card .field { + min-height: 112rpx; + padding: 12rpx 24rpx; +} + +.form-card .field-label { + width: 180rpx; + min-width: 180rpx; + color: #62574d; + font-weight: 800; +} + +.form-card .field input, +.form-card .field-value { + min-height: 72rpx; + padding: 0 22rpx; + border: 1rpx solid #eadfd2; + border-radius: 18rpx; + background: #fffdf8; + line-height: 72rpx; +} + +.form-card .field.is-focused input { + border-color: #78a78f; + box-shadow: 0 0 0 4rpx rgba(120, 167, 143, 0.12); +} + .unit { color: #9a9288; font-size: 24rpx; diff --git a/JY-Salon-WeChat/pages/password/index.wxml b/JY-Salon-WeChat/pages/password/index.wxml index d626dd68..ee411158 100644 --- a/JY-Salon-WeChat/pages/password/index.wxml +++ b/JY-Salon-WeChat/pages/password/index.wxml @@ -1,8 +1,13 @@ - - 原密码 - 新密码 - 确认密码 + + 保护当前账号 + 修改成功后会重新登录,请确认新密码已经记牢。 + + 原密码 + 新密码 + 确认密码 + + 建议使用 8 位以上密码,包含字母和数字,不要与其他平台共用密码。 diff --git a/JY-Salon-WeChat/pages/password/index.wxss b/JY-Salon-WeChat/pages/password/index.wxss index 8b137891..b5b19d42 100644 --- a/JY-Salon-WeChat/pages/password/index.wxss +++ b/JY-Salon-WeChat/pages/password/index.wxss @@ -1 +1,67 @@ +.password-guide { + display: flex; + flex-direction: column; + gap: 12rpx; + margin-bottom: 22rpx; + padding: 28rpx; + background: linear-gradient(135deg, #fffdf8, #ecf5ef); +} + +.password-guide-title { + color: #27231f; + font-size: 34rpx; + font-weight: 900; +} + +.password-guide-desc { + color: #756b61; + font-size: 25rpx; + line-height: 1.5; +} + +.form-card { + padding: 8rpx 0; + overflow: hidden; +} + +.password-field { + display: flex; + flex-direction: column; + align-items: stretch; + gap: 12rpx; + min-height: 130rpx; + padding: 20rpx 24rpx; +} + +.password-field .field-label { + width: auto; + color: #62574d; + font-size: 25rpx; + font-weight: 900; +} + +.password-field input { + width: 100%; + min-height: 76rpx; + padding: 0 22rpx; + border: 1rpx solid #eadfd2; + border-radius: 18rpx; + background: #fffdf8; + color: #2d2722; + font-size: 28rpx; + line-height: 76rpx; +} + +.password-field-active input { + border-color: #78a78f; + box-shadow: 0 0 0 4rpx rgba(120, 167, 143, 0.12); +} + +.password-tip { + margin-top: 22rpx; + padding: 24rpx; + color: #82776c; + font-size: 24rpx; + line-height: 1.5; +} diff --git a/JY-Salon-WeChat/pages/planning/index.js b/JY-Salon-WeChat/pages/planning/index.js index cb069dc1..6521be55 100644 --- a/JY-Salon-WeChat/pages/planning/index.js +++ b/JY-Salon-WeChat/pages/planning/index.js @@ -1,4 +1,5 @@ const planningApi = require('../../api/planning') +const shopApi = require('../../api/shop') const dateUtil = require('../../utils/date') const CALENDAR_ERROR_FALLBACK_MESSAGE = '规划数据暂时不可用,请稍后重试' @@ -98,6 +99,44 @@ function resolveDayStatusClass(items) { return '' } +function normalizeWorkDays(workDays, presetType) { + if (presetType === 'DOUBLE_REST') { + return [1, 2, 3, 4, 5] + } + if (presetType === 'SINGLE_REST') { + return [1, 2, 3, 4, 5, 6] + } + if (presetType === 'EVERYDAY') { + return [1, 2, 3, 4, 5, 6, 7] + } + const values = String(workDays || '') + .split(',') + .map(item => Number(String(item).trim())) + .filter(item => item >= 1 && item <= 7) + return Array.from(new Set(values.length ? values : [1, 2, 3, 4, 5, 6, 7])) +} + +function buildExceptionMap(exceptions) { + return (exceptions || []).reduce((map, item) => { + if (item && item.workDate) { + map[item.workDate] = item.exceptionType + } + return map + }, {}) +} + +function isShopRestDate(date, workDays, exceptionMap) { + const exceptionType = exceptionMap[date] + if (exceptionType === 'REST') { + return true + } + if (exceptionType === 'EXTRA_WORK' || exceptionType === 'CHANGE_SHIFT') { + return false + } + const weekDay = toLocalDate(date).getDay() || 7 + return !workDays.includes(weekDay) +} + Page({ data: { viewMode: 'month', @@ -126,6 +165,7 @@ Page({ artists: [], appointments: [], daySummaries: [], + shopRestDates: [], monthDays: [], weekDays: [], dayLanes: [], @@ -234,7 +274,8 @@ Page({ endDate: range.end, artistId: this.data.selectedArtistId || undefined }) - this.applyCalendar(data) + const shopSchedule = await this.loadShopSchedule(range) + this.applyCalendar(data, shopSchedule) this.setData({ calendarError: '' }) } catch (error) { this.clearCalendarView() @@ -259,6 +300,7 @@ Page({ artists: [], appointments: [], daySummaries: [], + shopRestDates: [], monthDays: [], weekDays: [], dayLanes: [], @@ -286,18 +328,40 @@ Page({ return { start: current, end: current } }, - applyCalendar(calendar) { + applyCalendar(calendar, shopSchedule) { const artists = calendar.artists || [] this.setData({ businessStartTime: (calendar.businessStartTime || '10:00').slice(0, 5), businessEndTime: (calendar.businessEndTime || '22:00').slice(0, 5), artists, appointments: calendar.appointments || [], - daySummaries: calendar.daySummaries || [] + daySummaries: calendar.daySummaries || [], + shopRestDates: shopSchedule ? shopSchedule.restDates : [] }) this.prepareView() }, + async loadShopSchedule(range) { + const [settings, exceptions] = await Promise.all([ + shopApi.settings(), + shopApi.scheduleExceptions({ + startDate: range.start, + endDate: range.end + }) + ]) + const workDays = normalizeWorkDays(settings.scheduleWorkDays, settings.schedulePresetType) + const exceptionMap = buildExceptionMap(exceptions) + const restDates = [] + let cursor = range.start + while (cursor <= range.end) { + if (isShopRestDate(cursor, workDays, exceptionMap)) { + restDates.push(cursor) + } + cursor = dateUtil.formatDate(dateUtil.addDays(cursor, 1)) + } + return { restDates } + }, + prepareView() { const current = this.data.currentDateText const range = this.resolveRange() @@ -319,6 +383,7 @@ Page({ buildMonthDays() { const summaryMap = this.summaryMap() const todayText = dateUtil.formatDate(new Date()) + const shopRestDates = this.data.shopRestDates || [] const artistTemplate = this.data.artists.map(artist => ({ artistId: artist.id, artistName: artist.name, @@ -338,6 +403,7 @@ Page({ isPast: day.date < todayText, totalCount: summary.totalCount || 0, dayStatus: summary.dayStatus || 'free', + shopRest: shopRestDates.includes(day.date), artistCounts, expandedBlocks: this.buildExpandedBlocks(artistCounts), rowBlocks: this.buildRowBlocks(artistCounts), diff --git a/JY-Salon-WeChat/pages/planning/index.wxml b/JY-Salon-WeChat/pages/planning/index.wxml index 3a8d1333..f70cb668 100644 --- a/JY-Salon-WeChat/pages/planning/index.wxml +++ b/JY-Salon-WeChat/pages/planning/index.wxml @@ -125,8 +125,8 @@ {{item.day}} - 满 - 休 + 休 + 满 diff --git a/JY-Salon-WeChat/pages/profile/index.js b/JY-Salon-WeChat/pages/profile/index.js index eee47beb..c250323b 100644 --- a/JY-Salon-WeChat/pages/profile/index.js +++ b/JY-Salon-WeChat/pages/profile/index.js @@ -1,5 +1,6 @@ const { BRAND_CONFIG } = require('../../utils/config') const userApi = require('../../api/user') +const shopApi = require('../../api/shop') const authApi = require('../../api/auth') const auth = require('../../utils/auth') const { chooseImageFilePath, uploadAvatar } = require('../../utils/upload') @@ -27,9 +28,17 @@ function resolveDisplayAvatar(avatar) { return value } +function resolveShopCoverImage(settings) { + if (!settings || !Array.isArray(settings.coverImageUrls)) { + return '' + } + return String(settings.coverImageUrls[0] || '').trim() +} + Page({ data: { shopName: BRAND_CONFIG.defaultShopName, + shopCoverImage: '', phone: '店长端', roleText: '管理端', userInfo: {}, @@ -56,6 +65,7 @@ Page({ onShow() { this.refreshFromSession() + this.loadShopHeader() this.loadProfile() }, @@ -65,6 +75,7 @@ Page({ const displayAvatar = resolveDisplayAvatar(userInfo.avatar) this.setData({ shopName: app.globalData.shopName || BRAND_CONFIG.appName, + shopCoverImage: app.globalData.shopCoverImage || '', phone: userInfo.contactPhone || userInfo.phone || userInfo.account || '店长端', roleText: resolveRoleText(userInfo.type), userInfo: { @@ -74,6 +85,23 @@ Page({ }) }, + async loadShopHeader() { + try { + const settings = await shopApi.settings() + const app = getApp() + const shopName = settings.shopName || settings.name || app.globalData.shopName || BRAND_CONFIG.appName + const shopCoverImage = resolveShopCoverImage(settings) + app.globalData.shopName = shopName + app.globalData.shopCoverImage = shopCoverImage + this.setData({ + shopName, + shopCoverImage + }) + } catch (error) { + wx.showToast({ title: error.message || '店铺信息加载失败', icon: 'none' }) + } + }, + go(event) { const action = event.currentTarget.dataset.action if (action === 'editProfile') { diff --git a/JY-Salon-WeChat/pages/profile/index.wxml b/JY-Salon-WeChat/pages/profile/index.wxml index eb811577..1fd1d402 100644 --- a/JY-Salon-WeChat/pages/profile/index.wxml +++ b/JY-Salon-WeChat/pages/profile/index.wxml @@ -1,10 +1,10 @@ - - + 个人信息 @@ -31,25 +31,35 @@ 头像 - - + + {{profileForm.nickname || userInfo.nickname || '个人头像'}} + 这里只修改个人资料头像 + + + + + + + 登录账号 + {{userInfo.account || '未设置'}} + + + 身份 + {{roleText}} + + + 登录手机号 + {{userInfo.phone || '未绑定'}} + + + 当前店铺 + {{shopName}} + 昵称 - - 登录账号 - {{userInfo.account || '未设置'}} - - - 身份 - {{roleText}} - - - 登录手机号 - {{userInfo.phone || '未绑定'}} - 联系电话 diff --git a/JY-Salon-WeChat/pages/profile/index.wxss b/JY-Salon-WeChat/pages/profile/index.wxss index 1794e2f2..c4c058a3 100644 --- a/JY-Salon-WeChat/pages/profile/index.wxss +++ b/JY-Salon-WeChat/pages/profile/index.wxss @@ -112,7 +112,7 @@ width: 100%; max-height: 88vh; overflow-y: auto; - padding: 28rpx 28rpx calc(28rpx + env(safe-area-inset-bottom)); + padding: 28rpx 28rpx calc(30rpx + env(safe-area-inset-bottom)); border-radius: 28rpx 28rpx 0 0; background: #fffaf4; box-shadow: 0 -18rpx 40rpx rgba(41, 31, 23, 0.16); @@ -170,10 +170,10 @@ .profile-avatar-row { display: flex; align-items: center; - gap: 16rpx; + gap: 18rpx; margin-bottom: 18rpx; padding: 18rpx; - border-radius: 18rpx; + border-radius: 20rpx; background: #f7efe7; } @@ -197,14 +197,96 @@ height: 100%; } -.avatar-btn { - flex: 1; +.profile-avatar-copy { min-width: 0; - max-width: none; + flex: 1; +} + +.profile-avatar-name, +.profile-avatar-desc { + display: block; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.profile-avatar-name { + color: #29241f; + font-size: 28rpx; + font-weight: 900; +} + +.profile-avatar-desc { + margin-top: 8rpx; + color: #8a7f75; + font-size: 22rpx; +} + +.avatar-btn { + display: flex; + align-items: center; + justify-content: center; + flex: 0 0 auto; + min-width: 104rpx; + min-height: 58rpx; + padding: 0 18rpx; + border-radius: 16rpx; + background: #fffdf8; + color: #72553b; + font-size: 24rpx; + font-weight: 900; } .avatar-remove { + display: flex; + align-items: center; + justify-content: center; flex: 0 0 auto; + min-width: 76rpx; + min-height: 58rpx; + padding: 0 16rpx; + border-radius: 16rpx; + background: #f0e5dc; + color: #9a5f43; + font-size: 24rpx; + font-weight: 900; +} + +.profile-info-grid { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 14rpx; + margin-bottom: 18rpx; +} + +.profile-info-item { + min-width: 0; + padding: 16rpx; + border-radius: 18rpx; + background: #f7efe7; +} + +.profile-info-item text, +.profile-info-item view { + display: block; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.profile-info-item text { + color: #8a7f75; + font-size: 22rpx; + font-weight: 800; +} + +.profile-info-item view { + margin-top: 8rpx; + color: #2c2722; + font-size: 25rpx; + font-weight: 900; } .modal-field { @@ -226,18 +308,24 @@ .modal-field textarea, .readonly-field view { width: 100%; + padding: 0 18rpx; + border: 1rpx solid #eadfd2; + border-radius: 16rpx; + background: #fffdf8; color: #2c2722; font-size: 28rpx; } .modal-field input, .readonly-field view { - min-height: 58rpx; - line-height: 58rpx; + min-height: 70rpx; + line-height: 70rpx; } .modal-field textarea { min-height: 120rpx; + padding-top: 18rpx; + padding-bottom: 18rpx; } .readonly-field view { diff --git a/JY-Salon-WeChat/pages/shop-settings/index.js b/JY-Salon-WeChat/pages/shop-settings/index.js index 8d070e37..9460081a 100644 --- a/JY-Salon-WeChat/pages/shop-settings/index.js +++ b/JY-Salon-WeChat/pages/shop-settings/index.js @@ -2,6 +2,7 @@ const shopApi = require('../../api/shop') const dateUtil = require('../../utils/date') const { BRAND_CONFIG } = require('../../utils/config') const { markPlanningRefresh } = require('../../utils/planning-refresh') +const { chooseImageFilePath, uploadObjectFile, resolveUploadedImagePreviewUrl } = require('../../utils/upload') const PRESETS = [ { value: 'EVERYDAY', label: '全周营业', workDays: [1, 2, 3, 4, 5, 6, 7], startTime: '10:00', endTime: '22:00' }, @@ -66,6 +67,10 @@ function buildExceptionSummary(item) { return `${item.workDate} ${exceptionTypeLabel(item.exceptionType)} ${String(item.startTime || '').slice(0, 5)}-${String(item.endTime || '').slice(0, 5)}` } +function resolveFirstImageUrl(urls) { + return Array.isArray(urls) ? String(urls[0] || '').trim() : '' +} + Page({ data: { presets: PRESETS, @@ -78,6 +83,8 @@ Page({ exceptions: [], loading: false, saving: false, + coverUploading: false, + coverImagePreviewUrl: '', form: { shopName: BRAND_CONFIG.defaultShopName, startTime: '10:00', @@ -86,7 +93,8 @@ Page({ rule: '必须选择已有作品作为项目来源', schedulePresetType: 'EVERYDAY', scheduleWorkDays: [1, 2, 3, 4, 5, 6, 7], - scheduleRemark: '' + scheduleRemark: '', + coverImageFileId: '' }, exceptionForm: { workDate: dateUtil.formatDate(new Date()), @@ -118,10 +126,12 @@ Page({ rule: settings.description || this.data.form.rule, schedulePresetType: settings.schedulePresetType || preset.value, scheduleWorkDays: copyWorkDays(settings.scheduleWorkDays || preset.workDays), - scheduleRemark: settings.scheduleRemark || '' + scheduleRemark: settings.scheduleRemark || '', + coverImageFileId: settings.coverImageFileId || '' } this.setData({ form, + coverImagePreviewUrl: resolveFirstImageUrl(settings.coverImageUrls), presetOptions: buildPresetOptions(form.schedulePresetType), weekdayOptions: buildWeekdayOptions(form.scheduleWorkDays), exceptions: (exceptions || []).map(item => ({ @@ -142,6 +152,42 @@ Page({ this.setData({ [`form.${event.currentTarget.dataset.field}`]: event.detail.value }) }, + async chooseCoverImage() { + if (this.data.coverUploading || this.data.saving) { + return + } + try { + const filePath = await chooseImageFilePath() + if (!filePath) { + return + } + this.setData({ coverUploading: true }) + const uploadResult = await uploadObjectFile(filePath) + const fileId = String(uploadResult && uploadResult.id ? uploadResult.id : '').trim() + if (!fileId) { + throw new Error('店铺主图上传失败:上传接口未返回文件ID') + } + this.setData({ + 'form.coverImageFileId': fileId, + coverImagePreviewUrl: resolveUploadedImagePreviewUrl(uploadResult, filePath) + }) + } catch (error) { + wx.showToast({ title: error.message || '店铺主图上传失败', icon: 'none' }) + } finally { + this.setData({ coverUploading: false }) + } + }, + + removeCoverImage() { + if (this.data.coverUploading || this.data.saving) { + return + } + this.setData({ + 'form.coverImageFileId': '', + coverImagePreviewUrl: '' + }) + }, + onExceptionInput(event) { this.setData({ [`exceptionForm.${event.currentTarget.dataset.field}`]: event.detail.value }) }, @@ -257,7 +303,8 @@ Page({ description: form.rule, schedulePresetType: form.schedulePresetType, scheduleWorkDays: encodeWorkDays(workDays), - scheduleRemark: String(form.scheduleRemark || '').trim() + scheduleRemark: String(form.scheduleRemark || '').trim(), + coverImageFileId: String(form.coverImageFileId || '').trim() }) markPlanningRefresh() wx.showToast({ title: '已保存', icon: 'success' }) diff --git a/JY-Salon-WeChat/pages/shop-settings/index.wxml b/JY-Salon-WeChat/pages/shop-settings/index.wxml index a709d751..afe3f75a 100644 --- a/JY-Salon-WeChat/pages/shop-settings/index.wxml +++ b/JY-Salon-WeChat/pages/shop-settings/index.wxml @@ -1,8 +1,27 @@ 店铺设置加载中 + + + + + + 店铺主图 + + + + {{form.shopName || '店铺主图'}} + 我的页顶部展示这张图片 + + + + + + + + - 店铺名称 + 店铺名称 默认时长 diff --git a/JY-Salon-WeChat/pages/shop-settings/index.wxss b/JY-Salon-WeChat/pages/shop-settings/index.wxss index be32704a..99451585 100644 --- a/JY-Salon-WeChat/pages/shop-settings/index.wxss +++ b/JY-Salon-WeChat/pages/shop-settings/index.wxss @@ -1,8 +1,128 @@ +.cover-card { + position: relative; + height: 300rpx; + margin-bottom: 24rpx; + overflow: hidden; + border-radius: 22rpx; + background: linear-gradient(135deg, #7b9987, #c4996e); + box-shadow: 0 18rpx 36rpx rgba(83, 64, 44, 0.14); +} + +.cover-preview, +.cover-preview image { + width: 100%; + height: 100%; +} + +.cover-empty { + display: flex; + align-items: center; + justify-content: center; + color: rgba(255, 255, 255, 0.82); + font-size: 34rpx; + font-weight: 900; +} + +.cover-shade { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + display: flex; + align-items: flex-end; + justify-content: space-between; + gap: 20rpx; + padding: 28rpx; + background: linear-gradient(180deg, rgba(30, 24, 19, 0.08), rgba(30, 24, 19, 0.48)); +} + +.cover-copy { + min-width: 0; + color: #fffdf8; +} + +.cover-title, +.cover-desc { + display: block; +} + +.cover-title { + overflow: hidden; + font-size: 34rpx; + font-weight: 900; + line-height: 1.25; + text-overflow: ellipsis; + white-space: nowrap; +} + +.cover-desc { + margin-top: 8rpx; + font-size: 23rpx; + opacity: 0.9; +} + +.cover-actions { + display: flex; + flex: 0 0 auto; + flex-direction: column; + gap: 10rpx; +} + +.cover-btn, +.cover-remove { + display: flex; + align-items: center; + justify-content: center; + min-width: 154rpx; + min-height: 58rpx; + padding: 0 20rpx; + border-radius: 16rpx; + font-size: 24rpx; + font-weight: 900; +} + +.cover-btn { + background: #fffdf8; + color: #72553b; +} + +.cover-remove { + background: rgba(255, 253, 248, 0.18); + color: #fffdf8; +} + +.form-card, +.rule-card { + padding: 10rpx 0; + overflow: hidden; +} + +.field { + min-height: 108rpx; + padding: 12rpx 24rpx; +} + +.field-label, +.label-with-help { + width: 180rpx; + min-width: 180rpx; +} + +.field input, +.field-value { + min-height: 70rpx; + padding: 0 22rpx; + border: 1rpx solid #eadfd2; + border-radius: 18rpx; + background: #fffaf4; + line-height: 70rpx; +} + .label-with-help { display: flex; align-items: center; - min-width: 144rpx; } .label-with-help .field-label { diff --git a/memory/bugs.md b/memory/bugs.md index 4ffc47a4..a13299d5 100644 --- a/memory/bugs.md +++ b/memory/bugs.md @@ -264,3 +264,11 @@ - 处理方式:员工排班刷数 SQL 以 active `t_user_shop_binding` 的每个 `(user_id, shop_id)` 为准生成规则,并用 `t_user.shop_id` 作为无绑定记录时的回退来源。 - 以后避免:涉及员工、店长、门店绑定关系的数据修复时,不要默认一人一店;先看绑定表语义,按业务需要逐绑定处理。 - 验证方式:构造一个 `type=3` 员工绑定两个有效门店,执行迁移后应有两条 active `t_artist_schedule_rule`,且均为 `EVERYDAY`、`1,2,3,4,5,6,7`、`00:00:00-23:59:59`。 + +## 2026-07-22 Windows PowerShell 执行临时脚本要注意 UTF-8 BOM + +- 问题:用 `apply_patch` 生成的临时 `.ps1` 预览脚本含中文字符串,直接 `powershell -File` 执行时被 Windows PowerShell 按 ANSI 解码,中文变成乱码并导致数组字符串解析失败。 +- 原因:Windows PowerShell 5 对无 BOM 的 UTF-8 脚本兼容性差;仓库和补丁默认 UTF-8 无 BOM,直接执行会走本机 ANSI 代码页。 +- 处理方式:临时脚本执行前用 UTF-8 BOM 重写一次,或改用 `Get-Content -Encoding UTF8` 读取后执行;复杂脚本仍放在 `D:\codex\tmp`。 +- 以后避免:包含中文或非 ASCII 的临时 PowerShell 脚本,不要直接 `powershell -File` 执行无 BOM 文件;先显式保证编码。 +- 验证方式:执行前后检查脚本中的中文数组/字符串能被正确解析,并确认生成物存在且非零字节。