From 1ae987d882c1d67c0ee11c40af05d311df9e214b Mon Sep 17 00:00:00 2001 From: zxl <763096477@qq.com> Date: 星期三, 23 七月 2025 15:25:55 +0800 Subject: [PATCH] 需求改动 --- pages/mine/set/personMsg.vue | 109 ++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 76 insertions(+), 33 deletions(-) diff --git a/pages/mine/set/personMsg.vue b/pages/mine/set/personMsg.vue index 613338b..7f42ea7 100644 --- a/pages/mine/set/personMsg.vue +++ b/pages/mine/set/personMsg.vue @@ -1,14 +1,16 @@ <template> <view class="person-msg"> - <view class="head c-content" @click="changeFace"> + <view class="head c-content"> <image v-if="form.face" :src="endpoint + '/' + form.face" mode=""></image> <image v-else :src="'/pages/subComponents/static/missing-face.png'" mode=""></image> - <view>鐐瑰嚮淇敼澶村儚</view> + <button class="avatar-button" type="default" open-type="chooseAvatar"聽@chooseavatar="onChooseAvatar">鐐瑰嚮淇敼澶村儚</button> </view> <u-form :model="form" ref="uForm" class="form"> <u-form-item label="鏄电О" label-width="150"> - <u-input v-model="form.nickName" placeholder="璇疯緭鍏ユ樀绉�" /> + <u-input v-model="form.nickName" placeholder="璇疯緭鍏ユ樀绉�" type="nickname"/> + </u-form-item> + <u-form-item label="鎬у埆" label-width="150"> <u-radio-group v-model="form.sex" :active-color="lightColor"> <u-radio name="1">鐢�</u-radio> @@ -127,6 +129,7 @@ this.getMemberTag() }, methods: { + toggleTag(tag) { console.log(tag) }, @@ -278,39 +281,67 @@ } }); }, - + /** + * 淇敼澶村儚 + * @param {Object} e + */ + onChooseAvatar(e){ + console.log(e.detail.avatarUrl) + console.log("") + console.log(e.detail) + const tempFilePath = e.detail.avatarUrl; + let fileName = tempFilePath.substring(tempFilePath.lastIndexOf('/') + 1); + if (fileName.indexOf('%') > -1) { + fileName = decodeURIComponent(fileName); + } + const fileKey = getFileKey(fileName); + this.cosClient.uploadFile({ + Bucket: this.bucket, + Region: this.region, + Key: fileKey, + FilePath: tempFilePath, + SliceSize: 1024 * 1024 * 5 /* 瑙﹀彂鍒嗗潡涓婁紶鐨勯槇鍊�,5M */ + }, (err, data) => { + if (err) { + console.log('涓婁紶澶辫触', err); + } else { + this.form.face = fileKey; + } + }); + }, /** * 淇敼澶村儚 */ - changeFace(index) { - uni.chooseImage({ - count: 1, - sizeType: ['compressed'], - sourceType: ['album'], - success: (chooseImageRes) => { - const tempFilePath = chooseImageRes.tempFilePaths[0]; - let fileName = tempFilePath.substring(tempFilePath.lastIndexOf('/') + 1); - // 澶勭悊瀹夊崜鍙兘鐨刄RI缂栫爜 - if (fileName.indexOf('%') > -1) { - fileName = decodeURIComponent(fileName); - } - const fileKey = getFileKey(fileName); - this.cosClient.uploadFile({ - Bucket: this.bucket, - Region: this.region, - Key: fileKey, - FilePath: tempFilePath, - SliceSize: 1024 * 1024 * 5 /* 瑙﹀彂鍒嗗潡涓婁紶鐨勯槇鍊�,5M */ - }, (err, data) => { - if (err) { - console.log('涓婁紶澶辫触', err); - } else { - this.form.face = fileKey; - } - }); - }, - }); - }, + // changeFace(index) { + // uni.chooseImage({ + // count: 1, + // sizeType: ['compressed'], + // sourceType: ['album'], + // success: (chooseImageRes) => { + + // const tempFilePath = chooseImageRes.tempFilePaths[0]; + // let fileName = tempFilePath.substring(tempFilePath.lastIndexOf('/') + 1); + // // 澶勭悊瀹夊崜鍙兘鐨刄RI缂栫爜 + // if (fileName.indexOf('%') > -1) { + // fileName = decodeURIComponent(fileName); + // } + // const fileKey = getFileKey(fileName); + // this.cosClient.uploadFile({ + // Bucket: this.bucket, + // Region: this.region, + // Key: fileKey, + // FilePath: tempFilePath, + // SliceSize: 1024 * 1024 * 5 /* 瑙﹀彂鍒嗗潡涓婁紶鐨勯槇鍊�,5M */ + // }, (err, data) => { + // if (err) { + // console.log('涓婁紶澶辫触', err); + // } else { + // this.form.face = fileKey; + // } + // }); + // }, + // }); + // }, /** * 閫夋嫨鍦板潃 @@ -497,4 +528,16 @@ color: #999; font-size: 24rpx; } + .avatar-button { + background: transparent; + color: $font-color-light; + font-size: $font-sm; + line-height: 2em; + margin: 0; + padding: 0; + border: none; + &::after { + border: none; + } + } </style> \ No newline at end of file -- Gitblit v1.8.0