upload project

This commit is contained in:
unknown 2025-12-27 17:16:03 +08:00
commit 06961cae04
422 changed files with 110626 additions and 0 deletions

View file

@ -0,0 +1,56 @@
const friendAPI = require('../../utils/friend-api.js');
Page({
data: {
remark: '',
nickname: '',
friendId: ''
},
onLoad(options) {
// 接收参数
const nickname = options.nickname ? decodeURIComponent(options.nickname) : '';
const friendId = options.friendId ? decodeURIComponent(options.friendId) : (options.customId ? decodeURIComponent(options.customId) : '');
const remark = options.remark ? decodeURIComponent(options.remark) : '';
this.setData({
nickname: nickname,
friendId: friendId,
remark: remark
});
},
onRemarkInput(e) {
this.setData({ remark: e.detail.value });
},
async onSaveRemark() {
const { remark, friendId } = this.data;
if (!friendId) {
wx.showToast({ title: '参数错误', icon: 'none' });
return;
}
wx.showLoading({ title: '保存中...', mask: true });
try {
const response = await friendAPI.updateFriendRelation(friendId, { remark: remark });
if (response && (response.code === 0 || response.code === 200 || response.code === '0' || response.code === '200')) {
// 更新上一页的好友信息
const pages = getCurrentPages();
const prevPage = pages[pages.length - 2];
if (prevPage && prevPage.setData) {
prevPage.setData({ 'friendInfo.remark': remark });
}
wx.hideLoading();
wx.showToast({ title: '保存成功', icon: 'success' });
setTimeout(() => wx.navigateBack(), 1500);
} else {
throw new Error(response.message || '保存失败');
}
} catch (error) {
wx.hideLoading();
wx.showToast({ title: error.message || '保存失败', icon: 'none' });
}
}
})

View file

@ -0,0 +1,5 @@
{
"navigationBarTitleText": "备注",
"navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "white"
}

View file

@ -0,0 +1,11 @@
<view class="friend-remark-container">
<view class="remark-row">
<view class="remark-form">
<view class="remark-label">备注好友姓名</view>
<input class="remark-input" placeholder="{{nickname ? nickname : '请输入备注'}}" value="{{remark}}" bindinput="onRemarkInput" maxlength="50" />
</view>
<view class="remark-actions">
<button class="save-btn" bindtap="onSaveRemark">保存</button>
</view>
</view>
</view>

View file

@ -0,0 +1,77 @@
.friend-remark-container {
width: 100vw;
height: 100vh;
background: #000;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
padding: 0 32rpx;
padding-top: 40rpx;
box-sizing: border-box;
}
.remark-row {
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: space-between;
width: 100%;
gap: 20rpx;
margin-top: 160rpx;
}
.remark-form {
flex: 1;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
}
.remark-form > view {
font-size: 28rpx;
color: #999;
margin-bottom: 16rpx;
}
.remark-input {
width: 100%;
height: 80rpx;
border-radius: 40rpx;
background: #1a1a1a;
font-size: 28rpx;
padding: 0 32rpx;
box-sizing: border-box;
border: 1rpx solid #333;
color: #fff;
}
.remark-input::placeholder {
color: #666;
}
.remark-actions {
flex-shrink: 0;
display: flex;
align-items: flex-start;
padding-top: 56rpx;
}
.save-btn {
background: linear-gradient(135deg, #68f9fe 0%, #AA93ED 100%);
color: #fff;
border-radius: 40rpx;
padding: 0 48rpx;
height: 80rpx;
line-height: 80rpx;
font-size: 32rpx;
border: none;
display: flex;
align-items: center;
justify-content: center;
}
.save-btn::after {
border: none;
}