123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <template>
- <view class="content">
- <view class="banner">
- <view class="avatar">
- <image :src="userAvatar" mode="widthFix" @error="userAvatar=defaultAvatar"></image>
- </view>
- <view class="bottom">
- <view class="name">
- <text>{{userName}}</text>
- </view>
- </view>
- </view>
- <view class="zhcx-table">
- <uni-list>
- <uni-list-item title="个人资料"
- link="navigateTo" to="/pages/myCenter/personalData/personalData"
- showArrow></uni-list-item>
- <uni-list-item title="修改密码"
- link="navigateTo" to="/pages/myCenter/updatePassword/updatePassword"
- showArrow></uni-list-item>
- <uni-list-item title="退出登录" @click="logout" clickable></uni-list-item>
- </uni-list>
- </view>
- </view>
- </template>
- <script>
- export default{
- data(){
- return{
- defaultAvatar:"/static/components/avatar.png",
- userAvatar:"",
- userName:""
- }
- },
- onShow() {
- this.init();
- },
- methods:{
- init(){
- let user=uni.getStorageSync('accountInfo');
- if(user){user=JSON.parse(user)}
- this.userAvatar=user.avatar||this.defaultAvatar;
- this.userName=user.name;
- },
- logout(){
- uni.showModal({
- title:'提示!',
- content:"是否要退出登录",
- success(res) {
- if (res.confirm) {
- uni.reLaunch({
- url:'/pages/login/index'
- })
- }
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .content{
- .banner{
- height: 327upx;
- background-color: var(--sysblue);
- padding-top:46upx;
- .avatar{
- width: 150upx;
- height: 150upx;
- border-radius: 50%;
- overflow: hidden;
- image{
- display: block;
- width: 150upx;
- height: 150upx;
- border-radius: 50%;
- }
- margin:0 auto;
- }
- .bottom{
- position: relative;
- .name{
- font-size: 40upx;
- text-align: center;
- color: #fff;
- padding-top: 15upx;
- }
- .edit{
- position: absolute;
- right:48upx;
- bottom: 0;
- .zhcx-iconfont{
- font-size: 50upx;
- color: #fff;
- }
- }
- }
- }
- }
- </style>
|