diff --git a/src/pages/client/category/components/GoodItem.vue b/src/pages/client/category/components/GoodItem.vue index 1fdb1b4..6df3a43 100644 --- a/src/pages/client/category/components/GoodItem.vue +++ b/src/pages/client/category/components/GoodItem.vue @@ -22,7 +22,7 @@ - 立即购买 + 立即购买1 diff --git a/src/pages/client/home/index.vue b/src/pages/client/home/index.vue index 222c81d..38ed405 100644 --- a/src/pages/client/home/index.vue +++ b/src/pages/client/home/index.vue @@ -397,7 +397,7 @@ export default { flex-direction: row; justify-content: flex-start; align-items: flex-start; - margin-top: 40rpx; + margin-top: 50rpx; .goods-list-item { flex: 1; diff --git a/src/pages/client/mine/index.vue b/src/pages/client/mine/index.vue index 70ca994..e25669b 100644 --- a/src/pages/client/mine/index.vue +++ b/src/pages/client/mine/index.vue @@ -464,7 +464,7 @@ title: '请添加客服号', width: calc(100vw - 40rpx); background-color: #fff; margin: auto; - margin-top: 20rpx; + margin-top:46rpx; border-radius: 16rpx; margin-bottom: 26rpx; diff --git a/src/pages/client/mine/userInfo.vue b/src/pages/client/mine/userInfo.vue index a3709cc..bede43d 100644 --- a/src/pages/client/mine/userInfo.vue +++ b/src/pages/client/mine/userInfo.vue @@ -3,7 +3,7 @@ 头像 - @@ -174,30 +174,41 @@ export default { }); }, // 更新头像 - async chooseavatar(e) { - const { - avatarUrl - } = e.detail; + chooseavatar() { + let that = this; uni.showLoading({ title: "上传中..." }); - try { - const { url, objectKey } = await uploadImageToOSS_PUT(avatarUrl); - console.log(url, objectKey, 'url, objectKey') - this.userInfo.head_pic_url = url; // 同时更新 head_pic_url,因为模板使用的是这个字段 - this.userInfo.head_pic = objectKey; - this.$forceUpdate(); - uni.hideLoading(); - } catch (error) { - console.error('头像上传失败:', error); - uni.hideLoading(); - uni.showToast({ - title: error?.message || "头像上传失败", - icon: "none" - }); - } + uni.chooseImage({ + count: 1, // 只选一张图片 + sourceType: ['album', 'camera'], // 来源:相册、相机 + success: async function(res) { + try { + const { url, objectKey } = await uploadImageToOSS_PUT(res.tempFilePaths[0]); + that.userInfo.head_pic_url = url; // 同时更新 head_pic_url,因为模板使用的是这个字段 + that.userInfo.head_pic = objectKey; + that.$forceUpdate(); + uni.hideLoading(); + uni.showToast({ + title: "上传成功", + icon: "success", + }); + } catch (error) { + console.error('头像上传失败:', error); + uni.hideLoading(); + uni.showToast({ + title: error?.message || "头像上传失败", + icon: "none" + }); + } + }, + fail: function(err) { + console.log('选择图片失败:', err.errMsg); + uni.hideLoading(); + } + }); }, onChange(value, key) { this.userInfo[key] = value; diff --git a/src/pages/client/shop/components/GoodItem.vue b/src/pages/client/shop/components/GoodItem.vue index e92e1a2..543457f 100644 --- a/src/pages/client/shop/components/GoodItem.vue +++ b/src/pages/client/shop/components/GoodItem.vue @@ -1,6 +1,6 @@