odc.xiaohui
2023-03-23 b501abb64da23384a85081c246e9c906c6962efd
用户头像修改
5个文件已修改
125 ■■■■■ 已修改文件
miniprogram/pages/user/loginInfo/index.ts 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
miniprogram/pages/user/myself/detail/index.ts 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
miniprogram/pages/user/myself/detail/index.wxml 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
miniprogram/pages/user/myself/detail/index.wxss 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
miniprogram/pages/user/report/detail/index.ts 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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: '采集成功' });
                }
            })
        }
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);
          }
              })
    }
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>
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;
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(","))
                                }
                            }