修复我的页面布局 + 找伙伴弹窗优化
## 我的页面 1. 头像使用wx.chooseMedia替代button的chooseAvatar 2. 头像/名字/ID布局对齐 3. 去掉多余的创业伙伴图标 ## 找伙伴页面 1. 导师顾问改为"立即咨询" 2. 团队招募改为"团队招募"(去掉"加入项目") 3. 弹窗标题去掉"加入"字样
This commit is contained in:
@@ -10,8 +10,8 @@ const app = getApp()
|
|||||||
let MATCH_TYPES = [
|
let MATCH_TYPES = [
|
||||||
{ id: 'partner', label: '创业合伙', matchLabel: '创业伙伴', icon: '⭐', matchFromDB: true, showJoinAfterMatch: false },
|
{ id: 'partner', label: '创业合伙', matchLabel: '创业伙伴', icon: '⭐', matchFromDB: true, showJoinAfterMatch: false },
|
||||||
{ id: 'investor', label: '资源对接', matchLabel: '资源对接', icon: '👥', matchFromDB: false, showJoinAfterMatch: true },
|
{ id: 'investor', label: '资源对接', matchLabel: '资源对接', icon: '👥', matchFromDB: false, showJoinAfterMatch: true },
|
||||||
{ id: 'mentor', label: '导师顾问', matchLabel: '商业顾问', icon: '❤️', matchFromDB: false, showJoinAfterMatch: true },
|
{ id: 'mentor', label: '导师顾问', matchLabel: '立即咨询', icon: '❤️', matchFromDB: false, showJoinAfterMatch: true },
|
||||||
{ id: 'team', label: '团队招募', matchLabel: '加入项目', icon: '🎮', matchFromDB: false, showJoinAfterMatch: true }
|
{ id: 'team', label: '团队招募', matchLabel: '团队招募', icon: '🎮', matchFromDB: false, showJoinAfterMatch: true }
|
||||||
]
|
]
|
||||||
|
|
||||||
let FREE_MATCH_LIMIT = 3 // 每日免费匹配次数
|
let FREE_MATCH_LIMIT = 3 // 每日免费匹配次数
|
||||||
|
|||||||
@@ -181,7 +181,7 @@
|
|||||||
<view class="join-icon-wrap">
|
<view class="join-icon-wrap">
|
||||||
<text class="join-icon">{{joinType === 'investor' ? '👥' : joinType === 'mentor' ? '❤️' : '🎮'}}</text>
|
<text class="join-icon">{{joinType === 'investor' ? '👥' : joinType === 'mentor' ? '❤️' : '🎮'}}</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="join-title">加入{{joinTypeLabel}}</text>
|
<text class="join-title">{{joinTypeLabel}}</text>
|
||||||
<text class="join-subtitle" wx:if="{{needBindFirst}}">请先绑定联系方式</text>
|
<text class="join-subtitle" wx:if="{{needBindFirst}}">请先绑定联系方式</text>
|
||||||
<text class="join-subtitle" wx:else>填写联系方式,专人对接</text>
|
<text class="join-subtitle" wx:else>填写联系方式,专人对接</text>
|
||||||
<view class="close-btn-new" bindtap="closeJoinModal">✕</view>
|
<view class="close-btn-new" bindtap="closeJoinModal">✕</view>
|
||||||
|
|||||||
@@ -102,33 +102,43 @@ Page({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 微信头像选择回调(button open-type="chooseAvatar")
|
// 点击头像 - 从相册选择
|
||||||
async onChooseAvatar(e) {
|
chooseAvatar() {
|
||||||
const avatarUrl = e.detail.avatarUrl
|
wx.chooseMedia({
|
||||||
if (!avatarUrl) return
|
count: 1,
|
||||||
|
mediaType: ['image'],
|
||||||
wx.showLoading({ title: '更新中...', mask: true })
|
sourceType: ['album', 'camera'],
|
||||||
|
success: async (res) => {
|
||||||
try {
|
const tempFilePath = res.tempFiles[0].tempFilePath
|
||||||
// 更新本地显示
|
|
||||||
const userInfo = this.data.userInfo
|
wx.showLoading({ title: '更新中...', mask: true })
|
||||||
userInfo.avatar = avatarUrl
|
|
||||||
this.setData({ userInfo })
|
try {
|
||||||
app.globalData.userInfo = userInfo
|
// 更新本地显示
|
||||||
wx.setStorageSync('userInfo', userInfo)
|
const userInfo = this.data.userInfo
|
||||||
|
userInfo.avatar = tempFilePath
|
||||||
// 同步到服务器
|
this.setData({ userInfo })
|
||||||
await app.request('/api/user/update', {
|
app.globalData.userInfo = userInfo
|
||||||
method: 'POST',
|
wx.setStorageSync('userInfo', userInfo)
|
||||||
data: { userId: userInfo.id, avatar: avatarUrl }
|
|
||||||
})
|
// 同步到服务器
|
||||||
|
try {
|
||||||
wx.hideLoading()
|
await app.request('/api/user/update', {
|
||||||
wx.showToast({ title: '头像已更新', icon: 'success' })
|
method: 'POST',
|
||||||
} catch (e) {
|
data: { userId: userInfo.id, avatar: tempFilePath }
|
||||||
wx.hideLoading()
|
})
|
||||||
wx.showToast({ title: '更新失败', icon: 'none' })
|
} catch (e) {
|
||||||
}
|
console.log('同步头像失败', e)
|
||||||
|
}
|
||||||
|
|
||||||
|
wx.hideLoading()
|
||||||
|
wx.showToast({ title: '头像已更新', icon: 'success' })
|
||||||
|
} catch (e) {
|
||||||
|
wx.hideLoading()
|
||||||
|
wx.showToast({ title: '更新失败', icon: 'none' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 点击昵称修改
|
// 点击昵称修改
|
||||||
|
|||||||
@@ -27,8 +27,8 @@
|
|||||||
<!-- 用户卡片 - 已登录状态 -->
|
<!-- 用户卡片 - 已登录状态 -->
|
||||||
<view class="user-card card-gradient" wx:else>
|
<view class="user-card card-gradient" wx:else>
|
||||||
<view class="user-header-row">
|
<view class="user-header-row">
|
||||||
<!-- 头像点击获取微信头像 -->
|
<!-- 头像 - 点击获取微信头像 -->
|
||||||
<button class="avatar-btn" open-type="chooseAvatar" bindchooseavatar="onChooseAvatar">
|
<view class="avatar-wrapper" bindtap="chooseAvatar">
|
||||||
<view class="avatar">
|
<view class="avatar">
|
||||||
<image class="avatar-img" wx:if="{{userInfo.avatar}}" src="{{userInfo.avatar}}" mode="aspectFill"/>
|
<image class="avatar-img" wx:if="{{userInfo.avatar}}" src="{{userInfo.avatar}}" mode="aspectFill"/>
|
||||||
<text class="avatar-text" wx:else>{{userInfo.nickname[0] || '微'}}</text>
|
<text class="avatar-text" wx:else>{{userInfo.nickname[0] || '微'}}</text>
|
||||||
@@ -36,16 +36,17 @@
|
|||||||
<view class="avatar-edit-hint">
|
<view class="avatar-edit-hint">
|
||||||
<text class="edit-icon">✎</text>
|
<text class="edit-icon">✎</text>
|
||||||
</view>
|
</view>
|
||||||
</button>
|
</view>
|
||||||
|
|
||||||
<!-- 用户信息 - 点击昵称修改 -->
|
<!-- 用户信息 -->
|
||||||
<view class="user-info-block">
|
<view class="user-info-block">
|
||||||
<view class="user-name-row" bindtap="editNickname">
|
<view class="user-name-row" bindtap="editNickname">
|
||||||
<text class="user-name">{{userInfo.nickname || '微信用户'}}</text>
|
<text class="user-name">{{userInfo.nickname || '微信用户'}}</text>
|
||||||
<text class="edit-name-icon">✎</text>
|
<text class="edit-name-icon">✎</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="user-wechat" wx:if="{{userInfo.wechatId}}">微信: {{userInfo.wechatId}}</text>
|
<view class="user-id-row">
|
||||||
<text class="user-id" wx:else>ID: {{userIdShort}}</text>
|
<text class="user-id">ID: {{userIdShort}}</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|||||||
@@ -65,27 +65,16 @@
|
|||||||
.user-header-row {
|
.user-header-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 28rpx;
|
gap: 24rpx;
|
||||||
margin-bottom: 36rpx;
|
margin-bottom: 32rpx;
|
||||||
}
|
|
||||||
|
|
||||||
/* 头像按钮样式 */
|
|
||||||
.avatar-btn {
|
|
||||||
position: relative;
|
|
||||||
flex-shrink: 0;
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
background: transparent;
|
|
||||||
border: none;
|
|
||||||
line-height: normal;
|
|
||||||
}
|
|
||||||
.avatar-btn::after {
|
|
||||||
border: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 头像容器 */
|
||||||
.avatar-wrapper {
|
.avatar-wrapper {
|
||||||
position: relative;
|
position: relative;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
width: 120rpx;
|
||||||
|
height: 120rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
@@ -98,6 +87,7 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
background: linear-gradient(135deg, rgba(0, 206, 209, 0.2) 0%, transparent 100%);
|
background: linear-gradient(135deg, rgba(0, 206, 209, 0.2) 0%, transparent 100%);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar-img {
|
.avatar-img {
|
||||||
@@ -144,32 +134,41 @@
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
gap: 8rpx;
|
gap: 8rpx;
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-name-row {
|
.user-name-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 16rpx;
|
gap: 8rpx;
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-name {
|
.user-name {
|
||||||
font-size: 34rpx;
|
font-size: 36rpx;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
max-width: 280rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.edit-name-icon {
|
.edit-name-icon {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: rgba(255,255,255,0.4);
|
color: rgba(255,255,255,0.4);
|
||||||
margin-left: 8rpx;
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-id-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-wechat {
|
.user-wechat {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #00CED1;
|
color: #00CED1;
|
||||||
margin-top: 4rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-badge-small {
|
.user-badge-small {
|
||||||
|
|||||||
Reference in New Issue
Block a user