123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- <template>
- <view class="my" :style="{background:'url('+ bannerImage +')'}">
- <view><nav-bar title="none" icon="none" background="transparent" border-color="transparent" ></nav-bar></view>
- <view class="content">
- <view class="news flex jcsb">
- <view class="info flex">
- <view style="width:128rpx;height:128rpx"><image class="img" :src="avatar || defaultAvatar" @tap="chooseImage"></image></view>
- <view class="info-text flex-column jcsa">
- <view class="info-top flex aic">
- <view class="name">{{info.name}}</view>
- <view class="level flex aic">
- <re-image imgSrc="/retail/main/ic_chuji.png" width="54" height="60"></re-image>
- <view class="level-text">{{info.lvName}}</view>
- </view>
- </view>
- <view class="phone">{{info.username}}</view>
- </view>
- </view>
- <view class="right" @click="logOut"><re-image imgSrc="/retail/my/ic_more.png" width="24" height="24" class="more"></re-image></view>
- </view>
- <view class="menu">
- <view class="menu-item item-one">
- <view class="item-left flex aic jcsb" @click="toAccount">
- <view class="flex aic">
- <re-image imgSrc="/retail/my/ic_jilu.png" width="48" height="48"></re-image>
- <text>账户充值记录</text>
- </view>
- <re-image imgSrc="/retail/my/ic_more.png" width="24" height="24"></re-image>
- </view>
- </view>
- <view class="menu-item">
- <view class="item-left flex aic jcsb">
- <view class="flex aic">
- <re-image imgSrc="/retail/my/ic_kefu.png" width="48" height="48"></re-image>
- <text>联系客服</text>
- </view>
- <re-image imgSrc="/retail/my/ic_more.png" width="24" height="24"></re-image>
- </view>
- </view>
- </view>
- </view>
- <u-popup :show="show" @close="close" @open="open">
- <view class="safe-area-inset-bottom">
- <view class="login-out" @click="outLogin">退出登录</view>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- import { toRpx } from '@/utils/calculate.js'
- import defaultConfig from '@/config/default.js'
- import { changeAvatar } from '@/apis/main'
- export default {
- components: {},
- computed: {
- statusBarHeight() {
- return this.$store.state.info.systemInfo?.statusBarHeight
- },
- },
- data() {
- return {
- show:false,
- bannerImage: defaultConfig.ossImgUrl + '/retail/my/img_myBgc.png',
- defaultAvatar: '../../static/image/img_touxiang.png',
- navBarHeight: uni.getStorageSync('navBarHeight'),
- info: uni.getStorageSync('userInfo'),
- avatar: uni.getStorageSync('avatar'),
- }
- },
- onLoad() {
- },
- methods: {
- outLogin(){
- uni.removeStorageSync('accessToken')
- uni.removeStorageSync('userInfo')
- uni.removeStorageSync('name')
- uni.redirectTo({
- url: '/pages/login/index'
- })
- },
- toAccount(){
- uni.navigateTo({
- url: '/pages/accountRecharge/index'
- })
- },
- chooseImage() {
- var that = this;
- uni.chooseImage({
- count: 1, // 默认9
- sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
- sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
- success: function (res) {
- // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
- that.avatar = res.tempFilePaths[0];
- that.upAvatar(that.avatar)
-
- }
- });
- },
- // 更换头像
- async upAvatar(avatar) {
- await changeAvatar({avatar:avatar})
- uni.setStorageSync('avatar',avatar)
- uni.showToast({
- title:'更换成功'
- })
- },
- logOut(){
- this.show = true
- },
- open() {
- // console.log('open');
- },
- close() {
- this.show = false
- // console.log('close');
- }
- },
- mounted() {
- },
- }
- </script>
- <style lang="scss" scoped>
- .my {
- background-repeat: no-repeat !important;
- background-size: contain !important;
- // background-position: top;
- width: 100%;
- position: absolute;
- top: 0;
- bottom: 0;
- .content{
- padding: 0 32rpx;
- .news {
- .info {
- .img{
- flex-shrink: 0;
- width: 128rpx;
- height: 128rpx;
- border-radius: 8rpx;
- }
- .info-text {
- margin: 8rpx 0 20rpx 36rpx;
- .info-top {
- .name {
- font-weight: 500;
- font-size: 32rpx;
- color: #363531;
- }
- .level {
- margin-left: 12rpx;
- .level-text {
- width: 105.9rpx;
- height: 47rpx;
- padding: 0 16rpx 0 26rpx;
- background: linear-gradient(130deg, #FFB873 0%, #FEC287 0%, #E69349 100%);
- border-radius: 0rpx 18rpx 18rpx 0rpx;
- font-weight: 500;
- font-size: 24rpx;
- color: #FFFFFF;
- line-height: 47rpx;
- margin-left: -16rpx;
- // text-align: left;
- }
- }
- }
- }
- .phone {
- font-weight: 400;
- font-size: 28rpx;
- color: #363531;
- }
- }
- .right{
- flex: 1;
- display: flex;
- justify-content: flex-end;
- .more{
-
- margin-top: 26rpx;
- }
- }
- .news-total {
- margin-top: 44rpx;
- .item-num {
- font-weight: bold;
- font-size: 40rpx;
- color: #363531;
- }
- .orange {
- color: #FF6400;
- }
- .item-text {
- font-weight: 400;
- font-size: 28rpx;
- color: #9598A6;
- }
- }
- }
- .menu{
- margin-top: 32rpx;
- background: #fff;
- border-radius: 16rpx;
- .menu-item{
- padding: 32rpx 28rpx 32rpx 24rpx;
- .item-left{
- text{
- margin-left: 20rpx;
- }
- }
- }
- .item-one{
- border-bottom: 2rpx solid #F0F2F4;
- }
- }
- }
- .login-out{
- text-align: center;
- margin: 40rpx 0;
- }
- }
- </style>
|