diff --git a/README.md b/README.md index 98314ae..049f3b8 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# attendant +# 暖橙陪诊 diff --git a/_verify2.ps1 b/_verify2.ps1 deleted file mode 100644 index 848a73c..0000000 --- a/_verify2.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -Add-Type -AssemblyName System.Drawing -foreach ($n in 'home-green', 'ai-green', 'mine-green') { - $bmp = [System.Drawing.Bitmap]::FromFile("d:\work\health\code\ws_health\ui\wxapp_escort\images\$n.png") - $counts = @{} - for ($x = 0; $x -lt $bmp.Width; $x += 2) { - for ($y = 0; $y -lt $bmp.Height; $y += 2) { - $p = $bmp.GetPixel($x, $y) - if ($p.A -lt 128) { continue } - $key = '{0},{1},{2}' -f $p.R, $p.G, $p.B - $counts[$key] = [int]$counts[$key] + 1 - } - } - $top = $counts.GetEnumerator() | Sort-Object Value -Descending | Select-Object -First 2 - $line = ($top | ForEach-Object { "$($_.Key)=$($_.Value)" }) -join ' ' - Write-Host "$n : $line" - $bmp.Dispose() -} \ No newline at end of file diff --git a/app.js b/app.js index 389051d..e3b905e 100644 --- a/app.js +++ b/app.js @@ -8,13 +8,6 @@ App({ // 登录逻辑只在 app 里有一份,request 层不碰 request.setUnauthorizedHandler(() => this.silentSignin()) - let appId = wx.getStorageSync('attendant-appid') - if (!appId) { - appId = 'app_' + Date.now().toString(36) + Math.random().toString(36).substr(2, 9) - wx.setStorageSync('attendant-appid', appId) - } - this.globalData.appId = appId - this.loadServices() this.loadAgreement() @@ -173,7 +166,6 @@ App({ }, globalData: { - appId: '', user: null, chatSocket: null, services: [], diff --git a/app.json b/app.json index dcef8cc..25c9f39 100644 --- a/app.json +++ b/app.json @@ -4,8 +4,6 @@ "pages/ai/aichat", "pages/escort/itemdetail", "pages/escort/itemlist", - "pages/attendant/attendantlist", - "pages/attendant/attendantdetail", "pages/escort/recordlist", "pages/escort/agreement", "pages/escort/recorddetail", @@ -14,10 +12,8 @@ "pages/health/profileedit", "pages/mine/mine", "pages/mine/profileedit", - "pages/mine/addressedit", "pages/mine/about", "pages/mine/contact", - "pages/home/webview", "pages/mine/business" ], "window": { diff --git a/app.wxss b/app.wxss index 89ccae5..d0fc462 100644 --- a/app.wxss +++ b/app.wxss @@ -1,5 +1,18 @@ /**app.wxss**/ +/* 图标字体随包发布,避免运行时依赖远程字体域名。 + 使用独立字体族覆盖 apply-shared 的 TDesign 图标组件,不修改会被 npm 重建的依赖文件。 */ +@font-face { + font-family: 'escort-icons'; + src: url('/assets/fonts/t.woff') format('woff'); + font-weight: 400; + font-style: normal; +} + +.t-icon { + font-family: 'escort-icons' !important; +} + page { /* ===== 全站配色令牌 · 唯一来源(改配色只改这里)===== 页面 page{} 只消费令牌,不再定义或覆盖同名变量。 diff --git a/assets/fonts/t.woff b/assets/fonts/t.woff new file mode 100644 index 0000000..75a7a06 Binary files /dev/null and b/assets/fonts/t.woff differ diff --git a/doc/DESIGN.md b/doc/DESIGN.md index 06cd12d..7a9c096 100644 --- a/doc/DESIGN.md +++ b/doc/DESIGN.md @@ -119,7 +119,6 @@ | 范围 | 现状 | 替换为 | |---|---|---| -| `mine/addressedit.wxml`(`switch` 属性) | 旧金色 | `#B8520A`(属性值需硬编码) | | `hospital/contact.wxss`、`hospital/ranking.wxss` | 底 `#F5F7F6`、字 `#1F2937`、绿灰系 | 整体并入暖橙体系 | 已完成(2026-10-06):`health/profilelist`、`health/profileedit` 已按本节并入暖橙体系——两页 `.wxss` 的旧金色 `#D4A853` 连同冷灰文字 `#1F2937`/`#374151`/`#6B7280`/`#9CA3AF`、冷灰线 `#F3F4F6`、旧底 `#FAF6F1`/`#FDF8EE` 一并换成暖橙令牌与暖墨阶。列表页改「浅橙说明砖 + 通栏白块」,每条主体整块可点进编辑(补 chevron 点击暗示,删除动作下沉到卡内操作行、走 `--muted`),空态与「邮寄地址」同语言(`--faint` 图标 + `--muted` 说明);表单页改通栏白块,标签左走 `--muted`、值右走 `--ink` 700,性别选中态用软橙底 + 实心橙描边,健康备注独立一块。两页 `page{}` 均不留令牌副本;`profilelist.js` 的 `confirmColor` 硬编码改 `#B8520A`,`profilelist.json` 补注册既已使用的 `t-loading`(原只在 `.wxml` 里引用、未注册,渲染为空)。 @@ -134,6 +133,8 @@ 已完成(2026-10-06):`escort/attendantlist` 4 文件迁至 `attendant/attendantlist`,同目录新增 `attendant/attendantdetail`(4 文件),两页一并并入暖橙体系——`attendantlist.wxss` 的 page 级令牌副本(停在旧值 `#C2410C` / `#9A3412`)整块删除,改用 `app.wxss` 唯一来源,`page{}` 只留 `background-color: var(--paper)`(同 `guide`);`.wxml` 的 `t-icon` 硬编码 `#9A3412`→`#9B4508`,两处竖分隔线 `#E5DACC`→`--sep`。结构:列表卡右侧补 `chevron-right`(`#6F655C`)作点击暗示,整卡可点进详情;详情页按国标 4.2.1.5 分区——主卡(头像 / 脱敏名 / 已核验徽标 / 服务年限 · 累计服务次数,居中)+ 擅长场景(全量,不截断)+ 服务信息(性别 / 服务区域 / 服务语言,空项整行隐藏)+ 个人简介(未填整块隐藏),全页无实心色块、不新增色相,说明行仍是「公示信息,不含联系方式」。入口仍在首页介绍卡信任行(`goToAttendants`),`app.json` 两条路由同步改路径。同日按国标 4.2.1.5 补全公示项:详情页加「资质与培训」(健康证明有效期 + 培训记录)与「过往服务评价」两个分区,两区均无数据时整块隐藏;区块内条目用 `--line` 发丝线分隔,评分用 48rpx `--ink` 大字 + `--muted` 小数(`/ 5`)与条数,无实心色块。 +已完成(2026-10-24):无入口的 `attendant/attendantlist`、`attendant/attendantdetail` 整体下线并删除路由;地址维护入口由下单地址快照替代,`mine/addressedit` 同步删除。上文陪诊师页面与入口描述仅保留为历史记录,不代表当前能力。 + 已完成(2026-10-18):`health/profilelist` 卡片重构为「身份牌」结构——首字牌 + 姓名/性别签 + 竖线分隔元信息行(空值整项剔除,不留「未填写」)+ 备注单行省略,与 `recorddetail` 就诊人卡同语言。删除动作由「卡内操作行」改为**右上角安静图标**(`catchtap` 防冒泡、确认弹窗兜底):孤行删除撑不满一行、反而拉高卡片;上文「删除动作下沉到卡内操作行」的描述就此被替代。 已完成(2026-10-18):`escort/itemlist` 版式重排并同步本档——结构由「通栏白底章节带」改「组头落纸面 + 每项一张白卡」,虚线行与章线撤销;`.notice` 降为纸面披露行,客服旁路卡下沉到清单之后(§2.3 两条例外同步修订);价格 `--muted`→`--brand-strong`(回到「价格数字」默认用途)、「预约」改软填充胶囊(§2.1 按钮例外同步修订);组头副题说明砖按 §四.5 走 `--brand-soft` 填充 + `--brand-line` 描边;规格签删底(`--brand-soft` 落白卡仅 1.08:1 形同虚设),仅时长服务保留签,「按次」删;按钮补透明热区(`::after` 外扩 6rpx,触控 56→68rpx)。全页仍单色相、无新色。 diff --git a/doc/PROJECT_GUIDE.md b/doc/PROJECT_GUIDE.md index d002857..534ffbf 100644 --- a/doc/PROJECT_GUIDE.md +++ b/doc/PROJECT_GUIDE.md @@ -38,8 +38,6 @@ doc/ | `pages/ai/aichat` | AI 客服 | | `pages/escort/itemlist` | 陪诊服务列表 | | `pages/escort/itemdetail` | 服务详情 / 下单 | -| `pages/attendant/attendantlist` | 陪诊师团队(公示列表) | -| `pages/attendant/attendantdetail` | 陪诊师详情(公示) | | `pages/escort/recordlist` | 订单记录 | | `pages/escort/recorddetail` | 订单详情 | | `pages/escort/agreement` | 用户协议 | @@ -50,7 +48,6 @@ doc/ | `pages/mine/about` | 关于 | | `pages/mine/contact` | 联系我们 | | `pages/mine/business` | 合作与入驻(商务合作 / 陪诊师入驻 / 陪诊师培训,入口自首页与「我的」页页脚) | -| `pages/home/webview` | 网页容器 | ## 约定 diff --git a/package-lock.json b/package-lock.json index 3253cb9..be8ad71 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "attendant-wechat", + "name": "wxapp-escort", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "attendant-wechat", + "name": "wxapp-escort", "version": "1.0.0", "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 3fddf57..9b1f005 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "attendant-wechat", + "name": "wxapp-escort", "version": "1.0.0", - "description": "值班助手微信小程序", + "description": "暖橙陪诊用户端微信小程序", "main": "app.js", "scripts": { "dev": "echo '请在微信开发者工具中打开项目进行开发'" diff --git a/pages/ai/aichat.js b/pages/ai/aichat.js index 9f75edb..342d760 100644 --- a/pages/ai/aichat.js +++ b/pages/ai/aichat.js @@ -8,9 +8,9 @@ Page({ isTyping: false, scrollToMessage: '', quickQuestions: [ - '陪诊服务的流程是什么?', - '如何预约陪诊服务?', - '陪诊服务收费标准?' + { id: '陪诊服务的流程是什么?', text: '陪诊服务的流程是什么?' }, + { id: '如何预约陪诊服务?', text: '如何预约陪诊服务?' }, + { id: '陪诊服务收费标准?', text: '陪诊服务收费标准?' } ] }, @@ -46,13 +46,27 @@ Page({ try { const res = await API.resource.getAiQuickQuestions() if (res.code === 0) { - this.setData({ quickQuestions: res.data.aiquick_questions }) + this.setData({ + quickQuestions: this.createQuestionItems(res.data.aiquick_questions) + }) } } catch (err) { console.error('获取陪诊服务问题失败', err) } }, + // 问题文本即稳定键;重复问题只保留一项,避免服务端清单造成重复 key。 + createQuestionItems(questions) { + const seen = new Set() + return (Array.isArray(questions) ? questions : []).reduce((list, item) => { + const text = typeof item === 'string' ? item : item?.text + if (!text || seen.has(text)) return list + seen.add(text) + list.push({ id: text, text }) + return list + }, []) + }, + initSocketListeners() { const socket = getApp().initChatSocket() @@ -190,6 +204,9 @@ Page({ .filter(item => item && ['ai', 'user', 'system'].includes(item.type)) .map((item) => { const message = { ...item } + if (message.contentType === 'questions') { + message.content = this.createQuestionItems(message.content) + } if (!message.id || usedIds.has(message.id)) { message.id = this.createMessageId() } @@ -248,7 +265,7 @@ Page({ id: this.createMessageId(), type: 'ai', contentType: 'questions', - content: questions, + content: this.createQuestionItems(questions.map(item => item.text)), time: this.formatTime(new Date()) } @@ -324,7 +341,6 @@ Page({ content, id: requestId, token, - appId: app.globalData.appId, ts: new Date().toISOString() }) return true diff --git a/pages/ai/aichat.wxml b/pages/ai/aichat.wxml index 076edc6..876a102 100644 --- a/pages/ai/aichat.wxml +++ b/pages/ai/aichat.wxml @@ -18,11 +18,11 @@ - {{item}} + {{item.text}} @@ -74,11 +74,11 @@ class="quick-item" wx:for="{{item.content}}" wx:for-item="question" - wx:key="*this" + wx:key="id" bindtap="onQuickQuestionTap" - data-question="{{question}}" + data-question="{{question.text}}" > - {{question}} + {{question.text}} diff --git a/pages/attendant/attendantdetail.js b/pages/attendant/attendantdetail.js deleted file mode 100644 index 4d749dc..0000000 --- a/pages/attendant/attendantdetail.js +++ /dev/null @@ -1,157 +0,0 @@ -const API = require('../../utils/api.js') - -// 由 YYYY-MM-DD 生日换算周岁。 -// 后端只下发到「日」、不含时分秒——公示场景要的是"多大",不是哪一天生的。 -// 生日缺失 / 非法 / 算出不合常理(负数或 >120),一律返回 0,模板按 0 隐藏该项 -function calcAge(birthday) { - if (!birthday) { - return 0 - } - // 把 '-' 换成 '/' 再解析:小程序 iOS 对 'YYYY-MM-DD HH:mm:ss' 这类格式 - // 会得到 Invalid Date,'/' 分隔是各端都稳的写法 - const birth = new Date(String(birthday).replace(/-/g, '/')) - if (Number.isNaN(birth.getTime())) { - return 0 - } - - const today = new Date() - let age = today.getFullYear() - birth.getFullYear() - // 今年生日还没到,减一岁 - const monthDiff = today.getMonth() - birth.getMonth() - if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birth.getDate())) { - age -= 1 - } - - // 上限 120 是给运营手抖填错年份兜底,否则页面上会出现"年龄 226 岁" - if (!Number.isFinite(age) || age < 0 || age > 120) { - return 0 - } - return age -} - -// 陪诊师详情:数据来自后端公开接口 /health/attendant/:id -// 与列表页是同一份白名单数据(不含手机号 / 身份证号 / 证书编号原文), -// 差别在于详情页按 GB/T 47801—2026 4.2.1.5 把公示项补全: -// 不截断擅长场景,并额外展示个人简介、健康证明有效期、培训记录与过往服务评价 -// (培训记录是数组、评价要多一次聚合查询,所以只在详情里带) -Page({ - data: { - loading: true, - // null 表示查不到(ID 非法、已离职或已下架),模板据此渲染空态 - attendant: null, - specialtyTags: [], - trainings: [], - areaText: '', - langText: '' - }, - - onLoad(options) { - const id = options.id - if (!id) { - this.setData({ loading: false }) - return - } - this.loadAttendant(id) - }, - - loadAttendant(id) { - API.escort.getAttendantById(id) - .then((res) => { - const item = res.code === 0 && res.data && res.data.attendant - if (!item) { - this.setData({ loading: false }) - return - } - - const name = item.name || '' - const healthCertificate = item.healthCertificate || {} - const review = item.review || {} - - // 健康证明按国标只公示「有效期」,文案分有效 / 已过期两种; - // 运营没登到期日就整行不显示(不给"有效"的默认结论) - let healthCertificateText = '' - if (healthCertificate.expireDate) { - healthCertificateText = healthCertificate.valid - ? `有效期内(至 ${healthCertificate.expireDate})` - : `已过期(${healthCertificate.expireDate})` - } - - const attendant = { - id: item.id, - name, - avatar: item.avatar || '', - // 头像兜底用的首字:姓名已脱敏为「姓 + 陪诊师」,取第一个字即可 - initial: name.slice(0, 1), - // 后端 sex 为空串表示未登记,模板据此隐藏该行 - sexText: item.sex === 'male' ? '男' : item.sex === 'female' ? '女' : '', - // 周岁由本页现算,未登记生日时为 0,模板据 0 隐藏该行 - age: calcAge(item.birthday), - workYears: item.workYears || 0, - orderCount: item.orderCount || 0, - qualificationVerified: !!item.qualificationVerified, - healthCertificateText, - introduction: item.introduction || '', - reviewCount: review.count || 0, - // 评价条数未达后端阈值时 score 为 null,模板据此显示"暂不显示评分" - reviewScore: typeof review.score === 'number' ? review.score : null - } - - this.setData({ - loading: false, - attendant, - // 详情页展示全部擅长场景,不再像列表页截断到 3 个 - specialtyTags: item.specialties || [], - trainings: item.trainings || [], - // 数组在 WXML 里不能直接拼展示,这里先转成文本 - areaText: (item.serviceAreas || []).join(' / '), - langText: (item.languages || []).join(' / ') - }) - - // 标题用脱敏名,比「陪诊师详情」更有信息量 - if (name) { - wx.setNavigationBarTitle({ title: name }) - } - }) - .catch((err) => { - console.log('获取陪诊师详情失败', err) - this.setData({ loading: false }) - }) - }, - - onShareAppMessage() { - const { - attendant - } = this.data - - if (!attendant) { - return { - title: '暖橙陪诊 · 陪诊师团队', - path: '/pages/attendant/attendantlist' - } - } - - return { - title: `暖橙陪诊 · ${attendant.name}`, - path: `/pages/attendant/attendantdetail?id=${attendant.id}` - } - }, - - // 朋友圈只能分享当前页,陪诊师 id 只能靠 query 带上; - // 详情还没回来(attendant 为 null)时不带 query,好友打开是列表页口径的空态 - onShareTimeline() { - const { - attendant - } = this.data - - if (!attendant) { - return { - title: '暖橙陪诊 · 陪诊师团队' - } - } - - return { - title: `暖橙陪诊 · ${attendant.name}`, - query: `id=${attendant.id}` - } - } -}) diff --git a/pages/attendant/attendantdetail.json b/pages/attendant/attendantdetail.json deleted file mode 100644 index 0dee0ae..0000000 --- a/pages/attendant/attendantdetail.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "navigationBarTitleText": "陪诊师详情", - "usingComponents": { - "t-icon": "tdesign-miniprogram/icon/icon" - } -} diff --git a/pages/attendant/attendantdetail.wxml b/pages/attendant/attendantdetail.wxml deleted file mode 100644 index b01d532..0000000 --- a/pages/attendant/attendantdetail.wxml +++ /dev/null @@ -1,150 +0,0 @@ - - - - - 加载中… - - - - 该陪诊师信息不存在或已下架 - - - - - - - - - - {{ attendant.initial }} - - - - {{ attendant.name }} - - - 资质已核验 - - - - - 从业 {{ attendant.workYears }} 年 - - 已服务 {{ attendant.orderCount }} 次 - - - - - - - - 擅长场景 - - - {{ tag }} - - - - - - - - 服务信息 - - - - 性别 - {{ attendant.sexText }} - - - 年龄 - {{ attendant.age }} 岁 - - - 服务区域 - {{ areaText }} - - - 服务语言 - {{ langText }} - - - - - - - - - 资质与培训 - - - - 健康证明 - {{ attendant.healthCertificateText }} - - - - - {{ item.title }} - {{ item.date }} - - {{ item.org }} - - - - - - - - - 过往服务评价 - - - - {{ attendant.reviewScore }} - / 5 - 共 {{ attendant.reviewCount }} 条评价 - - - - {{ attendant.reviewCount > 0 ? '评价条数不足,暂不显示评分' : '暂无评价' }} - - - - - - - - - 个人简介 - - - {{ attendant.introduction }} - - - - - - 以上为陪同人员信息公示,用于核对身份与从业信息,不含联系方式。 - - - - - - diff --git a/pages/attendant/attendantdetail.wxss b/pages/attendant/attendantdetail.wxss deleted file mode 100644 index 8001cf4..0000000 --- a/pages/attendant/attendantdetail.wxss +++ /dev/null @@ -1,299 +0,0 @@ -/* pages/attendant/attendantdetail.wxss - 陪诊师详情:与陪诊师团队列表、陪诊指南同用一套暖橙 + 暖白令牌, - 令牌唯一来源在 app.wxss,本页不复制副本 */ -page { - background-color: var(--paper); -} - -.page-bg { - min-height: 100vh; - background: var(--paper); -} - -.container { - padding: 32rpx 32rpx 0; -} - -/* ===== 加载 / 空状态 ===== */ -.state { - padding: 120rpx 0; - text-align: center; -} - -.state-text { - font-size: 26rpx; - color: var(--muted); -} - -/* ===== 主卡:白卡 + 发丝边 + 紧阴影,居中排布 ===== */ -.profile-card { - display: flex; - flex-direction: column; - align-items: center; - padding: 48rpx 32rpx 40rpx; - border-radius: 28rpx; - background: var(--white); - border: 2rpx solid var(--line); - box-shadow: var(--shadow-card); -} - -.profile-avatar { - width: 144rpx; - height: 144rpx; - border-radius: 36rpx; - flex-shrink: 0; -} - -/* 无头像兜底:浅橙衬底 + 姓氏首字。 - box-sizing 必须显式声明,否则 2rpx 描边会把 144rpx 撑成 148rpx */ -.profile-avatar-fallback { - display: flex; - align-items: center; - justify-content: center; - box-sizing: border-box; - background: var(--brand-soft); - border: 2rpx solid var(--brand-line); -} - -.profile-avatar-text { - font-size: 52rpx; - font-weight: 700; - color: var(--brand-ink); -} - -.profile-name-row { - display: flex; - align-items: center; - margin-top: 24rpx; -} - -.profile-name { - font-size: 40rpx; - font-weight: 700; - color: var(--ink); - letter-spacing: 1rpx; -} - -/* 资质徽标:浅橙衬底 + 暖橙图标,不引入新的色相 */ -.profile-badge { - display: flex; - align-items: center; - flex-shrink: 0; - margin-left: 14rpx; - padding: 4rpx 14rpx; - border-radius: 10rpx; - background: var(--brand-soft); - border: 2rpx solid var(--brand-line); -} - -.profile-badge-text { - margin-left: 4rpx; - /* 中文最小 24rpx(12px),低于此不达可读下限 */ - font-size: 24rpx; - color: var(--brand-ink); -} - -.profile-meta { - display: flex; - align-items: center; - margin-top: 16rpx; -} - -.profile-meta-text { - font-size: 26rpx; - color: var(--muted); -} - -/* 竖分隔线:与列表页、场景行同一档 --sep */ -.meta-sep { - width: 2rpx; - height: 22rpx; - flex-shrink: 0; - margin: 0 16rpx; - background: var(--sep); -} - -/* ===== 分区:单竖条 + 区块标题(与全站 section-bar 同构) ===== */ -.section { - margin-top: 40rpx; -} - -.section-head { - display: flex; - align-items: center; - margin-bottom: 20rpx; -} - -.section-bar { - width: 8rpx; - height: 32rpx; - border-radius: 4rpx; - background: var(--brand-strong); -} - -.section-title { - margin-left: 14rpx; - font-size: 32rpx; - font-weight: 700; - color: var(--ink); - letter-spacing: 1rpx; -} - -/* ===== 擅长场景 ===== */ -.tag-card { - display: flex; - flex-wrap: wrap; - /* 每个 .tag 自带 12rpx 右 / 下外边距,右侧内边距相应减到 16rpx, - 否则最后一列标签会比左边多出 12rpx,看起来不居中 */ - padding: 28rpx 16rpx 16rpx 28rpx; - border-radius: 24rpx; - background: var(--white); - border: 2rpx solid var(--line); - box-shadow: var(--shadow-card); -} - -.tag { - margin: 0 12rpx 12rpx 0; - padding: 6rpx 14rpx; - border-radius: 10rpx; - background: var(--brand-soft); - border: 2rpx solid var(--brand-line); - font-size: 26rpx; - color: var(--brand-ink); -} - -/* ===== 服务信息:标签左 --muted、值 --ink,末行去分隔线 ===== */ -.info-card { - padding: 4rpx 28rpx; - border-radius: 24rpx; - background: var(--white); - border: 2rpx solid var(--line); - box-shadow: var(--shadow-card); -} - -.info-row { - display: flex; - align-items: flex-start; - padding: 24rpx 0; - border-bottom: 2rpx solid var(--line); -} - -.info-row:last-child { - border-bottom: none; -} - -.info-label { - width: 140rpx; - flex-shrink: 0; - font-size: 26rpx; - color: var(--muted); -} - -.info-value { - flex: 1; - font-size: 26rpx; - font-weight: 700; - color: var(--ink); - line-height: 1.6; -} - -/* ===== 资质与培训:健康证明行 + 培训记录条目 ===== - 健康证明复用 .info-row;培训条目用上边线彼此分隔。 - 两条例外避免出现双线或顶线: - - 紧跟在健康证明行后面时,行尾那条线已由 .info-row 提供 - - 作为卡片首个子元素时,不能贴着卡片上沿画线 */ -.training-item { - padding: 24rpx 0; - border-top: 2rpx solid var(--line); -} - -.info-row + .training-item, -.training-item:first-child { - border-top: none; -} - -.training-head { - display: flex; - align-items: flex-start; -} - -.training-title { - flex: 1; - font-size: 26rpx; - font-weight: 700; - color: var(--ink); - line-height: 1.6; -} - -.training-date { - flex-shrink: 0; - margin-left: 20rpx; - font-size: 24rpx; - color: var(--muted); -} - -.training-org { - display: block; - margin-top: 8rpx; - font-size: 24rpx; - color: var(--muted); -} - -/* ===== 过往服务评价 ===== */ -.review-box { - display: flex; - /* baseline 让「4.8」与「/ 5」在文字基线上对齐,而不是盒中线 */ - align-items: baseline; - padding: 28rpx 0; -} - -.review-score { - font-size: 48rpx; - font-weight: 700; - color: var(--ink); - line-height: 1; -} - -.review-unit { - margin-left: 8rpx; - font-size: 24rpx; - color: var(--muted); -} - -/* 条数推到右侧,与左边的分数形成两栏 */ -.review-count { - margin-left: auto; - font-size: 24rpx; - color: var(--muted); -} - -.review-empty { - display: block; - padding: 28rpx 0; - font-size: 26rpx; - color: var(--muted); -} - -/* 简介与 info-row 共用 info-card,但不带标签列 */ -.intro-text { - display: block; - padding: 28rpx 0; - font-size: 26rpx; - line-height: 1.8; - color: var(--ink-2); -} - -/* ===== 底部说明 ===== */ -.notice { - margin-top: 40rpx; -} - -.notice-text { - font-size: 24rpx; - line-height: 1.6; - color: var(--muted); -} - -.footer-space { - height: 48rpx; -} diff --git a/pages/attendant/attendantlist.js b/pages/attendant/attendantlist.js deleted file mode 100644 index ba50834..0000000 --- a/pages/attendant/attendantlist.js +++ /dev/null @@ -1,106 +0,0 @@ -const API = require('../../utils/api.js') - -// 陪诊师公示列表:数据来自后端公开接口 /health/attendant -// 该接口已做脱敏(不含手机号 / 身份证号 / 证书编号原文,生日只下发到日), -// 前端不做二次裁剪,只把后端字段整形为展示所需结构(周岁由生日现算) - -// 由 YYYY-MM-DD 生日换算周岁。 -// 后端只下发到「日」、不含时分秒——公示场景要的是"多大",不是哪一天生的。 -// 生日缺失 / 非法 / 算出不合常理(负数或 >120),一律返回 0,模板按 0 隐藏该项 -function calcAge(birthday) { - if (!birthday) { - return 0 - } - // 把 '-' 换成 '/' 再解析:小程序 iOS 对 'YYYY-MM-DD HH:mm:ss' 这类格式 - // 会得到 Invalid Date,'/' 分隔是各端都稳的写法 - const birth = new Date(String(birthday).replace(/-/g, '/')) - if (Number.isNaN(birth.getTime())) { - return 0 - } - - const today = new Date() - let age = today.getFullYear() - birth.getFullYear() - // 今年生日还没到,减一岁 - const monthDiff = today.getMonth() - birth.getMonth() - if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birth.getDate())) { - age -= 1 - } - - // 上限 120 是给运营手抖填错年份兜底,否则页面上会出现"年龄 226 岁" - if (!Number.isFinite(age) || age < 0 || age > 120) { - return 0 - } - return age -} - -Page({ - data: { - loading: true, - attendants: [] - }, - - onLoad() { - this.loadAttendants() - }, - - loadAttendants() { - API.escort.getAttendants() - .then((res) => { - if (res.code !== 0) { - this.setData({ loading: false }) - return - } - - const list = (res.data && res.data.attendants) || [] - this.setData({ - loading: false, - attendants: list.map((item) => { - const specialties = item.specialties || [] - const serviceAreas = item.serviceAreas || [] - const languages = item.languages || [] - - return { - id: item.id, - name: item.name, - avatar: item.avatar, - // 头像兜底用的首字:姓名已脱敏为「姓 + 陪诊师」,取第一个字即可 - initial: (item.name || '').slice(0, 1), - workYears: item.workYears || 0, - // 周岁由本页现算,未登记生日时为 0,模板据 0 隐藏该段 - age: calcAge(item.birthday), - orderCount: item.orderCount || 0, - qualificationVerified: !!item.qualificationVerified, - // 擅长场景最多展示 3 个,避免长尾把卡片撑高;完整列表在详情页 - specialtyTags: specialties.slice(0, 3), - // 数组在 WXML 里不能直接拼展示,这里先转成文本 - areaText: serviceAreas.join(' / '), - langText: languages.join(' / ') - } - }) - }) - }) - .catch((err) => { - console.log('获取陪诊师列表失败', err) - this.setData({ loading: false }) - }) - }, - - // 整卡可点进详情。卡片右侧补 chevron 做点击暗示—— - // 项目约束不允许"无暗示的整卡可点" - goToDetail(e) { - const id = e.currentTarget.dataset.id - if (!id) { - return - } - wx.navigateTo({ - url: `/pages/attendant/attendantdetail?id=${id}` - }) - }, - - onShareAppMessage() { - return { - title: '暖橙陪诊 · 陪诊师团队', - path: '/pages/attendant/attendantlist' - } - } -}) diff --git a/pages/attendant/attendantlist.json b/pages/attendant/attendantlist.json deleted file mode 100644 index 1a8afec..0000000 --- a/pages/attendant/attendantlist.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "navigationBarTitleText": "陪诊师团队", - "usingComponents": { - "t-icon": "tdesign-miniprogram/icon/icon" - } -} diff --git a/pages/attendant/attendantlist.wxml b/pages/attendant/attendantlist.wxml deleted file mode 100644 index bbb9815..0000000 --- a/pages/attendant/attendantlist.wxml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - 陪诊师团队 - 每位都实名上岗,从业信息可核对 - - - - 加载中… - - - - 暂无陪诊师信息 - - - - - - - - - - {{ item.initial }} - - - - - {{ item.name }} - - - 资质已核验 - - - - 从业 {{ item.workYears }} 年 - - - - {{ item.age }} 岁 - - - 已服务 {{ item.orderCount }} 次 - - - - {{ tag }} - - - - - - - 服务区域 {{ item.areaText }} - - 语言 {{ item.langText }} - - - - - - - 以上为陪同人员信息公示,用于核对身份与从业信息,不含联系方式。 - - - - - diff --git a/pages/attendant/attendantlist.wxss b/pages/attendant/attendantlist.wxss deleted file mode 100644 index 1550f5f..0000000 --- a/pages/attendant/attendantlist.wxss +++ /dev/null @@ -1,232 +0,0 @@ -/* pages/attendant/attendantlist.wxss - 陪诊师公示页:与首页、陪诊指南页、联系我们页共用同一套暖橙 + 暖白令牌。 - 本页原有的 page 级令牌副本(停在旧值 #C2410C / #9A3412)已按 - DESIGN.md §5.1 删掉,改用 app.wxss 的唯一来源(#B8520A / #9B4508) */ -page { - background-color: var(--paper); -} - -.page-bg { - min-height: 100vh; - background: var(--paper); -} - -.container { - padding: 32rpx 32rpx 0; -} - -/* ===== 头部:小色带 + 深墨标题 ===== */ -.page-header { - padding: 24rpx 0 8rpx; -} - -.header-accent { - width: 64rpx; - height: 8rpx; - border-radius: 4rpx; - background: var(--brand-strong); -} - -.header-title { - display: block; - margin-top: 20rpx; - font-size: 46rpx; - font-weight: 700; - color: var(--ink); - letter-spacing: 1rpx; -} - -.header-subtitle { - display: block; - margin-top: 12rpx; - font-size: 26rpx; - color: var(--muted); - letter-spacing: 1rpx; -} - -/* ===== 加载 / 空状态 ===== */ -.state { - padding: 120rpx 0; - text-align: center; -} - -.state-text { - font-size: 26rpx; - color: var(--muted); -} - -/* ===== 陪诊师卡片:发丝边 + 紧阴影,与首页白卡同语言 ===== */ -.list { - display: flex; - flex-direction: column; - margin-top: 32rpx; -} - -.staff-card { - padding: 28rpx 26rpx; - border-radius: 28rpx; - background: var(--white); - border: 2rpx solid var(--line); - box-shadow: var(--shadow-card); -} - -.staff-card + .staff-card { - margin-top: 24rpx; -} - -/* stretch 而非 center:让文字块与 160rpx 的头像同高, - 由 .staff-main 内部用 space-between 把行铺满, - 否则文字块居中后,头像下半部右侧会留出一片空白 */ -.staff-head { - display: flex; - align-items: stretch; -} - -.staff-avatar { - width: 160rpx; - height: 160rpx; - border-radius: 40rpx; - flex-shrink: 0; -} - -/* 无头像兜底:浅橙衬底 + 姓氏首字。 - box-sizing 必须显式声明,否则 2rpx 描边会把 160rpx 撑成 164rpx */ -.staff-avatar-fallback { - display: flex; - align-items: center; - justify-content: center; - box-sizing: border-box; - background: var(--brand-soft); - border: 2rpx solid var(--brand-line); -} - -.staff-avatar-text { - font-size: 60rpx; - font-weight: 700; - color: var(--brand-ink); -} - -.staff-main { - /* min-width: 0 让长内容可收缩,避免把右侧徽标与箭头挤出行外 */ - flex: 1; - min-width: 0; - margin-left: 20rpx; - /* 纵向两行铺满头像高度:姓名行贴顶、从业信息贴底 */ - display: flex; - flex-direction: column; - justify-content: space-between; -} - -.staff-name-row { - display: flex; - align-items: center; -} - -.staff-name { - font-size: 32rpx; - font-weight: 700; - color: var(--ink); - letter-spacing: 1rpx; -} - -/* 资质徽标:浅橙衬底 + 暖橙图标,不引入新的色相 */ -.staff-badge { - display: flex; - align-items: center; - flex-shrink: 0; - margin-left: 14rpx; - padding: 4rpx 14rpx; - border-radius: 10rpx; - background: var(--brand-soft); - border: 2rpx solid var(--brand-line); -} - -.staff-badge-text { - margin-left: 4rpx; - /* 中文最小 24rpx(12px),低于此不达可读下限 */ - font-size: 24rpx; - color: var(--brand-ink); -} - -/* 竖向位置交给 .staff-main 的 space-between, - 这里不再加 margin-top,免得和铺满逻辑叠加 */ -.staff-meta { - display: flex; - align-items: center; -} - -.staff-meta-text { - font-size: 24rpx; - color: var(--muted); -} - -/* 竖分隔线:与场景行、页脚同一档 --sep, - 比 --line 深一档,保证在浅橙底与白卡上都看得见 */ -.meta-sep { - width: 2rpx; - height: 20rpx; - flex-shrink: 0; - margin: 0 14rpx; - background: var(--sep); -} - -/* ===== 擅长场景标签(已在头像右侧文字列内,排在从业信息下方) ===== */ -.staff-tags { - display: flex; - flex-wrap: wrap; - /* 作为 .staff-main 的第三行:这里只负责与从业信息的最小间距, - 竖向富余空间交给 .staff-main 的 space-between 分配。 - 列宽只有约 414rpx,3 个标签通常会折成两行 */ - margin-top: 12rpx; -} - -.staff-tag { - margin: 0 12rpx 12rpx 0; - padding: 6rpx 14rpx; - border-radius: 10rpx; - background: var(--brand-soft); - border: 2rpx solid var(--brand-line); - font-size: 24rpx; - color: var(--brand-ink); -} - -/* ===== 服务区域 / 语言 ===== */ -.staff-area { - display: flex; - align-items: center; - /* border-top 画在元素上边缘,padding-top 是线内侧的空隙, - 所以线外侧与照片的间距只能用 margin-top 给。 - 标签行从卡片主体移入头部后,原本垫在线上的那层间距没了, - 不补这里就会让照片底线直接贴住这条发丝线 */ - margin-top: 24rpx; - padding-top: 16rpx; - border-top: 2rpx solid var(--line); -} - -.staff-area-text { - font-size: 24rpx; - color: var(--muted); -} - -.area-sep { - width: 2rpx; - height: 20rpx; - flex-shrink: 0; - margin: 0 14rpx; - background: var(--sep); -} - -/* ===== 底部说明 ===== */ -.notice { - margin-top: 32rpx; -} - -.notice-text { - font-size: 24rpx; - line-height: 1.6; - color: var(--muted); -} - -.footer-space { - height: 48rpx; -} diff --git a/pages/escort/agreement.js b/pages/escort/agreement.js index 596d393..cb992c3 100644 --- a/pages/escort/agreement.js +++ b/pages/escort/agreement.js @@ -20,13 +20,36 @@ Page({ this.setData({ loading: true, error: false }) getApp().loadAgreement().then((agreement) => { this.setData({ - agreement: agreement || null, + agreement: agreement ? this.formatAgreement(agreement) : null, loading: false, error: !agreement }) }) }, + // 服务端协议保留简洁文案结构,页面渲染前补稳定键,不在 WXML 使用索引或值本身作 key。 + formatAgreement(agreement) { + const toItems = list => (list || []).map((text, index) => ({ + id: `${index}_${text}`, + text + })) + return { + ...agreement, + sections: (agreement.sections || []).map(section => ({ + ...section, + items: section.items ? toItems(section.items) : section.items, + table: section.table ? { + headers: toItems(section.table.headers), + rows: (section.table.rows || []).map(row => ({ + id: row.join('|'), + cells: toItems(row) + })) + } : section.table + })), + footer: toItems(agreement.footer) + } + }, + retry() { this.loadAgreement() }, diff --git a/pages/escort/agreement.wxml b/pages/escort/agreement.wxml index 552d93b..2c5bd85 100644 --- a/pages/escort/agreement.wxml +++ b/pages/escort/agreement.wxml @@ -25,9 +25,9 @@ - + - {{subItem}} + {{subItem.text}} @@ -35,10 +35,10 @@ - {{h}} + {{h.text}} - - {{cell}} + + {{cell.text}} @@ -52,7 +52,7 @@ - {{item}} + {{item.text}} diff --git a/pages/escort/guide.js b/pages/escort/guide.js index 4f21604..23f2e75 100644 --- a/pages/escort/guide.js +++ b/pages/escort/guide.js @@ -63,6 +63,14 @@ Page({ ] }, + onLoad() { + const toItems = list => list.map(text => ({ id: text, text })) + this.setData({ + preparations: toItems(this.data.preparations), + tips: toItems(this.data.tips) + }) + }, + // 下一步:进入陪诊服务列表 goToServiceList() { wx.navigateTo({ diff --git a/pages/escort/guide.wxml b/pages/escort/guide.wxml index b530871..6f17fb3 100644 --- a/pages/escort/guide.wxml +++ b/pages/escort/guide.wxml @@ -22,9 +22,9 @@ 就诊前准备 - + - {{ item }} + {{ item.text }} @@ -61,9 +61,9 @@ 温馨提示 - + - {{ item }} + {{ item.text }} diff --git a/pages/escort/itemdetail.js b/pages/escort/itemdetail.js index ebfe6c7..a38fea0 100644 --- a/pages/escort/itemdetail.js +++ b/pages/escort/itemdetail.js @@ -65,8 +65,12 @@ Page({ } this.applyBookingConfig(service) + const serviceView = { + ...service, + notices: (service.notices || []).map(text => ({ id: text, text })) + } this.setData({ - service, + service: serviceView, serviceIcon: this.getServiceIcon(service.title), totalPrice: service.price, pageLoading: false diff --git a/pages/escort/itemdetail.wxml b/pages/escort/itemdetail.wxml index e1caf45..84dec0f 100644 --- a/pages/escort/itemdetail.wxml +++ b/pages/escort/itemdetail.wxml @@ -29,7 +29,7 @@ 服务流程 - + {{ index + 1 }} @@ -49,9 +49,9 @@ 注意事项 - + - {{ item }} + {{ item.text }} diff --git a/pages/escort/recorddetail.js b/pages/escort/recorddetail.js index b1159bc..afd0c70 100644 --- a/pages/escort/recorddetail.js +++ b/pages/escort/recorddetail.js @@ -39,11 +39,11 @@ Page({ showCancelPopup: false, cancelReason: '', cancelReasons: [ - '临时有事,无法前往', - '病情好转,无需陪诊', - '医院停诊/改期', - '陪诊师无法到达', - '其他原因' + { id: 'schedule', text: '临时有事,无法前往' }, + { id: 'recovered', text: '病情好转,无需陪诊' }, + { id: 'hospital', text: '医院停诊/改期' }, + { id: 'escort', text: '陪诊师无法到达' }, + { id: 'other', text: '其他原因' } ] }, @@ -259,10 +259,10 @@ Page({ // 不靠一串 && 条件去猜哪条分隔线该出现(避免留下孤立的分隔线) buildPatientMeta(patient) { const list = [] - if (patient.sexText) list.push(patient.sexText) - if (patient.age) list.push(`${patient.age}岁`) - if (patient.height) list.push(`身高 ${patient.height}cm`) - if (patient.weight) list.push(`体重 ${patient.weight}kg`) + if (patient.sexText) list.push({ id: 'sex', text: patient.sexText }) + if (patient.age) list.push({ id: 'age', text: `${patient.age}岁` }) + if (patient.height) list.push({ id: 'height', text: `身高 ${patient.height}cm` }) + if (patient.weight) list.push({ id: 'weight', text: `体重 ${patient.weight}kg` }) return list }, @@ -270,9 +270,11 @@ Page({ // 省份不进元信息行,由 hospitalProvince 单独提到卡内右上角 buildHospitalMeta(hospital) { const list = [] - if (hospital.department) list.push(hospital.department) - if (hospital.doctor) list.push(hospital.doctor) - if (hospital.medicalRecordNo) list.push(`病历号 ${hospital.medicalRecordNo}`) + if (hospital.department) list.push({ id: 'department', text: hospital.department }) + if (hospital.doctor) list.push({ id: 'doctor', text: hospital.doctor }) + if (hospital.medicalRecordNo) { + list.push({ id: 'medicalRecordNo', text: `病历号 ${hospital.medicalRecordNo}` }) + } return list }, diff --git a/pages/escort/recorddetail.wxml b/pages/escort/recorddetail.wxml index 13a7b37..842c9ef 100644 --- a/pages/escort/recorddetail.wxml +++ b/pages/escort/recorddetail.wxml @@ -47,9 +47,9 @@ - + - {{item}} + {{item.text}} @@ -85,9 +85,9 @@ - + - {{item}} + {{item.text}} @@ -392,16 +392,16 @@ 确定要取消该陪诊订单吗?取消后陪诊师将收到通知。 - + - {{item}} + {{item.text}} diff --git a/pages/health/profilelist.js b/pages/health/profilelist.js index 5dffa2a..c47a259 100644 --- a/pages/health/profilelist.js +++ b/pages/health/profilelist.js @@ -59,13 +59,13 @@ Page({ // 顺序:出生年月 → 联系电话 → 证件号(脱敏) const metaList = [] if (profile.birth) { - metaList.push(formatDate(profile.birth, profile.birth)) + metaList.push({ id: 'birth', text: formatDate(profile.birth, profile.birth) }) } if (profile.mobile) { - metaList.push(profile.mobile) + metaList.push({ id: 'mobile', text: profile.mobile }) } if (profile.idnumber) { - metaList.push(maskIdNumber(profile.idnumber)) + metaList.push({ id: 'idnumber', text: maskIdNumber(profile.idnumber) }) } return { diff --git a/pages/health/profilelist.wxml b/pages/health/profilelist.wxml index 0cae24f..4b0d1e4 100644 --- a/pages/health/profilelist.wxml +++ b/pages/health/profilelist.wxml @@ -36,9 +36,9 @@ {{item.sexText}} - + - {{meta}} + {{meta.text}} 健康备注 {{item.remark}} diff --git a/pages/home/webview.js b/pages/home/webview.js deleted file mode 100644 index 4c42964..0000000 --- a/pages/home/webview.js +++ /dev/null @@ -1,70 +0,0 @@ -// pages/home/webview.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - url: '' - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - if (options.url) { - this.setData({ - url: decodeURIComponent(options.url) - }); - } - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - - } -}) \ No newline at end of file diff --git a/pages/home/webview.json b/pages/home/webview.json deleted file mode 100644 index 8835af0..0000000 --- a/pages/home/webview.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "usingComponents": {} -} \ No newline at end of file diff --git a/pages/home/webview.wxml b/pages/home/webview.wxml deleted file mode 100644 index 12b8ab5..0000000 --- a/pages/home/webview.wxml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/pages/home/webview.wxss b/pages/home/webview.wxss deleted file mode 100644 index 6819689..0000000 --- a/pages/home/webview.wxss +++ /dev/null @@ -1 +0,0 @@ -/* pages/home/webview.wxss */ \ No newline at end of file diff --git a/pages/mine/about.js b/pages/mine/about.js index d12739f..2b005b3 100644 --- a/pages/mine/about.js +++ b/pages/mine/about.js @@ -1,80 +1,19 @@ -// pages/mine/about.js Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - onShareAppMessage() { - return { - title: '暖橙陪诊', // 转发标题 - path: '/pages/mine/about', - } - }, - - onShareTimeline: function () { return { title: '暖橙陪诊', + path: '/pages/mine/about' } }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - + onShareTimeline() { + return { + title: '暖橙陪诊' + } }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - // 跳转「联系我们」页:本页不再平铺联系方式,四项内容与那一页重合, - // 且那一页每行还带「拨打」「复制」动作词,是更完整的一份 + // 联系方式只在独立页面维护,避免同一意图出现两个入口。 goToContact() { - wx.navigateTo({ - url: '/pages/mine/contact' - }); + wx.navigateTo({ url: '/pages/mine/contact' }) } -}); +}) diff --git a/pages/mine/about.wxss b/pages/mine/about.wxss index 6a75d93..540029a 100644 --- a/pages/mine/about.wxss +++ b/pages/mine/about.wxss @@ -125,13 +125,6 @@ page { color: var(--ink); } -/* 摘要:文案与首页同一张卡一致(人工客服),单行短句,不摊开具体号码 */ -.contact-desc { - margin-top: 8rpx; - font-size: 26rpx; - color: var(--muted); -} - /* t-icon 的 color 读不到 CSS 变量,只能硬编码,须与令牌同步(DESIGN.md §2.2); 此处对应 --muted #6F655C。项目里 chevron 一律 muted,不抢暖橙焦点 */ .contact-arrow { diff --git a/pages/mine/addressedit.js b/pages/mine/addressedit.js deleted file mode 100644 index ee4eae6..0000000 --- a/pages/mine/addressedit.js +++ /dev/null @@ -1,216 +0,0 @@ -// pages/mine/addressedit.js -const API = require('../../utils/api.js') - -Page({ - data: { - addresses: [], - editData: { - _index: -1, - label: '', - province: '', - city: '', - district: '', - address: '', - postcode: '', - isDefault: false - }, - isEditing: false - }, - - onLoad() { - this.initAddressData() - }, - - // 列表初值取自全局用户对象;「我的」页不再持有地址,本页是唯一入口 - initAddressData() { - const app = getApp() - const user = app.globalData.user || {} - const addresses = user.addresses || [] - this.setData({ - // 深拷一份,编辑过程中不污染全局对象,落库成功后才回写 - addresses: addresses.map(item => ({ ...item })), - isEditing: false, - editData: this.emptyEditData() - }) - }, - - emptyEditData() { - return { - _index: -1, - label: '', - province: '', - city: '', - district: '', - address: '', - postcode: '', - isDefault: false - } - }, - - onAddAddress() { - this.setData({ - isEditing: true, - // 第一条地址自动设为默认,免得多一步勾选 - editData: { ...this.emptyEditData(), isDefault: this.data.addresses.length === 0 } - }) - wx.setNavigationBarTitle({ title: '新增地址' }) - }, - - onEditAddress(e) { - const index = e.currentTarget.dataset.index - const item = this.data.addresses[index] - this.setData({ - isEditing: true, - editData: { - _index: index, - label: item.label || '', - province: item.province || '', - city: item.city || '', - district: item.district || '', - address: item.address || '', - // 本页没有邮编输入项,但要原样带过去,避免编辑一次就把它清掉 - postcode: item.postcode || '', - isDefault: item.isDefault || false - } - }) - wx.setNavigationBarTitle({ title: '编辑地址' }) - }, - - onBackToList() { - this.setData({ - isEditing: false, - editData: this.emptyEditData() - }) - wx.setNavigationBarTitle({ title: '邮寄地址' }) - }, - - onDeleteAddress(e) { - const index = e.currentTarget.dataset.index - wx.showModal({ - title: '提示', - content: '确定删除该地址吗?', - success: (res) => { - if (!res.confirm) return - const addresses = this.data.addresses.slice() - addresses.splice(index, 1) - // 删掉的是默认地址时顺位补一个,保证列表里始终有默认 - if (addresses.length > 0 && !addresses.some(a => a.isDefault)) { - addresses[0].isDefault = true - } - this.setData({ addresses }) - this.persist(addresses) - } - }) - }, - - onSetDefault(e) { - const index = e.currentTarget.dataset.index - const addresses = this.data.addresses.map((item, i) => ({ - ...item, - isDefault: i === index - })) - this.setData({ addresses }) - this.persist(addresses) - }, - - onRegionChange(e) { - const region = e.detail.value - this.setData({ - 'editData.province': region[0] || '', - 'editData.city': region[1] || '', - 'editData.district': region[2] || '' - }) - }, - - onFieldInput(e) { - const field = e.currentTarget.dataset.field - this.setData({ - [`editData.${field}`]: e.detail.value - }) - }, - - onDefaultChange(e) { - this.setData({ - 'editData.isDefault': e.detail.value - }) - }, - - onSaveEdit() { - const editData = this.data.editData - if (!editData.label.trim()) { - wx.showToast({ title: '请输入地址标签', icon: 'none' }) - return - } - if (!editData.province || !editData.city || !editData.district) { - wx.showToast({ title: '请选择所在地区', icon: 'none' }) - return - } - if (!editData.address.trim()) { - wx.showToast({ title: '请输入详细地址', icon: 'none' }) - return - } - - const addresses = this.data.addresses.slice() - const newItem = { - label: editData.label.trim(), - province: editData.province, - city: editData.city, - district: editData.district, - address: editData.address.trim(), - postcode: editData.postcode.trim(), - isDefault: editData.isDefault - } - - if (editData.isDefault) { - addresses.forEach(item => { item.isDefault = false }) - } - - if (editData._index >= 0) { - addresses[editData._index] = newItem - } else { - if (addresses.length === 0) { - newItem.isDefault = true - } - addresses.push(newItem) - } - - this.setData({ addresses }) - this.onBackToList() - this.persist(addresses) - }, - - // 地址是即时生效的(删除 / 设默认 / 表单保存都直接落库), - // 成功后回写全局对象:「我的」页与下单页读的都是它 - persist(addresses) { - const app = getApp() - const user = app.globalData.user - - if (!user || !user._id) { - wx.showToast({ title: '请先登录', icon: 'none' }) - return - } - - wx.showLoading({ title: '保存中...' }) - - API.user.update({ - _id: user._id, - addresses - }) - .then((data) => { - if (data.code === 0) { - // 与 profileedit 同一处坑:/user/update 的响应不含 security.token, - // 整替会抹掉本机 token,security 必须保留本地那份 - app.globalData.user = { ...user, ...data.data.user, security: user.security || {} } - wx.showToast({ title: '保存成功', icon: 'success' }) - } else { - wx.showToast({ title: data.msg || '保存失败', icon: 'none' }) - } - }) - .catch(() => { - wx.showToast({ title: '网络请求失败', icon: 'none' }) - }) - .finally(() => { - wx.hideLoading() - }) - } -}) \ No newline at end of file diff --git a/pages/mine/addressedit.json b/pages/mine/addressedit.json deleted file mode 100644 index 62aab2d..0000000 --- a/pages/mine/addressedit.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "navigationBarTitleText": "邮寄地址", - "usingComponents": { - "t-icon": "tdesign-miniprogram/icon/icon" - } -} \ No newline at end of file diff --git a/pages/mine/addressedit.wxml b/pages/mine/addressedit.wxml deleted file mode 100644 index c8fd6f5..0000000 --- a/pages/mine/addressedit.wxml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - - - - - {{item.label}} - 默认 - - {{item.province}} {{item.city}} {{item.district}} - {{item.address}} - 邮编:{{item.postcode}} - - - - - - - - - - {{item.isDefault ? '默认地址' : '设为默认'}} - - - - 删除 - - - - - - - - 还没有邮寄地址,添加后下单即可选用 - - - - - - - - - - - - 地址标签 - - - - - 所在地区 - - - {{editData.province || '请选择地区'}}{{editData.city ? ' ' + editData.city : ''}}{{editData.district ? ' ' + editData.district : ''}} - - - - - - 详细地址 - - - - - 设为默认地址 - - - - - - - - - - - - \ No newline at end of file diff --git a/pages/mine/addressedit.wxss b/pages/mine/addressedit.wxss deleted file mode 100644 index f1d6f9b..0000000 --- a/pages/mine/addressedit.wxss +++ /dev/null @@ -1,268 +0,0 @@ -page { - /* 配色令牌来自 app.wxss(全站唯一来源),本页不留副本 */ - background-color: var(--paper); - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; -} - -.container { - min-height: 100vh; - box-sizing: border-box; - /* 底部留出固定操作栏的高度 + 安全区,避免最后一个地址被盖住 */ - padding: 40rpx 32rpx calc(180rpx + env(safe-area-inset-bottom)); -} - -/* ===== 通栏白块(列表态 / 表单态共用同一语言)===== - 白面 + 上下各 2rpx 发丝线 + 中性阴影,圆角 0; - 负向 margin 抵消容器 32rpx 内距后左右顶到屏幕两侧, - 行内再用 32rpx 内距回到同一左基线,内部发丝线因此通到底 */ -.addr-list, -.form-card { - margin: 0 -32rpx; - background: var(--white); - border-top: 2rpx solid var(--line); - border-bottom: 2rpx solid var(--line); - box-shadow: var(--shadow-card); -} - -/* ===== 地址卡 ===== */ -.addr-card { - padding: 28rpx 32rpx; - border-bottom: 2rpx solid var(--line); -} - -.addr-card-last { - border-bottom: none; -} - -.addr-main { - display: flex; - align-items: center; - justify-content: space-between; -} - -.addr-main-hover { - opacity: 0.7; -} - -.addr-info { - flex: 1; - min-width: 0; - display: flex; - flex-direction: column; -} - -.addr-top { - display: flex; - align-items: center; - margin-bottom: 10rpx; -} - -.addr-label { - font-size: 30rpx; - font-weight: 700; - color: var(--ink); -} - -/* 默认标签:浅橙衬底档(--brand-soft + 2rpx --brand-line + --brand-ink), - 字号 24rpx 是中文最小字号下限,不得再小 */ -.addr-default-tag { - margin-left: 16rpx; - padding: 4rpx 12rpx; - border-radius: 6rpx; - background: var(--brand-soft); - border: 2rpx solid var(--brand-line); - font-size: 24rpx; - color: var(--brand-ink); -} - -.addr-region { - margin-bottom: 6rpx; - font-size: 26rpx; - color: var(--muted); -} - -.addr-detail { - font-size: 28rpx; - color: var(--ink); - line-height: 1.5; -} - -.addr-postcode { - margin-top: 6rpx; - font-size: 24rpx; - color: var(--muted); -} - -.addr-arrow { - flex-shrink: 0; - margin-left: 16rpx; - color: var(--muted); -} - -/* 卡片操作行:与主体隔一条发丝线,两项分列两端 */ -.addr-actions { - display: flex; - align-items: center; - justify-content: space-between; - margin-top: 24rpx; - padding-top: 20rpx; - border-top: 2rpx solid var(--line); -} - -/* 文字只有 26rpx 高,用 padding 撑热区、等量负外边距抵消,不改变行高 */ -.addr-action { - display: flex; - align-items: center; - padding: 16rpx 0; - margin: -16rpx 0; -} - -.addr-action-icon { - margin-right: 10rpx; - color: var(--muted); -} - -.addr-action-icon-active { - color: var(--brand-strong); -} - -.addr-action-text { - font-size: 26rpx; - color: var(--muted); -} - -.addr-action-text-active { - color: var(--brand-ink); - font-weight: 700; -} - -/* ===== 空态 ===== */ -.addr-empty { - display: flex; - flex-direction: column; - align-items: center; - padding: 140rpx 32rpx; -} - -/* --faint 仅用于非文字装饰,不承载信息 */ -.addr-empty-icon { - color: var(--faint); -} - -.addr-empty-text { - margin-top: 24rpx; - font-size: 28rpx; - color: var(--muted); -} - -/* ===== 表单 ===== */ -/* 行高约 87rpx(28rpx×1.4 + 上下 24rpx),贴近 iOS 44pt 触控目标 */ -.form-row { - display: flex; - align-items: center; - justify-content: space-between; - padding: 24rpx 32rpx; - border-bottom: 2rpx solid var(--line); -} - -.form-row-last { - border-bottom: none; -} - -/* 标签走 --muted、值走 --ink 700:层级靠明度与字重拉开,不给可点性上色 */ -.form-label { - flex-shrink: 0; - margin-right: 24rpx; - font-size: 28rpx; - color: var(--muted); - letter-spacing: 1rpx; -} - -.form-input { - flex: 1; - min-width: 0; - text-align: right; - font-size: 28rpx; - font-weight: 700; - color: var(--ink); -} - -.form-placeholder { - color: var(--muted); - font-weight: 400; -} - -/* picker 需占满剩余宽度,值才能靠右对齐 */ -.form-picker { - flex: 1; - min-width: 0; -} - -.picker-value { - display: block; - text-align: right; - font-size: 28rpx; - font-weight: 700; - color: var(--ink); -} - -.picker-placeholder { - color: var(--muted); - font-weight: 400; -} - -/* ===== 底部固定操作栏 ===== */ -/* 纸面与白面填充差只有 1.05:1,靠一道小偏移小模糊的上向暖墨阴影托住边界 */ -.footer-bar { - position: fixed; - left: 0; - right: 0; - bottom: 0; - padding: 20rpx 32rpx calc(20rpx + env(safe-area-inset-bottom)); - background: var(--white); - box-shadow: 0 -2rpx 8rpx rgba(63, 43, 25, 0.07); -} - -.footer-bar-duo { - display: flex; - gap: 24rpx; -} - -/* 保存是本页唯一的实心暖橙块,独占「全页同类实心块不超过一处」的额度 */ -.primary-btn { - flex: 1; - margin: 0; - padding: 24rpx 0; - border: none; - border-radius: 999rpx; - background: var(--brand-strong); - box-shadow: var(--shadow-cta); - color: var(--white); - font-size: 30rpx; - font-weight: 700; - letter-spacing: 2rpx; - line-height: 1.4; -} - -.primary-btn::after { - border: none; -} - -/* 取消:空心胶囊,靠--sep 环 + 透明底表达"次要动作",不占用实心额度 */ -.ghost-btn { - flex: 1; - margin: 0; - padding: 22rpx 0; - border: 2rpx solid var(--sep); - border-radius: 999rpx; - background: transparent; - color: var(--ink-2); - font-size: 30rpx; - font-weight: 500; - letter-spacing: 2rpx; - line-height: 1.4; -} - -.ghost-btn::after { - border: none; -} \ No newline at end of file diff --git a/pages/mine/business.js b/pages/mine/business.js index 7316fda..9b4d3b5 100644 --- a/pages/mine/business.js +++ b/pages/mine/business.js @@ -58,6 +58,12 @@ Page({ onLoad(options) { const section = options && options.section this.sectionId = SECTION_IDS.indexOf(section) > -1 ? section : '' + this.setData({ + sections: this.data.sections.map(item => ({ + ...item, + points: item.points.map(text => ({ id: text, text })) + })) + }) }, onReady() { diff --git a/pages/mine/business.wxml b/pages/mine/business.wxml index adce68c..6d75e54 100644 --- a/pages/mine/business.wxml +++ b/pages/mine/business.wxml @@ -23,9 +23,9 @@ - + - {{ point }} + {{ point.text }} diff --git a/pages/mine/mine.js b/pages/mine/mine.js index 487f503..ebf0c58 100644 --- a/pages/mine/mine.js +++ b/pages/mine/mine.js @@ -10,7 +10,6 @@ Page({ name: '用户', // 身份行副行,loadUserInfo 时由手机号脱敏填入 account: '', - phone: '', isLoggedIn: false }, // 菜单分组:按"用途"而非"是不是陪诊"分,三组才立得住。 @@ -77,11 +76,8 @@ Page({ this.setData({ 'userInfo.isLoggedIn': true, 'userInfo.name': profile.name || '用户', - // 头像补读后端返回值;取不到留空,由模板渲染暖橙默认头像。 - // 注:profileedit 页里新选的图目前不会落库——utils/api.js 没有文件上传接口, - // 微信返回的是本地临时路径,存进库里也会失效,所以这里只修"显示"这一半 + // 头像只读展示;取不到时由模板渲染暖橙默认头像。 'userInfo.avatar': profile.avatar || '', - 'userInfo.phone': profile.mobile || '', // 身份行副行(微信那行是微信号):本应用没有账号体系, // 等价标识是手机号,脱敏成 138****1234 后再上屏 'userInfo.account': this.maskMobile(profile.mobile || '') @@ -94,8 +90,7 @@ Page({ 'userInfo.isLoggedIn': false, 'userInfo.avatar': '', 'userInfo.name': '用户', - 'userInfo.account': '', - 'userInfo.phone': '' + 'userInfo.account': '' }) } },