doum
2026-04-21 3539d67072a5fd179bd44385ebefce0d1a6e8cb4
small-program/pages/settings/settings.vue
@@ -2,7 +2,7 @@
   <view class="box">
      <view class="box-tx">
         <view class="box-tx-image">
            <image :src="form.imgFullUrl || '/static/image/tx@2x.png'" mode="widthFix"></image>
            <image :src="form.fullCoverImage || '/static/image/tx@2x.png'" mode="widthFix"></image>
         </view>
         <button open-type="chooseAvatar" @chooseavatar="getAvatar">更换头像</button>
      </view>
@@ -10,32 +10,34 @@
         <view class="list-item">
            <view class="list-item-label">昵称</view>
            <view class="list-item-val">
               <input type="text" v-model="form.nickname" @blur="updateUserInfo" placeholder="请输入" />
               <input type="text" v-model="form.nickName" @blur="updateUserInfo" placeholder="请输入" />
               <u-icon name="arrow-right" color="#999999" size="17"></u-icon>
            </view>
         </view>
         <view class="list-item">
            <view class="list-item-label">真实姓名</view>
            <view class="list-item-val">
               <input type="text" v-model="form.name" @blur="updateUserInfo" placeholder="请输入" />
               <u-icon name="arrow-right" color="#999999" size="17"></u-icon>
            </view>
         </view>
         <view class="list-item">
            <view class="list-item-label">绑定手机</view>
            <view class="list-item-val" @click="show = true">
               <text>{{form.phone1}}</text>
               <image src="/static/icon/ar_next@2x.png" mode="widthFix"></image>
               <u-icon name="arrow-right" color="#999999" size="17"></u-icon>
            </view>
         </view>
         <view class="list-item" @click="jumpAddr">
            <view class="list-item-label">收货地址</view>
            <view class="list-item-val">
               <image src="/static/icon/ar_next@2x.png" mode="widthFix"></image>
               <u-icon name="arrow-right" color="#999999" size="17"></u-icon>
            </view>
         </view>
         <view class="list-item" @click="jumpxy">
            <view class="list-item-label">协议与说明</view>
            <view class="list-item-val">
               <image src="/static/icon/ar_next@2x.png" mode="widthFix"></image>
               <u-icon name="arrow-right" color="#999999" size="17"></u-icon>
            </view>
         </view>
      </view>
@@ -69,25 +71,25 @@
         return {
            show: false,
            form: {
               nickname: '',
               nickName: '',
               name: '',
               phone: '',
               telephone: '',
               phone1: '',
               imgFullUrl: '',
               imgurl: ''
               fullCoverImage: '',
               coverImage: ''
            }
         };
      },
      onLoad() {
         this.form.nickname = this.userInfo.nickname
         this.form.nickName = this.userInfo.nickName
         this.form.name = this.userInfo.name
         this.form.phone = this.userInfo.phone
         this.form.phone1 = this.returnPhone(this.userInfo.phone)
         this.form.imgFullUrl = this.userInfo.imgFullUrl
         this.form.imgurl = this.userInfo.imgurl
         this.form.telephone = this.userInfo.telephone
         this.form.phone1 = this.returnPhone(this.userInfo.telephone)
         this.form.fullCoverImage = this.userInfo.fullCoverImage
         this.form.coverImage = this.userInfo.coverImage
         uni.$on('phone', () => {
            this.form.phone = this.userInfo.phone
            this.form.phone1 = this.returnPhone(this.userInfo.phone)
            this.form.telephone = this.userInfo.telephone
            this.form.phone1 = this.returnPhone(this.userInfo.telephone)
         })
      },
      methods: {
@@ -114,7 +116,7 @@
         getAvatar(e) {
            var that = this;
            uni.uploadFile({
               url: `${this.$baseUrl}public/upload`,
               url: `${this.$baseUrl}/web/public/upload`,
               filePath: e.detail.avatarUrl,
               name: 'file',
               fileType: 'image',
@@ -122,8 +124,8 @@
               formData: { folder: 'member' },
               success: (uploadFileRes) => {
                  let result = JSON.parse(uploadFileRes.data)
                  that.form.imgurl = result.data.imgaddr
                  that.form.imgFullUrl = result.data.url
                  that.form.coverImage = result.data.imgaddr
                  that.form.fullCoverImage = result.data.url
                  that.updateUserInfo()
               }
            });
@@ -139,10 +141,10 @@
         },
         // 缓存最新用户信息
         async setUserInfo() {
            let res = await this.$u.api.getUserInfo()
            let res = await this.$u.api.getMemberInfo()
            if (res.code === 200) {
               await this.$store.commit('setUserInfo', res.data)
               await this.$store.commit('setOpenId', res.data.openId)
               await this.$store.commit('setOpenid', res.data.openId)
            }
         },
         // 退出登录
@@ -150,8 +152,7 @@
            this.$u.api.logOut()
               .then(res => {
                  if (res.code === 200) {
                     this.$store.commit('clear')
                     uni.$emit('loginOut')
                     this.$store.commit('empty')
                     uni.switchTab({
                        url: '/pages/index/index'
                     })
@@ -253,10 +254,10 @@
            line-height: 48rpx;
            text-align: center;
            border-radius: 32rpx;
            border: 1rpx solid #004096;
            border: 1rpx solid #10B2FA;
            font-weight: 400;
            font-size: 24rpx;
            color: #004096;
            color: #10B2FA;
            margin-top: 24rpx;
         }
      }