| | |
| | | <view class="setup-list-item"> |
| | | <view class="label">昵称</view> |
| | | <view class="val"> |
| | | <input type="text" v-model='nickname' placeholder="请输入" /> |
| | | <input type="text" v-model='nickName' placeholder="请输入" /> |
| | | </view> |
| | | </view> |
| | | <view class="setup-list-item"> |
| | |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="setup-sub">退出登录</view> |
| | | <view class="setup-sub" @click="updateMemberInfo">保存</view> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | return { |
| | | name:null, |
| | | coverImage:null, |
| | | nickname:null, |
| | | nickName:null, |
| | | fullCoverImage:null |
| | | }; |
| | | }, |
| | | onShow(options){ |
| | | console.log(this.userInfo) |
| | | this.coverImage = this.userInfo.coverImage |
| | | this.nickname = this.userInfo.nickname |
| | | this.nickName = this.userInfo.nickName |
| | | this.fullCoverImage = this.userInfo.fullCoverImage |
| | | this.name = this.userInfo.name |
| | | }, |
| | |
| | | var that = this |
| | | console.log(fileUrl, 'fileUrl') |
| | | uni.uploadFile({ |
| | | url: `web/public/upload?folder=member` , |
| | | filePath: fileUrl, |
| | | name: 'file', |
| | | success:(data)=>{ |
| | | const res = JSON.parse(data.data) |
| | | that.coverImage = res.data.imgaddr |
| | | that.fullCoverImage = res.data.url |
| | | that.updateMemberInfo() |
| | | }, |
| | | fail:(e)=>{ |
| | | uni.showToast({ |
| | | title: '上传失败', |
| | | duration: 2000, |
| | | icon: "none" |
| | | }); |
| | | } |
| | | url: this.$baseUrl + 'web/public/upload', |
| | | filePath: fileUrl, |
| | | name: 'file', |
| | | formData: { |
| | | 'folder': 'member' |
| | | }, |
| | | success:(data)=>{ |
| | | const res = JSON.parse(data.data) |
| | | that.coverImage = res.data.imgaddr |
| | | that.fullCoverImage = res.data.url |
| | | that.updateMemberInfo() |
| | | }, |
| | | fail:(e)=>{ |
| | | uni.showToast({ |
| | | title: '上传失败', |
| | | duration: 2000, |
| | | icon: "none" |
| | | }); |
| | | } |
| | | }) |
| | | }, |
| | | updateMemberInfo() { |
| | | if((!this.name ||this.name.trim() =='' ) |
| | | &&(!this.nickName ||this.nickName.trim() =='') |
| | | &&(!this.coverImage ||this.coverImage.trim() =='')){ |
| | | uni.showToast({ |
| | | title: '对不起,请按要求填写信息!', |
| | | icon: "none", |
| | | duration: 2000 |
| | | }); |
| | | return |
| | | } |
| | | var that = this |
| | | this.$u.api.editMemberInfo({ |
| | | name:that.name, |
| | | coverImage:that.nickname, |
| | | coverImage:that.coverImage, |
| | | name:that.name, |
| | | nickName:that.nickName, |
| | | coverImage:that.coverImage, |
| | | }).then(res =>{ |
| | | uni.showToast({ |
| | | title: '更新成功', |
| | | icon: "none", |
| | | duration: 2000 |
| | | }); |
| | | that.userInfo.name = this.name |
| | | that.userInfo.nickName = this.nickName |
| | | that.userInfo.coverImage = this.coverImage |
| | | that.userInfo.fullCoverImage = this.fullCoverImage |
| | | uni.showToast({ |
| | | title: '更新成功', |
| | | icon: "none", |
| | | duration: 2000 |
| | | }); |
| | | }) |
| | | } |
| | | } |
| | |
| | | border-radius: 44rpx; |
| | | font-weight: 500; |
| | | font-size: 32rpx; |
| | | color: #5BBE38; |
| | | color: white; |
| | | background-color: #15CF52; |
| | | margin-top: 80rpx; |
| | | border: 1rpx solid #15CF52; |
| | | } |