You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<template> <view> <u-cell-group :border="false"> <u-cell title="头像" :isLink="false" :border="false" @click="previewImage"> <u-avatar size="40" slot="value" :src="userInfo.avatar"></u-avatar> </u-cell> <u-cell title="昵称" :isLink="false" :border="false" :value="userInfo.nick_name"></u-cell> <u-cell title="收货地址" :isLink="true" :border="false" url="/packages/address/address"></u-cell> <u-cell title="系统消息" :isLink="true" :border="false" url="/packages/notify/notify"> <u-badge class="badge" slot="value" numberType="overflow" max="99" :value="sysDots"></u-badge> </u-cell> <u-cell title="我的分销优惠码" :isLink="true" :border="false" url="/packages/agent/agent" v-if="isAgent()"></u-cell> <u-cell title="退出登录" :isLink="true" :border="false" @click="logout"></u-cell> </u-cell-group> <view class="fixed-tips">{{ version ? 'v'+ version : '' }}</view> </view></template>
<script> import { my } from '@/service/index.js'; export default { data() { return { src:"https://cdn.uviewui.com/uview/album/1.jpg", userInfo: {}, version: '', sysDots:0, } }, onLoad(){ this.userInfo = uni.getStorageSync('userInfo') || {}; let miniProgram = wx.getAccountInfoSync().miniProgram; if(miniProgram.version){ this.version = miniProgram.version; } }, onShow(){ this.getUserCenterDetail() }, methods: { async getUserCenterDetail(){ let res = await my(); this.sysDots = res.data.datas.dots.system }, logout(){ uni.removeStorage({key:'userInfo'}); uni.removeStorage({key:'qxk_sysinfo'}); uni.reLaunch({ url: 'pages/login/login' }); }, previewImage(){ uni.previewImage({ urls: [this.userInfo.avatar] }) }, isAgent(){ return this.userInfo.is_agent } } }</script>
<style lang="scss" scoped> .fixed-tips{ position: fixed; bottom: 8vh; width: 750rpx; left: 0; text-align: center; font-size: 26rpx; color: #bdc3c7; }</style>
|