Initial commit

This commit is contained in:
2026-06-05 17:46:51 +08:00
commit c04c890186
96 changed files with 6477 additions and 0 deletions

View File

@@ -0,0 +1 @@
{ "navigationStyle": "custom", "usingComponents": {} }

View File

@@ -0,0 +1,46 @@
const app = getApp<{ userInfo: any }>()
Page({
data: {
statusBarHeight: 0,
form: { nickName: '', bio: '', location: '' },
},
onLoad() {
const info = wx.getSystemInfoSync()
this.setData({ statusBarHeight: info.statusBarHeight })
const user = app.globalData?.userInfo
if (user) {
this.setData({
form: { nickName: user.nickName || '', bio: user.bio || '', location: user.location || '' },
})
}
},
onField(e: WechatMiniprogram.CustomEvent) {
this.setData({ [`form.${e.currentTarget.dataset.key}`]: e.detail.value })
},
async onSave() {
const { form } = this.data
if (!form.nickName.trim()) {
wx.showToast({ title: '昵称不能为空', icon: 'none' })
return
}
wx.showLoading({ title: '保存中...' })
try {
await wx.cloud.callFunction({ name: 'updateProfile', data: form })
if (app.globalData.userInfo) {
Object.assign(app.globalData.userInfo, form)
}
wx.hideLoading()
wx.showToast({ title: '保存成功', icon: 'success' })
setTimeout(() => wx.navigateBack(), 800)
} catch {
wx.hideLoading()
wx.showToast({ title: '保存失败', icon: 'none' })
}
},
onBack() { wx.navigateBack() },
})

View File

@@ -0,0 +1,27 @@
<view class="page">
<view class="safe-top" style="height: {{statusBarHeight}}px"></view>
<view class="nav">
<view class="nav-back" bindtap="onBack">取消</view>
<view class="nav-title">编辑资料</view>
<view class="nav-save" bindtap="onSave">保存</view>
</view>
<scroll-view scroll-y="true" enhanced="true" show-scrollbar="false">
<view class="form">
<view class="field-group">
<view class="field-item">
<text class="field-label">昵称</text>
<input class="field-input" value="{{form.nickName}}" bindinput="onField" data-key="nickName" placeholder="你的昵称" maxlength="20" />
</view>
<view class="field-item field-item-col">
<text class="field-label">个人简介</text>
<textarea class="field-textarea" value="{{form.bio}}" bindinput="onField" data-key="bio" placeholder="介绍一下你和你的宠物..." maxlength="80" auto-height="true" show-confirm-bar="false" />
</view>
<view class="field-item">
<text class="field-label">所在城市</text>
<input class="field-input" value="{{form.location}}" bindinput="onField" data-key="location" placeholder="所在城市" maxlength="20" />
</view>
</view>
<view style="height: 60rpx;"></view>
</view>
</scroll-view>
</view>

View File

@@ -0,0 +1,13 @@
.page { min-height: 100vh; background: linear-gradient(180deg, #fff8f2 0%, #f5f0ff 100%); }
.nav { display: flex; align-items: center; padding: 14rpx 28rpx; gap: 16rpx; }
.nav-back { font-size: 28rpx; font-weight: 700; color: #9b8fa8; }
.nav-title { flex: 1; font-size: 32rpx; font-weight: 900; color: #272235; text-align: center; }
.nav-save { font-size: 28rpx; font-weight: 900; color: #ff4f91; }
.form { padding: 24rpx 28rpx; }
.field-group { background: rgba(255,255,255,0.90); border-radius: 36rpx; border: 1rpx solid rgba(255,255,255,0.72); overflow: hidden; box-shadow: 0 12rpx 26rpx rgba(78,56,96,0.08); }
.field-item { display: flex; align-items: center; justify-content: space-between; padding: 24rpx 28rpx; border-bottom: 1rpx solid rgba(43,37,61,0.06); }
.field-item:last-child { border-bottom: none; }
.field-item-col { flex-direction: column; align-items: flex-start; gap: 14rpx; }
.field-label { font-size: 28rpx; font-weight: 700; color: #272235; flex-shrink: 0; margin-right: 20rpx; }
.field-input { flex: 1; font-size: 28rpx; color: #272235; text-align: right; }
.field-textarea { width: 100%; min-height: 80rpx; font-size: 28rpx; color: #272235; line-height: 1.6; }