<view class="cen_ter">
<view class="box_At">
<view class="box_At_text">获取您的昵称、头像、手机号</view>
<view class="box_At_co">获取用户头像、昵称、手机号信息,主要用于完善个人资料,向用户提供更好使用体验</view>
<view class="box_B" style="border-top:1px solid #f3f3f3 ;">
<view class="acvter">头像</view>
<button v-if="!avatar" class="acvter_all" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<view class="mast">请选择头像</view>
</button>
<view v-if="avatar" class="img"><image :src="avatar" ></image></view>
</view>
<view class="box_B">
<view class="acvter">昵称</view>
<input class="acvter_all" type="nickname" :value="nickname" @blur="bindblur" placeholder="请输入昵称" />
</view>
<view class="Brn_S">
<view class="btn_btns" @click.stop="colse">取消</view>
<button class="btn" open-type="getPhoneNumber" @getphonenumber.stop="openphone" >
<view class="btn">保存</view>
</button>
</view>
</view>
</view>
// 头像
onChooseAvatar(e) {
let that = this
console.log(e.detail.avatarUrl,'头像临时地址')
that.avatar = e.detail.avatarUrl
uni.uploadFile({
url: 'https://tuniu.shangmenfuwux.xin/index.php/api/common/upload', //仅为示例,非真实的接口地址
filePath: e.detail.avatarUrl,
name: 'file',
success: (res) => {
console.log(res,'成功了没111');
console.log(JSON.parse(res.data),'成功了没222');
let data = JSON.parse(res.data).data.fullurl
that.avatar = data
}
});
},
报错信息:[渲染层错误] [Component] <button>: chooseAvatar:fail timeout(env: Windows,mp,1.06.2412050; lib: 3.8.3)