From a8c837e95d3ce56db280cc50d63f832e6cc39794 Mon Sep 17 00:00:00 2001 From: 63194756 <63194756@qq.com> Date: Tue, 8 Oct 2024 13:35:39 +0000 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E6=88=91=E7=9A=84=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E4=BF=AE=E6=94=B9=E4=B8=8A=E4=BC=A0=E5=A4=B4?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/my/my-person.vue | 67 ++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/components/my/my-person.vue b/components/my/my-person.vue index f8a0e27..0089d3c 100644 --- a/components/my/my-person.vue +++ b/components/my/my-person.vue @@ -3,7 +3,7 @@ - + {{ userName }} @@ -55,6 +55,7 @@ const factory = context.factory; //获取app实例 const constant = context.constant; import conf from '@/conf/config.js'; + import * as TanslateImage from '../../lib/java110/utils/translate-image.js'; import {queryOwnerAccount,queryUserIntegral} from '@/api/user/userApi.js'; import { getCouponUsers @@ -90,6 +91,70 @@ authOwnerDialog }, methods: { + //上传人脸 + settingHeadImg: function() { + var _that = this; + wx.chooseImage({ + count: 1, + sizeType: ['compressed'], + sourceType: ['album', 'camera'], + success: function(res) { + // console.log(res) + wx.showToast({ + title: '正在上传', + icon: 'loading', + mask: true, + duration: 1000 + }); + var tempFilePaths = res.tempFilePaths + console.log('头像地址', tempFilePaths); + TanslateImage.translate(this,tempFilePaths, (_baseInfo) => { + _that.headerImg = _baseInfo; + _that._uploadOwnerHeaderImg(); + wx.hideLoading() + }) + } + }) + }, + _uploadOwnerHeaderImg: function() { + let _that = this; + context.getOwner(function(_owner) { + let _memberId = _owner.memberId; + let _communityId = _owner.communityId; + let obj = { + memberId: _memberId, + communityId: _communityId, + photo: _that.headerImg + }; + context.request({ + url: constant.url.uploadOwnerPhoto, + header: context.getHeaders(), + method: "POST", + data: obj, //动态数据 + success: function(res) { + console.log(res); + if (res.statusCode != 200) { + wx.showToast({ + title: '头像上传失败', + icon: 'none', + duration: 2000 + }); + return; + } + + _that.loadOwnerHeaderImg(); + }, + fail: function(e) { + wx.showToast({ + title: "服务器异常了", + icon: 'none', + duration: 2000 + }); + } + }); + }); + + }, //切换小区 _changeCommunity: function() { uni.navigateTo({