diff --git a/packageA/my/person-detail.vue b/packageA/my/person-detail.vue index 1a0c132..6d663af 100644 --- a/packageA/my/person-detail.vue +++ b/packageA/my/person-detail.vue @@ -4,7 +4,33 @@ - + + + 头像 + + + + + + + + + + + 更换图片 + + + + 完成 + + + + + + 昵称设置 @@ -142,6 +168,7 @@ export default { data() { return { + baseUrl: 'https://naweigetetest2.hschool.com.cn/', typeop: '', avatarStyle: { display: 'flex', @@ -185,6 +212,17 @@ border: 'none', fontFamily: "YouSheBiaoTiHei" }, + avatarShowStyle: { + width: '400rpx', + height: '90rpx', + borderRadius: '148rpx', + background: '#323232', + fontSize: '36rpx', + color: '#BBFC5B', + lineHeight: '90rpx', + border: 'none', + fontFamily: "YouSheBiaoTiHei" + }, //昵称 niName: '', //签名 @@ -253,7 +291,9 @@ }] ], sfInfo: {}, - bankInfo: {} + bankInfo: {}, + imageShow: false, + profile:'', } }, onLoad(options) { @@ -277,6 +317,117 @@ this.getDetail(); }, methods: { + confirmImage() { + console.log('confirmImage11',this.profile); + if(!this.profile){ + uni.showToast({ + title: "请选择图片", + icon: "none" + }) + return + } + + console.log('confirmImage22'); + // this.userInfo.profile = this.profile + // this.userInfo.avatar = this.profile + + this.upAvatar = this.profile; + this.avatar = this.avatar; + console.log(this.upAvatar); + console.log(this.avatar); + this.imageShow = false + this.submit(); + + }, + async chooseavatar(e) { + console.log('chooseavatar',e,e.detail); + // this.profile = this.uploadFilePromise(e.detail.avatarUrl, 'user'); + let result = await this.uploadFilePromise(e.detail.avatarUrl, 'user'); + console.log('chooseavatar2222',result,); + this.profile = result + this.upAvatar = this.baseUrl + this.profile + this.avatar = this.profile; + console.log('chooseavatar3333',this.profile,this.avatar,this.upAvatar); + + }, + uploadFilePromise(url) { + console.log('uploadFilePromise',url); + // console.log('接口地址', `${baseUrl}/common/upload`); + console.log('上传-uploadFilePromise'); + // console.log('category', category) + return new Promise((resolve, reject) => { + let a = uni.uploadFile({ + url: 'https://naweigetetest2.hschool.com.cn/api/common/upload', // 仅为示例,非真实的接口地址 + filePath: url, + name: 'file', + formData: { + user: 'test', + category: 'category' + }, + header: { + "token": uni.getStorageSync("token") + }, + success: (res) => { + console.log('uploadFilePromise成功',res.data); + // setTimeout(() => { + // resolve(JSON.parse(res.data).url); + // }, 1000); + var js = JSON.parse(res.data); + console.log(js.data.errcode); + if (js.data.errcode == '30002') { + uni.showToast({ + title: '请登录...', + icon: 'none', + duration: 1000 + }); + setTimeout(() => { + uni.switchTab({ + url: '/pages/my/index', + }) + }, 1000) + resolve(''); + } + resolve(js.data.url); + }, + fail: (err) => { + reject(err); + } + }); + + // console.log(''); + }); + // return new Promise((resolve, reject) => { + // let a = uni.uploadFile({ + // url: 'https://naweigetetest2.hschool.com.cn/api/common/upload', // 接口地址 + // filePath: url, + // name: 'file', + // header: { + // "token": uni.getStorageSync("token") + // }, + // formData: { + // 'user': 'test' + // }, + // success: (res) => { + // console.log('res', JSON.parse(res.data), JSON.parse(res.data).url); + // setTimeout(() => { + // resolve(JSON.parse(res.data).url); + // }, 1000); + // }, + // fail: (res) => { + // setTimeout(() => { + // console.log("上传失败", res) + // reject(res) + // }, 1000); + // } + // }); + // }); + }, + + closeImagePopup() { + this.imageShow = false + }, + + getBankList() { uni.$u.http .get("/api/school.newactivity.settle_log/detail") @@ -372,6 +523,8 @@ // } if (userinfo.avatar !== null) { this.avatar = userinfo.avatar + this.upAvatar = userinfo.avatar + this.profile = userinfo.avatar uni.setStorageSync('avatar', this.avatar) } if (userinfo.nickname !== null) { @@ -731,5 +884,37 @@ } } } + + + .popup_box { + background-color: #fff; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-around; + padding: 20px; + + .popup_title { + width: 500rpx; + text-align: center; + margin: 10px auto; + } + + button { + box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0); + } + + ::v-deep button[type=default][plain] { + border: none; + } + + .nickname { + border: none; + font-size: 32rpx; + margin: 0; + } + } + + } \ No newline at end of file