From b501abb64da23384a85081c246e9c906c6962efd Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期四, 23 三月 2023 15:59:04 +0800
Subject: [PATCH] 用户头像修改
---
miniprogram/pages/user/report/detail/index.ts | 8 +-
miniprogram/pages/user/myself/detail/index.wxss | 32 ++++++++++
miniprogram/pages/user/myself/detail/index.wxml | 20 +++++-
miniprogram/pages/user/loginInfo/index.ts | 4
miniprogram/pages/user/myself/detail/index.ts | 61 ++++++++++++++++++++
5 files changed, 114 insertions(+), 11 deletions(-)
diff --git a/miniprogram/pages/user/loginInfo/index.ts b/miniprogram/pages/user/loginInfo/index.ts
index 1308f7a..c0534c1 100644
--- a/miniprogram/pages/user/loginInfo/index.ts
+++ b/miniprogram/pages/user/loginInfo/index.ts
@@ -109,13 +109,13 @@
'content-type': 'application/json'
},
success:(res)=>{
- // 鎴愬姛閫氱煡
- Notify({ type: 'primary', message: '閲囬泦鎴愬姛' });
const result = JSON.parse(res.data)
this.setData({
pic:result.data,
isShow:true
})
+ // 鎴愬姛閫氱煡
+ Notify({ type: 'primary', message: '閲囬泦鎴愬姛' });
}
})
}
diff --git a/miniprogram/pages/user/myself/detail/index.ts b/miniprogram/pages/user/myself/detail/index.ts
index 05e6288..2944ca7 100644
--- a/miniprogram/pages/user/myself/detail/index.ts
+++ b/miniprogram/pages/user/myself/detail/index.ts
@@ -4,11 +4,67 @@
Page({
data: {
+ isShowImg:false,
+ pic:'',
+ picUrl:'',
reportList:{},
},
face(){
+ console.log(this.data.reportList.pic);
+
wx.previewMedia({
sources:[{url:this.data.reportList.pic}]
+ })
+},
+subImg(){
+ wx.request(
+ {
+ url:userDetailMyself.globalData.url+ "/wx/user/add",
+ method:"POST",
+ data:{
+ id:wx.getStorageSync('id'),
+ pic:this.data.pic
+ },
+ header:{'token':wx.getStorageSync('token')},
+ success:(res)=>{
+ console.log(res)
+ this.data.reportList.pic= this.data.picUrl
+ this.setData({
+ isShowImg:false
+ })
+ }
+ })
+},
+faces(){
+ wx.chooseMedia({
+ count:1,
+ mediaType:['image'],
+ sourceType:['camera'],
+ camera:"front",
+ success:(res)=>{
+ wx.uploadFile({
+ url: userDetailMyself.globalData.url+"/minio/upload",
+ filePath: res.tempFiles[0].tempFilePath,
+ name: "file",
+ header: {
+ // 'token': wx.getStorageSync('token'),
+ 'content-type': 'application/json'
+ },
+ success:(res)=>{
+ // // 鎴愬姛閫氱煡
+ // Notify({ type: 'primary', message: '閲囬泦鎴愬姛' });
+ const result = JSON.parse(res.data)
+ this.setData({
+ pic:result.data,
+ picUrl:userDetailMyself.globalData.imageUrl+'/img/'+result.data,
+ isShowImg:true
+ })
+ this.subImg()
+ console.log(this.data.pic,this.data.picUrl);
+
+ }
+ })
+ }
})
},
onLoad() {
@@ -26,8 +82,11 @@
res.data.data.pic=userDetailMyself.globalData.imageUrl+"/img/"+res.data.data.pic
}
this.setData({
- reportList:res.data.data
+ reportList:res.data.data,
+ picUrl:res.data.data.pic
})
+ console.log(this.data.picUrl);
+
}
})
}
diff --git a/miniprogram/pages/user/myself/detail/index.wxml b/miniprogram/pages/user/myself/detail/index.wxml
index 2e57700..5047e15 100644
--- a/miniprogram/pages/user/myself/detail/index.wxml
+++ b/miniprogram/pages/user/myself/detail/index.wxml
@@ -20,12 +20,24 @@
</view>
<view class="list1">
+ <view class="foot">
<view class="font-wenzi">澶村儚閲囬泦</view>
- <view wx:if="{{reportList.pic==null||reportList.pic==''}}" class="content headPortrait" bindtap="face">鏈笂浼�</view>
- <view wx:else="{{reportList.pic!=null}}" class="content headPortrait" bindtap="face">鏌ョ湅</view>
-
+ <!-- <view wx:else="{{reportList.pic!=null}}" class="content headPortrait" bindtap="face">鏌ョ湅</view> -->
+ </view>
+ <view wx:if="{{reportList.pic==null||reportList.pic==''}}" class="content headPortrait" bindtap="face">鏈笂浼�</view>
+ <view wx:if="{{!isShowImg}}" >
+ <van-image bind:click="faces" width="100" height="100" src="{{picUrl}}" />
+ </view>
+ <view wx:if="{{isShowImg}}" >
+ <van-image bind:click="faces" width="100" height="100" src="{{picUrl}}" />
+ </view>
+ <!-- <button class="foot-button" size="mini" bindtap="faces">鐐瑰嚮淇敼澶村儚</button> -->
</view>
-
+
+ <!-- <view class="buttonView">
+ <button class="button-sub" size="mini" bindtap="subImg">鎻� 浜�</button>
+ </view> -->
+
<!-- <view class="list1">
<view class="content">{{causeDetail.cop}}</view>
<view class="font-wenzi">璐熻矗姘戣</view>
diff --git a/miniprogram/pages/user/myself/detail/index.wxss b/miniprogram/pages/user/myself/detail/index.wxss
index 0d87cc2..5a38263 100644
--- a/miniprogram/pages/user/myself/detail/index.wxss
+++ b/miniprogram/pages/user/myself/detail/index.wxss
@@ -1,4 +1,31 @@
/**index.wxss**/
+.buttonView{
+ margin-top: 1rem;
+ font-size: 14px;
+ text-align: center;
+ width: 100%;
+ margin-bottom: 1rem;
+}
+.button-sub{
+
+ height: 5vh;
+ line-height: 5vh;
+ text-align: center;
+ left: 0;
+ right: 0;
+ margin: 0 auto;
+ width: 90%;
+ font-size: 13px;
+ color: #6699ff;
+ background-color: white;
+ border: 1px solid #6699ff;
+}
+.isshow-img{
+ margin-top: 1rem;
+}
+.foot{
+ display: flex;
+}
.title{
margin-top: 1rem;
font-size: 18px;
@@ -6,7 +33,12 @@
margin-right: 0.6rem;
font-weight: 700;
}
+.foot-button{
+ margin: 0;
+}
.list1{
+ align-items: center;
+ justify-content: space-between;
margin-left: 0.6rem;
margin-right: 0.6rem;
display: flex;
diff --git a/miniprogram/pages/user/report/detail/index.ts b/miniprogram/pages/user/report/detail/index.ts
index 1624458..489a9ee 100644
--- a/miniprogram/pages/user/report/detail/index.ts
+++ b/miniprogram/pages/user/report/detail/index.ts
@@ -29,13 +29,13 @@
header: { 'token': wx.getStorageSync('token') },
success: (res) => {
let imgs = []
- if (res.data.data.idCardMaterials != '') {
+ if (res.data.data.idCardMaterials) {
imgs.push(...res.data.data.idCardMaterials.split(","))
- if (res.data.data.contractMaterials != '') {
+ if (res.data.data.contractMaterials) {
imgs.push(...res.data.data.contractMaterials.split(","))
- if (res.data.data.transactionMaterials != '') {
+ if (res.data.data.transactionMaterials) {
imgs.push(...res.data.data.transactionMaterials.split(","))
- if (res.data.data.elseMaterials != '') {
+ if (res.data.data.elseMaterials) {
imgs.push(...res.data.data.elseMaterials.split(","))
}
}
--
Gitblit v1.8.0