删除不再使用的文件和配置,优化项目结构以提升可维护性;新增环境变量配置示例,更新 Docker 和部署相关文件以支持灵活的端口设置;重构数据库连接逻辑,增强错误处理和配置管理,确保更好的兼容性和稳定性。

This commit is contained in:
乘风
2026-02-02 18:16:15 +08:00
parent 6dcc6a4709
commit 8eec1ab78c
126 changed files with 12536 additions and 20384 deletions

View File

@@ -1,83 +1,68 @@
/**
* Soul创业派对 - 收货地址列表(增删改查)
*/
// pages/address-list/address-list.js
const app = getApp()
Page({
data: {
statusBarHeight: 44,
list: [],
loading: true
navBarHeight: 88
},
onLoad() {
this.setData({ statusBarHeight: app.globalData.statusBarHeight })
this.loadList()
},
onShow() {
this.loadList()
},
async loadList() {
const userId = app.globalData.userInfo?.id
if (!userId) {
this.setData({ list: [], loading: false })
return
}
this.setData({ loading: true })
try {
const res = await app.request('/api/user/addresses', { data: { userId } })
if (res.success && res.list) {
this.setData({ list: res.list, loading: false })
} else {
this.setData({ list: [], loading: false })
}
} catch (e) {
this.setData({ list: [], loading: false })
}
},
goAdd() {
wx.navigateTo({ url: '/pages/address-edit/address-edit' })
},
goEdit(e) {
const id = e.currentTarget.dataset.id
wx.navigateTo({ url: '/pages/address-edit/address-edit?id=' + id })
},
async deleteAddress(e) {
const id = e.currentTarget.dataset.id
const that = this
wx.showModal({
title: '删除地址',
content: '确定要删除该收货地址吗?',
success(res) {
if (!res.confirm) return
that.doDelete(id)
}
})
},
async doDelete(id) {
wx.showLoading({ title: '删除中...' })
try {
const res = await app.request('/api/user/addresses/' + id, { method: 'DELETE' })
wx.hideLoading()
if (res.success) {
wx.showToast({ title: '已删除', icon: 'success' })
this.loadList()
} else {
wx.showToast({ title: res.message || '删除失败', icon: 'none' })
}
} catch (e) {
wx.hideLoading()
wx.showToast({ title: '删除失败', icon: 'none' })
}
onLoad(options) {
const statusBarHeight = app.globalData.statusBarHeight || 44
const navBarHeight = app.globalData.navBarHeight || (statusBarHeight + 44)
this.setData({ statusBarHeight, navBarHeight })
},
goBack() {
wx.navigateBack()
wx.navigateBack({ fail: () => wx.switchTab({ url: '/pages/my/my' }) })
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
})

View File

@@ -1,4 +1,4 @@
{
"navigationBarTitleText": "收货地址",
"navigationBarTitleText": "地址管理",
"usingComponents": {}
}

View File

@@ -1,46 +1,8 @@
<!-- 收货地址列表 - 类似淘宝 -->
<view class="page">
<view class="nav-bar" style="padding-top: {{statusBarHeight}}px;">
<view class="nav-back" bindtap="goBack">
<text class="back-icon"></text>
</view>
<text class="nav-title">收货地址</text>
<view class="nav-placeholder"></view>
</view>
<view style="height: {{statusBarHeight + 44}}px;"></view>
<view class="content">
<view wx:if="{{loading}}" class="loading-wrap">
<text class="loading-text">加载中...</text>
</view>
<view wx:elif="{{list.length === 0}}" class="empty-wrap">
<text class="empty-icon">📍</text>
<text class="empty-text">暂无收货地址</text>
<text class="empty-tip">点击下方按钮添加</text>
</view>
<view wx:else class="address-list">
<view
class="address-card"
wx:for="{{list}}"
wx:key="id"
data-id="{{item.id}}"
bindtap="goEdit"
>
<view class="card-header">
<text class="name">{{item.name}}</text>
<text class="phone">{{item.phone}}</text>
<view class="default-tag" wx:if="{{item.isDefault}}">默认</view>
</view>
<view class="card-address">{{item.fullAddress}}</view>
<view class="card-actions">
<view class="action-btn" catchtap="goEdit" data-id="{{item.id}}">编辑</view>
<view class="action-btn delete" catchtap="deleteAddress" data-id="{{item.id}}">删除</view>
</view>
</view>
</view>
<view class="btn-add" bindtap="goAdd">+ 新增收货地址</view>
<view class="nav-placeholder" style="height: {{navBarHeight || (statusBarHeight + 44)}}px;"></view>
<view class="header safe-header-right">
<view class="nav-back" bindtap="goBack">← 返回</view>
<text class="header-title">地址列表</text>
</view>
<view class="placeholder-body">待开发</view>
</view>

View File

@@ -1,44 +1,8 @@
.page { min-height: 100vh; background: #000; padding-bottom: 120rpx; }
.nav-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 100; background: rgba(0,0,0,0.9); backdrop-filter: blur(40rpx); display: flex; align-items: center; justify-content: space-between; padding: 0 32rpx; height: 88rpx; }
.nav-back { width: 64rpx; height: 64rpx; display: flex; align-items: center; justify-content: center; }
.back-icon { font-size: 40rpx; color: rgba(255,255,255,0.6); }
.nav-title { font-size: 34rpx; font-weight: 600; color: #fff; }
.nav-placeholder { width: 64rpx; }
.content { padding: 24rpx; }
.loading-wrap, .empty-wrap { text-align: center; padding: 80rpx 0; }
.loading-text { color: rgba(255,255,255,0.5); font-size: 28rpx; }
.empty-icon { font-size: 80rpx; display: block; margin-bottom: 24rpx; opacity: 0.6; }
.empty-text { color: #fff; font-size: 30rpx; display: block; }
.empty-tip { color: rgba(255,255,255,0.4); font-size: 26rpx; display: block; margin-top: 8rpx; }
.address-list { display: flex; flex-direction: column; gap: 24rpx; }
.address-card {
background: #1c1c1e;
border-radius: 24rpx;
padding: 28rpx;
border: 2rpx solid rgba(0,206,209,0.2);
}
.card-header { display: flex; align-items: center; gap: 16rpx; margin-bottom: 16rpx; }
.card-header .name { font-size: 30rpx; font-weight: 600; color: #fff; }
.card-header .phone { font-size: 26rpx; color: rgba(255,255,255,0.6); }
.default-tag { margin-left: auto; padding: 4rpx 12rpx; background: rgba(0,206,209,0.25); color: #00CED1; font-size: 22rpx; border-radius: 8rpx; }
.card-address { font-size: 26rpx; color: rgba(255,255,255,0.7); line-height: 1.5; margin-bottom: 20rpx; }
.card-actions { display: flex; justify-content: flex-end; gap: 24rpx; }
.action-btn { font-size: 26rpx; color: #00CED1; }
.action-btn.delete { color: rgba(255,107,107,0.9); }
.btn-add {
position: fixed;
bottom: 0;
left: 24rpx;
right: 24rpx;
height: 88rpx;
line-height: 88rpx;
text-align: center;
background: #00CED1;
color: #000;
font-size: 30rpx;
font-weight: 600;
border-radius: 44rpx;
}
page { background: #000; color: #fff; }
.page { min-height: 100vh; }
.nav-placeholder { width: 100%; }
.header { display: flex; align-items: center; padding: 24rpx 32rpx; border-bottom: 2rpx solid rgba(255,255,255,0.05); }
.nav-back { font-size: 32rpx; color: #00CED1; margin-right: 24rpx; }
.header-title { flex: 1; text-align: center; font-size: 34rpx; color: #00CED1; }
.placeholder-body { padding: 48rpx; text-align: center; color: rgba(255,255,255,0.4); font-size: 28rpx; }
.container { padding: 32rpx; }