Your description here.
1.上传后显示头像,没有上传就是默认头像把avatarurl改为定义为一个对象,页面用if和else判断是否存在显示,上传完头像,然后把头像地址保存到数据库然后一开始加载就会显示上传了的头像在上传之前就会把临时头像地址先给avatarurl,这样先显示,使得页面更加友好<image v-if="avatarurl" :src="avatarurl" mode="aspectFill"></image> <image v-else src="../../static/images/defAvatar.png" mode="aspectFill"></image> jsconst avatarurl =ref(userStore.userInfo.avatar); function onChooseAvatar(e){ avatarurl.value=e.detail.av
1.上传头像功能完成,这里面cloudPathAsRealPath:true只能阿里云空间可以使用,就是绝对路径,我们上传的会也创建好路径,不会把路径也当成文件名字let avatarurl =e.detail.avatarUrl; uniCloud.uploadFile({ filePath:avatarurl, cloudPath:`userAvatar/${formatTimestampToYearMonthDay(Date.now())}/${Date.now()}.jpg`, cloudPathAsRealPath:true })
1.在/soup/edit中加入昵称修改,数据库更新方法,确保能执行先把uni-id-users.schema表中的username写入权限改为ture//确认修改昵称function usernameConfirm(e){console.log(e); userStore.updateUserInfo({username:e}) }2.由于更新后页面数据没有发生变化,加入计算属性,computed响应,随数据变化const userInfo = computed(()=>userStore.userInfo); //computed是Vue中的一种特殊属性,它根据响应式数据的变化自动重新计算值。computed属性非常适合用于以下场景: 当你需要根据现有数据派生出一个新的数据时或一个数据结果受多个数据影响时。 当派生数据①的计算逻辑相对复杂,且可能在多个地方被引用时。 当你希望避免不必要的重复计算,通过缓存机制提高性能时。 3.在/soup/edit中加入性别修改,数据库更新方法,确保能执行先把uni-id-users.schema表中的gender写入权限改为tur
1.引入pinia里面的数据userinfo,为把/soup/edit里面的数据补充上import { useUserStore, useUserStore } from "../../stores/user"; const userStore=useUserStore(); const userInfo = userStore.userInfo; 2.补充内容绑定<view class="list"> <uni-list> <uni-list-item showArrow title="用户ID" clickable :rightText="userInfo._id" @click="clickID(userInfo._id)"/> <uni-list-item showArrow title
1.创建page_self/user/edit.vue,作为个人中心资料编辑页面(记得注册路由)<template> <view class="userLayout"> <view class="avatar"> <view class="box"> <view class="inner"> <image src="../../static/images/defAvatar.png" mode="aspectFill"></image> <button open-type="chooseAvatar" @chooseavatar="onChooseAva
ikrins