syle:更新样式

This commit is contained in:
2025-10-15 14:56:34 +08:00
parent 46179c5d3f
commit 49ce29945f
17 changed files with 814 additions and 132 deletions
+72 -36
View File
@@ -16,7 +16,7 @@
<uv-icon type="right" size="16" color="#999"></uv-icon>
</view>
<!-- <view class="assets-card">
<view class="assets-left">
<view class="label">押金余额</view>
@@ -28,9 +28,9 @@
</view> -->
<view class="section">
<view class="banner-card">
<image class="banner-image" src="/static/userCenter_swiper.png" mode="aspectFill"></image>
</view>
<view class="banner-card" @click="navigateTo('/pages/join/index')">
<image class="banner-image" src="/static/userCenter_swiper.png" mode="aspectFill"></image>
</view>
<!-- <view class="section-title">常用服务</view> -->
<view class="list">
<view class="list-item" @click="handleQuickReturn">
@@ -63,21 +63,21 @@
</view>
<view class="list-item" @click="navigateTo('/pages/feedback/index')">
<view class="left">
<image class="icon" src="/static/complaint.png" mode="aspectFit"></image>
<image class="icon" src="/static/suggess.png" mode="aspectFit"></image>
<text class="title">投诉与建议</text>
</view>
<uv-icon name="arrow-right" size="16" color="#c8c8c8"></uv-icon>
</view>
<view class="list-item" @click="navigateTo('/pages/legal/agreement')">
<view class="left">
<image class="icon" src="/static/peopleInWork.png" mode="aspectFit"></image>
<image class="icon" src="/static/business-licence.png" mode="aspectFit"></image>
<text class="title">营业资质</text>
</view>
<uv-icon name="arrow-right" size="16" color="#c8c8c8"></uv-icon>
</view>
<view class="list-item" @click="navigateTo('/pages/serve/bagCheck/index')">
<view class="list-item" @click="navigateTo('/pages/join/index')">
<view class="left">
<image class="icon" src="/static/other_device.png" mode="aspectFit"></image>
<image class="icon" src="/static/peopleInWork.png" mode="aspectFit"></image>
<text class="title">合作加盟</text>
</view>
<uv-icon name="arrow-right" size="16" color="#c8c8c8"></uv-icon>
@@ -94,7 +94,7 @@
<view class="footer-agreements">
<view class="link-box">
<text class="link" @click="navigateTo('/pages/legal/agreement')">服务条款</text>
<text class="link" @click="navigateTo('/pages/legal/agreement')">服务条款</text>
<text class="sep"></text>
<text class="link" @click="navigateTo('/pages/legal/privacy')">隐私政策</text>
</view>
@@ -128,9 +128,13 @@
wxLogin,
getUserInfo
} from '../../util/index.js';
import { uploadUserAvatar } from '../../config/user.js'
import { URL } from '../../config/url.js'
// 设置页执行退出登录,此页不再直接调用
import {
uploadUserAvatar
} from '../../config/user.js'
import {
URL
} from '../../config/url.js'
// 设置页执行退出登录,此页不再直接调用
// 响应式状态
const userInfo = ref({});
@@ -234,15 +238,15 @@
title: '加载中'
});
// 获取使用中的订单
const res = await uni.request({
url: `${URL}/app/order/inUse`,
method: 'GET',
header: {
'Authorization': "Bearer " + uni.getStorageSync('token'),
'Clientid': uni.getStorageSync('client_id')
}
});
// 获取使用中的订单
const res = await uni.request({
url: `${URL}/app/order/inUse`,
method: 'GET',
header: {
'Authorization': "Bearer " + uni.getStorageSync('token'),
'Clientid': uni.getStorageSync('client_id')
}
});
uni.hideLoading();
@@ -289,7 +293,10 @@
getUserProfile()
// #endif
// #ifndef MP-WEIXIN
uni.showToast({ title: '请在微信小程序中使用此功能', icon: 'none' })
uni.showToast({
title: '请在微信小程序中使用此功能',
icon: 'none'
})
// #endif
};
@@ -303,21 +310,36 @@
}
const avatarLocalPath = e?.detail?.avatarUrl
if (!avatarLocalPath) {
uni.showToast({ title: '未选择头像', icon: 'none' })
uni.showToast({
title: '未选择头像',
icon: 'none'
})
return
}
uni.showLoading({ title: '上传中...', mask: true })
uni.showLoading({
title: '上传中...',
mask: true
})
const uploadRes = await uploadUserAvatar(avatarLocalPath)
const serverAvatar = uploadRes?.data?.url || uploadRes?.url || uploadRes?.data || ''
if (serverAvatar) {
userInfo.value = { ...userInfo.value, avatar: serverAvatar }
userInfo.value = {
...userInfo.value,
avatar: serverAvatar
}
uni.setStorageSync('userInfo', userInfo.value)
}
uni.showToast({ title: '头像已更新', icon: 'success' })
uni.showToast({
title: '头像已更新',
icon: 'success'
})
await getInfo()
} catch (err) {
console.error('选择/上传头像失败:', err)
uni.showToast({ title: '头像更新失败', icon: 'none' })
uni.showToast({
title: '头像更新失败',
icon: 'none'
})
} finally {
uni.hideLoading()
}
@@ -425,7 +447,10 @@
try {
const avatarUrl = wxUserInfo?.avatarUrl
if (!avatarUrl) {
uni.showToast({ title: '未获取到头像地址', icon: 'none' })
uni.showToast({
title: '未获取到头像地址',
icon: 'none'
})
return
}
// 下载微信头像为本地临时文件
@@ -447,14 +472,23 @@
// 直接使用返回的头像地址(如果有),并刷新用户信息
const serverAvatar = uploadRes?.data?.url || uploadRes?.url || uploadRes?.data || ''
if (serverAvatar) {
userInfo.value = { ...userInfo.value, avatar: serverAvatar }
userInfo.value = {
...userInfo.value,
avatar: serverAvatar
}
uni.setStorageSync('userInfo', userInfo.value)
}
uni.showToast({ title: '头像已更新', icon: 'success' })
uni.showToast({
title: '头像已更新',
icon: 'success'
})
await getInfo()
} catch (error) {
console.error('头像上传失败:', error)
uni.showToast({ title: '头像上传失败', icon: 'none' })
uni.showToast({
title: '头像上传失败',
icon: 'none'
})
} finally {
uni.hideLoading()
}
@@ -491,7 +525,7 @@
return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
}
// 退出登录移动至设置页
// 退出登录移动至设置页
</script>
<style lang="scss" scoped>
@@ -510,7 +544,7 @@
display: flex;
align-items: center;
padding: 24rpx 30rpx;
// background-color: #D1FFE1;
background: linear-gradient(180deg, #D1FFE1 0%, #ffffff 100%);
// border-bottom: 1rpx solid #f0f0f0;
@@ -556,8 +590,10 @@
background: transparent;
padding: 0;
margin: 0;
opacity: 0; /* 保持可点击但不可见 */
opacity: 0;
/* 保持可点击但不可见 */
}
/* #endif */
.user-text {
@@ -612,7 +648,7 @@
margin-top: 20rpx;
margin: 0 20rpx 20rpx 20rpx;
background-color: #ffffff;
flex:1;
flex: 1;
// border-top: 1rpx solid #f0f0f0;
// border-bottom: 1rpx solid #f0f0f0;
border-radius: 20rpx;
@@ -665,7 +701,7 @@
color: #999999;
font-size: 22rpx;
.link-box{
.link-box {
display: flex;
align-items: center;
justify-content: center;