16 changed files with 262 additions and 98 deletions
@ -1,7 +1,33 @@ |
|||||||
<van-popup show="{{ show }}" wx:if="{{type===1}}" custom-style="background: transparent;" bind:close="handleClose"> |
<van-popup |
||||||
|
show="{{ show }}" |
||||||
|
wx:if="{{type===1}}" |
||||||
|
custom-style="background: transparent;" |
||||||
|
bind:close="handleClose" |
||||||
|
> |
||||||
<view class="popup1" style="background: url('/images/popup1-bg.png') no-repeat top center/100%"> |
<view class="popup1" style="background: url('/images/popup1-bg.png') no-repeat top center/100%"> |
||||||
<view class="title">关注适中健康微信公众号</view> |
<view class="title">关注适中健康微信公众号</view> |
||||||
<image class="code" :src="{{params.mpPicture}}" show-menu-by-longpress></image> |
<image |
||||||
|
class="code" |
||||||
|
:src="{{params.mpPicture}}" |
||||||
|
show-menu-by-longpress |
||||||
|
></image> |
||||||
|
<view class="tip">长按识别二维码关注</view> |
||||||
|
</view> |
||||||
|
</van-popup> |
||||||
|
|
||||||
|
<van-popup |
||||||
|
show="{{ show }}" |
||||||
|
wx:if="{{type===2}}" |
||||||
|
custom-style="background: transparent;" |
||||||
|
bind:close="handleClose" |
||||||
|
> |
||||||
|
<view class="popup1" style="background: url('/images/popup1-bg.png') no-repeat top center/100%"> |
||||||
|
<view class="title">添加我的企业微信</view> |
||||||
|
<image |
||||||
|
class="code" |
||||||
|
:src="{{params.qwPicture}}" |
||||||
|
show-menu-by-longpress |
||||||
|
></image> |
||||||
<view class="tip">长按识别二维码关注</view> |
<view class="tip">长按识别二维码关注</view> |
||||||
</view> |
</view> |
||||||
</van-popup> |
</van-popup> |
||||||
|
After Width: | Height: | Size: 206 KiB |
After Width: | Height: | Size: 479 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.1 KiB |
@ -0,0 +1,7 @@ |
|||||||
|
{ |
||||||
|
"navigationStyle": "default", |
||||||
|
"navigationBarTitleText": "个人信息", |
||||||
|
"usingComponents": { |
||||||
|
"uploadFile": "/components/uploadFile/index" |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,56 @@ |
|||||||
|
page { |
||||||
|
background-color: #f3f4f5; |
||||||
|
} |
||||||
|
.page { |
||||||
|
padding: 32rpx; |
||||||
|
.container { |
||||||
|
border-radius: 16rpx; |
||||||
|
background-color: #fff; |
||||||
|
.row { |
||||||
|
padding: 36rpx 32rpx; |
||||||
|
display: flex; |
||||||
|
align-items: center; |
||||||
|
justify-content: space-between; |
||||||
|
border-bottom: 1px solid #f0f0f0; |
||||||
|
&:last-of-type { |
||||||
|
border: none; |
||||||
|
} |
||||||
|
&.small { |
||||||
|
padding: 24rpx 32rpx; |
||||||
|
} |
||||||
|
.label { |
||||||
|
font-size: 36rpx; |
||||||
|
color: #222222; |
||||||
|
} |
||||||
|
.wrap { |
||||||
|
flex: 1; |
||||||
|
display: flex; |
||||||
|
justify-content: flex-end; |
||||||
|
.avatar { |
||||||
|
position: relative; |
||||||
|
width: 100rpx; |
||||||
|
height: 100rpx; |
||||||
|
.a-img { |
||||||
|
width: 100rpx; |
||||||
|
height: 100rpx; |
||||||
|
border-radius: 50%; |
||||||
|
} |
||||||
|
.icon { |
||||||
|
position: absolute; |
||||||
|
bottom: 0; |
||||||
|
right: 0; |
||||||
|
width: 32rpx; |
||||||
|
height: 32rpx; |
||||||
|
} |
||||||
|
} |
||||||
|
.input { |
||||||
|
text-align: right; |
||||||
|
font-size: 36rpx; |
||||||
|
} |
||||||
|
.place-input { |
||||||
|
color: #babdc1; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,48 @@ |
|||||||
|
const app = getApp<IAppOption>(); |
||||||
|
|
||||||
|
Page({ |
||||||
|
data: { |
||||||
|
userInfo: {} as any, |
||||||
|
}, |
||||||
|
onLoad() { |
||||||
|
app.waitLogin().then(() => { |
||||||
|
app.getUserInfo(this); |
||||||
|
}); |
||||||
|
}, |
||||||
|
handleFile(e) { |
||||||
|
const avatar = e.detail.fileUrl; |
||||||
|
this.setData({ |
||||||
|
'userInfo.avatar': avatar, |
||||||
|
}); |
||||||
|
this.updateUserInfo(); |
||||||
|
}, |
||||||
|
handleInputBlur(e) { |
||||||
|
const { key } = e.currentTarget.dataset; |
||||||
|
this.setData({ |
||||||
|
[`userInfo.${key}`]: e.detail.value, |
||||||
|
}); |
||||||
|
this.updateUserInfo(); |
||||||
|
}, |
||||||
|
updateUserInfo() { |
||||||
|
const { avatar, username } = this.data.userInfo; |
||||||
|
if (!username) { |
||||||
|
wx.showToast({ |
||||||
|
title: '请输入用户名', |
||||||
|
icon: 'none', |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
wx.ajax({ |
||||||
|
method: 'POST', |
||||||
|
url: '?r=shizhong/account/update-info', |
||||||
|
data: { |
||||||
|
userName: username, |
||||||
|
avatar, |
||||||
|
}, |
||||||
|
}).then(() => { |
||||||
|
app.getUserInfo(this); |
||||||
|
}); |
||||||
|
}, |
||||||
|
}); |
||||||
|
|
||||||
|
export {}; |
@ -0,0 +1,43 @@ |
|||||||
|
<view class="page"> |
||||||
|
<view class="container"> |
||||||
|
<view class="row small"> |
||||||
|
<view class="label">头像</view> |
||||||
|
<view class="wrap"> |
||||||
|
|
||||||
|
<uploadFile |
||||||
|
class="avatar" |
||||||
|
chooseAvatar |
||||||
|
bind:file="handleFile" |
||||||
|
data-key="Img" |
||||||
|
bind:file="handleAvatar" |
||||||
|
> |
||||||
|
<image |
||||||
|
wx:if="{{userInfo.avatar}}" |
||||||
|
class="a-img" |
||||||
|
src="{{userInfo.avatar}}" |
||||||
|
></image> |
||||||
|
<image |
||||||
|
wx:else |
||||||
|
class="a-img" |
||||||
|
src="/images/user.png" |
||||||
|
></image> |
||||||
|
<image class="icon" src="/images/icon-pic.png"></image> |
||||||
|
</uploadFile> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
<view class="row"> |
||||||
|
<view class="label">昵称</view> |
||||||
|
<view class="wrap"> |
||||||
|
<input |
||||||
|
class="input" |
||||||
|
type="nickname" |
||||||
|
value="{{userInfo.username}}" |
||||||
|
placeholder-class="place-input" |
||||||
|
placeholder="请输入昵称" |
||||||
|
data-key="username" |
||||||
|
bindblur="handleInputBlur" |
||||||
|
></input> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
</view> |
Loading…
Reference in new issue