uni-app更换头像(自用瞎写的) //换头像changeImg() { console.log("000000")//1,选择头像文件uni.chooseImage({ count:1, success: (res)=>{ console.log(res)//2上传文件uni.uploadFile({ url:"/api/pcUser/updata/userAvatar", filePath: res.tempFilePaths[0], name:"file", success: (res2)=...
uni.showActionSheet({// itemList按钮的文字接受的是数组itemList: ["查看头像","从相册选择图片"], success(e){varindex = e.tapIndexif(index ===0){// 用户点击了预览当前图片// 可以自己实现当前头像链接的读取leturl ="../../static/1.png"letarr=[] arr.push(url) uni.previewImage({// 预...
uni-app更换头像(自用瞎写的) //换头像changeImg() { console.log("000000")//1,选择头像文件uni.chooseImage({ count:1, success: (res)=>{ console.log(res)//2上传文件uni.uploadFile({ url:"/api/pcUser/updata/userAvatar", filePath: res.tempFilePaths[0], name:"file", success: (res2)=...
uni.chooseMedia({ count: 1, sourceType: ['album'], success: res => { uni.getImageInfo({ src: res.tempFiles[0].tempFilePath, success: image => { console.log(image) uni.showLoading({ title: '图片上传中', mask: true }) uni.uploadFile({ url: `${VUE_APP_API_URL}/api/upload`, ...