曲靖
This commit is contained in:
		@@ -5,7 +5,7 @@
 | 
			
		||||
        <div class="wrap" @click="handleLogin()">
 | 
			
		||||
          <div class="user-img-div">
 | 
			
		||||
            <img :src="user.avatarUrl" alt="" class="user-img" v-if="user.id && user.avatarUrl"/>
 | 
			
		||||
            <open-data type="userAvatarUrl" lang="zh_CN" class="user-img" v-else/>
 | 
			
		||||
            <img class="user-img" src="https://cdn.cunwuyun.cn/dvcp/myFamily/tx.png" v-else alt="">
 | 
			
		||||
          </div>
 | 
			
		||||
          <div class="user-info">
 | 
			
		||||
            <div class="option">
 | 
			
		||||
@@ -16,7 +16,6 @@
 | 
			
		||||
              <template v-else>
 | 
			
		||||
                <p v-if="isApprove">{{ user.realName || user.nickName}}</p>
 | 
			
		||||
                <p v-else>{{ user.nickName }}</p>
 | 
			
		||||
                <!-- <p>{{ user.areaName || "" }}</p> -->
 | 
			
		||||
                <p>共累计学习<span>{{studyDuration || 0}}</span>分钟</p>
 | 
			
		||||
              </template>
 | 
			
		||||
            </div>
 | 
			
		||||
 
 | 
			
		||||
@@ -5,35 +5,39 @@
 | 
			
		||||
        <div class="item solid">
 | 
			
		||||
          <p class="mar-t22">头像</p>
 | 
			
		||||
          <button class="user-img-div" open-type="chooseAvatar" @chooseavatar="handleWeixinSync">
 | 
			
		||||
            <img :src="user.avatarUrl" class="user-img">
 | 
			
		||||
            <img v-if="user.avatarUrl" :src="user.avatarUrl" class="user-img">
 | 
			
		||||
            <img v-else src="https://cdn.cunwuyun.cn/dvcp/myFamily/tx.png" alt="" class="user-img">
 | 
			
		||||
          </button>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="item">
 | 
			
		||||
          <p>用户昵称</p>
 | 
			
		||||
          <div v-if="!editNickName" @click="editNickName=true">
 | 
			
		||||
            <div class="name" v-text="nickName"/>
 | 
			
		||||
          <div class="item-right" v-if="!editNickName" @click="editNickName=true, userName = user.nickName">
 | 
			
		||||
            <div class="name">{{ user.nickName }}</div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <input v-else type="nickname" class="editNickName" v-model="nickName" @blur="handleWeixinSync">
 | 
			
		||||
          <input class="item-right" v-else type="text" v-model="userName" @blur="handleWeixinSync">
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="item-content mar-b8">
 | 
			
		||||
        <div class="item">
 | 
			
		||||
          <p>手机号</p>
 | 
			
		||||
          <div>{{ user.phone || '' }}</div>
 | 
			
		||||
          <div class="item-right" v-if="!!!editPhone" @click="editPhone = true, userPhone = user.phone">
 | 
			
		||||
            <p class="name">{{ user.phone || '' }}</p>
 | 
			
		||||
          </div>
 | 
			
		||||
          <input class="item-right" v-else type="number" v-model="userPhone" @blur="handleWeixin" maxlength="11">
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="item-content mar-b8" v-if="user.areaId">
 | 
			
		||||
        <div class="item solid">
 | 
			
		||||
          <p>姓名</p>
 | 
			
		||||
          <div>{{ user.realName || '' }}</div>
 | 
			
		||||
          <div class="item-right">{{ user.realName || '' }}</div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="item solid">
 | 
			
		||||
          <p>身份证号</p>
 | 
			
		||||
          <div>{{ user.idNumber || '' }}</div>
 | 
			
		||||
          <div class="item-right">{{ user.idNumber || '' }}</div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="item">
 | 
			
		||||
          <p>地区</p>
 | 
			
		||||
          <div>{{ user.areaName || '' }}</div>
 | 
			
		||||
          <div class="item-right">{{ user.areaName || '' }}</div>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="item-content" @click="onLogout">
 | 
			
		||||
@@ -54,11 +58,21 @@ export default {
 | 
			
		||||
    ...mapState(['token']),
 | 
			
		||||
    nickName: {
 | 
			
		||||
      set(v) {
 | 
			
		||||
        this.userName = v
 | 
			
		||||
      },
 | 
			
		||||
      get() {
 | 
			
		||||
        const {nickName} = this.user
 | 
			
		||||
        return nickName
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    phone: {
 | 
			
		||||
      set(v) {
 | 
			
		||||
        this.userPhone = v
 | 
			
		||||
      },
 | 
			
		||||
      get() {
 | 
			
		||||
        const { phone } = this.user
 | 
			
		||||
        return phone
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  onLoad() {
 | 
			
		||||
@@ -74,11 +88,29 @@ export default {
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      editNickName: false,
 | 
			
		||||
      user: {}
 | 
			
		||||
      user: {},
 | 
			
		||||
      editPhone: false,
 | 
			
		||||
      avatar: '',
 | 
			
		||||
      userName: '',
 | 
			
		||||
      userPhone: ''
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    ...mapActions(['autoLogin']),
 | 
			
		||||
    updateInfo() {
 | 
			
		||||
      this.$instance.post(`/app/appwechatuser/update-nickName`, null, {
 | 
			
		||||
        params: {
 | 
			
		||||
          id: this.user.id,
 | 
			
		||||
          nickName: this.userName ? this.userName : this.user.nickName,
 | 
			
		||||
          avatarUrl: this.avatar ? this.avatar : this.user.avatarUrl,
 | 
			
		||||
          phone: this.userPhone ? this.userPhone : this.user.phone,
 | 
			
		||||
        }
 | 
			
		||||
      }).then(res => {
 | 
			
		||||
        if (res?.code == 0) {
 | 
			
		||||
          this.$u.toast('修改成功')
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    upLoad(img) {
 | 
			
		||||
      return new Promise((resolve, reject) => {
 | 
			
		||||
        uni.uploadFile({
 | 
			
		||||
@@ -90,6 +122,7 @@ export default {
 | 
			
		||||
            Authorization: uni.getStorageSync('token')
 | 
			
		||||
          },
 | 
			
		||||
          success: uploadFileRes => {
 | 
			
		||||
            this.avatar = JSON.parse(uploadFileRes.data).data[0].split(';')[0]
 | 
			
		||||
            resolve(uploadFileRes)
 | 
			
		||||
          },
 | 
			
		||||
          fail: err => {
 | 
			
		||||
@@ -115,9 +148,29 @@ export default {
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    handleWeixin({ detail }) {
 | 
			
		||||
      if (detail.value) {
 | 
			
		||||
        this.phone = detail.value
 | 
			
		||||
        this.updateInfo()
 | 
			
		||||
      }
 | 
			
		||||
      setTimeout(() => {
 | 
			
		||||
        this.getUserInfo()
 | 
			
		||||
      }, 500)
 | 
			
		||||
    },
 | 
			
		||||
    handleWeixinSync({detail}) {
 | 
			
		||||
      const {value: nickName, avatarUrl} = detail
 | 
			
		||||
      this.autoLogin({nickName, avatarUrl})
 | 
			
		||||
      if (avatarUrl?.length) {
 | 
			
		||||
        this.upLoad(avatarUrl).then(() => {
 | 
			
		||||
          this.updateInfo()
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
      if (nickName) {
 | 
			
		||||
        this.updateInfo()
 | 
			
		||||
      }
 | 
			
		||||
      setTimeout(()=> {
 | 
			
		||||
        this.getUserInfo()
 | 
			
		||||
      }, 500)
 | 
			
		||||
    },
 | 
			
		||||
    getUserInfo() {
 | 
			
		||||
      this.$instance.post(`/app/appwechatuserqujing/check`).then(res=> {
 | 
			
		||||
@@ -137,10 +190,12 @@ export default {
 | 
			
		||||
  background-color: #F4F5FA;
 | 
			
		||||
 | 
			
		||||
  .info-list {
 | 
			
		||||
    padding: 50px 16px 0;
 | 
			
		||||
    padding: 50px 32px 0 32px;
 | 
			
		||||
    box-sizing: border-box;
 | 
			
		||||
 | 
			
		||||
    .item-content {
 | 
			
		||||
      padding: 0 32px;
 | 
			
		||||
      box-sizing: border-box;
 | 
			
		||||
      background-color: #fff;
 | 
			
		||||
      border-radius: 32px;
 | 
			
		||||
    }
 | 
			
		||||
@@ -151,25 +206,31 @@ export default {
 | 
			
		||||
      width: 100%;
 | 
			
		||||
      box-sizing: content-box;
 | 
			
		||||
      display: flex;
 | 
			
		||||
      justify-content: space-between;
 | 
			
		||||
      font-size: 30px;
 | 
			
		||||
 | 
			
		||||
      p {
 | 
			
		||||
        font-family: PingFangSC-Regular;
 | 
			
		||||
        color: #666;
 | 
			
		||||
        color: #333;
 | 
			
		||||
        font-weight: 400;
 | 
			
		||||
        width: 200px;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      div {
 | 
			
		||||
        font-family: PingFangSC-Medium;
 | 
			
		||||
        font-weight: 500;
 | 
			
		||||
        color: #333;
 | 
			
		||||
        color: #666;
 | 
			
		||||
        font-size: 28px;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .item-right {
 | 
			
		||||
        width: calc(100% - 200px);
 | 
			
		||||
        text-align: right;
 | 
			
		||||
        font-size: 28px;
 | 
			
		||||
        p {
 | 
			
		||||
          width: 100%;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .user-img-div {
 | 
			
		||||
        width: 104px;
 | 
			
		||||
        height: 104px;
 | 
			
		||||
        border-radius: 50%;
 | 
			
		||||
        overflow: hidden;
 | 
			
		||||
        width: calc(100% - 200px);
 | 
			
		||||
        text-align: right;
 | 
			
		||||
        display: inline-block;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .user-img {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user