清理无效页面与前端发布风险

Co-Authored-By: Kimi-K3.1-Pro noreply@moonshot.cn
This commit is contained in:
lik
2026-10-24 19:07:02 +08:00
committed by trae-solo-agent
co-authored by Kimi-K3.1-Pro noreply@moonshot.cn
parent 1181d598b4
commit df96cb3b07
43 changed files with 144 additions and 1878 deletions
+8 -69
View File
@@ -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' })
}
});
})
-7
View File
@@ -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 {
-216
View File
@@ -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()
})
}
})
-6
View File
@@ -1,6 +0,0 @@
{
"navigationBarTitleText": "邮寄地址",
"usingComponents": {
"t-icon": "tdesign-miniprogram/icon/icon"
}
}
-93
View File
@@ -1,93 +0,0 @@
<view class="container">
<!-- 原先这里是 mine 页上的 comp_address 浮层(fixed + 遮罩 + 底部 sheet),
不占页面栈,系统返回键会直接退出小程序;改为真页面后由微信原生
导航栏接管返回。列表 / 表单两个状态仍在同页切换(外层不再有壳),
切换时同步改导航栏标题 -->
<!-- ===== 列表态 ===== -->
<block wx:if="{{!isEditing}}">
<view class="addr-list" wx:if="{{addresses.length > 0}}">
<view
class="addr-card {{index === addresses.length - 1 ? 'addr-card-last' : ''}}"
wx:for="{{addresses}}"
wx:key="index"
>
<!-- 主体可点进编辑:右侧 chevron 是点击暗示,不做无暗示的整卡可点 -->
<view class="addr-main" bindtap="onEditAddress" data-index="{{index}}" hover-class="addr-main-hover">
<view class="addr-info">
<view class="addr-top">
<text class="addr-label">{{item.label}}</text>
<text class="addr-default-tag" wx:if="{{item.isDefault}}">默认</text>
</view>
<text class="addr-region">{{item.province}} {{item.city}} {{item.district}}</text>
<text class="addr-detail">{{item.address}}</text>
<text class="addr-postcode" wx:if="{{item.postcode}}">邮编:{{item.postcode}}</text>
</view>
<t-icon name="chevron-right" class="addr-arrow" size="32rpx" />
</view>
<view class="addr-actions">
<view class="addr-action" bindtap="onSetDefault" data-index="{{index}}">
<!-- 状态同时用图形与文字传达,不只靠颜色(WCAG 1.4.1);
t-icon 的 color 读不到变量,故用 CSS 类着色而不是写死 hex -->
<t-icon wx:if="{{item.isDefault}}" name="check-circle-filled" class="addr-action-icon addr-action-icon-active" size="32rpx" />
<t-icon wx:else name="circle" class="addr-action-icon" size="32rpx" />
<text class="addr-action-text {{item.isDefault ? 'addr-action-text-active' : ''}}">{{item.isDefault ? '默认地址' : '设为默认'}}</text>
</view>
<view class="addr-action" bindtap="onDeleteAddress" data-index="{{index}}">
<t-icon name="delete" class="addr-action-icon" size="32rpx" />
<text class="addr-action-text">删除</text>
</view>
</view>
</view>
</view>
<view class="addr-empty" wx:else>
<t-icon name="location" class="addr-empty-icon" size="80rpx" />
<text class="addr-empty-text">还没有邮寄地址,添加后下单即可选用</text>
</view>
<view class="footer-bar">
<button class="primary-btn" bindtap="onAddAddress">添加地址</button>
</view>
</block>
<!-- ===== 表单态 ===== -->
<block wx:else>
<view class="form-card">
<view class="form-row">
<text class="form-label">地址标签</text>
<input class="form-input" value="{{editData.label}}" placeholder="如:家庭、公司" placeholder-class="form-placeholder"
maxlength="20" bindinput="onFieldInput" data-field="label" />
</view>
<view class="form-row">
<text class="form-label">所在地区</text>
<picker class="form-picker" mode="region" value="{{[editData.province, editData.city, editData.district]}}"
bindchange="onRegionChange">
<view class="picker-value {{editData.province ? '' : 'picker-placeholder'}}">
{{editData.province || '请选择地区'}}{{editData.city ? ' ' + editData.city : ''}}{{editData.district ? ' ' + editData.district : ''}}
</view>
</picker>
</view>
<view class="form-row">
<text class="form-label">详细地址</text>
<input class="form-input" value="{{editData.address}}" placeholder="请输入详细地址" placeholder-class="form-placeholder"
maxlength="100" bindinput="onFieldInput" data-field="address" />
</view>
<view class="form-row form-row-last">
<text class="form-label">设为默认地址</text>
<!-- switch 的 color 属性读不到 CSS 变量,只能硬编码,取值须与令牌同步 -->
<switch checked="{{editData.isDefault}}" bindchange="onDefaultChange" color="#B8520A" />
</view>
</view>
<!-- 表单态双按钮:取消走空心(--sep 描边 + 透明底),保存是本页唯一实心橙块 -->
<view class="footer-bar footer-bar-duo">
<button class="ghost-btn" bindtap="onBackToList">取消</button>
<button class="primary-btn" bindtap="onSaveEdit">保存</button>
</view>
</block>
</view>
-268
View File
@@ -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;
}
+6
View File
@@ -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() {
+2 -2
View File
@@ -23,9 +23,9 @@
<!-- 规则条目用陪诊指南页同一套圆点语言 -->
<view class="dot-list">
<view class="dot-item" wx:for="{{ item.points }}" wx:for-item="point" wx:key="*this">
<view class="dot-item" wx:for="{{ item.points }}" wx:for-item="point" wx:key="id">
<view class="dot"></view>
<text class="dot-text">{{ point }}</text>
<text class="dot-text">{{ point.text }}</text>
</view>
</view>
+2 -7
View File
@@ -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': ''
})
}
},